Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / v8 / src / objects-inl.h
index 8165e26..6d0f8d4 100644 (file)
@@ -786,6 +786,7 @@ TYPE_CHECKER(Code, CODE_TYPE)
 TYPE_CHECKER(Oddball, ODDBALL_TYPE)
 TYPE_CHECKER(Cell, CELL_TYPE)
 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE)
+TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE)
 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE)
 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE)
 TYPE_CHECKER(JSModule, JS_MODULE_TYPE)
@@ -813,9 +814,6 @@ TYPE_CHECKER(JSArrayBuffer, JS_ARRAY_BUFFER_TYPE)
 TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE)
 TYPE_CHECKER(JSDataView, JS_DATA_VIEW_TYPE)
 
-TYPE_CHECKER(Float32x4, FLOAT32x4_TYPE)
-TYPE_CHECKER(Float64x2, FLOAT64x2_TYPE)
-TYPE_CHECKER(Int32x4, INT32x4_TYPE)
 
 bool Object::IsJSArrayBufferView() const {
   return IsJSDataView() || IsJSTypedArray();
@@ -1124,6 +1122,19 @@ MaybeHandle<Object> Object::GetElement(Isolate* isolate,
 }
 
 
+Handle<Object> Object::GetPrototypeSkipHiddenPrototypes(
+    Isolate* isolate, Handle<Object> receiver) {
+  PrototypeIterator iter(isolate, receiver);
+  while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) {
+    if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
+      return PrototypeIterator::GetCurrent(iter);
+    }
+    iter.Advance();
+  }
+  return PrototypeIterator::GetCurrent(iter);
+}
+
+
 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object,
                                                  Handle<Name> name) {
   uint32_t index;
@@ -1259,29 +1270,6 @@ Maybe<bool> JSProxy::HasElementWithHandler(Handle<JSProxy> proxy,
     write_double_field(p, offset, value)
 #endif  // V8_TARGET_ARCH_MIPS
 
-#define READ_FLOAT32x4_FIELD(p, offset) \
-  (*reinterpret_cast<float32x4_value_t*>(FIELD_ADDR(p, offset)))
-
-#define WRITE_FLOAT32x4_FIELD(p, offset, value) \
-  (*reinterpret_cast<float32x4_value_t*>(FIELD_ADDR(p, offset)) = value)
-
-#define READ_FLOAT64x2_FIELD(p, offset) \
-  (*reinterpret_cast<float64x2_value_t*>(FIELD_ADDR(p, offset)))
-
-#define WRITE_FLOAT64x2_FIELD(p, offset, value) \
-  (*reinterpret_cast<float64x2_value_t*>(FIELD_ADDR(p, offset)) = value)
-
-#define READ_INT32x4_FIELD(p, offset) \
-  (*reinterpret_cast<int32x4_value_t*>(FIELD_ADDR(p, offset)))
-
-#define WRITE_INT32x4_FIELD(p, offset, value) \
-  (*reinterpret_cast<int32x4_value_t*>(FIELD_ADDR(p, offset)) = value)
-
-#define READ_FLOAT_FIELD(p, offset) \
-  (*reinterpret_cast<float*>(FIELD_ADDR(p, offset)))
-
-#define WRITE_FLOAT_FIELD(p, offset, value) \
-  (*reinterpret_cast<float*>(FIELD_ADDR(p, offset)) = value)
 
 #define READ_INT_FIELD(p, offset) \
   (*reinterpret_cast<const int*>(FIELD_ADDR_CONST(p, offset)))
@@ -1559,88 +1547,6 @@ int HeapNumber::get_sign() {
 }
 
 
-ACCESSORS(Float32x4, value, Object, kValueOffset)
-ACCESSORS(Float64x2, value, Object, kValueOffset)
-ACCESSORS(Int32x4, value, Object, kValueOffset)
-
-
-const char* Float32x4::Name() {
-  return "float32x4";
-}
-
-
-int Float32x4::kRuntimeAllocatorId() {
-  return Runtime::kAllocateFloat32x4;
-}
-
-
-float Float32x4::getAt(int index) {
-  DCHECK(index >= 0 && index < kLanes);
-  return get().storage[index];
-}
-
-
-float32x4_value_t Float32x4::get() {
-  return FixedFloat32x4Array::cast(value())->get_scalar(0);
-}
-
-
-void Float32x4::set(float32x4_value_t f32x4) {
-  FixedFloat32x4Array::cast(value())->set(0, f32x4);
-}
-
-
-const char* Float64x2::Name() {
-  return "float64x2";
-}
-
-
-int Float64x2::kRuntimeAllocatorId() {
-  return Runtime::kAllocateFloat64x2;
-}
-
-
-double Float64x2::getAt(int index) {
-  DCHECK(index >= 0 && index < kLanes);
-  return get().storage[index];
-}
-
-float64x2_value_t Float64x2::get() {
-  return FixedFloat64x2Array::cast(value())->get_scalar(0);
-}
-
-
-void Float64x2::set(float64x2_value_t f64x2) {
-  FixedFloat64x2Array::cast(value())->set(0, f64x2);
-}
-
-
-const char* Int32x4::Name() {
-  return "int32x4";
-}
-
-
-int Int32x4::kRuntimeAllocatorId() {
-  return Runtime::kAllocateInt32x4;
-}
-
-
-int32_t Int32x4::getAt(int index) {
-  DCHECK(index >= 0 && index < kLanes);
-  return get().storage[index];;
-}
-
-
-int32x4_value_t Int32x4::get() {
-  return FixedInt32x4Array::cast(value())->get_scalar(0);
-}
-
-
-void Int32x4::set(int32x4_value_t i32x4) {
-  FixedInt32x4Array::cast(value())->set(0, i32x4);
-}
-
-
 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset)
 
 
@@ -2024,6 +1930,35 @@ void PropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) {
 }
 
 
+Object* WeakCell::value() const { return READ_FIELD(this, kValueOffset); }
+
+
+void WeakCell::clear() {
+  DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT);
+  WRITE_FIELD(this, kValueOffset, Smi::FromInt(0));
+}
+
+
+void WeakCell::initialize(HeapObject* val) {
+  WRITE_FIELD(this, kValueOffset, val);
+  WRITE_BARRIER(GetHeap(), this, kValueOffset, val);
+}
+
+
+bool WeakCell::cleared() const { return value() == Smi::FromInt(0); }
+
+
+Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); }
+
+
+void WeakCell::set_next(Object* val, WriteBarrierMode mode) {
+  WRITE_FIELD(this, kNextOffset, val);
+  if (mode == UPDATE_WRITE_BARRIER) {
+    WRITE_BARRIER(GetHeap(), this, kNextOffset, val);
+  }
+}
+
+
 int JSObject::GetHeaderSize() {
   InstanceType type = map()->instance_type();
   // Check for the most common kind of JavaScript object before
@@ -2055,12 +1990,6 @@ int JSObject::GetHeaderSize() {
       return JSTypedArray::kSize;
     case JS_DATA_VIEW_TYPE:
       return JSDataView::kSize;
-    case FLOAT32x4_TYPE:
-      return Float32x4::kSize;
-    case FLOAT64x2_TYPE:
-      return Float64x2::kSize;
-    case INT32x4_TYPE:
-      return Int32x4::kSize;
     case JS_SET_TYPE:
       return JSSet::kSize;
     case JS_MAP_TYPE:
@@ -2276,7 +2205,7 @@ void Object::VerifyApiCallResultType() {
 }
 
 
-Object* FixedArray::get(int index) {
+Object* FixedArray::get(int index) const {
   SLOW_DCHECK(index >= 0 && index < this->length());
   return READ_FIELD(this, kHeaderSize + index * kPointerSize);
 }
@@ -2736,14 +2665,14 @@ void ConstantPoolArray::InitExtended(const NumberOfEntries& small,
 
   // Initialize the extended layout fields.
   int extended_header_offset = get_extended_section_header_offset();
-  WRITE_INT_FIELD(this, extended_header_offset + kExtendedInt64CountOffset,
-      extended.count_of(INT64));
-  WRITE_INT_FIELD(this, extended_header_offset + kExtendedCodePtrCountOffset,
-      extended.count_of(CODE_PTR));
-  WRITE_INT_FIELD(this, extended_header_offset + kExtendedHeapPtrCountOffset,
-      extended.count_of(HEAP_PTR));
-  WRITE_INT_FIELD(this, extended_header_offset + kExtendedInt32CountOffset,
-      extended.count_of(INT32));
+  WRITE_INT32_FIELD(this, extended_header_offset + kExtendedInt64CountOffset,
+                    extended.count_of(INT64));
+  WRITE_INT32_FIELD(this, extended_header_offset + kExtendedCodePtrCountOffset,
+                    extended.count_of(CODE_PTR));
+  WRITE_INT32_FIELD(this, extended_header_offset + kExtendedHeapPtrCountOffset,
+                    extended.count_of(HEAP_PTR));
+  WRITE_INT32_FIELD(this, extended_header_offset + kExtendedInt32CountOffset,
+                    extended.count_of(INT32));
 }
 
 
@@ -2872,8 +2801,10 @@ void DescriptorArray::SetNumberOfDescriptors(int number_of_descriptors) {
 // Perform a binary search in a fixed array. Low and high are entry indices. If
 // there are three entries in this array it should be called with low=0 and
 // high=2.
-template<SearchMode search_mode, typename T>
-int BinarySearch(T* array, Name* name, int low, int high, int valid_entries) {
+template <SearchMode search_mode, typename T>
+int BinarySearch(T* array, Name* name, int low, int high, int valid_entries,
+                 int* out_insertion_index) {
+  DCHECK(search_mode == ALL_ENTRIES || out_insertion_index == NULL);
   uint32_t hash = name->Hash();
   int limit = high;
 
@@ -2894,7 +2825,13 @@ int BinarySearch(T* array, Name* name, int low, int high, int valid_entries) {
   for (; low <= limit; ++low) {
     int sort_index = array->GetSortedKeyIndex(low);
     Name* entry = array->GetKey(sort_index);
-    if (entry->Hash() != hash) break;
+    uint32_t current_hash = entry->Hash();
+    if (current_hash != hash) {
+      if (out_insertion_index != NULL) {
+        *out_insertion_index = sort_index + (current_hash > hash ? 0 : 1);
+      }
+      return T::kNotFound;
+    }
     if (entry->Equals(name)) {
       if (search_mode == ALL_ENTRIES || sort_index < valid_entries) {
         return sort_index;
@@ -2903,37 +2840,45 @@ int BinarySearch(T* array, Name* name, int low, int high, int valid_entries) {
     }
   }
 
+  if (out_insertion_index != NULL) *out_insertion_index = limit + 1;
   return T::kNotFound;
 }
 
 
 // Perform a linear search in this fixed array. len is the number of entry
 // indices that are valid.
-template<SearchMode search_mode, typename T>
-int LinearSearch(T* array, Name* name, int len, int valid_entries) {
+template <SearchMode search_mode, typename T>
+int LinearSearch(T* array, Name* name, int len, int valid_entries,
+                 int* out_insertion_index) {
   uint32_t hash = name->Hash();
   if (search_mode == ALL_ENTRIES) {
     for (int number = 0; number < len; number++) {
       int sorted_index = array->GetSortedKeyIndex(number);
       Name* entry = array->GetKey(sorted_index);
       uint32_t current_hash = entry->Hash();
-      if (current_hash > hash) break;
+      if (current_hash > hash) {
+        if (out_insertion_index != NULL) *out_insertion_index = sorted_index;
+        return T::kNotFound;
+      }
       if (current_hash == hash && entry->Equals(name)) return sorted_index;
     }
+    if (out_insertion_index != NULL) *out_insertion_index = len;
+    return T::kNotFound;
   } else {
     DCHECK(len >= valid_entries);
+    DCHECK_EQ(NULL, out_insertion_index);  // Not supported here.
     for (int number = 0; number < valid_entries; number++) {
       Name* entry = array->GetKey(number);
       uint32_t current_hash = entry->Hash();
       if (current_hash == hash && entry->Equals(name)) return number;
     }
+    return T::kNotFound;
   }
-  return T::kNotFound;
 }
 
 
-template<SearchMode search_mode, typename T>
-int Search(T* array, Name* name, int valid_entries) {
+template <SearchMode search_mode, typename T>
+int Search(T* array, Name* name, int valid_entries, int* out_insertion_index) {
   if (search_mode == VALID_ENTRIES) {
     SLOW_DCHECK(array->IsSortedNoDuplicates(valid_entries));
   } else {
@@ -2941,7 +2886,10 @@ int Search(T* array, Name* name, int valid_entries) {
   }
 
   int nof = array->number_of_entries();
-  if (nof == 0) return T::kNotFound;
+  if (nof == 0) {
+    if (out_insertion_index != NULL) *out_insertion_index = 0;
+    return T::kNotFound;
+  }
 
   // Fast case: do linear search for small arrays.
   const int kMaxElementsForLinearSearch = 8;
@@ -2949,16 +2897,18 @@ int Search(T* array, Name* name, int valid_entries) {
        nof <= kMaxElementsForLinearSearch) ||
       (search_mode == VALID_ENTRIES &&
        valid_entries <= (kMaxElementsForLinearSearch * 3))) {
-    return LinearSearch<search_mode>(array, name, nof, valid_entries);
+    return LinearSearch<search_mode>(array, name, nof, valid_entries,
+                                     out_insertion_index);
   }
 
   // Slow case: perform binary search.
-  return BinarySearch<search_mode>(array, name, 0, nof - 1, valid_entries);
+  return BinarySearch<search_mode>(array, name, 0, nof - 1, valid_entries,
+                                   out_insertion_index);
 }
 
 
 int DescriptorArray::Search(Name* name, int valid_descriptors) {
-  return internal::Search<VALID_ENTRIES>(this, name, valid_descriptors);
+  return internal::Search<VALID_ENTRIES>(this, name, valid_descriptors, NULL);
 }
 
 
@@ -3285,12 +3235,9 @@ CAST_ACCESSOR(DescriptorArray)
 CAST_ACCESSOR(ExternalArray)
 CAST_ACCESSOR(ExternalOneByteString)
 CAST_ACCESSOR(ExternalFloat32Array)
-CAST_ACCESSOR(ExternalFloat32x4Array)
 CAST_ACCESSOR(ExternalFloat64Array)
-CAST_ACCESSOR(ExternalFloat64x2Array)
 CAST_ACCESSOR(ExternalInt16Array)
 CAST_ACCESSOR(ExternalInt32Array)
-CAST_ACCESSOR(ExternalInt32x4Array)
 CAST_ACCESSOR(ExternalInt8Array)
 CAST_ACCESSOR(ExternalString)
 CAST_ACCESSOR(ExternalTwoByteString)
@@ -3306,9 +3253,6 @@ CAST_ACCESSOR(Foreign)
 CAST_ACCESSOR(FreeSpace)
 CAST_ACCESSOR(GlobalObject)
 CAST_ACCESSOR(HeapObject)
-CAST_ACCESSOR(Float32x4)
-CAST_ACCESSOR(Float64x2)
-CAST_ACCESSOR(Int32x4)
 CAST_ACCESSOR(JSArray)
 CAST_ACCESSOR(JSArrayBuffer)
 CAST_ACCESSOR(JSArrayBufferView)
@@ -3360,6 +3304,7 @@ CAST_ACCESSOR(StringTable)
 CAST_ACCESSOR(Struct)
 CAST_ACCESSOR(Symbol)
 CAST_ACCESSOR(UnseededNumberDictionary)
+CAST_ACCESSOR(WeakCell)
 CAST_ACCESSOR(WeakHashTable)
 
 
@@ -3421,7 +3366,11 @@ uint32_t Name::hash_field() {
 void Name::set_hash_field(uint32_t value) {
   WRITE_UINT32_FIELD(this, kHashFieldOffset, value);
 #if V8_HOST_ARCH_64_BIT
-  WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0);
+#if V8_TARGET_LITTLE_ENDIAN
+  WRITE_UINT32_FIELD(this, kHashFieldSlot + kIntSize, 0);
+#else
+  WRITE_UINT32_FIELD(this, kHashFieldSlot, 0);
+#endif
 #endif
 }
 
@@ -3765,28 +3714,26 @@ const uint16_t* ExternalTwoByteString::ExternalTwoByteStringGetData(
 }
 
 
-int ConsStringIteratorOp::OffsetForDepth(int depth) {
-  return depth & kDepthMask;
-}
+int ConsStringIterator::OffsetForDepth(int depth) { return depth & kDepthMask; }
 
 
-void ConsStringIteratorOp::PushLeft(ConsString* string) {
+void ConsStringIterator::PushLeft(ConsString* string) {
   frames_[depth_++ & kDepthMask] = string;
 }
 
 
-void ConsStringIteratorOp::PushRight(ConsString* string) {
+void ConsStringIterator::PushRight(ConsString* string) {
   // Inplace update.
   frames_[(depth_-1) & kDepthMask] = string;
 }
 
 
-void ConsStringIteratorOp::AdjustMaximumDepth() {
+void ConsStringIterator::AdjustMaximumDepth() {
   if (depth_ > maximum_depth_) maximum_depth_ = depth_;
 }
 
 
-void ConsStringIteratorOp::Pop() {
+void ConsStringIterator::Pop() {
   DCHECK(depth_ > 0);
   DCHECK(depth_ <= maximum_depth_);
   depth_--;
@@ -3802,11 +3749,8 @@ uint16_t StringCharacterStream::GetNext() {
 }
 
 
-StringCharacterStream::StringCharacterStream(String* string,
-                                             ConsStringIteratorOp* op,
-                                             int offset)
-  : is_one_byte_(false),
-    op_(op) {
+StringCharacterStream::StringCharacterStream(String* string, int offset)
+    : is_one_byte_(false) {
   Reset(string, offset);
 }
 
@@ -3815,9 +3759,9 @@ void StringCharacterStream::Reset(String* string, int offset) {
   buffer8_ = NULL;
   end_ = NULL;
   ConsString* cons_string = String::VisitFlat(this, string, offset);
-  op_->Reset(cons_string, offset);
+  iter_.Reset(cons_string, offset);
   if (cons_string != NULL) {
-    string = op_->Next(&offset);
+    string = iter_.Next(&offset);
     if (string != NULL) String::VisitFlat(this, string, offset);
   }
 }
@@ -3826,7 +3770,7 @@ void StringCharacterStream::Reset(String* string, int offset) {
 bool StringCharacterStream::HasMore() {
   if (buffer8_ != end_) return true;
   int offset;
-  String* string = op_->Next(&offset);
+  String* string = iter_.Next(&offset);
   DCHECK_EQ(offset, 0);
   if (string == NULL) return false;
   String::VisitFlat(this, string);
@@ -4101,89 +4045,6 @@ void ExternalFloat32Array::set(int index, float value) {
 }
 
 
-float32x4_value_t ExternalFloat32x4Array::get_scalar(int index) {
-  DCHECK((index >= 0) && (index < this->length()));
-  float* ptr = static_cast<float*>(external_pointer());
-  float32x4_value_t value;
-  value.storage[0] = ptr[index * 4 + 0];
-  value.storage[1] = ptr[index * 4 + 1];
-  value.storage[2] = ptr[index * 4 + 2];
-  value.storage[3] = ptr[index * 4 + 3];
-  return value;
-}
-
-
-Handle<Object> ExternalFloat32x4Array::get(Handle<ExternalFloat32x4Array> array,
-                                           int index) {
-  float32x4_value_t value = array->get_scalar(index);
-  return array->GetIsolate()->factory()->NewFloat32x4(value);
-}
-
-
-void ExternalFloat32x4Array::set(int index, const float32x4_value_t& value) {
-  DCHECK((index >= 0) && (index < this->length()));
-  float* ptr = static_cast<float*>(external_pointer());
-  ptr[index * 4 + 0] = value.storage[0];
-  ptr[index * 4 + 1] = value.storage[1];
-  ptr[index * 4 + 2] = value.storage[2];
-  ptr[index * 4 + 3] = value.storage[3];
-}
-
-
-float64x2_value_t ExternalFloat64x2Array::get_scalar(int index) {
-  DCHECK((index >= 0) && (index < this->length()));
-  double* ptr = static_cast<double*>(external_pointer());
-  float64x2_value_t value;
-  value.storage[0] = ptr[index * 2 + 0];
-  value.storage[1] = ptr[index * 2 + 1];
-  return value;
-}
-
-
-Handle<Object> ExternalFloat64x2Array::get(Handle<ExternalFloat64x2Array> array,
-                                           int index) {
-  float64x2_value_t value = array->get_scalar(index);
-  return array->GetIsolate()->factory()->NewFloat64x2(value);
-}
-
-
-void ExternalFloat64x2Array::set(int index, const float64x2_value_t& value) {
-  DCHECK((index >= 0) && (index < this->length()));
-  double* ptr = static_cast<double*>(external_pointer());
-  ptr[index * 2 + 0] = value.storage[0];
-  ptr[index * 2 + 1] = value.storage[1];
-}
-
-
-int32x4_value_t ExternalInt32x4Array::get_scalar(int index) {
-  DCHECK((index >= 0) && (index < this->length()));
-  int32_t* ptr = static_cast<int32_t*>(external_pointer());
-  int32x4_value_t value;
-  value.storage[0] = ptr[index * 4 + 0];
-  value.storage[1] = ptr[index * 4 + 1];
-  value.storage[2] = ptr[index * 4 + 2];
-  value.storage[3] = ptr[index * 4 + 3];
-  return value;
-}
-
-
-Handle<Object> ExternalInt32x4Array::get(Handle<ExternalInt32x4Array> array,
-                                         int index) {
-  int32x4_value_t value = array->get_scalar(index);
-  return array->GetIsolate()->factory()->NewInt32x4(value);
-}
-
-
-void ExternalInt32x4Array::set(int index, const int32x4_value_t& value) {
-  DCHECK((index >= 0) && (index < this->length()));
-  int32_t* ptr = static_cast<int32_t*>(external_pointer());
-  ptr[index * 4 + 0] = value.storage[0];
-  ptr[index * 4 + 1] = value.storage[1];
-  ptr[index * 4 + 2] = value.storage[2];
-  ptr[index * 4 + 3] = value.storage[3];
-}
-
-
 double ExternalFloat64Array::get_scalar(int index) {
   DCHECK((index >= 0) && (index < this->length()));
   double* ptr = static_cast<double*>(external_pointer());
@@ -4328,7 +4189,8 @@ typename Traits::ElementType FixedTypedArray<Traits>::from_double(
 
 template<> inline
 uint8_t FixedTypedArray<Uint8ClampedArrayTraits>::from_double(double value) {
-  if (value < 0) return 0;
+  // Handle NaNs and less than zero values which clamp to zero.
+  if (!(value > 0)) return 0;
   if (value > 0xFF) return 0xFF;
   return static_cast<uint8_t>(lrint(value));
 }
@@ -4377,72 +4239,6 @@ Handle<Object> FixedTypedArray<Traits>::SetValue(
   return Traits::ToHandle(array->GetIsolate(), cast_value);
 }
 
-template<> inline
-Handle<Object> FixedTypedArray<Float32x4ArrayTraits>::SetValue(
-    Handle<FixedTypedArray<Float32x4ArrayTraits> > array,
-    uint32_t index, Handle<Object> value) {
-  float32x4_value_t cast_value;
-  cast_value.storage[0] = static_cast<float>(base::OS::nan_value());
-  cast_value.storage[1] = static_cast<float>(base::OS::nan_value());
-  cast_value.storage[2] = static_cast<float>(base::OS::nan_value());
-  cast_value.storage[3] = static_cast<float>(base::OS::nan_value());
-  if (index < static_cast<uint32_t>(array->length())) {
-    if (value->IsFloat32x4()) {
-      cast_value = Handle<Float32x4>::cast(value)->get();
-    } else {
-      // Clamp undefined to NaN (default). All other types have been
-      // converted to a number type further up in the call chain.
-      DCHECK(value->IsUndefined());
-    }
-    array->set(index, cast_value);
-  }
-  return Float32x4ArrayTraits::ToHandle(array->GetIsolate(), cast_value);
-}
-
-
-template<> inline
-Handle<Object> FixedTypedArray<Float64x2ArrayTraits>::SetValue(
-    Handle<FixedTypedArray<Float64x2ArrayTraits> > array,
-    uint32_t index, Handle<Object> value) {
-  float64x2_value_t cast_value;
-  cast_value.storage[0] = base::OS::nan_value();
-  cast_value.storage[1] = base::OS::nan_value();
-  if (index < static_cast<uint32_t>(array->length())) {
-    if (value->IsFloat64x2()) {
-      cast_value = Handle<Float64x2>::cast(value)->get();
-    } else {
-      // Clamp undefined to NaN (default). All other types have been
-      // converted to a number type further up in the call chain.
-      DCHECK(value->IsUndefined());
-    }
-    array->set(index, cast_value);
-  }
-  return Float64x2ArrayTraits::ToHandle(array->GetIsolate(), cast_value);
-}
-
-
-template<> inline
-Handle<Object> FixedTypedArray<Int32x4ArrayTraits>::SetValue(
-    Handle<FixedTypedArray<Int32x4ArrayTraits> > array,
-    uint32_t index, Handle<Object> value) {
-  int32x4_value_t cast_value;
-  cast_value.storage[0] = 0;
-  cast_value.storage[1] = 0;
-  cast_value.storage[2] = 0;
-  cast_value.storage[3] = 0;
-  if (index < static_cast<uint32_t>(array->length())) {
-    if (value->IsInt32x4()) {
-      cast_value = Handle<Int32x4>::cast(value)->get();
-    } else {
-      // Clamp undefined to zero (default). All other types have been
-      // converted to a number type further up in the call chain.
-      DCHECK(value->IsUndefined());
-    }
-    array->set(index, cast_value);
-  }
-  return Int32x4ArrayTraits::ToHandle(array->GetIsolate(), cast_value);
-}
-
 
 Handle<Object> Uint8ArrayTraits::ToHandle(Isolate* isolate, uint8_t scalar) {
   return handle(Smi::FromInt(scalar), isolate);
@@ -4485,24 +4281,6 @@ Handle<Object> Float32ArrayTraits::ToHandle(Isolate* isolate, float scalar) {
 }
 
 
-Handle<Object> Int32x4ArrayTraits::ToHandle(
-    Isolate* isolate, int32x4_value_t scalar) {
-  return isolate->factory()->NewInt32x4(scalar);
-}
-
-
-Handle<Object> Float32x4ArrayTraits::ToHandle(
-    Isolate* isolate, float32x4_value_t scalar) {
-  return isolate->factory()->NewFloat32x4(scalar);
-}
-
-
-Handle<Object> Float64x2ArrayTraits::ToHandle(
-    Isolate* isolate, float64x2_value_t scalar) {
-  return isolate->factory()->NewFloat64x2(scalar);
-}
-
-
 Handle<Object> Float64ArrayTraits::ToHandle(Isolate* isolate, double scalar) {
   return isolate->factory()->NewNumber(scalar);
 }
@@ -5074,13 +4852,11 @@ void Code::set_profiler_ticks(int ticks) {
 
 
 int Code::builtin_index() {
-  DCHECK_EQ(BUILTIN, kind());
   return READ_INT32_FIELD(this, kKindSpecificFlags1Offset);
 }
 
 
 void Code::set_builtin_index(int index) {
-  DCHECK_EQ(BUILTIN, kind());
   WRITE_INT32_FIELD(this, kKindSpecificFlags1Offset, index);
 }
 
@@ -5448,9 +5224,8 @@ Map* Map::elements_transition_map() {
 
 bool Map::CanHaveMoreTransitions() {
   if (!HasTransitionArray()) return true;
-  return FixedArray::SizeFor(transitions()->length() +
-                             TransitionArray::kTransitionSize)
-      <= Page::kMaxRegularHeapObjectSize;
+  return transitions()->number_of_transitions() <
+         TransitionArray::kMaxNumberOfTransitions;
 }
 
 
@@ -5648,7 +5423,7 @@ ACCESSORS(Script, id, Smi, kIdOffset)
 ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset)
 ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset)
 ACCESSORS(Script, context_data, Object, kContextOffset)
-ACCESSORS(Script, wrapper, Foreign, kWrapperOffset)
+ACCESSORS(Script, wrapper, HeapObject, kWrapperOffset)
 ACCESSORS_TO_SMI(Script, type, kTypeOffset)
 ACCESSORS(Script, line_ends, Object, kLineEndsOffset)
 ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset)
@@ -5735,6 +5510,7 @@ BOOL_ACCESSORS(SharedFunctionInfo,
                has_duplicate_parameters,
                kHasDuplicateParameters)
 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, asm_function, kIsAsmFunction)
+BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, deserialized, kDeserialized)
 
 
 #if V8_HOST_ARCH_32_BIT
@@ -5759,25 +5535,30 @@ SMI_ACCESSORS(SharedFunctionInfo, profiler_ticks, kProfilerTicksOffset)
 
 #else
 
-#define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset)             \
-  STATIC_ASSERT(holder::offset % kPointerSize == 0);              \
-  int holder::name() const {                                      \
-    int value = READ_INT_FIELD(this, offset);                     \
-    DCHECK(kHeapObjectTag == 1);                                  \
-    DCHECK((value & kHeapObjectTag) == 0);                        \
-    return value >> 1;                                            \
-  }                                                               \
-  void holder::set_##name(int value) {                            \
-    DCHECK(kHeapObjectTag == 1);                                  \
-    DCHECK((value & 0xC0000000) == 0xC0000000 ||                  \
-           (value & 0xC0000000) == 0x0);                          \
-    WRITE_INT_FIELD(this,                                         \
-                    offset,                                       \
-                    (value << 1) & ~kHeapObjectTag);              \
-  }
-
-#define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset)             \
-  STATIC_ASSERT(holder::offset % kPointerSize == kIntSize);       \
+#if V8_TARGET_LITTLE_ENDIAN
+#define PSEUDO_SMI_LO_ALIGN 0
+#define PSEUDO_SMI_HI_ALIGN kIntSize
+#else
+#define PSEUDO_SMI_LO_ALIGN kIntSize
+#define PSEUDO_SMI_HI_ALIGN 0
+#endif
+
+#define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset)                          \
+  STATIC_ASSERT(holder::offset % kPointerSize == PSEUDO_SMI_LO_ALIGN);         \
+  int holder::name() const {                                                   \
+    int value = READ_INT_FIELD(this, offset);                                  \
+    DCHECK(kHeapObjectTag == 1);                                               \
+    DCHECK((value & kHeapObjectTag) == 0);                                     \
+    return value >> 1;                                                         \
+  }                                                                            \
+  void holder::set_##name(int value) {                                         \
+    DCHECK(kHeapObjectTag == 1);                                               \
+    DCHECK((value & 0xC0000000) == 0xC0000000 || (value & 0xC0000000) == 0x0); \
+    WRITE_INT_FIELD(this, offset, (value << 1) & ~kHeapObjectTag);             \
+  }
+
+#define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset)                  \
+  STATIC_ASSERT(holder::offset % kPointerSize == PSEUDO_SMI_HI_ALIGN); \
   INT_ACCESSORS(holder, name, offset)
 
 
@@ -6539,6 +6320,16 @@ void JSArrayBuffer::set_should_be_freed(bool value) {
 }
 
 
+bool JSArrayBuffer::is_neuterable() {
+  return BooleanBit::get(flag(), kIsNeuterableBit);
+}
+
+
+void JSArrayBuffer::set_is_neuterable(bool value) {
+  set_flag(BooleanBit::set(flag(), kIsNeuterableBit, value));
+}
+
+
 ACCESSORS(JSArrayBuffer, weak_next, Object, kWeakNextOffset)
 ACCESSORS(JSArrayBuffer, weak_first_view, Object, kWeakFirstViewOffset)
 
@@ -6864,9 +6655,9 @@ uint32_t IteratingStringHasher::Hash(String* string, uint32_t seed) {
   // The string was flat.
   if (cons_string == NULL) return hasher.GetHashField();
   // This is a ConsString, iterate across it.
-  ConsStringIteratorOp op(cons_string);
+  ConsStringIterator iter(cons_string);
   int offset;
-  while (NULL != (string = op.Next(&offset))) {
+  while (NULL != (string = iter.Next(&offset))) {
     String::VisitFlat(&hasher, string, offset);
   }
   return hasher.GetHashField();
@@ -6906,7 +6697,7 @@ void String::SetForwardedInternalizedString(String* canonical) {
   DCHECK(SlowEquals(canonical));
   DCHECK(canonical->IsInternalizedString());
   DCHECK(canonical->HasHashCode());
-  WRITE_FIELD(this, kHashFieldOffset, canonical);
+  WRITE_FIELD(this, kHashFieldSlot, canonical);
   // Setting the hash field to a tagged value sets the LSB, causing the hash
   // code to be interpreted as uninitialized.  We use this fact to recognize
   // that we have a forwarded string.
@@ -6917,7 +6708,7 @@ void String::SetForwardedInternalizedString(String* canonical) {
 String* String::GetForwardedInternalizedString() {
   DCHECK(IsInternalizedString());
   if (HasHashCode()) return this;
-  String* canonical = String::cast(READ_FIELD(this, kHashFieldOffset));
+  String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot));
   DCHECK(canonical->IsInternalizedString());
   DCHECK(SlowEquals(canonical));
   DCHECK(canonical->HasHashCode());
@@ -6925,11 +6716,6 @@ String* String::GetForwardedInternalizedString() {
 }
 
 
-Object* JSReceiver::GetConstructor() {
-  return map()->constructor();
-}
-
-
 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object,
                                     Handle<Name> name) {
   if (object->IsJSProxy()) {
@@ -7167,9 +6953,9 @@ Handle<Object> NameDictionaryShape::AsHandle(Isolate* isolate,
 }
 
 
-void NameDictionary::DoGenerateNewEnumerationIndices(
+Handle<FixedArray> NameDictionary::DoGenerateNewEnumerationIndices(
     Handle<NameDictionary> dictionary) {
-  DerivedDictionary::GenerateNewEnumerationIndices(dictionary);
+  return DerivedDictionary::GenerateNewEnumerationIndices(dictionary);
 }
 
 
@@ -7239,6 +7025,14 @@ void Map::ClearCodeCache(Heap* heap) {
 }
 
 
+int Map::SlackForArraySize(int old_size, int size_limit) {
+  const int max_slack = size_limit - old_size;
+  CHECK(max_slack >= 0);
+  if (old_size < 4) return Min(max_slack, 1);
+  return Min(max_slack, old_size / 2);
+}
+
+
 void JSArray::EnsureSize(Handle<JSArray> array, int required_size) {
   DCHECK(array->HasFastSmiOrObjectElements());
   Handle<FixedArray> elts = handle(FixedArray::cast(array->elements()));