| Index: src/objects-inl.h
|
| ===================================================================
|
| --- src/objects-inl.h (revision 9808)
|
| +++ src/objects-inl.h (working copy)
|
| @@ -67,6 +67,13 @@
|
| }
|
|
|
|
|
| +#define TYPE_CHECKER(type, instancetype) \
|
| + bool Object::Is##type() { \
|
| + return Object::IsHeapObject() && \
|
| + HeapObject::cast(this)->map()->instance_type() == instancetype; \
|
| + }
|
| +
|
| +
|
| #define CAST_ACCESSOR(type) \
|
| type* type::cast(Object* object) { \
|
| ASSERT(object->Is##type()); \
|
| @@ -112,6 +119,11 @@
|
| }
|
|
|
|
|
| +bool Object::IsFixedArrayBase() {
|
| + return IsFixedArray() || IsFixedDoubleArray();
|
| +}
|
| +
|
| +
|
| bool Object::IsInstanceOf(FunctionTemplateInfo* expected) {
|
| // There is a constraint on the object; check.
|
| if (!this->IsJSObject()) return false;
|
| @@ -147,10 +159,7 @@
|
| }
|
|
|
|
|
| -bool Object::IsHeapNumber() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == HEAP_NUMBER_TYPE;
|
| -}
|
| +TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE)
|
|
|
|
|
| bool Object::IsString() {
|
| @@ -403,18 +412,10 @@
|
| }
|
|
|
|
|
| -bool Object::IsByteArray() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == BYTE_ARRAY_TYPE;
|
| -}
|
| +TYPE_CHECKER(ByteArray, BYTE_ARRAY_TYPE)
|
| +TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE)
|
|
|
|
|
| -bool Object::IsFreeSpace() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == FREE_SPACE_TYPE;
|
| -}
|
| -
|
| -
|
| bool Object::IsFiller() {
|
| if (!Object::IsHeapObject()) return false;
|
| InstanceType instance_type = HeapObject::cast(this)->map()->instance_type();
|
| @@ -422,11 +423,7 @@
|
| }
|
|
|
|
|
| -bool Object::IsExternalPixelArray() {
|
| - return Object::IsHeapObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() ==
|
| - EXTERNAL_PIXEL_ARRAY_TYPE;
|
| -}
|
| +TYPE_CHECKER(ExternalPixelArray, EXTERNAL_PIXEL_ARRAY_TYPE)
|
|
|
|
|
| bool Object::IsExternalArray() {
|
| @@ -439,62 +436,16 @@
|
| }
|
|
|
|
|
| -bool Object::IsExternalByteArray() {
|
| - return Object::IsHeapObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() ==
|
| - EXTERNAL_BYTE_ARRAY_TYPE;
|
| -}
|
| +TYPE_CHECKER(ExternalByteArray, EXTERNAL_BYTE_ARRAY_TYPE)
|
| +TYPE_CHECKER(ExternalUnsignedByteArray, EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE)
|
| +TYPE_CHECKER(ExternalShortArray, EXTERNAL_SHORT_ARRAY_TYPE)
|
| +TYPE_CHECKER(ExternalUnsignedShortArray, EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE)
|
| +TYPE_CHECKER(ExternalIntArray, EXTERNAL_INT_ARRAY_TYPE)
|
| +TYPE_CHECKER(ExternalUnsignedIntArray, EXTERNAL_UNSIGNED_INT_ARRAY_TYPE)
|
| +TYPE_CHECKER(ExternalFloatArray, EXTERNAL_FLOAT_ARRAY_TYPE)
|
| +TYPE_CHECKER(ExternalDoubleArray, EXTERNAL_DOUBLE_ARRAY_TYPE)
|
|
|
|
|
| -bool Object::IsExternalUnsignedByteArray() {
|
| - return Object::IsHeapObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() ==
|
| - EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsExternalShortArray() {
|
| - return Object::IsHeapObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() ==
|
| - EXTERNAL_SHORT_ARRAY_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsExternalUnsignedShortArray() {
|
| - return Object::IsHeapObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() ==
|
| - EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsExternalIntArray() {
|
| - return Object::IsHeapObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() ==
|
| - EXTERNAL_INT_ARRAY_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsExternalUnsignedIntArray() {
|
| - return Object::IsHeapObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() ==
|
| - EXTERNAL_UNSIGNED_INT_ARRAY_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsExternalFloatArray() {
|
| - return Object::IsHeapObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() ==
|
| - EXTERNAL_FLOAT_ARRAY_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsExternalDoubleArray() {
|
| - return Object::IsHeapObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() ==
|
| - EXTERNAL_DOUBLE_ARRAY_TYPE;
|
| -}
|
| -
|
| -
|
| bool MaybeObject::IsFailure() {
|
| return HAS_FAILURE_TAG(this);
|
| }
|
| @@ -549,44 +500,16 @@
|
| }
|
|
|
|
|
| -bool Object::IsJSFunctionProxy() {
|
| - return Object::IsHeapObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE;
|
| -}
|
| +TYPE_CHECKER(JSFunctionProxy, JS_FUNCTION_PROXY_TYPE)
|
| +TYPE_CHECKER(JSSet, JS_SET_TYPE)
|
| +TYPE_CHECKER(JSMap, JS_MAP_TYPE)
|
| +TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE)
|
| +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)
|
|
|
|
|
| -bool Object::IsJSWeakMap() {
|
| - return Object::IsJSObject() &&
|
| - HeapObject::cast(this)->map()->instance_type() == JS_WEAK_MAP_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsJSContextExtensionObject() {
|
| - return IsHeapObject()
|
| - && (HeapObject::cast(this)->map()->instance_type() ==
|
| - JS_CONTEXT_EXTENSION_OBJECT_TYPE);
|
| -}
|
| -
|
| -
|
| -bool Object::IsMap() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == MAP_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsFixedArray() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == FIXED_ARRAY_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsFixedDoubleArray() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() ==
|
| - FIXED_DOUBLE_ARRAY_TYPE;
|
| -}
|
| -
|
| -
|
| bool Object::IsDescriptorArray() {
|
| return IsFixedArray();
|
| }
|
| @@ -647,10 +570,7 @@
|
| }
|
|
|
|
|
| -bool Object::IsJSFunction() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE;
|
| -}
|
| +TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE)
|
|
|
|
|
| template <> inline bool Is<JSFunction>(Object* obj) {
|
| @@ -658,54 +578,20 @@
|
| }
|
|
|
|
|
| -bool Object::IsCode() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == CODE_TYPE;
|
| -}
|
| +TYPE_CHECKER(Code, CODE_TYPE)
|
| +TYPE_CHECKER(Oddball, ODDBALL_TYPE)
|
| +TYPE_CHECKER(JSGlobalPropertyCell, JS_GLOBAL_PROPERTY_CELL_TYPE)
|
| +TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE)
|
| +TYPE_CHECKER(JSValue, JS_VALUE_TYPE)
|
| +TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE)
|
|
|
|
|
| -bool Object::IsOddball() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == ODDBALL_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsJSGlobalPropertyCell() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type()
|
| - == JS_GLOBAL_PROPERTY_CELL_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsSharedFunctionInfo() {
|
| - return Object::IsHeapObject() &&
|
| - (HeapObject::cast(this)->map()->instance_type() ==
|
| - SHARED_FUNCTION_INFO_TYPE);
|
| -}
|
| -
|
| -
|
| -bool Object::IsJSValue() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == JS_VALUE_TYPE;
|
| -}
|
| -
|
| -
|
| -bool Object::IsJSMessageObject() {
|
| - return Object::IsHeapObject()
|
| - && (HeapObject::cast(this)->map()->instance_type() ==
|
| - JS_MESSAGE_OBJECT_TYPE);
|
| -}
|
| -
|
| -
|
| bool Object::IsStringWrapper() {
|
| return IsJSValue() && JSValue::cast(this)->value()->IsString();
|
| }
|
|
|
|
|
| -bool Object::IsForeign() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == FOREIGN_TYPE;
|
| -}
|
| +TYPE_CHECKER(Foreign, FOREIGN_TYPE)
|
|
|
|
|
| bool Object::IsBoolean() {
|
| @@ -714,18 +600,10 @@
|
| }
|
|
|
|
|
| -bool Object::IsJSArray() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == JS_ARRAY_TYPE;
|
| -}
|
| +TYPE_CHECKER(JSArray, JS_ARRAY_TYPE)
|
| +TYPE_CHECKER(JSRegExp, JS_REGEXP_TYPE)
|
|
|
|
|
| -bool Object::IsJSRegExp() {
|
| - return Object::IsHeapObject()
|
| - && HeapObject::cast(this)->map()->instance_type() == JS_REGEXP_TYPE;
|
| -}
|
| -
|
| -
|
| template <> inline bool Is<JSArray>(Object* obj) {
|
| return obj->IsJSArray();
|
| }
|
| @@ -760,7 +638,10 @@
|
| return false;
|
| }
|
| #ifdef DEBUG
|
| - reinterpret_cast<JSFunctionResultCache*>(this)->JSFunctionResultCacheVerify();
|
| + if (FLAG_verify_heap) {
|
| + reinterpret_cast<JSFunctionResultCache*>(this)->
|
| + JSFunctionResultCacheVerify();
|
| + }
|
| #endif
|
| return true;
|
| }
|
| @@ -772,7 +653,9 @@
|
| return false;
|
| }
|
| #ifdef DEBUG
|
| - reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify();
|
| + if (FLAG_verify_heap) {
|
| + reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify();
|
| + }
|
| #endif
|
| return true;
|
| }
|
| @@ -821,20 +704,10 @@
|
| }
|
|
|
|
|
| -bool Object::IsJSGlobalObject() {
|
| - return IsHeapObject() &&
|
| - (HeapObject::cast(this)->map()->instance_type() ==
|
| - JS_GLOBAL_OBJECT_TYPE);
|
| -}
|
| +TYPE_CHECKER(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE)
|
| +TYPE_CHECKER(JSBuiltinsObject, JS_BUILTINS_OBJECT_TYPE)
|
|
|
|
|
| -bool Object::IsJSBuiltinsObject() {
|
| - return IsHeapObject() &&
|
| - (HeapObject::cast(this)->map()->instance_type() ==
|
| - JS_BUILTINS_OBJECT_TYPE);
|
| -}
|
| -
|
| -
|
| bool Object::IsUndetectableObject() {
|
| return IsHeapObject()
|
| && HeapObject::cast(this)->map()->is_undetectable();
|
| @@ -1300,7 +1173,6 @@
|
|
|
| FixedArrayBase* JSObject::elements() {
|
| Object* array = READ_FIELD(this, kElementsOffset);
|
| - ASSERT(array->HasValidElements());
|
| return static_cast<FixedArrayBase*>(array);
|
| }
|
|
|
| @@ -1740,7 +1612,11 @@
|
| old_length * kDoubleSize);
|
| } else {
|
| for (int i = 0; i < old_length; ++i) {
|
| - set(i, from->get_scalar(i));
|
| + if (from->is_the_hole(i)) {
|
| + set_the_hole(i);
|
| + } else {
|
| + set(i, from->get_scalar(i));
|
| + }
|
| }
|
| }
|
| int offset = kHeaderSize + old_length * kDoubleSize;
|
| @@ -1805,15 +1681,13 @@
|
| }
|
|
|
|
|
| -void FixedArray::fast_set(FixedArray* array, int index, Object* value) {
|
| +void FixedArray::NoWriteBarrierSet(FixedArray* array,
|
| + int index,
|
| + Object* value) {
|
| ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map());
|
| ASSERT(index >= 0 && index < array->length());
|
| ASSERT(!HEAP->InNewSpace(value));
|
| WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value);
|
| - array->GetHeap()->incremental_marking()->RecordWrite(
|
| - array,
|
| - HeapObject::RawField(array, kHeaderSize + index * kPointerSize),
|
| - value);
|
| }
|
|
|
|
|
| @@ -1901,10 +1775,12 @@
|
| }
|
|
|
|
|
| -void DescriptorArray::fast_swap(FixedArray* array, int first, int second) {
|
| +void DescriptorArray::NoWriteBarrierSwap(FixedArray* array,
|
| + int first,
|
| + int second) {
|
| Object* tmp = array->get(first);
|
| - fast_set(array, first, array->get(second));
|
| - fast_set(array, second, tmp);
|
| + NoWriteBarrierSet(array, first, array->get(second));
|
| + NoWriteBarrierSet(array, second, tmp);
|
| }
|
|
|
|
|
| @@ -2012,7 +1888,9 @@
|
| }
|
|
|
|
|
| -void DescriptorArray::Set(int descriptor_number, Descriptor* desc) {
|
| +void DescriptorArray::Set(int descriptor_number,
|
| + Descriptor* desc,
|
| + const WhitenessWitness&) {
|
| // Range check.
|
| ASSERT(descriptor_number < number_of_descriptors());
|
|
|
| @@ -2020,29 +1898,56 @@
|
| ASSERT(!HEAP->InNewSpace(desc->GetKey()));
|
| ASSERT(!HEAP->InNewSpace(desc->GetValue()));
|
|
|
| - fast_set(this, ToKeyIndex(descriptor_number), desc->GetKey());
|
| + NoWriteBarrierSet(this,
|
| + ToKeyIndex(descriptor_number),
|
| + desc->GetKey());
|
| FixedArray* content_array = GetContentArray();
|
| - fast_set(content_array, ToValueIndex(descriptor_number), desc->GetValue());
|
| - fast_set(content_array, ToDetailsIndex(descriptor_number),
|
| - desc->GetDetails().AsSmi());
|
| + NoWriteBarrierSet(content_array,
|
| + ToValueIndex(descriptor_number),
|
| + desc->GetValue());
|
| + NoWriteBarrierSet(content_array,
|
| + ToDetailsIndex(descriptor_number),
|
| + desc->GetDetails().AsSmi());
|
| }
|
|
|
|
|
| -void DescriptorArray::CopyFrom(int index, DescriptorArray* src, int src_index) {
|
| +void DescriptorArray::CopyFrom(int index,
|
| + DescriptorArray* src,
|
| + int src_index,
|
| + const WhitenessWitness& witness) {
|
| Descriptor desc;
|
| src->Get(src_index, &desc);
|
| - Set(index, &desc);
|
| + Set(index, &desc, witness);
|
| }
|
|
|
|
|
| -void DescriptorArray::Swap(int first, int second) {
|
| - fast_swap(this, ToKeyIndex(first), ToKeyIndex(second));
|
| +void DescriptorArray::NoWriteBarrierSwapDescriptors(int first, int second) {
|
| + NoWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second));
|
| FixedArray* content_array = GetContentArray();
|
| - fast_swap(content_array, ToValueIndex(first), ToValueIndex(second));
|
| - fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second));
|
| + NoWriteBarrierSwap(content_array,
|
| + ToValueIndex(first),
|
| + ToValueIndex(second));
|
| + NoWriteBarrierSwap(content_array,
|
| + ToDetailsIndex(first),
|
| + ToDetailsIndex(second));
|
| }
|
|
|
|
|
| +DescriptorArray::WhitenessWitness::WhitenessWitness(DescriptorArray* array)
|
| + : marking_(array->GetHeap()->incremental_marking()) {
|
| + marking_->EnterNoMarkingScope();
|
| + if (array->number_of_descriptors() > 0) {
|
| + ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT);
|
| + ASSERT(Marking::Color(array->GetContentArray()) == Marking::WHITE_OBJECT);
|
| + }
|
| +}
|
| +
|
| +
|
| +DescriptorArray::WhitenessWitness::~WhitenessWitness() {
|
| + marking_->LeaveNoMarkingScope();
|
| +}
|
| +
|
| +
|
| template<typename Shape, typename Key>
|
| int HashTable<Shape, Key>::ComputeCapacity(int at_least_space_for) {
|
| const int kMinCapacity = 32;
|
| @@ -2142,6 +2047,8 @@
|
| CAST_ACCESSOR(JSRegExp)
|
| CAST_ACCESSOR(JSProxy)
|
| CAST_ACCESSOR(JSFunctionProxy)
|
| +CAST_ACCESSOR(JSSet)
|
| +CAST_ACCESSOR(JSMap)
|
| CAST_ACCESSOR(JSWeakMap)
|
| CAST_ACCESSOR(Foreign)
|
| CAST_ACCESSOR(ByteArray)
|
| @@ -2979,6 +2886,21 @@
|
| }
|
|
|
|
|
| +bool Code::is_compiled_optimizable() {
|
| + ASSERT(kind() == FUNCTION);
|
| + byte flags = READ_BYTE_FIELD(this, kFullCodeFlags);
|
| + return FullCodeFlagsIsCompiledOptimizable::decode(flags);
|
| +}
|
| +
|
| +
|
| +void Code::set_compiled_optimizable(bool value) {
|
| + ASSERT(kind() == FUNCTION);
|
| + byte flags = READ_BYTE_FIELD(this, kFullCodeFlags);
|
| + flags = FullCodeFlagsIsCompiledOptimizable::update(flags, value);
|
| + WRITE_BYTE_FIELD(this, kFullCodeFlags, flags);
|
| +}
|
| +
|
| +
|
| int Code::allow_osr_at_loop_nesting_level() {
|
| ASSERT(kind() == FUNCTION);
|
| return READ_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset);
|
| @@ -3304,7 +3226,7 @@
|
| ACCESSORS(Map, constructor, Object, kConstructorOffset)
|
|
|
| ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
|
| -ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset)
|
| +ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset)
|
| ACCESSORS(JSFunction,
|
| next_function_link,
|
| Object,
|
| @@ -3547,8 +3469,23 @@
|
| }
|
|
|
|
|
| -BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, strict_mode,
|
| - kStrictModeFunction)
|
| +StrictModeFlag SharedFunctionInfo::strict_mode_flag() {
|
| + return BooleanBit::get(compiler_hints(), kStrictModeFunction)
|
| + ? kStrictMode : kNonStrictMode;
|
| +}
|
| +
|
| +
|
| +void SharedFunctionInfo::set_strict_mode_flag(StrictModeFlag strict_mode_flag) {
|
| + ASSERT(strict_mode_flag == kStrictMode ||
|
| + strict_mode_flag == kNonStrictMode);
|
| + bool value = strict_mode_flag == kStrictMode;
|
| + set_compiler_hints(
|
| + BooleanBit::set(compiler_hints(), kStrictModeFunction, value));
|
| +}
|
| +
|
| +
|
| +BOOL_GETTER(SharedFunctionInfo, compiler_hints, strict_mode,
|
| + kStrictModeFunction)
|
| BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative)
|
| BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints,
|
| name_should_print_as_anonymous,
|
| @@ -3823,7 +3760,36 @@
|
| }
|
|
|
|
|
| +FixedArray* JSFunction::literals() {
|
| + ASSERT(!shared()->bound());
|
| + return literals_or_bindings();
|
| +}
|
| +
|
| +
|
| +void JSFunction::set_literals(FixedArray* literals) {
|
| + ASSERT(!shared()->bound());
|
| + set_literals_or_bindings(literals);
|
| +}
|
| +
|
| +
|
| +FixedArray* JSFunction::function_bindings() {
|
| + ASSERT(shared()->bound());
|
| + return literals_or_bindings();
|
| +}
|
| +
|
| +
|
| +void JSFunction::set_function_bindings(FixedArray* bindings) {
|
| + ASSERT(shared()->bound());
|
| + // Bound function literal may be initialized to the empty fixed array
|
| + // before the bindings are set.
|
| + ASSERT(bindings == GetHeap()->empty_fixed_array() ||
|
| + bindings->map() == GetHeap()->fixed_cow_array_map());
|
| + set_literals_or_bindings(bindings);
|
| +}
|
| +
|
| +
|
| int JSFunction::NumberOfLiterals() {
|
| + ASSERT(!shared()->bound());
|
| return literals()->length();
|
| }
|
|
|
| @@ -3870,6 +3836,8 @@
|
| }
|
|
|
|
|
| +ACCESSORS(JSSet, table, Object, kTableOffset)
|
| +ACCESSORS(JSMap, table, Object, kTableOffset)
|
| ACCESSORS(JSWeakMap, table, Object, kTableOffset)
|
| ACCESSORS(JSWeakMap, next, Object, kNextOffset)
|
|
|
| @@ -4056,14 +4024,16 @@
|
| reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset));
|
| Map* map = fixed_array->map();
|
| ASSERT(((kind == FAST_ELEMENTS || kind == FAST_SMI_ONLY_ELEMENTS) &&
|
| - (map == GetHeap()->fixed_array_map() ||
|
| - map == GetHeap()->fixed_cow_array_map())) ||
|
| - (kind == FAST_DOUBLE_ELEMENTS &&
|
| - fixed_array->IsFixedDoubleArray()) ||
|
| - (kind == DICTIONARY_ELEMENTS &&
|
| - fixed_array->IsFixedArray() &&
|
| - fixed_array->IsDictionary()) ||
|
| - (kind > DICTIONARY_ELEMENTS));
|
| + (map == GetHeap()->fixed_array_map() ||
|
| + map == GetHeap()->fixed_cow_array_map())) ||
|
| + (kind == FAST_DOUBLE_ELEMENTS &&
|
| + fixed_array->IsFixedDoubleArray()) ||
|
| + (kind == DICTIONARY_ELEMENTS &&
|
| + fixed_array->IsFixedArray() &&
|
| + fixed_array->IsDictionary()) ||
|
| + (kind > DICTIONARY_ELEMENTS));
|
| + ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) ||
|
| + (elements()->IsFixedArray() && elements()->length() >= 2));
|
| #endif
|
| return kind;
|
| }
|
| @@ -4407,7 +4377,7 @@
|
| WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc);
|
| FixedArray::set(index, key, mode);
|
| FixedArray::set(index+1, value, mode);
|
| - FixedArray::fast_set(this, index+2, details.AsSmi());
|
| + FixedArray::set(index+2, details.AsSmi());
|
| }
|
|
|
|
|
| @@ -4456,27 +4426,31 @@
|
| }
|
|
|
|
|
| -bool ObjectHashTableShape::IsMatch(JSReceiver* key, Object* other) {
|
| - return key == JSReceiver::cast(other);
|
| +template <int entrysize>
|
| +bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) {
|
| + return key->SameValue(other);
|
| }
|
|
|
|
|
| -uint32_t ObjectHashTableShape::Hash(JSReceiver* key) {
|
| - MaybeObject* maybe_hash = key->GetIdentityHash(OMIT_CREATION);
|
| - ASSERT(!maybe_hash->IsFailure());
|
| - return Smi::cast(maybe_hash->ToObjectUnchecked())->value();
|
| +template <int entrysize>
|
| +uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) {
|
| + ASSERT(!key->IsUndefined() && !key->IsNull());
|
| + MaybeObject* maybe_hash = key->GetHash(OMIT_CREATION);
|
| + return Smi::cast(maybe_hash->ToObjectChecked())->value();
|
| }
|
|
|
|
|
| -uint32_t ObjectHashTableShape::HashForObject(JSReceiver* key, Object* other) {
|
| - MaybeObject* maybe_hash =
|
| - JSReceiver::cast(other)->GetIdentityHash(OMIT_CREATION);
|
| - ASSERT(!maybe_hash->IsFailure());
|
| - return Smi::cast(maybe_hash->ToObjectUnchecked())->value();
|
| +template <int entrysize>
|
| +uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key,
|
| + Object* other) {
|
| + ASSERT(!other->IsUndefined() && !other->IsNull());
|
| + MaybeObject* maybe_hash = other->GetHash(OMIT_CREATION);
|
| + return Smi::cast(maybe_hash->ToObjectChecked())->value();
|
| }
|
|
|
|
|
| -MaybeObject* ObjectHashTableShape::AsObject(JSReceiver* key) {
|
| +template <int entrysize>
|
| +MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Object* key) {
|
| return key;
|
| }
|
|
|
| @@ -4534,6 +4508,12 @@
|
| }
|
|
|
|
|
| +MaybeObject* FixedDoubleArray::Copy() {
|
| + if (length() == 0) return this;
|
| + return GetHeap()->CopyFixedDoubleArray(this);
|
| +}
|
| +
|
| +
|
| Relocatable::Relocatable(Isolate* isolate) {
|
| ASSERT(isolate == Isolate::Current());
|
| isolate_ = isolate;
|
|
|