diff options
Diffstat (limited to 'deps/v8/src/ic/keyed-store-generic.cc')
-rw-r--r-- | deps/v8/src/ic/keyed-store-generic.cc | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/deps/v8/src/ic/keyed-store-generic.cc b/deps/v8/src/ic/keyed-store-generic.cc index 7ff72bb72f..4263dd8552 100644 --- a/deps/v8/src/ic/keyed-store-generic.cc +++ b/deps/v8/src/ic/keyed-store-generic.cc @@ -108,7 +108,7 @@ void KeyedStoreGenericAssembler::BranchIfPrototypesHaveNonFastElements( { Node* map = var_map.value(); Node* prototype = LoadMapPrototype(map); - GotoIf(WordEqual(prototype, NullConstant()), only_fast_elements); + GotoIf(IsNull(prototype), only_fast_elements); Node* prototype_map = LoadMap(prototype); var_map.Bind(prototype_map); Node* instance_type = LoadMapInstanceType(prototype_map); @@ -236,8 +236,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity( Node* intptr_index, Node* value, Node* context, Label* slow, UpdateLength update_length) { if (update_length != kDontChangeLength) { - CSA_ASSERT(this, Word32Equal(LoadMapInstanceType(receiver_map), - Int32Constant(JS_ARRAY_TYPE))); + CSA_ASSERT(this, InstanceTypeEqual(LoadMapInstanceType(receiver_map), + JS_ARRAY_TYPE)); // Check if the length property is writable. The fast check is only // supported for fast properties. GotoIf(IsDictionaryMap(receiver_map), slow); @@ -437,7 +437,7 @@ void KeyedStoreGenericAssembler::EmitGenericElementStore( BIND(&if_fast); Label if_array(this); - GotoIf(Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE)), &if_array); + GotoIf(InstanceTypeEqual(instance_type, JS_ARRAY_TYPE), &if_array); { Node* capacity = SmiUntag(LoadFixedArrayBaseLength(elements)); Branch(UintPtrLessThan(intptr_index, capacity), &if_in_bounds, &if_grow); @@ -529,6 +529,7 @@ void KeyedStoreGenericAssembler::LookupPropertyOnPrototypeChain( BIND(&loop); { Node* holder = var_holder.value(); + GotoIf(IsNull(holder), &ok_to_write); Node* holder_map = var_holder_map.value(); Node* instance_type = LoadMapInstanceType(holder_map); Label next_proto(this); @@ -593,10 +594,9 @@ void KeyedStoreGenericAssembler::LookupPropertyOnPrototypeChain( BIND(&next_proto); // Bailout if it can be an integer indexed exotic case. - GotoIf(Word32Equal(instance_type, Int32Constant(JS_TYPED_ARRAY_TYPE)), - bailout); + GotoIf(InstanceTypeEqual(instance_type, JS_TYPED_ARRAY_TYPE), bailout); Node* proto = LoadMapPrototype(holder_map); - GotoIf(WordEqual(proto, NullConstant()), &ok_to_write); + GotoIf(IsNull(proto), &ok_to_write); var_holder.Bind(proto); var_holder_map.Bind(LoadMap(proto)); Goto(&loop); @@ -686,17 +686,17 @@ void KeyedStoreGenericAssembler::OverwriteExistingFastProperty( slow); Node* field_index = DecodeWordFromWord32<PropertyDetails::FieldIndexField>(details); - Node* inobject_properties = LoadMapInobjectProperties(object_map); + field_index = + IntPtrAdd(field_index, LoadMapInobjectPropertiesStartInWords(object_map)); + Node* instance_size_in_words = LoadMapInstanceSizeInWords(object_map); Label inobject(this), backing_store(this); - Branch(UintPtrLessThan(field_index, inobject_properties), &inobject, + Branch(UintPtrLessThan(field_index, instance_size_in_words), &inobject, &backing_store); BIND(&inobject); { - Node* field_offset = TimesPointerSize(IntPtrAdd( - IntPtrSub(LoadMapInstanceSize(object_map), inobject_properties), - field_index)); + Node* field_offset = TimesPointerSize(field_index); Label tagged_rep(this), double_rep(this); Branch(Word32Equal(representation, Int32Constant(Representation::kDouble)), &double_rep, &tagged_rep); @@ -722,7 +722,7 @@ void KeyedStoreGenericAssembler::OverwriteExistingFastProperty( BIND(&backing_store); { - Node* backing_store_index = IntPtrSub(field_index, inobject_properties); + Node* backing_store_index = IntPtrSub(field_index, instance_size_in_words); Label tagged_rep(this), double_rep(this); Branch(Word32Equal(representation, Int32Constant(Representation::kDouble)), &double_rep, &tagged_rep); @@ -810,15 +810,15 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore( Label check_key(this, &var_transition_cell); BIND(&tuple3); { - var_transition_cell.Bind(LoadObjectField( - maybe_handler, StoreHandler::kTransitionOrHolderCellOffset)); + var_transition_cell.Bind( + LoadObjectField(maybe_handler, StoreHandler::kDataOffset)); Goto(&check_key); } BIND(&fixedarray); { - var_transition_cell.Bind(LoadFixedArrayElement( - maybe_handler, StoreHandler::kTransitionMapOrHolderCellIndex)); + var_transition_cell.Bind( + LoadFixedArrayElement(maybe_handler, StoreHandler::kDataIndex)); Goto(&check_key); } @@ -891,8 +891,14 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore( LookupPropertyOnPrototypeChain(receiver_map, p->name, &accessor, &var_accessor_pair, &var_accessor_holder, &readonly, slow); - Add<NameDictionary>(properties, p->name, p->value, slow); + Label add_dictionary_property_slow(this); + Add<NameDictionary>(properties, p->name, p->value, + &add_dictionary_property_slow); Return(p->value); + + BIND(&add_dictionary_property_slow); + TailCallRuntime(Runtime::kAddDictionaryProperty, p->context, p->receiver, + p->name, p->value); } } @@ -976,7 +982,8 @@ void KeyedStoreGenericAssembler::KeyedStoreGeneric() { VARIABLE(var_index, MachineType::PointerRepresentation()); VARIABLE(var_unique, MachineRepresentation::kTagged); var_unique.Bind(name); // Dummy initialization. - Label if_index(this), if_unique_name(this), slow(this); + Label if_index(this), if_unique_name(this), not_internalized(this), + slow(this); GotoIf(TaggedIsSmi(receiver), &slow); Node* receiver_map = LoadMap(receiver); @@ -987,7 +994,8 @@ void KeyedStoreGenericAssembler::KeyedStoreGeneric() { Int32Constant(LAST_CUSTOM_ELEMENTS_RECEIVER)), &slow); - TryToName(name, &if_index, &var_index, &if_unique_name, &var_unique, &slow); + TryToName(name, &if_index, &var_index, &if_unique_name, &var_unique, &slow, + ¬_internalized); BIND(&if_index); { @@ -1004,14 +1012,24 @@ void KeyedStoreGenericAssembler::KeyedStoreGeneric() { EmitGenericPropertyStore(receiver, receiver_map, &p, &slow); } + BIND(¬_internalized); + { + if (FLAG_internalize_on_the_fly) { + TryInternalizeString(name, &if_index, &var_index, &if_unique_name, + &var_unique, &slow, &slow); + } else { + Goto(&slow); + } + } + BIND(&slow); { Comment("KeyedStoreGeneric_slow"); VARIABLE(var_language_mode, MachineRepresentation::kTaggedSigned, - SmiConstant(STRICT)); + SmiConstant(LanguageMode::kStrict)); Label call_runtime(this); BranchIfStrictMode(vector, slot, &call_runtime); - var_language_mode.Bind(SmiConstant(SLOPPY)); + var_language_mode.Bind(SmiConstant(LanguageMode::kSloppy)); Goto(&call_runtime); BIND(&call_runtime); TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value, |