diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2014-11-14 00:52:27 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2014-11-14 16:34:58 +0100 |
commit | 5d1b6d3e0fa4b97a490ef964be48aed9872e3ec1 (patch) | |
tree | ab5f510c4d83b175681de629395525bf7ec7cedb /deps/v8/src/ic/x87 | |
parent | 3b3d89bad26f5dfebe73fef6ae284ee78acbd5c9 (diff) | |
download | node-new-5d1b6d3e0fa4b97a490ef964be48aed9872e3ec1.tar.gz |
deps: upgrade v8 to 3.30.37
Diffstat (limited to 'deps/v8/src/ic/x87')
-rw-r--r-- | deps/v8/src/ic/x87/handler-compiler-x87.cc | 183 | ||||
-rw-r--r-- | deps/v8/src/ic/x87/ic-x87.cc | 61 |
2 files changed, 50 insertions, 194 deletions
diff --git a/deps/v8/src/ic/x87/handler-compiler-x87.cc b/deps/v8/src/ic/x87/handler-compiler-x87.cc index e706998c38..ae637d11b7 100644 --- a/deps/v8/src/ic/x87/handler-compiler-x87.cc +++ b/deps/v8/src/ic/x87/handler-compiler-x87.cc @@ -329,172 +329,39 @@ void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, } -// Receiver_reg is preserved on jumps to miss_label, but may be destroyed if -// store is successful. -void NamedStoreHandlerCompiler::GenerateStoreTransition( - Handle<Map> transition, Handle<Name> name, Register receiver_reg, - Register storage_reg, Register value_reg, Register scratch1, - Register scratch2, Register unused, Label* miss_label, Label* slow) { - int descriptor = transition->LastAdded(); - DescriptorArray* descriptors = transition->instance_descriptors(); - PropertyDetails details = descriptors->GetDetails(descriptor); - Representation representation = details.representation(); - DCHECK(!representation.IsNone()); - - if (details.type() == CONSTANT) { - Handle<Object> constant(descriptors->GetValue(descriptor), isolate()); - __ CmpObject(value_reg, constant); - __ j(not_equal, miss_label); - } else if (representation.IsSmi()) { - __ JumpIfNotSmi(value_reg, miss_label); - } else if (representation.IsHeapObject()) { - __ JumpIfSmi(value_reg, miss_label); - HeapType* field_type = descriptors->GetFieldType(descriptor); - HeapType::Iterator<Map> it = field_type->Classes(); - if (!it.Done()) { - Label do_store; - while (true) { - __ CompareMap(value_reg, it.Current()); - it.Advance(); - if (it.Done()) { - __ j(not_equal, miss_label); - break; - } - __ j(equal, &do_store, Label::kNear); - } - __ bind(&do_store); - } - } else if (representation.IsDouble()) { - Label do_store, heap_number; - __ AllocateHeapNumber(storage_reg, scratch1, scratch2, slow, MUTABLE); - - __ JumpIfNotSmi(value_reg, &heap_number); - __ SmiUntag(value_reg); - __ push(value_reg); - __ fild_s(Operand(esp, 0)); - __ pop(value_reg); - __ SmiTag(value_reg); - __ jmp(&do_store); - - __ bind(&heap_number); - __ CheckMap(value_reg, isolate()->factory()->heap_number_map(), miss_label, - DONT_DO_SMI_CHECK); - __ fld_d(FieldOperand(value_reg, HeapNumber::kValueOffset)); - - __ bind(&do_store); - __ fstp_d(FieldOperand(storage_reg, HeapNumber::kValueOffset)); - } - - // Stub never generated for objects that require access checks. - DCHECK(!transition->is_access_check_needed()); - - // Perform map transition for the receiver if necessary. - if (details.type() == FIELD && - Map::cast(transition->GetBackPointer())->unused_property_fields() == 0) { - // The properties must be extended before we can store the value. - // We jump to a runtime call that extends the properties array. - __ pop(scratch1); // Return address. - __ push(receiver_reg); - __ push(Immediate(transition)); - __ push(value_reg); - __ push(scratch1); - __ TailCallExternalReference( - ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage), - isolate()), - 3, 1); - return; - } - - // Update the map of the object. - __ mov(scratch1, Immediate(transition)); - __ mov(FieldOperand(receiver_reg, HeapObject::kMapOffset), scratch1); - - // Update the write barrier for the map field. - __ RecordWriteField(receiver_reg, HeapObject::kMapOffset, scratch1, scratch2, - kDontSaveFPRegs, OMIT_REMEMBERED_SET, OMIT_SMI_CHECK); - - if (details.type() == CONSTANT) { - DCHECK(value_reg.is(eax)); - __ ret(0); - return; - } - - int index = transition->instance_descriptors()->GetFieldIndex( - transition->LastAdded()); - - // Adjust for the number of properties stored in the object. Even in the - // face of a transition we can use the old map here because the size of the - // object and the number of in-object properties is not going to change. - index -= transition->inobject_properties(); - - SmiCheck smi_check = - representation.IsTagged() ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; - // TODO(verwaest): Share this code as a code stub. - if (index < 0) { - // Set the property straight into the object. - int offset = transition->instance_size() + (index * kPointerSize); - if (representation.IsDouble()) { - __ mov(FieldOperand(receiver_reg, offset), storage_reg); - } else { - __ mov(FieldOperand(receiver_reg, offset), value_reg); - } - - if (!representation.IsSmi()) { - // Update the write barrier for the array address. - if (!representation.IsDouble()) { - __ mov(storage_reg, value_reg); - } - __ RecordWriteField(receiver_reg, offset, storage_reg, scratch1, - kDontSaveFPRegs, EMIT_REMEMBERED_SET, smi_check); - } - } else { - // Write to the properties array. - int offset = index * kPointerSize + FixedArray::kHeaderSize; - // Get the properties array (optimistically). - __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); - if (representation.IsDouble()) { - __ mov(FieldOperand(scratch1, offset), storage_reg); - } else { - __ mov(FieldOperand(scratch1, offset), value_reg); - } +void NamedStoreHandlerCompiler::GenerateRestoreNameAndMap( + Handle<Name> name, Handle<Map> transition) { + __ mov(this->name(), Immediate(name)); + __ mov(StoreTransitionDescriptor::MapRegister(), Immediate(transition)); +} - if (!representation.IsSmi()) { - // Update the write barrier for the array address. - if (!representation.IsDouble()) { - __ mov(storage_reg, value_reg); - } - __ RecordWriteField(scratch1, offset, storage_reg, receiver_reg, - kDontSaveFPRegs, EMIT_REMEMBERED_SET, smi_check); - } - } - // Return the value (register eax). - DCHECK(value_reg.is(eax)); - __ ret(0); +void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant, + Register value_reg, + Label* miss_label) { + __ CmpObject(value_reg, handle(constant, isolate())); + __ j(not_equal, miss_label); } -void NamedStoreHandlerCompiler::GenerateStoreField(LookupIterator* lookup, - Register value_reg, - Label* miss_label) { - DCHECK(lookup->representation().IsHeapObject()); +void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type, + Register value_reg, + Label* miss_label) { __ JumpIfSmi(value_reg, miss_label); - HeapType::Iterator<Map> it = lookup->GetFieldType()->Classes(); - Label do_store; - while (true) { - __ CompareMap(value_reg, it.Current()); - it.Advance(); - if (it.Done()) { - __ j(not_equal, miss_label); - break; + HeapType::Iterator<Map> it = field_type->Classes(); + if (!it.Done()) { + Label do_store; + while (true) { + __ CompareMap(value_reg, it.Current()); + it.Advance(); + if (it.Done()) { + __ j(not_equal, miss_label); + break; + } + __ j(equal, &do_store, Label::kNear); } - __ j(equal, &do_store, Label::kNear); + __ bind(&do_store); } - __ bind(&do_store); - - StoreFieldStub stub(isolate(), lookup->GetFieldIndex(), - lookup->representation()); - GenerateTailCall(masm(), stub.GetCode()); } diff --git a/deps/v8/src/ic/x87/ic-x87.cc b/deps/v8/src/ic/x87/ic-x87.cc index 9c090c56a5..959b8b628e 100644 --- a/deps/v8/src/ic/x87/ic-x87.cc +++ b/deps/v8/src/ic/x87/ic-x87.cc @@ -478,33 +478,6 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { } -void KeyedLoadIC::GenerateString(MacroAssembler* masm) { - // Return address is on the stack. - Label miss; - - Register receiver = LoadDescriptor::ReceiverRegister(); - Register index = LoadDescriptor::NameRegister(); - Register scratch = ebx; - DCHECK(!scratch.is(receiver) && !scratch.is(index)); - Register result = eax; - DCHECK(!result.is(scratch)); - - StringCharAtGenerator char_at_generator(receiver, index, scratch, result, - &miss, // When not a string. - &miss, // When not a number. - &miss, // When index out of range. - STRING_INDEX_IS_ARRAY_INDEX); - char_at_generator.GenerateFast(masm); - __ ret(0); - - StubRuntimeCallHelper call_helper; - char_at_generator.GenerateSlow(masm, call_helper); - - __ bind(&miss); - GenerateMiss(masm); -} - - void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { // Return address is on the stack. Label slow, notin; @@ -536,7 +509,7 @@ void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { } -static void KeyedStoreGenerateGenericHelper( +static void KeyedStoreGenerateMegamorphicHelper( MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length) { Label transition_smi_elements; @@ -674,12 +647,12 @@ static void KeyedStoreGenerateGenericHelper( } -void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, - StrictMode strict_mode) { +void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, + StrictMode strict_mode) { // Return address is on the stack. Label slow, fast_object, fast_object_grow; Label fast_double, fast_double_grow; - Label array, extra, check_if_double_array; + Label array, extra, check_if_double_array, maybe_name_key, miss; Register receiver = StoreDescriptor::ReceiverRegister(); Register key = StoreDescriptor::NameRegister(); DCHECK(receiver.is(edx)); @@ -695,7 +668,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, 1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved); __ j(not_zero, &slow); // Check that the key is a smi. - __ JumpIfNotSmi(key, &slow); + __ JumpIfNotSmi(key, &maybe_name_key); __ CmpInstanceType(edi, JS_ARRAY_TYPE); __ j(equal, &array); // Check that the object is some kind of JSObject. @@ -713,6 +686,18 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, // Slow case: call runtime. __ bind(&slow); PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode); + // Never returns to here. + + __ bind(&maybe_name_key); + __ mov(ebx, FieldOperand(key, HeapObject::kMapOffset)); + __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); + __ JumpIfNotUniqueNameInstanceType(ebx, &slow); + Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( + Code::ComputeHandlerFlags(Code::STORE_IC)); + masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, + key, ebx, no_reg); + // Cache miss. + __ jmp(&miss); // Extra capacity case: Check if there is extra capacity to // perform the store and update the length. Used for adding one @@ -751,10 +736,14 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, __ cmp(key, FieldOperand(receiver, JSArray::kLengthOffset)); // Compare smis. __ j(above_equal, &extra); - KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, &slow, - kCheckMap, kDontIncrementLength); - KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, - &slow, kDontCheckMap, kIncrementLength); + KeyedStoreGenerateMegamorphicHelper(masm, &fast_object, &fast_double, &slow, + kCheckMap, kDontIncrementLength); + KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow, + &fast_double_grow, &slow, kDontCheckMap, + kIncrementLength); + + __ bind(&miss); + GenerateMiss(masm); } |