Revision: 23634
Author:   [email protected]
Date:     Wed Sep  3 08:32:14 2014 UTC
Log:      Version 3.29.40 (based on bleeding_edge revision r23628)

Use correct receiver for DOM accessors on the prototype chain (issue 3538).

Performance and stability improvements on all platforms.
https://code.google.com/p/v8/source/detail?r=23634

Added:
 /trunk/src/base/bits.cc
 /trunk/src/compiler/access-builder.cc
 /trunk/src/compiler/operator.cc
 /trunk/src/compiler/simplified-operator.cc
Modified:
 /trunk/BUILD.gn
 /trunk/ChangeLog
 /trunk/src/allocation.cc
 /trunk/src/api.cc
 /trunk/src/arm/assembler-arm.cc
 /trunk/src/arm/code-stubs-arm.cc
 /trunk/src/arm/lithium-codegen-arm.cc
 /trunk/src/arm/macro-assembler-arm.cc
 /trunk/src/arm64/assembler-arm64.cc
 /trunk/src/arm64/assembler-arm64.h
 /trunk/src/arm64/code-stubs-arm64.cc
 /trunk/src/arm64/lithium-arm64.cc
 /trunk/src/arm64/lithium-codegen-arm64.cc
 /trunk/src/arm64/macro-assembler-arm64-inl.h
 /trunk/src/arm64/macro-assembler-arm64.cc
 /trunk/src/arm64/macro-assembler-arm64.h
 /trunk/src/base/bits-unittest.cc
 /trunk/src/base/bits.h
 /trunk/src/base/flags.h
 /trunk/src/base/macros.h
 /trunk/src/base/platform/platform-win32.cc
 /trunk/src/base/platform/semaphore.cc
 /trunk/src/code-stubs.cc
 /trunk/src/code-stubs.h
 /trunk/src/compiler/access-builder.h
 /trunk/src/compiler/arm/instruction-selector-arm.cc
 /trunk/src/compiler/arm/linkage-arm.cc
 /trunk/src/compiler/arm64/linkage-arm64.cc
 /trunk/src/compiler/common-operator.h
 /trunk/src/compiler/graph-visualizer.cc
 /trunk/src/compiler/ia32/linkage-ia32.cc
 /trunk/src/compiler/js-generic-lowering.cc
 /trunk/src/compiler/js-typed-lowering.cc
 /trunk/src/compiler/linkage-impl.h
 /trunk/src/compiler/linkage.cc
 /trunk/src/compiler/linkage.h
 /trunk/src/compiler/machine-type.h
 /trunk/src/compiler/operator-properties-inl.h
 /trunk/src/compiler/operator.h
 /trunk/src/compiler/raw-machine-assembler.cc
 /trunk/src/compiler/representation-change.h
 /trunk/src/compiler/simplified-lowering.cc
 /trunk/src/compiler/simplified-lowering.h
 /trunk/src/compiler/simplified-operator.h
 /trunk/src/compiler/verifier.cc
 /trunk/src/compiler/x64/linkage-x64.cc
 /trunk/src/conversions-inl.h
 /trunk/src/date.h
 /trunk/src/factory.cc
 /trunk/src/frames.cc
 /trunk/src/gdb-jit.cc
 /trunk/src/hashmap.h
 /trunk/src/heap/heap.cc
 /trunk/src/heap/mark-compact.h
 /trunk/src/heap/spaces.cc
 /trunk/src/heap/spaces.h
 /trunk/src/hydrogen-instructions.h
 /trunk/src/ia32/assembler-ia32.cc
 /trunk/src/ia32/code-stubs-ia32.cc
 /trunk/src/ia32/code-stubs-ia32.h
 /trunk/src/ia32/lithium-codegen-ia32.cc
 /trunk/src/ia32/macro-assembler-ia32.cc
 /trunk/src/ic/ic.cc
 /trunk/src/ic/stub-cache.cc
 /trunk/src/mips/assembler-mips.cc
 /trunk/src/mips/code-stubs-mips.cc
 /trunk/src/mips/lithium-codegen-mips.cc
 /trunk/src/mips/macro-assembler-mips.cc
 /trunk/src/mips/regexp-macro-assembler-mips.cc
 /trunk/src/mips64/assembler-mips64.cc
 /trunk/src/mips64/code-stubs-mips64.cc
 /trunk/src/mips64/full-codegen-mips64.cc
 /trunk/src/mips64/lithium-codegen-mips64.cc
 /trunk/src/mips64/macro-assembler-mips64.cc
 /trunk/src/mips64/regexp-macro-assembler-mips64.cc
 /trunk/src/objects-inl.h
 /trunk/src/objects.cc
 /trunk/src/objects.h
 /trunk/src/parser.cc
 /trunk/src/parser.h
 /trunk/src/preparser.h
 /trunk/src/utils.h
 /trunk/src/version.cc
 /trunk/src/x64/assembler-x64.cc
 /trunk/src/x64/code-stubs-x64.cc
 /trunk/src/x64/lithium-codegen-x64.cc
 /trunk/src/x64/macro-assembler-x64.cc
 /trunk/src/x87/code-stubs-x87.cc
 /trunk/src/x87/code-stubs-x87.h
 /trunk/src/x87/full-codegen-x87.cc
 /trunk/src/x87/macro-assembler-x87.cc
 /trunk/test/cctest/cctest.status
 /trunk/test/cctest/compiler/test-operator.cc
 /trunk/test/cctest/compiler/test-simplified-lowering.cc
 /trunk/test/cctest/test-parsing.cc
 /trunk/tools/gyp/v8.gyp
 /trunk/tools/push-to-trunk/chromium_roll.py
 /trunk/tools/push-to-trunk/test_scripts.py
 /trunk/tools/testrunner/local/testsuite.py
 /trunk/tools/whitespace.txt

=======================================
--- /dev/null
+++ /trunk/src/base/bits.cc     Wed Sep  3 08:32:14 2014 UTC
@@ -0,0 +1,25 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/bits.h"
+#include "src/base/logging.h"
+
+namespace v8 {
+namespace base {
+namespace bits {
+
+uint32_t RoundUpToPowerOfTwo32(uint32_t value) {
+  DCHECK_LE(value, 0x80000000u);
+  value = value - 1;
+  value = value | (value >> 1);
+  value = value | (value >> 2);
+  value = value | (value >> 4);
+  value = value | (value >> 8);
+  value = value | (value >> 16);
+  return value + 1;
+}
+
+}  // namespace bits
+}  // namespace base
+}  // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/compiler/access-builder.cc       Wed Sep  3 08:32:14 2014 UTC
@@ -0,0 +1,90 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/compiler/access-builder.h"
+#include "src/types-inl.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+// static
+FieldAccess AccessBuilder::ForMap() {
+  return {kTaggedBase, HeapObject::kMapOffset, Handle<Name>(), Type::Any(),
+          kMachAnyTagged};
+}
+
+
+// static
+FieldAccess AccessBuilder::ForJSObjectProperties() {
+ return {kTaggedBase, JSObject::kPropertiesOffset, Handle<Name>(), Type::Any(),
+          kMachAnyTagged};
+}
+
+
+// static
+FieldAccess AccessBuilder::ForJSObjectElements() {
+  return {kTaggedBase, JSObject::kElementsOffset, Handle<Name>(),
+          Type::Internal(), kMachAnyTagged};
+}
+
+
+// static
+FieldAccess AccessBuilder::ForJSArrayBufferBackingStore() {
+  return {kTaggedBase, JSArrayBuffer::kBackingStoreOffset, Handle<Name>(),
+          Type::UntaggedPtr(), kMachPtr};
+}
+
+
+// static
+FieldAccess AccessBuilder::ForExternalArrayPointer() {
+ return {kTaggedBase, ExternalArray::kExternalPointerOffset, Handle<Name>(),
+          Type::UntaggedPtr(), kMachPtr};
+}
+
+
+// static
+ElementAccess AccessBuilder::ForFixedArrayElement() {
+ return {kTaggedBase, FixedArray::kHeaderSize, Type::Any(), kMachAnyTagged};
+}
+
+
+// static
+ElementAccess AccessBuilder::ForBackingStoreElement(MachineType rep) {
+ return {kUntaggedBase, kNonHeapObjectHeaderSize - kHeapObjectTag, Type::Any(),
+          rep};
+}
+
+
+// static
+ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type,
+                                                  bool is_external) {
+  BaseTaggedness taggedness = is_external ? kUntaggedBase : kTaggedBase;
+  int header_size = is_external ? 0 : FixedTypedArrayBase::kDataOffset;
+  switch (type) {
+    case kExternalInt8Array:
+      return {taggedness, header_size, Type::Signed32(), kMachInt8};
+    case kExternalUint8Array:
+    case kExternalUint8ClampedArray:
+      return {taggedness, header_size, Type::Unsigned32(), kMachUint8};
+    case kExternalInt16Array:
+      return {taggedness, header_size, Type::Signed32(), kMachInt16};
+    case kExternalUint16Array:
+      return {taggedness, header_size, Type::Unsigned32(), kMachUint16};
+    case kExternalInt32Array:
+      return {taggedness, header_size, Type::Signed32(), kMachInt32};
+    case kExternalUint32Array:
+      return {taggedness, header_size, Type::Unsigned32(), kMachUint32};
+    case kExternalFloat32Array:
+      return {taggedness, header_size, Type::Number(), kRepFloat32};
+    case kExternalFloat64Array:
+      return {taggedness, header_size, Type::Number(), kRepFloat64};
+  }
+  UNREACHABLE();
+  return {kUntaggedBase, 0, Type::None(), kMachNone};
+}
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/compiler/operator.cc     Wed Sep  3 08:32:14 2014 UTC
@@ -0,0 +1,56 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/compiler/operator.h"
+
+#include "src/assembler.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+Operator::~Operator() {}
+
+
+SimpleOperator::SimpleOperator(Opcode opcode, Properties properties,
+                               int input_count, int output_count,
+                               const char* mnemonic)
+    : Operator(opcode, properties, mnemonic),
+      input_count_(input_count),
+      output_count_(output_count) {}
+
+
+SimpleOperator::~SimpleOperator() {}
+
+
+// static
+OStream& StaticParameterTraits<ExternalReference>::PrintTo(
+    OStream& os, ExternalReference reference) {
+  os << reference.address();
+  // TODO(bmeurer): Move to operator<<(os, ExternalReference)
+  const Runtime::Function* function =
+      Runtime::FunctionForEntry(reference.address());
+  if (function) {
+    os << " <" << function->name << ".entry>";
+  }
+  return os;
+}
+
+
+// static
+int StaticParameterTraits<ExternalReference>::HashCode(
+    ExternalReference reference) {
+  return reinterpret_cast<intptr_t>(reference.address()) & 0xFFFFFFFF;
+}
+
+
+// static
+bool StaticParameterTraits<ExternalReference>::Equals(ExternalReference lhs, + ExternalReference rhs) {
+  return lhs == rhs;
+}
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/compiler/simplified-operator.cc  Wed Sep  3 08:32:14 2014 UTC
@@ -0,0 +1,30 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/compiler/simplified-operator.h"
+#include "src/types-inl.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+// static
+bool StaticParameterTraits<FieldAccess>::Equals(const FieldAccess& lhs,
+                                                const FieldAccess& rhs) {
+ return lhs.base_is_tagged == rhs.base_is_tagged && lhs.offset == rhs.offset &&
+         lhs.machine_type == rhs.machine_type && lhs.type->Is(rhs.type);
+}
+
+
+// static
+bool StaticParameterTraits<ElementAccess>::Equals(const ElementAccess& lhs,
+ const ElementAccess& rhs) {
+  return lhs.base_is_tagged == rhs.base_is_tagged &&
+         lhs.header_size == rhs.header_size &&
+         lhs.machine_type == rhs.machine_type && lhs.type->Is(rhs.type);
+}
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8
=======================================
--- /trunk/BUILD.gn     Mon Sep  1 00:05:43 2014 UTC
+++ /trunk/BUILD.gn     Wed Sep  3 08:32:14 2014 UTC
@@ -460,6 +460,7 @@
     "src/codegen.h",
     "src/compilation-cache.cc",
     "src/compilation-cache.h",
+    "src/compiler/access-builder.cc",
     "src/compiler/access-builder.h",
     "src/compiler/ast-graph-builder.cc",
     "src/compiler/ast-graph-builder.h",
@@ -529,6 +530,7 @@
     "src/compiler/opcodes.h",
     "src/compiler/operator-properties-inl.h",
     "src/compiler/operator-properties.h",
+    "src/compiler/operator.cc",
     "src/compiler/operator.h",
     "src/compiler/phi-reducer.h",
     "src/compiler/pipeline.cc",
@@ -547,6 +549,7 @@
     "src/compiler/simplified-node-factory.h",
     "src/compiler/simplified-operator-reducer.cc",
     "src/compiler/simplified-operator-reducer.h",
+    "src/compiler/simplified-operator.cc",
     "src/compiler/simplified-operator.h",
     "src/compiler/source-position.cc",
     "src/compiler/source-position.h",
@@ -1172,6 +1175,7 @@
     "src/base/atomicops_internals_x86_gcc.cc",
     "src/base/atomicops_internals_x86_gcc.h",
     "src/base/atomicops_internals_x86_msvc.h",
+    "src/base/bits.cc",
     "src/base/bits.h",
     "src/base/build_config.h",
     "src/base/cpu.cc",
@@ -1337,6 +1341,7 @@

   direct_dependent_configs = [ ":external_config" ]

+  libs = []
   if (is_android && current_toolchain != host_toolchain) {
     libs += [ "log" ]
   }
=======================================
--- /trunk/ChangeLog    Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/ChangeLog    Wed Sep  3 08:32:14 2014 UTC
@@ -1,3 +1,11 @@
+2014-09-03: Version 3.29.40
+
+ Use correct receiver for DOM accessors on the prototype chain (issue
+        3538).
+
+        Performance and stability improvements on all platforms.
+
+
 2014-09-02: Version 3.29.38

Do not clear weak monomorphic IC after context disposal (Chromium issue
=======================================
--- /trunk/src/allocation.cc    Tue Aug  5 00:05:55 2014 UTC
+++ /trunk/src/allocation.cc    Wed Sep  3 08:32:14 2014 UTC
@@ -5,6 +5,7 @@
 #include "src/allocation.h"

 #include <stdlib.h>  // For free, malloc.
+#include "src/base/bits.h"
 #include "src/base/logging.h"
 #include "src/base/platform/platform.h"
 #include "src/utils.h"
@@ -83,7 +84,8 @@


 void* AlignedAlloc(size_t size, size_t alignment) {
- DCHECK(IsPowerOf2(alignment) && alignment >= V8_ALIGNOF(void*)); // NOLINT
+  DCHECK_LE(V8_ALIGNOF(void*), alignment);
+  DCHECK(base::bits::IsPowerOfTwo32(alignment));
   void* ptr;
 #if V8_OS_WIN
   ptr = _aligned_malloc(size, alignment);
=======================================
--- /trunk/src/api.cc   Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/api.cc   Wed Sep  3 08:32:14 2014 UTC
@@ -3610,7 +3610,8 @@
   i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
   i::PrototypeIterator iter(isolate, self_obj);
   if (iter.IsAtEnd()) return Local<Value>();
-  i::LookupIterator it(i::PrototypeIterator::GetCurrent(iter), key_obj,
+  i::Handle<i::Object> proto = i::PrototypeIterator::GetCurrent(iter);
+ i::LookupIterator it(self_obj, key_obj, i::Handle<i::JSReceiver>::cast(proto),
                        i::LookupIterator::PROTOTYPE_CHAIN_PROPERTY);
   return GetPropertyByLookup(&it);
 }
=======================================
--- /trunk/src/arm/assembler-arm.cc     Sun Aug 24 11:34:17 2014 UTC
+++ /trunk/src/arm/assembler-arm.cc     Wed Sep  3 08:32:14 2014 UTC
@@ -39,6 +39,7 @@
 #if V8_TARGET_ARCH_ARM

 #include "src/arm/assembler-arm-inl.h"
+#include "src/base/bits.h"
 #include "src/base/cpu.h"
 #include "src/macro-assembler.h"
 #include "src/serialize.h"
@@ -498,7 +499,7 @@


 void Assembler::Align(int m) {
-  DCHECK(m >= 4 && IsPowerOf2(m));
+  DCHECK(m >= 4 && base::bits::IsPowerOfTwo32(m));
   while ((pc_offset() & (m - 1)) != 0) {
     nop();
   }
=======================================
--- /trunk/src/arm/code-stubs-arm.cc    Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/arm/code-stubs-arm.cc    Wed Sep  3 08:32:14 2014 UTC
@@ -6,6 +6,7 @@

 #if V8_TARGET_ARCH_ARM

+#include "src/base/bits.h"
 #include "src/bootstrapper.h"
 #include "src/code-stubs.h"
 #include "src/codegen.h"
@@ -704,8 +705,8 @@
   Condition cc = GetCondition();

   Label miss;
-  ICCompareStub_CheckInputType(masm, lhs, r2, left_, &miss);
-  ICCompareStub_CheckInputType(masm, rhs, r3, right_, &miss);
+  ICCompareStub_CheckInputType(masm, lhs, r2, left(), &miss);
+  ICCompareStub_CheckInputType(masm, rhs, r3, right(), &miss);

   Label slow;  // Call builtin.
   Label not_smis, both_loaded_as_doubles, lhs_not_nan;
@@ -1158,7 +1159,7 @@
   if (FLAG_debug_code) {
     if (frame_alignment > kPointerSize) {
       Label alignment_as_expected;
-      DCHECK(IsPowerOf2(frame_alignment));
+      DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
       __ tst(sp, Operand(frame_alignment_mask));
       __ b(eq, &alignment_as_expected);
// Don't use Check here, as it will call Runtime_Abort re-entering here.
@@ -2953,7 +2954,7 @@
   // Fast case of Heap::LookupSingleCharacterStringFromCode.
   STATIC_ASSERT(kSmiTag == 0);
   STATIC_ASSERT(kSmiShiftSize == 0);
-  DCHECK(IsPowerOf2(String::kMaxOneByteCharCode + 1));
+  DCHECK(base::bits::IsPowerOfTwo32(String::kMaxOneByteCharCode + 1));
   __ tst(code_,
          Operand(kSmiTagMask |
                  ((~String::kMaxOneByteCharCode) << kSmiTagSize)));
@@ -3472,7 +3473,7 @@


 void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::SMI);
+  DCHECK(state() == CompareIC::SMI);
   Label miss;
   __ orr(r2, r1, r0);
   __ JumpIfNotSmi(r2, &miss);
@@ -3493,16 +3494,16 @@


 void ICCompareStub::GenerateNumbers(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::NUMBER);
+  DCHECK(state() == CompareIC::NUMBER);

   Label generic_stub;
   Label unordered, maybe_undefined1, maybe_undefined2;
   Label miss;

-  if (left_ == CompareIC::SMI) {
+  if (left() == CompareIC::SMI) {
     __ JumpIfNotSmi(r1, &miss);
   }
-  if (right_ == CompareIC::SMI) {
+  if (right() == CompareIC::SMI) {
     __ JumpIfNotSmi(r0, &miss);
   }

@@ -3544,12 +3545,12 @@

   __ bind(&unordered);
   __ bind(&generic_stub);
- ICCompareStub stub(isolate(), op_, CompareIC::GENERIC, CompareIC::GENERIC, + ICCompareStub stub(isolate(), op(), CompareIC::GENERIC, CompareIC::GENERIC,
                      CompareIC::GENERIC);
   __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);

   __ bind(&maybe_undefined1);
-  if (Token::IsOrderedRelationalCompareOp(op_)) {
+  if (Token::IsOrderedRelationalCompareOp(op())) {
     __ CompareRoot(r0, Heap::kUndefinedValueRootIndex);
     __ b(ne, &miss);
     __ JumpIfSmi(r1, &unordered);
@@ -3559,7 +3560,7 @@
   }

   __ bind(&maybe_undefined2);
-  if (Token::IsOrderedRelationalCompareOp(op_)) {
+  if (Token::IsOrderedRelationalCompareOp(op())) {
     __ CompareRoot(r1, Heap::kUndefinedValueRootIndex);
     __ b(eq, &unordered);
   }
@@ -3570,7 +3571,7 @@


 void ICCompareStub::GenerateInternalizedStrings(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::INTERNALIZED_STRING);
+  DCHECK(state() == CompareIC::INTERNALIZED_STRING);
   Label miss;

   // Registers containing left and right operands respectively.
@@ -3608,7 +3609,7 @@


 void ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::UNIQUE_NAME);
+  DCHECK(state() == CompareIC::UNIQUE_NAME);
   DCHECK(GetCondition() == eq);
   Label miss;

@@ -3647,10 +3648,10 @@


 void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::STRING);
+  DCHECK(state() == CompareIC::STRING);
   Label miss;

-  bool equality = Token::IsEqualityOp(op_);
+  bool equality = Token::IsEqualityOp(op());

   // Registers containing left and right operands respectively.
   Register left = r1;
@@ -3726,7 +3727,7 @@


 void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::OBJECT);
+  DCHECK(state() == CompareIC::OBJECT);
   Label miss;
   __ and_(r2, r1, Operand(r0));
   __ JumpIfSmi(r2, &miss);
@@ -3774,7 +3775,7 @@
     FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
     __ Push(r1, r0);
     __ Push(lr, r1, r0);
-    __ mov(ip, Operand(Smi::FromInt(op_)));
+    __ mov(ip, Operand(Smi::FromInt(op())));
     __ push(ip);
     __ CallExternalReference(miss, 3);
     // Compute the entry point of the rewritten stub.
@@ -4393,7 +4394,7 @@
   int frame_alignment = masm->ActivationFrameAlignment();
   if (frame_alignment > kPointerSize) {
     __ mov(r5, sp);
-    DCHECK(IsPowerOf2(frame_alignment));
+    DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
     __ and_(sp, sp, Operand(-frame_alignment));
   }

=======================================
--- /trunk/src/arm/lithium-codegen-arm.cc       Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/arm/lithium-codegen-arm.cc       Wed Sep  3 08:32:14 2014 UTC
@@ -6,6 +6,7 @@

 #include "src/arm/lithium-codegen-arm.h"
 #include "src/arm/lithium-gap-resolver-arm.h"
+#include "src/base/bits.h"
 #include "src/code-stubs.h"
 #include "src/hydrogen-osr.h"

@@ -1309,7 +1310,7 @@
   Register dividend = ToRegister(instr->dividend());
   int32_t divisor = instr->divisor();
   Register result = ToRegister(instr->result());
-  DCHECK(divisor == kMinInt || IsPowerOf2(Abs(divisor)));
+  DCHECK(divisor == kMinInt || base::bits::IsPowerOfTwo32(Abs(divisor)));
   DCHECK(!result.is(dividend));

   // Check for (0 / -x) that will produce negative zero.
@@ -1666,17 +1667,17 @@
         int32_t mask = constant >> 31;
         uint32_t constant_abs = (constant + mask) ^ mask;

-        if (IsPowerOf2(constant_abs)) {
+        if (base::bits::IsPowerOfTwo32(constant_abs)) {
           int32_t shift = WhichPowerOf2(constant_abs);
           __ mov(result, Operand(left, LSL, shift));
           // Correct the sign of the result is the constant is negative.
           if (constant < 0)  __ rsb(result, result, Operand::Zero());
-        } else if (IsPowerOf2(constant_abs - 1)) {
+        } else if (base::bits::IsPowerOfTwo32(constant_abs - 1)) {
           int32_t shift = WhichPowerOf2(constant_abs - 1);
           __ add(result, left, Operand(left, LSL, shift));
           // Correct the sign of the result is the constant is negative.
           if (constant < 0)  __ rsb(result, result, Operand::Zero());
-        } else if (IsPowerOf2(constant_abs + 1)) {
+        } else if (base::bits::IsPowerOfTwo32(constant_abs + 1)) {
           int32_t shift = WhichPowerOf2(constant_abs + 1);
           __ rsb(result, left, Operand(left, LSL, shift));
           // Correct the sign of the result is the constant is negative.
@@ -5119,8 +5120,8 @@
     uint8_t tag;
     instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag);

-    if (IsPowerOf2(mask)) {
-      DCHECK(tag == 0 || IsPowerOf2(tag));
+    if (base::bits::IsPowerOfTwo32(mask)) {
+      DCHECK(tag == 0 || base::bits::IsPowerOfTwo32(tag));
       __ tst(scratch, Operand(mask));
       DeoptimizeIf(tag == 0 ? ne : eq, instr->environment());
     } else {
=======================================
--- /trunk/src/arm/macro-assembler-arm.cc       Tue Aug  5 00:05:55 2014 UTC
+++ /trunk/src/arm/macro-assembler-arm.cc       Wed Sep  3 08:32:14 2014 UTC
@@ -8,6 +8,7 @@

 #if V8_TARGET_ARCH_ARM

+#include "src/base/bits.h"
 #include "src/bootstrapper.h"
 #include "src/codegen.h"
 #include "src/cpu-profiler.h"
@@ -270,7 +271,7 @@
   } else if (!(src2.instructions_required(this) == 1) &&
              !src2.must_output_reloc_info(this) &&
              CpuFeatures::IsSupported(ARMv7) &&
-             IsPowerOf2(src2.immediate() + 1)) {
+             base::bits::IsPowerOfTwo32(src2.immediate() + 1)) {
     ubfx(dst, src1, 0,
         WhichPowerOf2(static_cast<uint32_t>(src2.immediate()) + 1), cond);
   } else {
@@ -677,8 +678,7 @@
     Ret(eq);
   }
   push(lr);
-  StoreBufferOverflowStub store_buffer_overflow =
-      StoreBufferOverflowStub(isolate(), fp_mode);
+  StoreBufferOverflowStub store_buffer_overflow(isolate(), fp_mode);
   CallStub(&store_buffer_overflow);
   pop(lr);
   bind(&done);
@@ -1075,7 +1075,7 @@
   const int frame_alignment = MacroAssembler::ActivationFrameAlignment();
   sub(sp, sp, Operand((stack_space + 1) * kPointerSize));
   if (frame_alignment > 0) {
-    DCHECK(IsPowerOf2(frame_alignment));
+    DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
     and_(sp, sp, Operand(-frame_alignment));
   }

@@ -3489,7 +3489,7 @@
     // and the original value of sp.
     mov(scratch, sp);
     sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize));
-    DCHECK(IsPowerOf2(frame_alignment));
+    DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
     and_(sp, sp, Operand(-frame_alignment));
     str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize));
   } else {
@@ -3568,7 +3568,7 @@
     int frame_alignment = base::OS::ActivationFrameAlignment();
     int frame_alignment_mask = frame_alignment - 1;
     if (frame_alignment > kPointerSize) {
-      DCHECK(IsPowerOf2(frame_alignment));
+      DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
       Label alignment_as_expected;
       tst(sp, Operand(frame_alignment_mask));
       b(eq, &alignment_as_expected);
=======================================
--- /trunk/src/arm64/assembler-arm64.cc Wed Aug 27 00:06:40 2014 UTC
+++ /trunk/src/arm64/assembler-arm64.cc Wed Sep  3 08:32:14 2014 UTC
@@ -33,6 +33,7 @@
 #define ARM64_DEFINE_REG_STATICS

 #include "src/arm64/assembler-arm64-inl.h"
+#include "src/base/bits.h"
 #include "src/base/cpu.h"

 namespace v8 {
@@ -601,7 +602,7 @@


 void Assembler::Align(int m) {
-  DCHECK(m >= 4 && IsPowerOf2(m));
+  DCHECK(m >= 4 && base::bits::IsPowerOfTwo32(m));
   while ((pc_offset() & (m - 1)) != 0) {
     nop();
   }
@@ -2206,6 +2207,17 @@
   DCHECK(is_uint16(code));
   Emit(BRK | ImmException(code));
 }
+
+
+void Assembler::EmitStringData(const char* string) {
+  size_t len = strlen(string) + 1;
+  DCHECK(RoundUp(len, kInstructionSize) <= static_cast<size_t>(kGap));
+  EmitData(string, len);
+  // Pad with NULL characters until pc_ is aligned.
+  const char pad[] = {'\0', '\0', '\0', '\0'};
+  STATIC_ASSERT(sizeof(pad) == kInstructionSize);
+  EmitData(pad, RoundUp(pc_offset(), kInstructionSize) - pc_offset());
+}


 void Assembler::debug(const char* message, uint32_t code, Instr params) {
=======================================
--- /trunk/src/arm64/assembler-arm64.h  Wed Aug 20 00:06:26 2014 UTC
+++ /trunk/src/arm64/assembler-arm64.h  Wed Sep  3 08:32:14 2014 UTC
@@ -1733,16 +1733,7 @@
// Copy a string into the instruction stream, including the terminating NULL
   // character. The instruction pointer (pc_) is then aligned correctly for
   // subsequent instructions.
-  void EmitStringData(const char * string) {
-    size_t len = strlen(string) + 1;
-    DCHECK(RoundUp(len, kInstructionSize) <= static_cast<size_t>(kGap));
-    EmitData(string, len);
-    // Pad with NULL characters until pc_ is aligned.
-    const char pad[] = {'\0', '\0', '\0', '\0'};
-    STATIC_ASSERT(sizeof(pad) == kInstructionSize);
-    byte* next_pc = AlignUp(pc_, kInstructionSize);
-    EmitData(&pad, next_pc - pc_);
-  }
+  void EmitStringData(const char* string);

// Pseudo-instructions ------------------------------------------------------

=======================================
--- /trunk/src/arm64/code-stubs-arm64.cc        Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/arm64/code-stubs-arm64.cc        Wed Sep  3 08:32:14 2014 UTC
@@ -513,8 +513,8 @@
   Condition cond = GetCondition();

   Label miss;
-  ICCompareStub_CheckInputType(masm, lhs, x2, left_, &miss);
-  ICCompareStub_CheckInputType(masm, rhs, x3, right_, &miss);
+  ICCompareStub_CheckInputType(masm, lhs, x2, left(), &miss);
+  ICCompareStub_CheckInputType(masm, rhs, x3, right(), &miss);

   Label slow;  // Call builtin.
   Label not_smis, both_loaded_as_doubles;
@@ -3204,7 +3204,7 @@

 void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
   // Inputs are in x0 (lhs) and x1 (rhs).
-  DCHECK(state_ == CompareIC::SMI);
+  DCHECK(state() == CompareIC::SMI);
   ASM_LOCATION("ICCompareStub[Smis]");
   Label miss;
   // Bail out (to 'miss') unless both x0 and x1 are smis.
@@ -3226,7 +3226,7 @@


 void ICCompareStub::GenerateNumbers(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::NUMBER);
+  DCHECK(state() == CompareIC::NUMBER);
   ASM_LOCATION("ICCompareStub[HeapNumbers]");

   Label unordered, maybe_undefined1, maybe_undefined2;
@@ -3239,10 +3239,10 @@
   FPRegister rhs_d = d0;
   FPRegister lhs_d = d1;

-  if (left_ == CompareIC::SMI) {
+  if (left() == CompareIC::SMI) {
     __ JumpIfNotSmi(lhs, &miss);
   }
-  if (right_ == CompareIC::SMI) {
+  if (right() == CompareIC::SMI) {
     __ JumpIfNotSmi(rhs, &miss);
   }

@@ -3271,12 +3271,12 @@
   __ Ret();

   __ Bind(&unordered);
- ICCompareStub stub(isolate(), op_, CompareIC::GENERIC, CompareIC::GENERIC, + ICCompareStub stub(isolate(), op(), CompareIC::GENERIC, CompareIC::GENERIC,
                      CompareIC::GENERIC);
   __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);

   __ Bind(&maybe_undefined1);
-  if (Token::IsOrderedRelationalCompareOp(op_)) {
+  if (Token::IsOrderedRelationalCompareOp(op())) {
     __ JumpIfNotRoot(rhs, Heap::kUndefinedValueRootIndex, &miss);
     __ JumpIfSmi(lhs, &unordered);
__ JumpIfNotObjectType(lhs, x10, x10, HEAP_NUMBER_TYPE, &maybe_undefined2);
@@ -3284,7 +3284,7 @@
   }

   __ Bind(&maybe_undefined2);
-  if (Token::IsOrderedRelationalCompareOp(op_)) {
+  if (Token::IsOrderedRelationalCompareOp(op())) {
     __ JumpIfRoot(lhs, Heap::kUndefinedValueRootIndex, &unordered);
   }

@@ -3294,7 +3294,7 @@


 void ICCompareStub::GenerateInternalizedStrings(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::INTERNALIZED_STRING);
+  DCHECK(state() == CompareIC::INTERNALIZED_STRING);
   ASM_LOCATION("ICCompareStub[InternalizedStrings]");
   Label miss;

@@ -3332,7 +3332,7 @@


 void ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::UNIQUE_NAME);
+  DCHECK(state() == CompareIC::UNIQUE_NAME);
   ASM_LOCATION("ICCompareStub[UniqueNames]");
   DCHECK(GetCondition() == eq);
   Label miss;
@@ -3371,12 +3371,12 @@


 void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::STRING);
+  DCHECK(state() == CompareIC::STRING);
   ASM_LOCATION("ICCompareStub[Strings]");

   Label miss;

-  bool equality = Token::IsEqualityOp(op_);
+  bool equality = Token::IsEqualityOp(op());

   Register result = x0;
   Register rhs = x0;
@@ -3452,7 +3452,7 @@


 void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
-  DCHECK(state_ == CompareIC::OBJECT);
+  DCHECK(state() == CompareIC::OBJECT);
   ASM_LOCATION("ICCompareStub[Objects]");

   Label miss;
@@ -3522,7 +3522,7 @@
     // Preserve some caller-saved registers.
     __ Push(x1, x0, lr);
     // Push the arguments.
-    __ Mov(op, Smi::FromInt(op_));
+    __ Mov(op, Smi::FromInt(this->op()));
     __ Push(left, right, op);

     // Call the miss handler. This also pops the arguments.
=======================================
--- /trunk/src/arm64/lithium-arm64.cc   Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/arm64/lithium-arm64.cc   Wed Sep  3 08:32:14 2014 UTC
@@ -1937,12 +1937,12 @@
       int32_t constant_abs = Abs(constant);

       if (!end_range_constant &&
-          (small_constant ||
-           (IsPowerOf2(constant_abs)) ||
-           (!can_overflow && (IsPowerOf2(constant_abs + 1) ||
-                              IsPowerOf2(constant_abs - 1))))) {
+          (small_constant || (base::bits::IsPowerOfTwo32(constant_abs)) ||
+ (!can_overflow && (base::bits::IsPowerOfTwo32(constant_abs + 1) || + base::bits::IsPowerOfTwo32(constant_abs - 1))))) {
         LConstantOperand* right = UseConstant(most_const);
-        bool need_register = IsPowerOf2(constant_abs) && !small_constant;
+        bool need_register =
+            base::bits::IsPowerOfTwo32(constant_abs) && !small_constant;
         LOperand* left = need_register ? UseRegister(least_const)
                                        : UseRegisterAtStart(least_const);
         LInstruction* result =
=======================================
--- /trunk/src/arm64/lithium-codegen-arm64.cc   Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/arm64/lithium-codegen-arm64.cc   Wed Sep  3 08:32:14 2014 UTC
@@ -6,6 +6,7 @@

 #include "src/arm64/lithium-codegen-arm64.h"
 #include "src/arm64/lithium-gap-resolver-arm64.h"
+#include "src/base/bits.h"
 #include "src/code-stubs.h"
 #include "src/hydrogen-osr.h"

@@ -2236,7 +2237,7 @@
     uint8_t tag;
     instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag);

-    if (IsPowerOf2(mask)) {
+    if (base::bits::IsPowerOfTwo32(mask)) {
       DCHECK((tag == 0) || (tag == mask));
       if (tag == 0) {
         DeoptimizeIfBitSet(scratch, MaskToBit(mask), instr->environment());
@@ -2669,7 +2670,7 @@
   Register dividend = ToRegister32(instr->dividend());
   int32_t divisor = instr->divisor();
   Register result = ToRegister32(instr->result());
-  DCHECK(divisor == kMinInt || IsPowerOf2(Abs(divisor)));
+  DCHECK(divisor == kMinInt || base::bits::IsPowerOfTwo32(Abs(divisor)));
   DCHECK(!result.is(dividend));

   // Check for (0 / -x) that will produce negative zero.
@@ -4360,7 +4361,7 @@
       // can be done efficiently with shifted operands.
       int32_t right_abs = Abs(right);

-      if (IsPowerOf2(right_abs)) {
+      if (base::bits::IsPowerOfTwo32(right_abs)) {
         int right_log2 = WhichPowerOf2(right_abs);

         if (can_overflow) {
@@ -4393,10 +4394,10 @@
       DCHECK(!can_overflow);

       if (right >= 0) {
-        if (IsPowerOf2(right - 1)) {
+        if (base::bits::IsPowerOfTwo32(right - 1)) {
           // result = left + left << log2(right - 1)
__ Add(result, left, Operand(left, LSL, WhichPowerOf2(right - 1)));
-        } else if (IsPowerOf2(right + 1)) {
+        } else if (base::bits::IsPowerOfTwo32(right + 1)) {
           // result = -left + left << log2(right + 1)
__ Sub(result, left, Operand(left, LSL, WhichPowerOf2(right + 1)));
           __ Neg(result, result);
@@ -4404,10 +4405,10 @@
           UNREACHABLE();
         }
       } else {
-        if (IsPowerOf2(-right + 1)) {
+        if (base::bits::IsPowerOfTwo32(-right + 1)) {
           // result = left - left << log2(-right + 1)
__ Sub(result, left, Operand(left, LSL, WhichPowerOf2(-right + 1)));
-        } else if (IsPowerOf2(-right - 1)) {
+        } else if (base::bits::IsPowerOfTwo32(-right - 1)) {
           // result = -left - left << log2(-right - 1)
__ Add(result, left, Operand(left, LSL, WhichPowerOf2(-right - 1)));
           __ Neg(result, result);
=======================================
--- /trunk/src/arm64/macro-assembler-arm64-inl.h Fri Aug 8 15:46:17 2014 UTC +++ /trunk/src/arm64/macro-assembler-arm64-inl.h Wed Sep 3 08:32:14 2014 UTC
@@ -13,6 +13,7 @@
 #include "src/arm64/assembler-arm64.h"
 #include "src/arm64/instrument-arm64.h"
 #include "src/arm64/macro-assembler-arm64.h"
+#include "src/base/bits.h"


 namespace v8 {
@@ -1520,7 +1521,7 @@

 void MacroAssembler::Claim(const Register& count, uint64_t unit_size) {
   if (unit_size == 0) return;
-  DCHECK(IsPowerOf2(unit_size));
+  DCHECK(base::bits::IsPowerOfTwo64(unit_size));

   const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits);
   const Operand size(count, LSL, shift);
@@ -1538,7 +1539,7 @@


void MacroAssembler::ClaimBySMI(const Register& count_smi, uint64_t unit_size) {
-  DCHECK(unit_size == 0 || IsPowerOf2(unit_size));
+  DCHECK(unit_size == 0 || base::bits::IsPowerOfTwo64(unit_size));
const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits) - kSmiShift;
   const Operand size(count_smi,
                      (shift >= 0) ? (LSL) : (LSR),
@@ -1578,7 +1579,7 @@

 void MacroAssembler::Drop(const Register& count, uint64_t unit_size) {
   if (unit_size == 0) return;
-  DCHECK(IsPowerOf2(unit_size));
+  DCHECK(base::bits::IsPowerOfTwo64(unit_size));

   const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits);
   const Operand size(count, LSL, shift);
@@ -1599,7 +1600,7 @@


void MacroAssembler::DropBySMI(const Register& count_smi, uint64_t unit_size) {
-  DCHECK(unit_size == 0 || IsPowerOf2(unit_size));
+  DCHECK(unit_size == 0 || base::bits::IsPowerOfTwo64(unit_size));
const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits) - kSmiShift;
   const Operand size(count_smi,
                      (shift >= 0) ? (LSL) : (LSR),
=======================================
--- /trunk/src/arm64/macro-assembler-arm64.cc   Mon Sep  1 00:05:43 2014 UTC
+++ /trunk/src/arm64/macro-assembler-arm64.cc   Wed Sep  3 08:32:14 2014 UTC
@@ -6,6 +6,7 @@

 #if V8_TARGET_ARCH_ARM64

+#include "src/base/bits.h"
 #include "src/bootstrapper.h"
 #include "src/codegen.h"
 #include "src/cpu-profiler.h"
@@ -2059,7 +2060,7 @@
     int sp_alignment = ActivationFrameAlignment();
     // The ABI mandates at least 16-byte alignment.
     DCHECK(sp_alignment >= 16);
-    DCHECK(IsPowerOf2(sp_alignment));
+    DCHECK(base::bits::IsPowerOfTwo32(sp_alignment));

// The current stack pointer is a callee saved register, and is preserved
     // across the call.
@@ -4301,8 +4302,7 @@

   Bind(&store_buffer_overflow);
   Push(lr);
-  StoreBufferOverflowStub store_buffer_overflow_stub =
-      StoreBufferOverflowStub(isolate(), fp_mode);
+  StoreBufferOverflowStub store_buffer_overflow_stub(isolate(), fp_mode);
   CallStub(&store_buffer_overflow_stub);
   Pop(lr);

=======================================
--- /trunk/src/arm64/macro-assembler-arm64.h    Wed Aug 20 00:06:26 2014 UTC
+++ /trunk/src/arm64/macro-assembler-arm64.h    Wed Sep  3 08:32:14 2014 UTC
@@ -10,6 +10,7 @@
 #include "src/globals.h"

 #include "src/arm64/assembler-arm64-inl.h"
+#include "src/base/bits.h"

 // Simulator specific helpers.
 #if USE_SIMULATOR
@@ -808,7 +809,7 @@
     int sp_alignment = ActivationFrameAlignment();
     // AAPCS64 mandates at least 16-byte alignment.
     DCHECK(sp_alignment >= 16);
-    DCHECK(IsPowerOf2(sp_alignment));
+    DCHECK(base::bits::IsPowerOfTwo32(sp_alignment));
     Bic(csp, StackPointer(), sp_alignment - 1);
     SetStackPointer(csp);
   }
=======================================
--- /trunk/src/base/bits-unittest.cc    Mon Sep  1 00:05:43 2014 UTC
+++ /trunk/src/base/bits-unittest.cc    Wed Sep  3 08:32:14 2014 UTC
@@ -6,11 +6,17 @@
 #include "src/base/macros.h"
 #include "testing/gtest-support.h"

+#ifdef DEBUG
+#define DISABLE_IN_RELEASE(Name) Name
+#else
+#define DISABLE_IN_RELEASE(Name) DISABLED_##Name
+#endif
+
 namespace v8 {
 namespace base {
 namespace bits {

-TEST(BitsTest, CountPopulation32) {
+TEST(Bits, CountPopulation32) {
   EXPECT_EQ(0u, CountPopulation32(0));
   EXPECT_EQ(1u, CountPopulation32(1));
   EXPECT_EQ(8u, CountPopulation32(0x11111111));
@@ -20,7 +26,7 @@
 }


-TEST(BitsTest, CountLeadingZeros32) {
+TEST(Bits, CountLeadingZeros32) {
   EXPECT_EQ(32u, CountLeadingZeros32(0));
   EXPECT_EQ(31u, CountLeadingZeros32(1));
   TRACED_FORRANGE(uint32_t, shift, 0, 31) {
@@ -30,7 +36,7 @@
 }


-TEST(BitsTest, CountTrailingZeros32) {
+TEST(Bits, CountTrailingZeros32) {
   EXPECT_EQ(32u, CountTrailingZeros32(0));
   EXPECT_EQ(31u, CountTrailingZeros32(0x80000000));
   TRACED_FORRANGE(uint32_t, shift, 0, 31) {
@@ -40,7 +46,61 @@
 }


-TEST(BitsTest, RotateRight32) {
+TEST(Bits, IsPowerOfTwo32) {
+  EXPECT_FALSE(IsPowerOfTwo32(0U));
+  TRACED_FORRANGE(uint32_t, shift, 0, 31) {
+    EXPECT_TRUE(IsPowerOfTwo32(1U << shift));
+    EXPECT_FALSE(IsPowerOfTwo32((1U << shift) + 5U));
+    EXPECT_FALSE(IsPowerOfTwo32(~(1U << shift)));
+  }
+  TRACED_FORRANGE(uint32_t, shift, 2, 31) {
+    EXPECT_FALSE(IsPowerOfTwo32((1U << shift) - 1U));
+  }
+  EXPECT_FALSE(IsPowerOfTwo32(0xffffffff));
+}
+
+
+TEST(Bits, IsPowerOfTwo64) {
+  EXPECT_FALSE(IsPowerOfTwo64(0U));
+  TRACED_FORRANGE(uint32_t, shift, 0, 63) {
+    EXPECT_TRUE(IsPowerOfTwo64(V8_UINT64_C(1) << shift));
+    EXPECT_FALSE(IsPowerOfTwo64((V8_UINT64_C(1) << shift) + 5U));
+    EXPECT_FALSE(IsPowerOfTwo64(~(V8_UINT64_C(1) << shift)));
+  }
+  TRACED_FORRANGE(uint32_t, shift, 2, 63) {
+    EXPECT_FALSE(IsPowerOfTwo64((V8_UINT64_C(1) << shift) - 1U));
+  }
+  EXPECT_FALSE(IsPowerOfTwo64(V8_UINT64_C(0xffffffffffffffff)));
+}
+
+
+TEST(Bits, RoundUpToPowerOfTwo32) {
+  TRACED_FORRANGE(uint32_t, shift, 0, 31) {
+    EXPECT_EQ(1u << shift, RoundUpToPowerOfTwo32(1u << shift));
+  }
+  EXPECT_EQ(0u, RoundUpToPowerOfTwo32(0));
+  EXPECT_EQ(4u, RoundUpToPowerOfTwo32(3));
+  EXPECT_EQ(0x80000000u, RoundUpToPowerOfTwo32(0x7fffffffu));
+}
+
+
+TEST(BitsDeathTest, DISABLE_IN_RELEASE(RoundUpToPowerOfTwo32)) {
+  ASSERT_DEATH_IF_SUPPORTED({ RoundUpToPowerOfTwo32(0x80000001u); },
+                            "0x80000000");
+}
+
+
+TEST(Bits, RoundDownToPowerOfTwo32) {
+  TRACED_FORRANGE(uint32_t, shift, 0, 31) {
+    EXPECT_EQ(1u << shift, RoundDownToPowerOfTwo32(1u << shift));
+  }
+  EXPECT_EQ(0u, RoundDownToPowerOfTwo32(0));
+  EXPECT_EQ(4u, RoundDownToPowerOfTwo32(5));
+  EXPECT_EQ(0x80000000u, RoundDownToPowerOfTwo32(0x80000001u));
+}
+
+
+TEST(Bits, RotateRight32) {
   TRACED_FORRANGE(uint32_t, shift, 0, 31) {
     EXPECT_EQ(0u, RotateRight32(0u, shift));
   }
@@ -50,7 +110,7 @@
 }


-TEST(BitsTest, RotateRight64) {
+TEST(Bits, RotateRight64) {
   TRACED_FORRANGE(uint64_t, shift, 0, 63) {
     EXPECT_EQ(0u, RotateRight64(0u, shift));
   }
=======================================
--- /trunk/src/base/bits.h      Mon Aug 25 19:57:56 2014 UTC
+++ /trunk/src/base/bits.h      Wed Sep  3 08:32:14 2014 UTC
@@ -70,6 +70,37 @@
   return count;
 #endif
 }
+
+
+// Returns true iff |value| is a power of 2.
+inline bool IsPowerOfTwo32(uint32_t value) {
+  return value && !(value & (value - 1));
+}
+
+
+// Returns true iff |value| is a power of 2.
+inline bool IsPowerOfTwo64(uint64_t value) {
+  return value && !(value & (value - 1));
+}
+
+
+// RoundUpToPowerOfTwo32(value) returns the smallest power of two which is
+// greater than or equal to |value|. If you pass in a |value| that is already a +// power of two, it is returned as is. |value| must be less than or equal to +// 0x80000000u. Implementation is from "Hacker's Delight" by Henry S. Warren,
+// Jr., figure 3-3, page 48, where the function is called clp2.
+uint32_t RoundUpToPowerOfTwo32(uint32_t value);
+
+
+// RoundDownToPowerOfTwo32(value) returns the greatest power of two which is +// less than or equal to |value|. If you pass in a |value| that is already a
+// power of two, it is returned as is.
+inline uint32_t RoundDownToPowerOfTwo32(uint32_t value) {
+  if (value > 0x80000000u) return 0x80000000u;
+  uint32_t result = RoundUpToPowerOfTwo32(value);
+  if (result > value) result >>= 1;
+  return result;
+}


 inline uint32_t RotateRight32(uint32_t value, uint32_t shift) {
=======================================
--- /trunk/src/base/flags.h     Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/base/flags.h     Wed Sep  3 08:32:14 2014 UTC
@@ -65,51 +65,38 @@


#define DEFINE_OPERATORS_FOR_FLAGS(Type) \ - inline ::v8::base::Flags<Type::flag_type> operator&( \ - Type::flag_type lhs, \ - Type::flag_type rhs)ALLOW_UNUSED WARN_UNUSED_RESULT; \ - inline ::v8::base::Flags<Type::flag_type> operator&(Type::flag_type lhs, \ - Type::flag_type rhs) { \ - return ::v8::base::Flags<Type::flag_type>(lhs) & rhs; \ + inline Type operator&(Type::flag_type lhs, \ + Type::flag_type rhs)ALLOW_UNUSED WARN_UNUSED_RESULT; \ + inline Type operator&(Type::flag_type lhs, Type::flag_type rhs) { \ + return Type(lhs) & rhs; \ } \ - inline ::v8::base::Flags<Type::flag_type> operator&( \ - Type::flag_type lhs, const ::v8::base::Flags<Type::flag_type>& rhs) \ - ALLOW_UNUSED WARN_UNUSED_RESULT; \ - inline ::v8::base::Flags<Type::flag_type> operator&( \ - Type::flag_type lhs, const ::v8::base::Flags<Type::flag_type>& rhs) { \ + inline Type operator&(Type::flag_type lhs, \ + const Type& rhs)ALLOW_UNUSED WARN_UNUSED_RESULT; \ + inline Type operator&(Type::flag_type lhs, const Type& rhs) { \ return rhs & lhs; \ } \ inline void operator&(Type::flag_type lhs, Type::mask_type rhs)ALLOW_UNUSED; \ inline void operator&(Type::flag_type lhs, Type::mask_type rhs) {} \ - inline ::v8::base::Flags<Type::flag_type> operator|(Type::flag_type lhs, \ - Type::flag_type rhs) \ + inline Type operator|(Type::flag_type lhs, Type::flag_type rhs) \ ALLOW_UNUSED WARN_UNUSED_RESULT; \ - inline ::v8::base::Flags<Type::flag_type> operator|(Type::flag_type lhs, \ - Type::flag_type rhs) { \ - return ::v8::base::Flags<Type::flag_type>(lhs) | rhs; \ + inline Type operator|(Type::flag_type lhs, Type::flag_type rhs) { \ + return Type(lhs) | rhs; \ } \ - inline ::v8::base::Flags<Type::flag_type> operator| ( \ - Type::flag_type lhs, const ::v8::base::Flags<Type::flag_type>& rhs) \ + inline Type operator|(Type::flag_type lhs, const Type& rhs) \ ALLOW_UNUSED WARN_UNUSED_RESULT; \ - inline ::v8::base::Flags<Type::flag_type> operator| ( \ - Type::flag_type lhs, const ::v8::base::Flags<Type::flag_type>& rhs) { \ + inline Type operator|(Type::flag_type lhs, const Type& rhs) { \ return rhs | lhs; \ } \ inline void operator|(Type::flag_type lhs, Type::mask_type rhs) \ ALLOW_UNUSED; \ inline void operator|(Type::flag_type lhs, Type::mask_type rhs) {} \ - inline ::v8::base::Flags<Type::flag_type> operator^(Type::flag_type lhs, \ - Type::flag_type rhs) \ + inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) \ ALLOW_UNUSED WARN_UNUSED_RESULT; \ - inline ::v8::base::Flags<Type::flag_type> operator^(Type::flag_type lhs, \ - Type::flag_type rhs) { \ - return ::v8::base::Flags<Type::flag_type>(lhs) ^ rhs; \ - } inline ::v8::base::Flags<Type::flag_type> \ - operator^(Type::flag_type lhs, \ - const ::v8::base::Flags<Type::flag_type>& rhs) \ + inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) { \ + return Type(lhs) ^ rhs; \ + } inline Type operator^(Type::flag_type lhs, const Type& rhs) \ ALLOW_UNUSED WARN_UNUSED_RESULT; \ - inline ::v8::base::Flags<Type::flag_type> operator^( \ - Type::flag_type lhs, const ::v8::base::Flags<Type::flag_type>& rhs) { \ + inline Type operator^(Type::flag_type lhs, const Type& rhs) { \ return rhs ^ lhs; \ } inline void operator^(Type::flag_type lhs, Type::mask_type rhs) \ ALLOW_UNUSED; \
=======================================
--- /trunk/src/base/macros.h    Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/base/macros.h    Wed Sep  3 08:32:14 2014 UTC
@@ -186,14 +186,6 @@


 #define IS_POWER_OF_TWO(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
-
-
-// Returns true iff x is a power of 2. Cannot be used with the maximally
-// negative value of the type T (the -1 overflows).
-template <typename T>
-inline bool IsPowerOf2(T x) {
-  return IS_POWER_OF_TWO(x);
-}


// Define our own macros for writing 64-bit constants. This is less fragile
@@ -268,7 +260,7 @@
 // Return the largest multiple of m which is <= x.
 template <typename T>
 inline T RoundDown(T x, intptr_t m) {
-  DCHECK(IsPowerOf2(m));
+  DCHECK(IS_POWER_OF_TWO(m));
   return AddressFrom<T>(OffsetFrom(x) & -m);
 }

@@ -278,46 +270,12 @@
 inline T RoundUp(T x, intptr_t m) {
   return RoundDown<T>(static_cast<T>(x + m - 1), m);
 }
-
-
-// Increment a pointer until it has the specified alignment.
-// This works like RoundUp, but it works correctly on pointer types where
-// sizeof(*pointer) might not be 1.
-template<class T>
-T AlignUp(T pointer, size_t alignment) {
-  DCHECK(sizeof(pointer) == sizeof(uintptr_t));
-  uintptr_t pointer_raw = reinterpret_cast<uintptr_t>(pointer);
-  return reinterpret_cast<T>(RoundUp(pointer_raw, alignment));
-}


 template <typename T, typename U>
 inline bool IsAligned(T value, U alignment) {
   return (value & (alignment - 1)) == 0;
 }
-
-
-// Returns the smallest power of two which is >= x. If you pass in a
-// number that is already a power of two, it is returned as is.
-// Implementation is from "Hacker's Delight" by Henry S. Warren, Jr.,
-// figure 3-3, page 48, where the function is called clp2.
-inline uint32_t RoundUpToPowerOf2(uint32_t x) {
-  DCHECK(x <= 0x80000000u);
-  x = x - 1;
-  x = x | (x >> 1);
-  x = x | (x >> 2);
-  x = x | (x >> 4);
-  x = x | (x >> 8);
-  x = x | (x >> 16);
-  return x + 1;
-}
-
-
-inline uint32_t RoundDownToPowerOf2(uint32_t x) {
-  uint32_t rounded_up = RoundUpToPowerOf2(x);
-  if (rounded_up > x) return rounded_up >> 1;
-  return rounded_up;
-}


 // Returns current value of top of the stack. Works correctly with ASAN.
=======================================
--- /trunk/src/base/platform/platform-win32.cc  Thu Aug 28 00:05:02 2014 UTC
+++ /trunk/src/base/platform/platform-win32.cc  Wed Sep  3 08:32:14 2014 UTC
@@ -21,6 +21,7 @@

 #include "src/base/win32-headers.h"

+#include "src/base/bits.h"
 #include "src/base/lazy-instance.h"
 #include "src/base/macros.h"
 #include "src/base/platform/platform.h"
@@ -700,7 +701,7 @@
   if (page_size == 0) {
     SYSTEM_INFO info;
     GetSystemInfo(&info);
-    page_size = RoundUpToPowerOf2(info.dwPageSize);
+    page_size = base::bits::RoundUpToPowerOfTwo32(info.dwPageSize);
   }
   return page_size;
 }
=======================================
--- /trunk/src/base/platform/semaphore.cc       Mon Sep  1 00:05:43 2014 UTC
+++ /trunk/src/base/platform/semaphore.cc       Wed Sep  3 08:32:14 2014 UTC
@@ -114,7 +114,7 @@
   do {
     int result = sem_trywait(&native_handle_);
     if (result == 0) return true;
-    DCHECK(errno == EAGAIN || error == EINTR);
+    DCHECK(errno == EAGAIN || errno == EINTR);
   } while (!timer.HasExpired(rel_time));
   return false;
 #else
=======================================
--- /trunk/src/code-stubs.cc    Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/code-stubs.cc    Wed Sep  3 08:32:14 2014 UTC
@@ -219,7 +219,7 @@


 void BinaryOpICStub::PrintState(OStream& os) const {  // NOLINT
-  os << state_;
+  os << state();
 }


@@ -270,7 +270,7 @@


 InlineCacheState ICCompareStub::GetICState() const {
-  CompareIC::State state = Max(left_, right_);
+  CompareIC::State state = Max(left(), right());
   switch (state) {
     case CompareIC::UNINITIALIZED:
       return ::v8::internal::UNINITIALIZED;
@@ -307,7 +307,7 @@
   Code::Flags flags = Code::ComputeFlags(
       GetCodeKind(),
       UNINITIALIZED);
-  DCHECK(op_ == Token::EQ || op_ == Token::EQ_STRICT);
+  DCHECK(op() == Token::EQ || op() == Token::EQ_STRICT);
   Handle<Object> probe(
       known_map_->FindInCodeCache(
         strict() ?
@@ -318,50 +318,20 @@
   if (probe->IsCode()) {
     *code_out = Code::cast(*probe);
 #ifdef DEBUG
-    Token::Value cached_op;
-    ICCompareStub::DecodeKey((*code_out)->stub_key(), NULL, NULL, NULL,
-                             &cached_op);
-    DCHECK(op_ == cached_op);
+    ICCompareStub decode((*code_out)->stub_key());
+    DCHECK(op() == decode.op());
+    DCHECK(left() == decode.left());
+    DCHECK(right() == decode.right());
+    DCHECK(state() == decode.state());
 #endif
     return true;
   }
   return false;
 }
-
-
-uint32_t ICCompareStub::MinorKey() const {
-  return OpField::encode(op_ - Token::EQ) |
-         LeftStateField::encode(left_) |
-         RightStateField::encode(right_) |
-         HandlerStateField::encode(state_);
-}
-
-
-void ICCompareStub::DecodeKey(uint32_t stub_key, CompareIC::State* left_state,
-                              CompareIC::State* right_state,
-                              CompareIC::State* handler_state,
-                              Token::Value* op) {
-  int minor_key = MinorKeyFromKey(stub_key);
-  if (left_state) {
-    *left_state =
-        static_cast<CompareIC::State>(LeftStateField::decode(minor_key));
-  }
-  if (right_state) {
-    *right_state =
-        static_cast<CompareIC::State>(RightStateField::decode(minor_key));
-  }
-  if (handler_state) {
-    *handler_state =
- static_cast<CompareIC::State>(HandlerStateField::decode(minor_key));
-  }
-  if (op) {
- *op = static_cast<Token::Value>(OpField::decode(minor_key) + Token::EQ);
-  }
-}


 void ICCompareStub::Generate(MacroAssembler* masm) {
-  switch (state_) {
+  switch (state()) {
     case CompareIC::UNINITIALIZED:
       GenerateMiss(masm);
       break;
@@ -395,24 +365,26 @@


 void CompareNilICStub::UpdateStatus(Handle<Object> object) {
-  DCHECK(!state_.Contains(GENERIC));
-  State old_state(state_);
+  State state = this->state();
+  DCHECK(!state.Contains(GENERIC));
+  State old_state = state;
   if (object->IsNull()) {
-    state_.Add(NULL_TYPE);
+    state.Add(NULL_TYPE);
   } else if (object->IsUndefined()) {
-    state_.Add(UNDEFINED);
+    state.Add(UNDEFINED);
   } else if (object->IsUndetectableObject() ||
              object->IsOddball() ||
              !object->IsHeapObject()) {
-    state_.RemoveAll();
-    state_.Add(GENERIC);
+    state.RemoveAll();
+    state.Add(GENERIC);
   } else if (IsMonomorphic()) {
-    state_.RemoveAll();
-    state_.Add(GENERIC);
+    state.RemoveAll();
+    state.Add(GENERIC);
   } else {
-    state_.Add(MONOMORPHIC_MAP);
+    state.Add(MONOMORPHIC_MAP);
   }
-  TraceTransition(old_state, state_);
+  TraceTransition(old_state, state);
+ set_sub_minor_key(TypesBits::update(sub_minor_key(), state.ToIntegral()));
 }


@@ -431,12 +403,12 @@

 void CompareNilICStub::PrintBaseName(OStream& os) const {  // NOLINT
   CodeStub::PrintBaseName(os);
-  os << ((nil_value_ == kNullValue) ? "(NullValue)" : "(UndefinedValue)");
+  os << ((nil_value() == kNullValue) ? "(NullValue)" : "(UndefinedValue)");
 }


 void CompareNilICStub::PrintState(OStream& os) const {  // NOLINT
-  os << state_;
+  os << state();
 }


@@ -473,18 +445,17 @@


 Type* CompareNilICStub::GetType(Zone* zone, Handle<Map> map) {
-  if (state_.Contains(CompareNilICStub::GENERIC)) {
-    return Type::Any(zone);
-  }
+  State state = this->state();
+  if (state.Contains(CompareNilICStub::GENERIC)) return Type::Any(zone);

   Type* result = Type::None(zone);
-  if (state_.Contains(CompareNilICStub::UNDEFINED)) {
+  if (state.Contains(CompareNilICStub::UNDEFINED)) {
     result = Type::Union(result, Type::Undefined(zone), zone);
   }
-  if (state_.Contains(CompareNilICStub::NULL_TYPE)) {
+  if (state.Contains(CompareNilICStub::NULL_TYPE)) {
     result = Type::Union(result, Type::Null(zone), zone);
   }
-  if (state_.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
+  if (state.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
     Type* type =
         map.is_null() ? Type::Detectable(zone) : Type::Class(map, zone);
     result = Type::Union(result, type, zone);
@@ -497,7 +468,7 @@
 Type* CompareNilICStub::GetInputType(Zone* zone, Handle<Map> map) {
   Type* output_type = GetType(zone, map);
   Type* nil_type =
-      nil_value_ == kNullValue ? Type::Null(zone) : Type::Undefined(zone);
+      nil_value() == kNullValue ? Type::Null(zone) : Type::Undefined(zone);
   return Type::Union(output_type, nil_type, zone);
 }

=======================================
--- /trunk/src/code-stubs.h     Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/code-stubs.h     Wed Sep  3 08:32:14 2014 UTC
@@ -204,6 +204,8 @@
   Isolate* isolate() const { return isolate_; }

  protected:
+  explicit CodeStub(uint32_t key) : minor_key_(MinorKeyFromKey(key)) {}
+
   // Generates the assembler code for the stub.
   virtual Handle<Code> GenerateCode() = 0;

@@ -274,6 +276,11 @@
  protected:
   // Generates the assembler code for the stub.
   virtual void Generate(MacroAssembler* masm) = 0;
+
+  explicit PlatformCodeStub(uint32_t key) : CodeStub(key) {}
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(PlatformCodeStub);
 };


@@ -415,14 +422,6 @@
   virtual Handle<Code> GenerateCode() = 0;

   bool IsUninitialized() const { return IsMissBits::decode(minor_key_); }
-
-  // TODO(yangguo): we use this temporarily to construct the minor key.
-  //   We want to remove NotMissMinorKey methods one by one and eventually
-  //   remove HydrogenStub::MinorKey and turn CodeStub::MinorKey into a
-  //   non-virtual method that directly returns minor_key_.
-  virtual int NotMissMinorKey() const {
-    return SubMinorKeyBits::decode(minor_key_);
-  }

   Handle<Code> GenerateLightweightMissCode();

@@ -438,16 +437,13 @@

   static const int kSubMinorKeyBits = kStubMinorKeyBits - 1;

-  class SubMinorKeyBits : public BitField<int, 0, kSubMinorKeyBits> {};
-
  private:
   class IsMissBits : public BitField<bool, kSubMinorKeyBits, 1> {};
+  class SubMinorKeyBits : public BitField<int, 0, kSubMinorKeyBits> {};

   void GenerateLightweightMiss(MacroAssembler* masm);
-  virtual uint32_t MinorKey() const {
-    return IsMissBits::encode(IsUninitialized()) |
-           SubMinorKeyBits::encode(NotMissMinorKey());
-  }
+
+  DISALLOW_COPY_AND_ASSIGN(HydrogenCodeStub);
 };


@@ -1123,10 +1119,15 @@
  public:
   BinaryOpICStub(Isolate* isolate, Token::Value op,
                  OverwriteMode mode = NO_OVERWRITE)
- : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {}
+      : HydrogenCodeStub(isolate, UNINITIALIZED) {
+    BinaryOpIC::State state(isolate, op, mode);
+    set_sub_minor_key(state.GetExtraICState());
+  }

   explicit BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state)
-      : HydrogenCodeStub(isolate), state_(state) {}
+      : HydrogenCodeStub(isolate) {
+    set_sub_minor_key(state.GetExtraICState());
+  }

   static void GenerateAheadOfTime(Isolate* isolate);

@@ -1140,34 +1141,31 @@
   }

   virtual InlineCacheState GetICState() const FINAL OVERRIDE {
-    return state_.GetICState();
+    return state().GetICState();
   }

   virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
-    return state_.GetExtraICState();
+    return static_cast<ExtraICState>(sub_minor_key());
   }

   virtual Handle<Code> GenerateCode() OVERRIDE;

-  const BinaryOpIC::State& state() const { return state_; }
+  BinaryOpIC::State state() const {
+    return BinaryOpIC::State(isolate(), GetExtraICState());
+  }

   virtual void PrintState(OStream& os) const FINAL OVERRIDE;  // NOLINT
-
-  virtual Major MajorKey() const OVERRIDE { return BinaryOpIC; }
-  virtual int NotMissMinorKey() const FINAL OVERRIDE {
-    return GetExtraICState();
-  }

   // Parameters accessed via CodeStubGraphBuilder::GetParameter()
   static const int kLeft = 0;
   static const int kRight = 1;

  private:
+  virtual Major MajorKey() const OVERRIDE { return BinaryOpIC; }
+
   static void GenerateAheadOfTime(Isolate* isolate,
                                   const BinaryOpIC::State& state);

-  BinaryOpIC::State state_;
-
   DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub);
 };

@@ -1309,37 +1307,34 @@

 class ICCompareStub: public PlatformCodeStub {
  public:
-  ICCompareStub(Isolate* isolate,
-                Token::Value op,
-                CompareIC::State left,
-                CompareIC::State right,
-                CompareIC::State handler)
-      : PlatformCodeStub(isolate),
-        op_(op),
-        left_(left),
-        right_(right),
-        state_(handler) {
+  ICCompareStub(Isolate* isolate, Token::Value op, CompareIC::State left,
+                CompareIC::State right, CompareIC::State state)
+      : PlatformCodeStub(isolate) {
     DCHECK(Token::IsCompareOp(op));
+ minor_key_ = OpBits::encode(op - Token::EQ) | LeftStateBits::encode(left) |
+                 RightStateBits::encode(right) | StateBits::encode(state);
   }

   virtual void Generate(MacroAssembler* masm);

   void set_known_map(Handle<Map> map) { known_map_ = map; }

-  static void DecodeKey(uint32_t stub_key, CompareIC::State* left_state,
-                        CompareIC::State* right_state,
-                        CompareIC::State* handler_state, Token::Value* op);
+  explicit ICCompareStub(uint32_t stub_key) : PlatformCodeStub(stub_key) {
+    DCHECK_EQ(MajorKeyFromKey(stub_key), MajorKey());
+  }

   virtual InlineCacheState GetICState() const;

+  Token::Value op() const {
+ return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_));
+  }
+
+ CompareIC::State left() const { return LeftStateBits::decode(minor_key_); } + CompareIC::State right() const { return RightStateBits::decode(minor_key_); }
+  CompareIC::State state() const { return StateBits::decode(minor_key_); }
+
  private:
-  class OpField: public BitField<int, 0, 3> { };
-  class LeftStateField: public BitField<int, 3, 4> { };
-  class RightStateField: public BitField<int, 7, 4> { };
-  class HandlerStateField: public BitField<int, 11, 4> { };
-
   virtual Major MajorKey() const OVERRIDE { return CompareIC; }
-  virtual uint32_t MinorKey() const;

   virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; }

@@ -1353,18 +1348,21 @@
   void GenerateKnownObjects(MacroAssembler* masm);
   void GenerateGeneric(MacroAssembler* masm);

-  bool strict() const { return op_ == Token::EQ_STRICT; }
- Condition GetCondition() const { return CompareIC::ComputeCondition(op_); }
+  bool strict() const { return op() == Token::EQ_STRICT; }
+ Condition GetCondition() const { return CompareIC::ComputeCondition(op()); }

   virtual void AddToSpecialCache(Handle<Code> new_object);
   virtual bool FindCodeInSpecialCache(Code** code_out);
- virtual bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECT; } + virtual bool UseSpecialCache() { return state() == CompareIC::KNOWN_OBJECT; }

-  Token::Value op_;
-  CompareIC::State left_;
-  CompareIC::State right_;
-  CompareIC::State state_;
+  class OpBits : public BitField<int, 0, 3> {};
+  class LeftStateBits : public BitField<CompareIC::State, 3, 4> {};
+  class RightStateBits : public BitField<CompareIC::State, 7, 4> {};
+  class StateBits : public BitField<CompareIC::State, 11, 4> {};
+
   Handle<Map> known_map_;
+
+  DISALLOW_COPY_AND_ASSIGN(ICCompareStub);
 };


@@ -1373,16 +1371,15 @@
   Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>());
   Type* GetInputType(Zone* zone, Handle<Map> map);

-  CompareNilICStub(Isolate* isolate, NilValue nil)
-      : HydrogenCodeStub(isolate), nil_value_(nil) { }
+ CompareNilICStub(Isolate* isolate, NilValue nil) : HydrogenCodeStub(isolate) {
+    set_sub_minor_key(NilValueBits::encode(nil));
+  }

-  CompareNilICStub(Isolate* isolate,
-                   ExtraICState ic_state,
+  CompareNilICStub(Isolate* isolate, ExtraICState ic_state,
                    InitializationState init_state = INITIALIZED)
-      : HydrogenCodeStub(isolate, init_state),
-        nil_value_(NilValueField::decode(ic_state)),
-        state_(State(TypesField::decode(ic_state))) {
-      }
+      : HydrogenCodeStub(isolate, init_state) {
+    set_sub_minor_key(ic_state);
+  }

   static Handle<Code> GetUninitialized(Isolate* isolate,
                                        NilValue nil) {
@@ -1399,9 +1396,10 @@
   }

   virtual InlineCacheState GetICState() const {
-    if (state_.Contains(GENERIC)) {
+    State state = this->state();
+    if (state.Contains(GENERIC)) {
       return MEGAMORPHIC;
-    } else if (state_.Contains(MONOMORPHIC_MAP)) {
+    } else if (state.Contains(MONOMORPHIC_MAP)) {
       return MONOMORPHIC;
     } else {
       return PREMONOMORPHIC;
@@ -1412,22 +1410,29 @@

   virtual Handle<Code> GenerateCode() OVERRIDE;

-  virtual ExtraICState GetExtraICState() const {
-    return NilValueField::encode(nil_value_) |
-           TypesField::encode(state_.ToIntegral());
-  }
+  virtual ExtraICState GetExtraICState() const { return sub_minor_key(); }

   void UpdateStatus(Handle<Object> object);

-  bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); }
-  NilValue GetNilValue() const { return nil_value_; }
-  void ClearState() { state_.RemoveAll(); }
+  bool IsMonomorphic() const { return state().Contains(MONOMORPHIC_MAP); }
+
+ NilValue nil_value() const { return NilValueBits::decode(sub_minor_key()); }
+
+  void ClearState() {
+    set_sub_minor_key(TypesBits::update(sub_minor_key(), 0));
+  }

   virtual void PrintState(OStream& os) const OVERRIDE;     // NOLINT
   virtual void PrintBaseName(OStream& os) const OVERRIDE;  // NOLINT

  private:
-  friend class CompareNilIC;
+  CompareNilICStub(Isolate* isolate, NilValue nil,
+                   InitializationState init_state)
+      : HydrogenCodeStub(isolate, init_state) {
+    set_sub_minor_key(NilValueBits::encode(nil));
+  }
+
+  virtual Major MajorKey() const OVERRIDE { return CompareNilIC; }

   enum CompareNilType {
     UNDEFINED,
@@ -1449,19 +1454,12 @@
   };
   friend OStream& operator<<(OStream& os, const State& s);

-  CompareNilICStub(Isolate* isolate,
-                   NilValue nil,
-                   InitializationState init_state)
-      : HydrogenCodeStub(isolate, init_state), nil_value_(nil) { }
+  State state() const { return State(TypesBits::decode(sub_minor_key())); }

-  class NilValueField : public BitField<NilValue, 0, 1> {};
-  class TypesField    : public BitField<byte,     1, NUMBER_OF_TYPES> {};
+  class NilValueBits : public BitField<NilValue, 0, 1> {};
+  class TypesBits : public BitField<byte, 1, NUMBER_OF_TYPES> {};

-  virtual Major MajorKey() const OVERRIDE { return CompareNilIC; }
-  virtual int NotMissMinorKey() const { return GetExtraICState(); }
-
-  NilValue nil_value_;
-  State state_;
+  friend class CompareNilIC;

   DISALLOW_COPY_AND_ASSIGN(CompareNilICStub);
 };
@@ -1967,7 +1965,9 @@
 class VectorLoadStub : public HydrogenCodeStub {
  public:
   explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state)
-      : HydrogenCodeStub(isolate), state_(state) {}
+      : HydrogenCodeStub(isolate) {
+    set_sub_minor_key(state.GetExtraICState());
+  }

   virtual Handle<Code> GenerateCode() OVERRIDE;

@@ -1983,15 +1983,13 @@
   }

   virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
-    return state_.GetExtraICState();
+    return static_cast<ExtraICState>(sub_minor_key());
   }
-
-  virtual Major MajorKey() const OVERRIDE { return VectorLoad; }

  private:
-  int NotMissMinorKey() const { return state_.GetExtraICState(); }
+  virtual Major MajorKey() const OVERRIDE { return VectorLoad; }

-  const LoadIC::State state_;
+  LoadIC::State state() const { return LoadIC::State(GetExtraICState()); }

   DISALLOW_COPY_AND_ASSIGN(VectorLoadStub);
 };
=======================================
--- /trunk/src/compiler/access-builder.h        Fri Aug 29 00:04:38 2014 UTC
+++ /trunk/src/compiler/access-builder.h        Wed Sep  3 08:32:14 2014 UTC
@@ -14,79 +14,35 @@
// This access builder provides a set of static methods constructing commonly // used FieldAccess and ElementAccess descriptors. These descriptors server as
 // parameters to simplified load/store operators.
-class AccessBuilder : public AllStatic {
+class AccessBuilder FINAL : public AllStatic {
  public:
   // Provides access to HeapObject::map() field.
-  static FieldAccess ForMap() {
- return {kTaggedBase, HeapObject::kMapOffset, Handle<Name>(), Type::Any(),
-            kMachAnyTagged};
-  }
+  static FieldAccess ForMap();

   // Provides access to JSObject::properties() field.
-  static FieldAccess ForJSObjectProperties() {
-    return {kTaggedBase, JSObject::kPropertiesOffset, Handle<Name>(),
-            Type::Any(), kMachAnyTagged};
-  }
+  static FieldAccess ForJSObjectProperties();

   // Provides access to JSObject::elements() field.
-  static FieldAccess ForJSObjectElements() {
-    return {kTaggedBase, JSObject::kElementsOffset, Handle<Name>(),
-            Type::Internal(), kMachAnyTagged};
-  }
+  static FieldAccess ForJSObjectElements();

   // Provides access to JSArrayBuffer::backing_store() field.
-  static FieldAccess ForJSArrayBufferBackingStore() {
- return {kTaggedBase, JSArrayBuffer::kBackingStoreOffset, Handle<Name>(),
-            Type::UntaggedPtr(), kMachPtr};
-  }
+  static FieldAccess ForJSArrayBufferBackingStore();

   // Provides access to ExternalArray::external_pointer() field.
-  static FieldAccess ForExternalArrayPointer() {
- return {kTaggedBase, ExternalArray::kExternalPointerOffset, Handle<Name>(),
-            Type::UntaggedPtr(), kMachPtr};
-  }
+  static FieldAccess ForExternalArrayPointer();

   // Provides access to FixedArray elements.
-  static ElementAccess ForFixedArrayElement() {
- return {kTaggedBase, FixedArray::kHeaderSize, Type::Any(), kMachAnyTagged};
-  }
+  static ElementAccess ForFixedArrayElement();

   // TODO(mstarzinger): Raw access only for testing, drop me.
-  static ElementAccess ForBackingStoreElement(MachineType rep) {
-    return {kUntaggedBase, kNonHeapObjectHeaderSize - kHeapObjectTag,
-            Type::Any(), rep};
-  }
+  static ElementAccess ForBackingStoreElement(MachineType rep);

// Provides access to Fixed{type}TypedArray and External{type}Array elements.
   static ElementAccess ForTypedArrayElement(ExternalArrayType type,
-                                            bool is_external) {
-    BaseTaggedness taggedness = is_external ? kUntaggedBase : kTaggedBase;
-    int header_size = is_external ? 0 : FixedTypedArrayBase::kDataOffset;
-    switch (type) {
-      case kExternalInt8Array:
-        return {taggedness, header_size, Type::Signed32(), kMachInt8};
-      case kExternalUint8Array:
-      case kExternalUint8ClampedArray:
-        return {taggedness, header_size, Type::Unsigned32(), kMachUint8};
-      case kExternalInt16Array:
-        return {taggedness, header_size, Type::Signed32(), kMachInt16};
-      case kExternalUint16Array:
-        return {taggedness, header_size, Type::Unsigned32(), kMachUint16};
-      case kExternalInt32Array:
-        return {taggedness, header_size, Type::Signed32(), kMachInt32};
-      case kExternalUint32Array:
-        return {taggedness, header_size, Type::Unsigned32(), kMachUint32};
-      case kExternalFloat32Array:
-        return {taggedness, header_size, Type::Number(), kRepFloat32};
-      case kExternalFloat64Array:
-        return {taggedness, header_size, Type::Number(), kRepFloat64};
-    }
-    UNREACHABLE();
-    return {kUntaggedBase, 0, Type::None(), kMachNone};
-  }
+                                            bool is_external);

  private:
-  DISALLOW_COPY_AND_ASSIGN(AccessBuilder);
+  DISALLOW_IMPLICIT_CONSTRUCTORS(AccessBuilder);
 };

 }  // namespace compiler
=======================================
--- /trunk/src/compiler/arm/instruction-selector-arm.cc Tue Sep 2 12:59:15 2014 UTC +++ /trunk/src/compiler/arm/instruction-selector-arm.cc Wed Sep 3 08:32:14 2014 UTC
@@ -596,14 +596,14 @@
   Int32BinopMatcher m(node);
   if (m.right().HasValue() && m.right().Value() > 0) {
     int32_t value = m.right().Value();
-    if (IsPowerOf2(value - 1)) {
+    if (base::bits::IsPowerOfTwo32(value - 1)) {
       Emit(kArmAdd | AddressingModeField::encode(kMode_Operand2_R_LSL_I),
            g.DefineAsRegister(node), g.UseRegister(m.left().node()),
            g.UseRegister(m.left().node()),
            g.TempImmediate(WhichPowerOf2(value - 1)));
       return;
     }
-    if (value < kMaxInt && IsPowerOf2(value + 1)) {
+    if (value < kMaxInt && base::bits::IsPowerOfTwo32(value + 1)) {
       Emit(kArmRsb | AddressingModeField::encode(kMode_Operand2_R_LSL_I),
            g.DefineAsRegister(node), g.UseRegister(m.left().node()),
            g.UseRegister(m.left().node()),
=======================================
--- /trunk/src/compiler/arm/linkage-arm.cc      Mon Sep  1 00:05:43 2014 UTC
+++ /trunk/src/compiler/arm/linkage-arm.cc      Wed Sep  3 08:32:14 2014 UTC
@@ -39,13 +39,11 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
-                                                  int parameter_count,
- Operator::Property properties, - CallDescriptor::Flags flags,
-                                                  Zone* zone) {
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(
+    Runtime::FunctionId function, int parameter_count,
+    Operator::Properties properties, Zone* zone) {
   return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>(
-      zone, function, parameter_count, properties, flags);
+      zone, function, parameter_count, properties);
 }


@@ -63,6 +61,7 @@
   return LinkageHelper::GetSimplifiedCDescriptor<LinkageHelperTraits>(
       zone, num_params, return_type, param_types);
 }
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8
=======================================
--- /trunk/src/compiler/arm64/linkage-arm64.cc  Mon Sep  1 00:05:43 2014 UTC
+++ /trunk/src/compiler/arm64/linkage-arm64.cc  Wed Sep  3 08:32:14 2014 UTC
@@ -39,13 +39,11 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
-                                                  int parameter_count,
- Operator::Property properties, - CallDescriptor::Flags flags,
-                                                  Zone* zone) {
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(
+    Runtime::FunctionId function, int parameter_count,
+    Operator::Properties properties, Zone* zone) {
   return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>(
-      zone, function, parameter_count, properties, flags);
+      zone, function, parameter_count, properties);
 }


@@ -64,6 +62,6 @@
       zone, num_params, return_type, param_types);
 }

-}
-}
-}  // namespace v8::internal::compiler
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8
=======================================
--- /trunk/src/compiler/common-operator.h       Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/compiler/common-operator.h       Wed Sep  3 08:32:14 2014 UTC
@@ -20,18 +20,20 @@

 namespace compiler {

-class ControlOperator : public Operator1<int> {
+class ControlOperator FINAL : public Operator1<int> {
  public:
-  ControlOperator(IrOpcode::Value opcode, uint16_t properties, int inputs,
+ ControlOperator(IrOpcode::Value opcode, Properties properties, int inputs,
                   int outputs, int controls, const char* mnemonic)
       : Operator1<int>(opcode, properties, inputs, outputs, mnemonic,
                        controls) {}

- virtual OStream& PrintParameter(OStream& os) const { return os; } // NOLINT
+  virtual OStream& PrintParameter(OStream& os) const OVERRIDE {  // NOLINT
+    return os;
+  }
   int ControlInputCount() const { return parameter(); }
 };

-class CallOperator : public Operator1<CallDescriptor*> {
+class CallOperator FINAL : public Operator1<CallDescriptor*> {
  public:
   CallOperator(CallDescriptor* descriptor, const char* mnemonic)
       : Operator1<CallDescriptor*>(
@@ -39,7 +41,7 @@
             descriptor->InputCount() + descriptor->FrameStateCount(),
             descriptor->ReturnCount(), mnemonic, descriptor) {}

-  virtual OStream& PrintParameter(OStream& os) const {  // NOLINT
+  virtual OStream& PrintParameter(OStream& os) const OVERRIDE {  // NOLINT
     return os << "[" << *parameter() << "]";
   }
 };
@@ -91,7 +93,8 @@
   Operator* Throw() { CONTROL_OP(Throw, 1, 1); }

   Operator* Return() {
- return new (zone_) ControlOperator(IrOpcode::kReturn, 0, 1, 0, 1, "Return");
+    return new (zone_) ControlOperator(
+        IrOpcode::kReturn, Operator::kNoProperties, 1, 0, 1, "Return");
   }

   Operator* Merge(int controls) {
=======================================
--- /trunk/src/compiler/graph-visualizer.cc     Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/compiler/graph-visualizer.cc     Wed Sep  3 08:32:14 2014 UTC
@@ -209,14 +209,14 @@
              (OperatorProperties::GetControlInputCount(from->op()) > 0 &&
               NodeProperties::GetControlInput(from) != to)) {
     os_ << ":I" << index << ":n -> ID" << to->id() << ":s"
-        << "[" << (unconstrained ? "constraint=false" : "")
-        << (NodeProperties::IsControlEdge(edge) ? "style=bold" : "")
-        << (NodeProperties::IsEffectEdge(edge) ? "style=dotted" : "")
- << (NodeProperties::IsContextEdge(edge) ? "style=dashed" : "") << "]";
+        << "[" << (unconstrained ? "constraint=false, " : "")
+        << (NodeProperties::IsControlEdge(edge) ? "style=bold, " : "")
+        << (NodeProperties::IsEffectEdge(edge) ? "style=dotted, " : "")
+ << (NodeProperties::IsContextEdge(edge) ? "style=dashed, " : "") << "]";
   } else {
-    os_ << " -> ID" << to->id() << ":s [color=transparent"
-        << (unconstrained ? ", constraint=false" : "")
- << (NodeProperties::IsControlEdge(edge) ? ", style=dashed" : "") << "]";
+    os_ << " -> ID" << to->id() << ":s [color=transparent, "
+        << (unconstrained ? "constraint=false, " : "")
+ << (NodeProperties::IsControlEdge(edge) ? "style=dashed, " : "") << "]";
   }
   os_ << "\n";
 }
=======================================
--- /trunk/src/compiler/ia32/linkage-ia32.cc    Mon Sep  1 00:05:43 2014 UTC
+++ /trunk/src/compiler/ia32/linkage-ia32.cc    Wed Sep  3 08:32:14 2014 UTC
@@ -35,13 +35,11 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
-                                                  int parameter_count,
- Operator::Property properties, - CallDescriptor::Flags flags,
-                                                  Zone* zone) {
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(
+    Runtime::FunctionId function, int parameter_count,
+    Operator::Properties properties, Zone* zone) {
   return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>(
-      zone, function, parameter_count, properties, flags);
+      zone, function, parameter_count, properties);
 }


=======================================
--- /trunk/src/compiler/js-generic-lowering.cc  Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/compiler/js-generic-lowering.cc  Wed Sep  3 08:32:14 2014 UTC
@@ -53,7 +53,6 @@

  private:
   virtual Major MajorKey() const OVERRIDE { return NoCache; }
-  virtual int NotMissMinorKey() const OVERRIDE { return 0; }
   virtual bool UseSpecialCache() OVERRIDE { return true; }

   ContextualMode contextual_mode_;
@@ -82,7 +81,6 @@

  private:
   virtual Major MajorKey() const OVERRIDE { return NoCache; }
-  virtual int NotMissMinorKey() const OVERRIDE { return 0; }
   virtual bool UseSpecialCache() OVERRIDE { return true; }
 };

@@ -110,7 +108,6 @@

  private:
   virtual Major MajorKey() const OVERRIDE { return NoCache; }
-  virtual int NotMissMinorKey() const OVERRIDE { return 0; }
   virtual bool UseSpecialCache() OVERRIDE { return true; }

   StrictMode strict_mode_;
@@ -142,7 +139,6 @@

  private:
   virtual Major MajorKey() const OVERRIDE { return NoCache; }
-  virtual int NotMissMinorKey() const OVERRIDE { return 0; }
   virtual bool UseSpecialCache() OVERRIDE { return true; }

   StrictMode strict_mode_;
@@ -299,28 +295,49 @@
                                              bool pure) {
   BinaryOpICStub stub(isolate(), Token::ADD);  // TODO(mstarzinger): Hack.
   CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor();
+ bool has_frame_state = OperatorProperties::HasFrameStateInput(node->op());
   CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(
-      d, 0, CallDescriptor::kPatchableCallSiteWithNop);
+ d, 0, CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node));
   Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token);
-  Node* compare;
+  NodeVector inputs(zone());
+  inputs.reserve(node->InputCount() + 1);
+  inputs.push_back(CodeConstant(ic));
+  inputs.push_back(NodeProperties::GetValueInput(node, 0));
+  inputs.push_back(NodeProperties::GetValueInput(node, 1));
+  inputs.push_back(NodeProperties::GetContextInput(node));
   if (pure) {
-    // A pure (strict) comparison doesn't have an effect or control.
-    // But for the graph, we need to add these inputs.
- compare = graph()->NewNode(common()->Call(desc_compare), CodeConstant(ic),
-                               NodeProperties::GetValueInput(node, 0),
-                               NodeProperties::GetValueInput(node, 1),
-                               NodeProperties::GetContextInput(node),
-                               graph()->start(), graph()->start());
+    // A pure (strict) comparison doesn't have an effect, control or frame
+    // state.  But for the graph, we need to add control and effect inputs.
+    DCHECK(!has_frame_state);
+    inputs.push_back(graph()->start());
+    inputs.push_back(graph()->start());
   } else {
- compare = graph()->NewNode(common()->Call(desc_compare), CodeConstant(ic),
-                               NodeProperties::GetValueInput(node, 0),
-                               NodeProperties::GetValueInput(node, 1),
-                               NodeProperties::GetContextInput(node),
-                               NodeProperties::GetEffectInput(node),
-                               NodeProperties::GetControlInput(node));
+    DCHECK(has_frame_state == FLAG_turbo_deoptimization);
+    if (FLAG_turbo_deoptimization) {
+      inputs.push_back(NodeProperties::GetFrameStateInput(node));
+    }
+    inputs.push_back(NodeProperties::GetEffectInput(node));
+    inputs.push_back(NodeProperties::GetControlInput(node));
   }
+  Node* compare =
+      graph()->NewNode(common()->Call(desc_compare),
+                       static_cast<int>(inputs.size()), &inputs.front());
+
   node->ReplaceInput(0, compare);
   node->ReplaceInput(1, SmiConstant(token));
+
+  if (has_frame_state) {
+    // Remove the frame state from inputs.
+ // TODO(jarin) This should use Node::RemoveInput (which does not exist yet).
+    int dest = NodeProperties::FirstFrameStateIndex(node);
+    for (int i = NodeProperties::PastFrameStateIndex(node);
+         i < node->InputCount(); i++) {
+      node->ReplaceInput(dest, node->InputAt(i));
+      dest++;
+    }
+    node->TrimInputCount(dest);
+  }
+
   ReplaceWithRuntimeCall(node, Runtime::kBooleanize);
 }

@@ -357,11 +374,11 @@
 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
                                                Runtime::FunctionId f,
                                                int nargs_override) {
-  Operator::Property props = node->op()->properties();
+  Operator::Properties properties = node->op()->properties();
   const Runtime::Function* fun = Runtime::FunctionForId(f);
   int nargs = (nargs_override < 0) ? fun->nargs : nargs_override;
   CallDescriptor* desc =
- linkage()->GetRuntimeCallDescriptor(f, nargs, props, FlagsForNode(node));
+      linkage()->GetRuntimeCallDescriptor(f, nargs, properties);
   Node* ref = ExternalConstant(ExternalReference(f, isolate()));
   Node* arity = Int32Constant(nargs);
   if (!centrystub_constant_.is_set()) {
=======================================
--- /trunk/src/compiler/js-typed-lowering.cc    Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/compiler/js-typed-lowering.cc    Wed Sep  3 08:32:14 2014 UTC
@@ -222,7 +222,8 @@
   if (r.OneInputIs(Type::String())) {
     r.ConvertInputsToString();
     return r.ChangeToPureOperator(simplified()->StringAdd());
-  } else if (r.NeitherInputCanBe(Type::String())) {
+  }
+  if (r.NeitherInputCanBe(Type::String())) {
     r.ConvertInputsToNumber();
     return r.ChangeToPureOperator(simplified()->NumberAdd());
   }
=======================================
--- /trunk/src/compiler/linkage-impl.h  Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/compiler/linkage-impl.h  Wed Sep  3 08:32:14 2014 UTC
@@ -71,7 +71,7 @@
   template <typename LinkageTraits>
   static CallDescriptor* GetRuntimeCallDescriptor(
       Zone* zone, Runtime::FunctionId function_id, int parameter_count,
-      Operator::Property properties, CallDescriptor::Flags flags) {
+      Operator::Properties properties) {
     const int code_count = 1;
     const int function_count = 1;
     const int num_args_count = 1;
@@ -109,6 +109,10 @@
         WordRegisterLocation(LinkageTraits::RuntimeCallArgCountReg());
locations[index++] = TaggedRegisterLocation(LinkageTraits::ContextReg());

+    CallDescriptor::Flags flags = Linkage::NeedsFrameState(function_id)
+                                      ? CallDescriptor::kNeedsFrameState
+                                      : CallDescriptor::kNoFlags;
+
// TODO(titzer): refactor TurboFan graph to consider context a value input. return new (zone) CallDescriptor(CallDescriptor::kCallCodeObject, // kind
                                      return_count,     // return_count
@@ -195,7 +199,6 @@
         CallDescriptor::kNoFlags);  // TODO(jarin) should deoptimize!
   }
 };
-
 }  // namespace compiler
 }  // namespace internal
 }  // namespace v8
=======================================
--- /trunk/src/compiler/linkage.cc      Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/compiler/linkage.cc      Wed Sep  3 08:32:14 2014 UTC
@@ -93,11 +93,10 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
-                                                  int parameter_count,
- Operator::Property properties, - CallDescriptor::Flags flags) { - return GetRuntimeCallDescriptor(function, parameter_count, properties, flags,
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(
+    Runtime::FunctionId function, int parameter_count,
+    Operator::Properties properties) {
+  return GetRuntimeCallDescriptor(function, parameter_count, properties,
                                   this->info_->zone());
 }

@@ -108,6 +107,26 @@
   return GetStubCallDescriptor(descriptor, stack_parameter_count, flags,
                                this->info_->zone());
 }
+
+
+// static
+bool Linkage::NeedsFrameState(Runtime::FunctionId function) {
+  if (!FLAG_turbo_deoptimization) {
+    return false;
+  }
+  // TODO(jarin) At the moment, we only add frame state for
+  // few chosen runtime functions.
+  switch (function) {
+    case Runtime::kDebugBreak:
+    case Runtime::kDeoptimizeFunction:
+    case Runtime::kSetScriptBreakPoint:
+    case Runtime::kDebugGetLoadedScripts:
+    case Runtime::kStackGuard:
+      return true;
+    default:
+      return false;
+  }
+}


//==============================================================================
@@ -120,11 +139,9 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
-                                                  int parameter_count,
- Operator::Property properties, - CallDescriptor::Flags flags,
-                                                  Zone* zone) {
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(
+    Runtime::FunctionId function, int parameter_count,
+    Operator::Properties properties, Zone* zone) {
   UNIMPLEMENTED();
   return NULL;
 }
=======================================
--- /trunk/src/compiler/linkage.h       Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/compiler/linkage.h       Wed Sep  3 08:32:14 2014 UTC
@@ -54,8 +54,9 @@

   CallDescriptor(Kind kind, int8_t return_count, int16_t parameter_count,
                  int16_t input_count, LinkageLocation* locations,
- Operator::Property properties, RegList callee_saved_registers,
-                 Flags flags, const char* debug_name = "")
+                 Operator::Properties properties,
+                 RegList callee_saved_registers, Flags flags,
+                 const char* debug_name = "")
       : kind_(kind),
         return_count_(return_count),
         parameter_count_(parameter_count),
@@ -97,7 +98,7 @@
   }

// Operator properties describe how this call can be optimized, if at all.
-  Operator::Property properties() const { return properties_; }
+  Operator::Properties properties() const { return properties_; }

   // Get the callee-saved registers, if any, across this call.
   RegList CalleeSavedRegisters() { return callee_saved_registers_; }
@@ -112,7 +113,7 @@
   int16_t parameter_count_;
   int16_t input_count_;
   LinkageLocation* locations_;
-  Operator::Property properties_;
+  Operator::Properties properties_;
   RegList callee_saved_registers_;
   Flags flags_;
   const char* debug_name_;
@@ -147,15 +148,12 @@
   CallDescriptor* GetIncomingDescriptor() { return incoming_; }
   CallDescriptor* GetJSCallDescriptor(int parameter_count);
static CallDescriptor* GetJSCallDescriptor(int parameter_count, Zone* zone);
-  CallDescriptor* GetRuntimeCallDescriptor(
+  CallDescriptor* GetRuntimeCallDescriptor(Runtime::FunctionId function,
+                                           int parameter_count,
+ Operator::Properties properties);
+  static CallDescriptor* GetRuntimeCallDescriptor(
       Runtime::FunctionId function, int parameter_count,
-      Operator::Property properties,
-      CallDescriptor::Flags flags = CallDescriptor::kNoFlags);
- static CallDescriptor* GetRuntimeCallDescriptor(Runtime::FunctionId function,
-                                                  int parameter_count,
- Operator::Property properties, - CallDescriptor::Flags flags,
-                                                  Zone* zone);
+      Operator::Properties properties, Zone* zone);

   CallDescriptor* GetStubCallDescriptor(
CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count = 0,
@@ -190,6 +188,8 @@
   FrameOffset GetFrameOffset(int spill_slot, Frame* frame, int extra = 0);

   CompilationInfo* info() const { return info_; }
+
+  static bool NeedsFrameState(Runtime::FunctionId function);

  private:
   CompilationInfo* info_;
=======================================
--- /trunk/src/compiler/machine-type.h  Thu Aug 28 15:38:17 2014 UTC
+++ /trunk/src/compiler/machine-type.h  Wed Sep  3 08:32:14 2014 UTC
@@ -5,6 +5,7 @@
 #ifndef V8_COMPILER_MACHINE_TYPE_H_
 #define V8_COMPILER_MACHINE_TYPE_H_

+#include "src/base/bits.h"
 #include "src/globals.h"

 namespace v8 {
@@ -82,7 +83,7 @@
 // Gets only the representation of the given type.
 inline MachineType RepresentationOf(MachineType machine_type) {
   int result = machine_type & kRepMask;
-  CHECK(IsPowerOf2(result));
+  CHECK(base::bits::IsPowerOfTwo32(result));
   return static_cast<MachineType>(result);
 }

=======================================
--- /trunk/src/compiler/operator-properties-inl.h Tue Sep 2 12:59:15 2014 UTC +++ /trunk/src/compiler/operator-properties-inl.h Wed Sep 3 08:32:14 2014 UTC
@@ -37,26 +37,28 @@
   }

   switch (op->opcode()) {
-    case IrOpcode::kJSCallFunction:
-    case IrOpcode::kJSCallConstruct:
-      return true;
     case IrOpcode::kJSCallRuntime: {
       Runtime::FunctionId function =
reinterpret_cast<Operator1<Runtime::FunctionId>*>(op)->parameter();
-      // TODO(jarin) At the moment, we only add frame state for
-      // few chosen runtime functions.
-      switch (function) {
-        case Runtime::kDebugBreak:
-        case Runtime::kDeoptimizeFunction:
-        case Runtime::kSetScriptBreakPoint:
-        case Runtime::kDebugGetLoadedScripts:
-        case Runtime::kStackGuard:
-          return true;
-        default:
-          return false;
-      }
-      UNREACHABLE();
+      return Linkage::NeedsFrameState(function);
     }
+
+    // Strict equality cannot lazily deoptimize.
+    case IrOpcode::kJSStrictEqual:
+    case IrOpcode::kJSStrictNotEqual:
+      return false;
+
+    // Calls
+    case IrOpcode::kJSCallFunction:
+    case IrOpcode::kJSCallConstruct:
+
+    // Compare operations
+    case IrOpcode::kJSEqual:
+    case IrOpcode::kJSNotEqual:
+    case IrOpcode::kJSLessThan:
+    case IrOpcode::kJSGreaterThan:
+    case IrOpcode::kJSLessThanOrEqual:
+    case IrOpcode::kJSGreaterThanOrEqual:

     // Binary operations
     case IrOpcode::kJSBitwiseOr:
=======================================
--- /trunk/src/compiler/operator.h      Thu Jul 31 18:45:14 2014 UTC
+++ /trunk/src/compiler/operator.h      Wed Sep  3 08:32:14 2014 UTC
@@ -5,14 +5,17 @@
 #ifndef V8_COMPILER_OPERATOR_H_
 #define V8_COMPILER_OPERATOR_H_

-#include "src/v8.h"
-
-#include "src/assembler.h"
+#include "src/base/flags.h"
 #include "src/ostreams.h"
 #include "src/unique.h"

 namespace v8 {
 namespace internal {
+
+// Forward declarations.
+class ExternalReference;
+
+
 namespace compiler {

 // An operator represents description of the "computation" of a node in the
@@ -29,9 +32,7 @@
 // meaningful to the operator itself.
 class Operator : public ZoneObject {
  public:
-  Operator(uint8_t opcode, uint16_t properties)
-      : opcode_(opcode), properties_(properties) {}
-  virtual ~Operator() {}
+  typedef uint8_t Opcode;

   // Properties inform the operator-independent optimizer about legal
   // transformations for nodes that have this operator.
@@ -49,78 +50,88 @@
     kEliminatable = kNoWrite | kNoThrow,
     kPure = kNoRead | kNoWrite | kNoThrow | kIdempotent
   };
+  typedef base::Flags<Property, uint8_t> Properties;
+
+  Operator(Opcode opcode, Properties properties, const char* mnemonic)
+      : opcode_(opcode), properties_(properties), mnemonic_(mnemonic) {}
+  virtual ~Operator();

// A small integer unique to all instances of a particular kind of operator, // useful for quick matching for specific kinds of operators. For fast access
   // the opcode is stored directly in the operator object.
-  inline uint8_t opcode() const { return opcode_; }
+  Opcode opcode() const { return opcode_; }

   // Returns a constant string representing the mnemonic of the operator,
   // without the static parameters. Useful for debugging.
-  virtual const char* mnemonic() = 0;
+  const char* mnemonic() const { return mnemonic_; }

// Check if this operator equals another operator. Equivalent operators can
   // be merged, and nodes with equivalent operators and equivalent inputs
   // can be merged.
-  virtual bool Equals(Operator* other) = 0;
+  virtual bool Equals(const Operator* other) const = 0;

   // Compute a hashcode to speed up equivalence-set checking.
// Equal operators should always have equal hashcodes, and unequal operators
   // should have unequal hashcodes with high probability.
-  virtual int HashCode() = 0;
+  virtual int HashCode() const = 0;

   // Check whether this operator has the given property.
-  inline bool HasProperty(Property property) const {
-    return (properties_ & static_cast<int>(property)) == property;
+  bool HasProperty(Property property) const {
+    return (properties() & property) == property;
   }

   // Number of data inputs to the operator, for verifying graph structure.
-  virtual int InputCount() = 0;
+  virtual int InputCount() const = 0;

// Number of data outputs from the operator, for verifying graph structure.
-  virtual int OutputCount() = 0;
+  virtual int OutputCount() const = 0;

- inline Property properties() { return static_cast<Property>(properties_); }
+  Properties properties() const { return properties_; }

   // TODO(titzer): API for input and output types, for typechecking graph.
- private:
+ protected:
   // Print the full operator into the given stream, including any
   // static parameters. Useful for debugging and visualizing the IR.
   virtual OStream& PrintTo(OStream& os) const = 0;  // NOLINT
   friend OStream& operator<<(OStream& os, const Operator& op);

-  uint8_t opcode_;
-  uint16_t properties_;
+ private:
+  Opcode opcode_;
+  Properties properties_;
+  const char* mnemonic_;
+
+  DISALLOW_COPY_AND_ASSIGN(Operator);
 };

+DEFINE_OPERATORS_FOR_FLAGS(Operator::Properties)
+
 OStream& operator<<(OStream& os, const Operator& op);

// An implementation of Operator that has no static parameters. Such operators
 // have just a name, an opcode, and a fixed number of inputs and outputs.
 // They can represented by singletons and shared globally.
-class SimpleOperator : public Operator {
+class SimpleOperator FINAL : public Operator {
  public:
-  SimpleOperator(uint8_t opcode, uint16_t properties, int input_count,
-                 int output_count, const char* mnemonic)
-      : Operator(opcode, properties),
-        input_count_(input_count),
-        output_count_(output_count),
-        mnemonic_(mnemonic) {}
+  SimpleOperator(Opcode opcode, Properties properties, int input_count,
+                 int output_count, const char* mnemonic);
+  ~SimpleOperator();

-  virtual const char* mnemonic() { return mnemonic_; }
- virtual bool Equals(Operator* that) { return opcode() == that->opcode(); }
-  virtual int HashCode() { return opcode(); }
-  virtual int InputCount() { return input_count_; }
-  virtual int OutputCount() { return output_count_; }
+  virtual bool Equals(const Operator* that) const OVERRIDE {
+    return opcode() == that->opcode();
+  }
+  virtual int HashCode() const OVERRIDE { return opcode(); }
+  virtual int InputCount() const OVERRIDE { return input_count_; }
+  virtual int OutputCount() const OVERRIDE { return output_count_; }

  private:
-  virtual OStream& PrintTo(OStream& os) const {  // NOLINT
-    return os << mnemonic_;
+  virtual OStream& PrintTo(OStream& os) const OVERRIDE {  // NOLINT
+    return os << mnemonic();
   }

   int input_count_;
   int output_count_;
-  const char* mnemonic_;
+
+  DISALLOW_COPY_AND_ASSIGN(SimpleOperator);
 };

// Template specialization implements a kind of type class for dealing with the
@@ -138,21 +149,9 @@

 template <>
 struct StaticParameterTraits<ExternalReference> {
-  static OStream& PrintTo(OStream& os, ExternalReference val) {  // NOLINT
-    os << val.address();
-    const Runtime::Function* function =
-        Runtime::FunctionForEntry(val.address());
-    if (function != NULL) {
-      os << " <" << function->name << ".entry>";
-    }
-    return os;
-  }
-  static int HashCode(ExternalReference a) {
-    return reinterpret_cast<intptr_t>(a.address()) & 0xFFFFFFFF;
-  }
-  static bool Equals(ExternalReference a, ExternalReference b) {
-    return a == b;
-  }
+ static OStream& PrintTo(OStream& os, ExternalReference reference); // NOLINT
+  static int HashCode(ExternalReference reference);
+  static bool Equals(ExternalReference lhs, ExternalReference rhs);
 };

 // Specialization for static parameters of type {int}.
@@ -233,48 +232,45 @@
 template <typename T>
 class Operator1 : public Operator {
  public:
-  Operator1(uint8_t opcode, uint16_t properties, int input_count,
+  Operator1(Opcode opcode, Properties properties, int input_count,
             int output_count, const char* mnemonic, T parameter)
-      : Operator(opcode, properties),
+      : Operator(opcode, properties, mnemonic),
         input_count_(input_count),
         output_count_(output_count),
-        mnemonic_(mnemonic),
         parameter_(parameter) {}

   const T& parameter() const { return parameter_; }

-  virtual const char* mnemonic() { return mnemonic_; }
-  virtual bool Equals(Operator* other) {
+  virtual bool Equals(const Operator* other) const OVERRIDE {
     if (opcode() != other->opcode()) return false;
-    Operator1<T>* that = static_cast<Operator1<T>*>(other);
-    T temp1 = this->parameter_;
-    T temp2 = that->parameter_;
-    return StaticParameterTraits<T>::Equals(temp1, temp2);
+    const Operator1<T>* that = static_cast<const Operator1<T>*>(other);
+ return StaticParameterTraits<T>::Equals(this->parameter_, that->parameter_);
   }
-  virtual int HashCode() {
+  virtual int HashCode() const OVERRIDE {
return opcode() + 33 * StaticParameterTraits<T>::HashCode(this->parameter_);
   }
-  virtual int InputCount() { return input_count_; }
-  virtual int OutputCount() { return output_count_; }
+  virtual int InputCount() const OVERRIDE { return input_count_; }
+  virtual int OutputCount() const OVERRIDE { return output_count_; }
   virtual OStream& PrintParameter(OStream& os) const {  // NOLINT
     return StaticParameterTraits<T>::PrintTo(os << "[", parameter_) << "]";
   }

- private:
-  virtual OStream& PrintTo(OStream& os) const {  // NOLINT
-    return PrintParameter(os << mnemonic_);
+ protected:
+  virtual OStream& PrintTo(OStream& os) const FINAL {  // NOLINT
+    return PrintParameter(os << mnemonic());
   }

+ private:
   int input_count_;
   int output_count_;
-  const char* mnemonic_;
   T parameter_;
 };

 // Type definitions for operators with specific types of parameters.
 typedef Operator1<PrintableUnique<Name> > NameOperator;
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8

 #endif  // V8_COMPILER_OPERATOR_H_
=======================================
--- /trunk/src/compiler/raw-machine-assembler.cc Tue Sep 2 12:59:15 2014 UTC +++ /trunk/src/compiler/raw-machine-assembler.cc Wed Sep 3 08:32:14 2014 UTC
@@ -107,8 +107,7 @@
 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function,
                                         Node* arg0, Node* frame_state) {
   CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor(
- function, 1, Operator::kNoProperties, CallDescriptor::kNeedsFrameState,
-      zone());
+      function, 1, Operator::kNoProperties, zone());

   Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
   Node* ref = NewNode(
=======================================
--- /trunk/src/compiler/representation-change.h Wed Aug 20 00:06:26 2014 UTC
+++ /trunk/src/compiler/representation-change.h Wed Sep  3 08:32:14 2014 UTC
@@ -5,6 +5,7 @@
 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_
 #define V8_COMPILER_REPRESENTATION_CHANGE_H_

+#include "src/base/bits.h"
 #include "src/compiler/js-graph.h"
 #include "src/compiler/machine-operator.h"
 #include "src/compiler/node-properties-inl.h"
@@ -34,7 +35,7 @@

   Node* GetRepresentationFor(Node* node, MachineTypeUnion output_type,
                              MachineTypeUnion use_type) {
-    if (!IsPowerOf2(output_type & kRepMask)) {
+    if (!base::bits::IsPowerOfTwo32(output_type & kRepMask)) {
       // There should be only one output representation.
       return TypeError(node, output_type, use_type);
     }
=======================================
--- /trunk/src/compiler/simplified-lowering.cc  Thu Aug 28 15:38:17 2014 UTC
+++ /trunk/src/compiler/simplified-lowering.cc  Wed Sep  3 08:32:14 2014 UTC
@@ -4,6 +4,7 @@

 #include "src/compiler/simplified-lowering.h"

+#include "src/base/bits.h"
 #include "src/compiler/common-operator.h"
 #include "src/compiler/graph-inl.h"
 #include "src/compiler/node-properties-inl.h"
@@ -151,7 +152,8 @@
     // Every node should have at most one output representation. Note that
// phis can have 0, if they have not been used in a representation-inducing
     // instruction.
-    DCHECK((output & kRepMask) == 0 || IsPowerOf2(output & kRepMask));
+    DCHECK((output & kRepMask) == 0 ||
+           base::bits::IsPowerOfTwo32(output & kRepMask));
     GetInfo(node)->output = output;
   }

@@ -254,13 +256,15 @@
   // Helper for handling phis.
   void VisitPhi(Node* node, MachineTypeUnion use) {
     // First, propagate the usage information to inputs of the phi.
-    int values = OperatorProperties::GetValueInputCount(node->op());
-    Node::Inputs inputs = node->inputs();
-    for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
-         ++iter, --values) {
+    if (!lower()) {
+      int values = OperatorProperties::GetValueInputCount(node->op());
       // Propagate {use} of the phi to value inputs, and 0 to control.
-      // TODO(titzer): it'd be nice to have distinguished edge kinds here.
-      ProcessInput(node, iter.index(), values > 0 ? use : 0);
+      Node::Inputs inputs = node->inputs();
+ for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
+           ++iter, --values) {
+ // TODO(titzer): it'd be nice to have distinguished edge kinds here.
+        ProcessInput(node, iter.index(), values > 0 ? use : 0);
+      }
     }
     // Phis adapt to whatever output representation their uses demand,
     // pushing representation changes to their inputs.
@@ -296,7 +300,19 @@
     }
     // Preserve the usage type, but set the representation.
     Type* upper = NodeProperties::GetBounds(node).upper;
-    SetOutput(node, rep | changer_->TypeFromUpperBound(upper));
+ MachineTypeUnion output_type = rep | changer_->TypeFromUpperBound(upper);
+    SetOutput(node, output_type);
+
+    if (lower()) {
+      int values = OperatorProperties::GetValueInputCount(node->op());
+      // Convert inputs to the output representation of this phi.
+      Node::Inputs inputs = node->inputs();
+ for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
+           ++iter, --values) {
+ // TODO(titzer): it'd be nice to have distinguished edge kinds here.
+        ProcessInput(node, iter.index(), values > 0 ? output_type : 0);
+      }
+    }
   }

   Operator* Int32Op(Node* node) {
@@ -492,7 +508,7 @@
       }
       case IrOpcode::kStringEqual: {
         VisitBinop(node, kMachAnyTagged, kRepBit);
-        // TODO(titzer): lower StringEqual to stub/runtime call.
+        if (lower()) lowering->DoStringEqual(node);
         break;
       }
       case IrOpcode::kStringLessThan: {
@@ -507,7 +523,7 @@
       }
       case IrOpcode::kStringAdd: {
         VisitBinop(node, kMachAnyTagged, kMachAnyTagged);
-        // TODO(titzer): lower StringAdd to stub/runtime call.
+        if (lower()) lowering->DoStringAdd(node);
         break;
       }
       case IrOpcode::kLoadField: {
@@ -805,6 +821,40 @@
   node->set_op(machine_.Store(access.machine_type, kind));
   node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
 }
+
+
+void SimplifiedLowering::DoStringAdd(Node* node) {
+ StringAddStub stub(zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
+  CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor();
+  CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
+ CallDescriptor* desc = Linkage::GetStubCallDescriptor(d, 0, flags, zone());
+  node->set_op(common()->Call(desc));
+  node->InsertInput(zone(), 0, jsgraph()->HeapConstant(stub.GetCode()));
+  node->AppendInput(zone(), jsgraph()->UndefinedConstant());
+  node->AppendInput(zone(), graph()->start());
+  node->AppendInput(zone(), graph()->start());
+}
+
+
+void SimplifiedLowering::DoStringEqual(Node* node) {
+  CEntryStub stub(zone()->isolate(), 1);
+  ExternalReference ref(Runtime::kStringEquals, zone()->isolate());
+  Operator::Properties props = node->op()->properties();
+ // TODO(mstarzinger): We should call StringCompareStub here instead, once an
+  // interface descriptor is available for it.
+  CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
+      Runtime::kStringEquals, 2, props, zone());
+  Node* call = graph()->NewNode(common()->Call(desc),
+                                jsgraph()->HeapConstant(stub.GetCode()),
+                                NodeProperties::GetValueInput(node, 0),
+                                NodeProperties::GetValueInput(node, 1),
+                                jsgraph()->ExternalConstant(ref),
+                                jsgraph()->Int32Constant(2),
+                                jsgraph()->UndefinedConstant());
+  node->set_op(machine()->WordEqual());
+  node->ReplaceInput(0, call);
+  node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
+}


 }  // namespace compiler
=======================================
--- /trunk/src/compiler/simplified-lowering.h   Thu Aug 28 07:03:22 2014 UTC
+++ /trunk/src/compiler/simplified-lowering.h   Wed Sep  3 08:32:14 2014 UTC
@@ -27,6 +27,8 @@
   void DoStoreField(Node* node);
   void DoLoadElement(Node* node);
   void DoStoreElement(Node* node);
+  void DoStringAdd(Node* node);
+  void DoStringEqual(Node* node);

  private:
   JSGraph* jsgraph_;
=======================================
--- /trunk/src/compiler/simplified-operator.h   Fri Aug 29 00:04:38 2014 UTC
+++ /trunk/src/compiler/simplified-operator.h   Wed Sep  3 08:32:14 2014 UTC
@@ -11,6 +11,14 @@

 namespace v8 {
 namespace internal {
+
+// Forward declarations.
+template <class>
+class TypeImpl;
+struct ZoneTypeConfig;
+typedef TypeImpl<ZoneTypeConfig> Type;
+
+
 namespace compiler {

 enum BaseTaggedness { kUntaggedBase, kTaggedBase };
@@ -49,34 +57,27 @@

 // Specialization for static parameters of type {FieldAccess}.
 template <>
-struct StaticParameterTraits<const FieldAccess> {
+struct StaticParameterTraits<FieldAccess> {
   static OStream& PrintTo(OStream& os, const FieldAccess& val) {  // NOLINT
     return os << val.offset;
   }
   static int HashCode(const FieldAccess& val) {
     return (val.offset < 16) | (val.machine_type & 0xffff);
   }
-  static bool Equals(const FieldAccess& a, const FieldAccess& b) {
-    return a.base_is_tagged == b.base_is_tagged && a.offset == b.offset &&
-           a.machine_type == b.machine_type && a.type->Is(b.type);
-  }
+  static bool Equals(const FieldAccess& lhs, const FieldAccess& rhs);
 };


 // Specialization for static parameters of type {ElementAccess}.
 template <>
-struct StaticParameterTraits<const ElementAccess> {
+struct StaticParameterTraits<ElementAccess> {
static OStream& PrintTo(OStream& os, const ElementAccess& val) { // NOLINT
     return os << val.header_size;
   }
   static int HashCode(const ElementAccess& val) {
     return (val.header_size < 16) | (val.machine_type & 0xffff);
   }
-  static bool Equals(const ElementAccess& a, const ElementAccess& b) {
-    return a.base_is_tagged == b.base_is_tagged &&
- a.header_size == b.header_size && a.machine_type == b.machine_type &&
-           a.type->Is(b.type);
-  }
+  static bool Equals(const ElementAccess& lhs, const ElementAccess& rhs);
 };


@@ -92,55 +93,6 @@
          op->opcode() == IrOpcode::kStoreElement);
   return static_cast<Operator1<ElementAccess>*>(op)->parameter();
 }
-
-
-// This access helper provides a set of static methods constructing commonly
-// used FieldAccess and ElementAccess descriptors.
-class Access : public AllStatic {
- public:
-  // Provides access to JSObject::elements() field.
-  static FieldAccess ForJSObjectElements() {
-    return {kTaggedBase, JSObject::kElementsOffset, Handle<Name>(),
-            Type::Internal(), kMachAnyTagged};
-  }
-
-  // Provides access to ExternalArray::external_pointer() field.
-  static FieldAccess ForExternalArrayPointer() {
- return {kTaggedBase, ExternalArray::kExternalPointerOffset, Handle<Name>(),
-            Type::UntaggedPtr(), kMachPtr};
-  }
-
- // Provides access to Fixed{type}TypedArray and External{type}Array elements.
-  static ElementAccess ForTypedArrayElement(ExternalArrayType type,
-                                            bool is_external) {
-    BaseTaggedness taggedness = is_external ? kUntaggedBase : kTaggedBase;
-    int header_size = is_external ? 0 : FixedTypedArrayBase::kDataOffset;
-    switch (type) {
-      case kExternalInt8Array:
-        return {taggedness, header_size, Type::Signed32(), kMachInt8};
-      case kExternalUint8Array:
-      case kExternalUint8ClampedArray:
-        return {taggedness, header_size, Type::Unsigned32(), kMachUint8};
-      case kExternalInt16Array:
-        return {taggedness, header_size, Type::Signed32(), kMachInt16};
-      case kExternalUint16Array:
-        return {taggedness, header_size, Type::Unsigned32(), kMachUint16};
-      case kExternalInt32Array:
-        return {taggedness, header_size, Type::Signed32(), kMachInt32};
-      case kExternalUint32Array:
-        return {taggedness, header_size, Type::Unsigned32(), kMachUint32};
-      case kExternalFloat32Array:
-        return {taggedness, header_size, Type::Number(), kRepFloat32};
-      case kExternalFloat64Array:
-        return {taggedness, header_size, Type::Number(), kRepFloat64};
-    }
-    UNREACHABLE();
-    return {kUntaggedBase, 0, Type::None(), kMachNone};
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Access);
-};


 // Interface for building simplified operators, which represent the
=======================================
--- /trunk/src/compiler/verifier.cc     Tue Sep  2 12:59:15 2014 UTC
+++ /trunk/src/compiler/verifier.cc     Wed Sep  3 08:32:14 2014 UTC
@@ -72,6 +72,14 @@
   int input_count = value_count + context_count + frame_state_count +
                     effect_count + control_count;
   CHECK_EQ(input_count, node->InputCount());
+
+  // Verify that frame state has been inserted for the nodes that need it.
+  if (OperatorProperties::HasFrameStateInput(node->op())) {
+    Node* frame_state = NodeProperties::GetFrameStateInput(node);
+    CHECK(frame_state->opcode() == IrOpcode::kFrameState);
+    CHECK(IsDefUseChainLinkPresent(frame_state, node));
+    CHECK(IsUseDefChainLinkPresent(frame_state, node));
+  }

   // Verify all value inputs actually produce a value.
   for (int i = 0; i < value_count; ++i) {
=======================================
--- /trunk/src/compiler/x64/linkage-x64.cc      Mon Sep  1 00:05:43 2014 UTC
+++ /trunk/src/compiler/x64/linkage-x64.cc      Wed Sep  3 08:32:14 2014 UTC
@@ -54,13 +54,11 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
-                                                  int parameter_count,
- Operator::Property properties, - CallDescriptor::Flags flags,
-                                                  Zone* zone) {
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(
+    Runtime::FunctionId function, int parameter_count,
+    Operator::Properties properties, Zone* zone) {
   return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>(
-      zone, function, parameter_count, properties, flags);
+      zone, function, parameter_count, properties);
 }


@@ -79,6 +77,6 @@
       zone, num_params, return_type, param_types);
 }

-}
-}
-}  // namespace v8::internal::compiler
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8
=======================================
***Additional files exist in this changeset.***

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to