| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic-inl.h" | 10 #include "src/ic-inl.h" |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 smi_check); | 561 smi_check); |
| 562 } | 562 } |
| 563 } | 563 } |
| 564 | 564 |
| 565 // Return the value (register eax). | 565 // Return the value (register eax). |
| 566 DCHECK(value_reg.is(eax)); | 566 DCHECK(value_reg.is(eax)); |
| 567 __ ret(0); | 567 __ ret(0); |
| 568 } | 568 } |
| 569 | 569 |
| 570 | 570 |
| 571 // Both name_reg and receiver_reg are preserved on jumps to miss_label, | 571 void NamedStoreHandlerCompiler::GenerateStoreField(LookupResult* lookup, |
| 572 // but may be destroyed if store is successful. | 572 Register value_reg, |
| 573 void NamedStoreHandlerCompiler::GenerateStoreField( | 573 Label* miss_label) { |
| 574 Handle<JSObject> object, LookupResult* lookup, Register receiver_reg, | |
| 575 Register name_reg, Register value_reg, Register scratch1, Register scratch2, | |
| 576 Label* miss_label) { | |
| 577 // Stub never generated for objects that require access checks. | |
| 578 DCHECK(!object->IsAccessCheckNeeded()); | |
| 579 DCHECK(!object->IsJSGlobalProxy()); | |
| 580 | |
| 581 FieldIndex index = lookup->GetFieldIndex(); | |
| 582 DCHECK(lookup->representation().IsHeapObject()); | 574 DCHECK(lookup->representation().IsHeapObject()); |
| 583 __ JumpIfSmi(value_reg, miss_label); | 575 __ JumpIfSmi(value_reg, miss_label); |
| 584 HeapType* field_type = lookup->GetFieldType(); | 576 HeapType::Iterator<Map> it = lookup->GetFieldType()->Classes(); |
| 585 HeapType::Iterator<Map> it = field_type->Classes(); | 577 Label do_store; |
| 586 if (!it.Done()) { | 578 while (true) { |
| 587 Label do_store; | 579 __ CompareMap(value_reg, it.Current()); |
| 588 while (true) { | 580 it.Advance(); |
| 589 __ CompareMap(value_reg, it.Current()); | 581 if (it.Done()) { |
| 590 it.Advance(); | 582 __ j(not_equal, miss_label); |
| 591 if (it.Done()) { | 583 break; |
| 592 __ j(not_equal, miss_label); | |
| 593 break; | |
| 594 } | |
| 595 __ j(equal, &do_store, Label::kNear); | |
| 596 } | 584 } |
| 597 __ bind(&do_store); | 585 __ j(equal, &do_store, Label::kNear); |
| 598 } | 586 } |
| 587 __ bind(&do_store); |
| 599 | 588 |
| 600 if (index.is_inobject()) { | 589 StoreFieldStub stub(isolate(), lookup->GetFieldIndex(), |
| 601 // Set the property straight into the object. | 590 lookup->representation()); |
| 602 __ mov(FieldOperand(receiver_reg, index.offset()), value_reg); | 591 GenerateTailCall(masm(), stub.GetCode()); |
| 603 | |
| 604 // Update the write barrier for the array address. | |
| 605 // Pass the value being stored in the now unused name_reg. | |
| 606 __ mov(name_reg, value_reg); | |
| 607 __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1, | |
| 608 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
| 609 } else { | |
| 610 // Write to the properties array. | |
| 611 // Get the properties array (optimistically). | |
| 612 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | |
| 613 __ mov(FieldOperand(scratch1, index.offset()), value_reg); | |
| 614 | |
| 615 // Update the write barrier for the array address. | |
| 616 // Pass the value being stored in the now unused name_reg. | |
| 617 __ mov(name_reg, value_reg); | |
| 618 __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg, | |
| 619 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
| 620 } | |
| 621 | |
| 622 // Return the value (register eax). | |
| 623 DCHECK(value_reg.is(eax)); | |
| 624 __ ret(0); | |
| 625 } | 592 } |
| 626 | 593 |
| 627 | 594 |
| 628 Register PropertyHandlerCompiler::CheckPrototypes( | 595 Register PropertyHandlerCompiler::CheckPrototypes( |
| 629 Register object_reg, Register holder_reg, Register scratch1, | 596 Register object_reg, Register holder_reg, Register scratch1, |
| 630 Register scratch2, Handle<Name> name, Label* miss, | 597 Register scratch2, Handle<Name> name, Label* miss, |
| 631 PrototypeCheckType check) { | 598 PrototypeCheckType check) { |
| 632 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); | 599 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); |
| 633 | 600 |
| 634 // Make sure there's no overlap between holder and object registers. | 601 // Make sure there's no overlap between holder and object registers. |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 // ----------------------------------- | 1193 // ----------------------------------- |
| 1227 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1194 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1228 } | 1195 } |
| 1229 | 1196 |
| 1230 | 1197 |
| 1231 #undef __ | 1198 #undef __ |
| 1232 | 1199 |
| 1233 } } // namespace v8::internal | 1200 } } // namespace v8::internal |
| 1234 | 1201 |
| 1235 #endif // V8_TARGET_ARCH_IA32 | 1202 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |