| Index: src/objects-inl.h
|
| diff --git a/src/objects-inl.h b/src/objects-inl.h
|
| index c16275b38162e11cf5d0f4521710cbcc137fed0a..deb33653f7844c70ae9d848f5a59e62cbbe43989 100644
|
| --- a/src/objects-inl.h
|
| +++ b/src/objects-inl.h
|
| @@ -80,7 +80,7 @@ PropertyDetails PropertyDetails::AsDeleted() {
|
|
|
| #define CAST_ACCESSOR(type) \
|
| type* type::cast(Object* object) { \
|
| - ASSERT(object->Is##type()); \
|
| + SLOW_ASSERT(object->Is##type()); \
|
| return reinterpret_cast<type*>(object); \
|
| }
|
|
|
| @@ -133,7 +133,7 @@ PropertyDetails PropertyDetails::AsDeleted() {
|
|
|
|
|
| bool Object::IsFixedArrayBase() {
|
| - return IsFixedArray() || IsFixedDoubleArray();
|
| + return IsFixedArray() || IsFixedDoubleArray() || IsConstantPoolArray();
|
| }
|
|
|
|
|
| @@ -571,6 +571,7 @@ TYPE_CHECKER(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE)
|
| TYPE_CHECKER(Map, MAP_TYPE)
|
| TYPE_CHECKER(FixedArray, FIXED_ARRAY_TYPE)
|
| TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE)
|
| +TYPE_CHECKER(ConstantPoolArray, CONSTANT_POOL_ARRAY_TYPE)
|
|
|
|
|
| bool Object::IsJSWeakCollection() {
|
| @@ -1027,6 +1028,12 @@ MaybeObject* Object::GetProperty(Name* key, PropertyAttributes* attributes) {
|
| #define WRITE_UINT32_FIELD(p, offset, value) \
|
| (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value)
|
|
|
| +#define READ_INT32_FIELD(p, offset) \
|
| + (*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset)))
|
| +
|
| +#define WRITE_INT32_FIELD(p, offset, value) \
|
| + (*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset)) = value)
|
| +
|
| #define READ_INT64_FIELD(p, offset) \
|
| (*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset)))
|
|
|
| @@ -1183,7 +1190,7 @@ void HeapObject::VerifySmiField(int offset) {
|
| Heap* HeapObject::GetHeap() {
|
| Heap* heap =
|
| MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap();
|
| - ASSERT(heap != NULL);
|
| + SLOW_ASSERT(heap != NULL);
|
| return heap;
|
| }
|
|
|
| @@ -1300,7 +1307,7 @@ FixedArrayBase* JSObject::elements() {
|
|
|
|
|
| void JSObject::ValidateElements() {
|
| -#if DEBUG
|
| +#ifdef ENABLE_SLOW_ASSERTS
|
| if (FLAG_enable_slow_asserts) {
|
| ElementsAccessor* accessor = GetElementsAccessor();
|
| accessor->Validate(this);
|
| @@ -1660,7 +1667,9 @@ int JSObject::GetHeaderSize() {
|
| case JS_MESSAGE_OBJECT_TYPE:
|
| return JSMessageObject::kSize;
|
| default:
|
| - UNREACHABLE();
|
| + // TODO(jkummerow): Re-enable this. Blink currently hits this
|
| + // from its CustomElementConstructorBuilder.
|
| + // UNREACHABLE();
|
| return 0;
|
| }
|
| }
|
| @@ -1887,13 +1896,14 @@ void Object::VerifyApiCallResultType() {
|
|
|
|
|
| FixedArrayBase* FixedArrayBase::cast(Object* object) {
|
| - ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray());
|
| + ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray() ||
|
| + object->IsConstantPoolArray());
|
| return reinterpret_cast<FixedArrayBase*>(object);
|
| }
|
|
|
|
|
| Object* FixedArray::get(int index) {
|
| - ASSERT(index >= 0 && index < this->length());
|
| + SLOW_ASSERT(index >= 0 && index < this->length());
|
| return READ_FIELD(this, kHeaderSize + index * kPointerSize);
|
| }
|
|
|
| @@ -1986,6 +1996,98 @@ bool FixedDoubleArray::is_the_hole(int index) {
|
| }
|
|
|
|
|
| +SMI_ACCESSORS(ConstantPoolArray, first_ptr_index, kFirstPointerIndexOffset)
|
| +SMI_ACCESSORS(ConstantPoolArray, first_int32_index, kFirstInt32IndexOffset)
|
| +
|
| +
|
| +int ConstantPoolArray::first_int64_index() {
|
| + return 0;
|
| +}
|
| +
|
| +
|
| +int ConstantPoolArray::count_of_int64_entries() {
|
| + return first_ptr_index();
|
| +}
|
| +
|
| +
|
| +int ConstantPoolArray::count_of_ptr_entries() {
|
| + return first_int32_index() - first_ptr_index();
|
| +}
|
| +
|
| +
|
| +int ConstantPoolArray::count_of_int32_entries() {
|
| + return length() - first_int32_index();
|
| +}
|
| +
|
| +
|
| +void ConstantPoolArray::SetEntryCounts(int number_of_int64_entries,
|
| + int number_of_ptr_entries,
|
| + int number_of_int32_entries) {
|
| + set_first_ptr_index(number_of_int64_entries);
|
| + set_first_int32_index(number_of_int64_entries + number_of_ptr_entries);
|
| + set_length(number_of_int64_entries + number_of_ptr_entries +
|
| + number_of_int32_entries);
|
| +}
|
| +
|
| +
|
| +int64_t ConstantPoolArray::get_int64_entry(int index) {
|
| + ASSERT(map() == GetHeap()->constant_pool_array_map());
|
| + ASSERT(index >= 0 && index < first_ptr_index());
|
| + return READ_INT64_FIELD(this, OffsetOfElementAt(index));
|
| +}
|
| +
|
| +double ConstantPoolArray::get_int64_entry_as_double(int index) {
|
| + STATIC_ASSERT(kDoubleSize == kInt64Size);
|
| + ASSERT(map() == GetHeap()->constant_pool_array_map());
|
| + ASSERT(index >= 0 && index < first_ptr_index());
|
| + return READ_DOUBLE_FIELD(this, OffsetOfElementAt(index));
|
| +}
|
| +
|
| +
|
| +Object* ConstantPoolArray::get_ptr_entry(int index) {
|
| + ASSERT(map() == GetHeap()->constant_pool_array_map());
|
| + ASSERT(index >= first_ptr_index() && index < first_int32_index());
|
| + return READ_FIELD(this, OffsetOfElementAt(index));
|
| +}
|
| +
|
| +
|
| +int32_t ConstantPoolArray::get_int32_entry(int index) {
|
| + ASSERT(map() == GetHeap()->constant_pool_array_map());
|
| + ASSERT(index >= first_int32_index() && index < length());
|
| + return READ_INT32_FIELD(this, OffsetOfElementAt(index));
|
| +}
|
| +
|
| +
|
| +void ConstantPoolArray::set(int index, Object* value) {
|
| + ASSERT(map() == GetHeap()->constant_pool_array_map());
|
| + ASSERT(index >= first_ptr_index() && index < first_int32_index());
|
| + WRITE_FIELD(this, OffsetOfElementAt(index), value);
|
| + WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value);
|
| +}
|
| +
|
| +
|
| +void ConstantPoolArray::set(int index, int64_t value) {
|
| + ASSERT(map() == GetHeap()->constant_pool_array_map());
|
| + ASSERT(index >= first_int64_index() && index < first_ptr_index());
|
| + WRITE_INT64_FIELD(this, OffsetOfElementAt(index), value);
|
| +}
|
| +
|
| +
|
| +void ConstantPoolArray::set(int index, double value) {
|
| + STATIC_ASSERT(kDoubleSize == kInt64Size);
|
| + ASSERT(map() == GetHeap()->constant_pool_array_map());
|
| + ASSERT(index >= first_int64_index() && index < first_ptr_index());
|
| + WRITE_DOUBLE_FIELD(this, OffsetOfElementAt(index), value);
|
| +}
|
| +
|
| +
|
| +void ConstantPoolArray::set(int index, int32_t value) {
|
| + ASSERT(map() == GetHeap()->constant_pool_array_map());
|
| + ASSERT(index >= this->first_int32_index() && index < length());
|
| + WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value);
|
| +}
|
| +
|
| +
|
| WriteBarrierMode HeapObject::GetWriteBarrierMode(
|
| const DisallowHeapAllocation& promise) {
|
| Heap* heap = GetHeap();
|
| @@ -2478,6 +2580,7 @@ void SeededNumberDictionary::set_requires_slow_elements() {
|
|
|
| CAST_ACCESSOR(FixedArray)
|
| CAST_ACCESSOR(FixedDoubleArray)
|
| +CAST_ACCESSOR(ConstantPoolArray)
|
| CAST_ACCESSOR(DescriptorArray)
|
| CAST_ACCESSOR(DeoptimizationInputData)
|
| CAST_ACCESSOR(DeoptimizationOutputData)
|
| @@ -3373,6 +3476,12 @@ int HeapObject::SizeFromMap(Map* map) {
|
| return FixedDoubleArray::SizeFor(
|
| reinterpret_cast<FixedDoubleArray*>(this)->length());
|
| }
|
| + if (instance_type == CONSTANT_POOL_ARRAY_TYPE) {
|
| + return ConstantPoolArray::SizeFor(
|
| + reinterpret_cast<ConstantPoolArray*>(this)->count_of_int64_entries(),
|
| + reinterpret_cast<ConstantPoolArray*>(this)->count_of_ptr_entries(),
|
| + reinterpret_cast<ConstantPoolArray*>(this)->count_of_int32_entries());
|
| + }
|
| ASSERT(instance_type == CODE_TYPE);
|
| return reinterpret_cast<Code*>(this)->CodeSize();
|
| }
|
| @@ -5409,19 +5518,24 @@ ElementsKind JSObject::GetElementsKind() {
|
| #if DEBUG
|
| FixedArrayBase* fixed_array =
|
| reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset));
|
| - Map* map = fixed_array->map();
|
| - ASSERT((IsFastSmiOrObjectElementsKind(kind) &&
|
| - (map == GetHeap()->fixed_array_map() ||
|
| - map == GetHeap()->fixed_cow_array_map())) ||
|
| - (IsFastDoubleElementsKind(kind) &&
|
| - (fixed_array->IsFixedDoubleArray() ||
|
| - fixed_array == GetHeap()->empty_fixed_array())) ||
|
| - (kind == DICTIONARY_ELEMENTS &&
|
| +
|
| + // If a GC was caused while constructing this object, the elements
|
| + // pointer may point to a one pointer filler map.
|
| + if (ElementsAreSafeToExamine()) {
|
| + Map* map = fixed_array->map();
|
| + ASSERT((IsFastSmiOrObjectElementsKind(kind) &&
|
| + (map == GetHeap()->fixed_array_map() ||
|
| + map == GetHeap()->fixed_cow_array_map())) ||
|
| + (IsFastDoubleElementsKind(kind) &&
|
| + (fixed_array->IsFixedDoubleArray() ||
|
| + fixed_array == GetHeap()->empty_fixed_array())) ||
|
| + (kind == DICTIONARY_ELEMENTS &&
|
| fixed_array->IsFixedArray() &&
|
| - fixed_array->IsDictionary()) ||
|
| - (kind > DICTIONARY_ELEMENTS));
|
| - ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) ||
|
| - (elements()->IsFixedArray() && elements()->length() >= 2));
|
| + fixed_array->IsDictionary()) ||
|
| + (kind > DICTIONARY_ELEMENTS));
|
| + ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) ||
|
| + (elements()->IsFixedArray() && elements()->length() >= 2));
|
| + }
|
| #endif
|
| return kind;
|
| }
|
| @@ -6052,6 +6166,12 @@ MaybeObject* FixedDoubleArray::Copy() {
|
| }
|
|
|
|
|
| +MaybeObject* ConstantPoolArray::Copy() {
|
| + if (length() == 0) return this;
|
| + return GetHeap()->CopyConstantPoolArray(this);
|
| +}
|
| +
|
| +
|
| void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) {
|
| set(1 + index * 2, Smi::FromInt(id.ToInt()));
|
| }
|
|
|