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_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 EMIT_REMEMBERED_SET, smi_check); | 509 EMIT_REMEMBERED_SET, smi_check); |
510 } | 510 } |
511 } | 511 } |
512 | 512 |
513 // Return the value (register rax). | 513 // Return the value (register rax). |
514 DCHECK(value_reg.is(rax)); | 514 DCHECK(value_reg.is(rax)); |
515 __ ret(0); | 515 __ ret(0); |
516 } | 516 } |
517 | 517 |
518 | 518 |
519 // Both name_reg and receiver_reg are preserved on jumps to miss_label, | 519 void NamedStoreHandlerCompiler::GenerateStoreField(LookupResult* lookup, |
520 // but may be destroyed if store is successful. | 520 Register value_reg, |
521 void NamedStoreHandlerCompiler::GenerateStoreField( | 521 Label* miss_label) { |
522 Handle<JSObject> object, LookupResult* lookup, Register receiver_reg, | |
523 Register name_reg, Register value_reg, Register scratch1, Register scratch2, | |
524 Label* miss_label) { | |
525 // Stub never generated for objects that require access checks. | |
526 DCHECK(!object->IsAccessCheckNeeded()); | |
527 DCHECK(!object->IsJSGlobalProxy()); | |
528 | |
529 FieldIndex index = lookup->GetFieldIndex(); | |
530 | |
531 DCHECK(lookup->representation().IsHeapObject()); | 522 DCHECK(lookup->representation().IsHeapObject()); |
532 __ JumpIfSmi(value_reg, miss_label); | 523 __ JumpIfSmi(value_reg, miss_label); |
533 HeapType* field_type = lookup->GetFieldType(); | 524 HeapType::Iterator<Map> it = lookup->GetFieldType()->Classes(); |
534 HeapType::Iterator<Map> it = field_type->Classes(); | 525 Label do_store; |
535 if (!it.Done()) { | 526 while (true) { |
536 Label do_store; | 527 __ CompareMap(value_reg, it.Current()); |
537 while (true) { | 528 it.Advance(); |
538 __ CompareMap(value_reg, it.Current()); | 529 if (it.Done()) { |
539 it.Advance(); | 530 __ j(not_equal, miss_label); |
540 if (it.Done()) { | 531 break; |
541 __ j(not_equal, miss_label); | |
542 break; | |
543 } | |
544 __ j(equal, &do_store, Label::kNear); | |
545 } | 532 } |
546 __ bind(&do_store); | 533 __ j(equal, &do_store, Label::kNear); |
547 } | 534 } |
| 535 __ bind(&do_store); |
548 | 536 |
549 if (index.is_inobject()) { | 537 StoreFieldStub stub(isolate(), lookup->GetFieldIndex(), |
550 // Set the property straight into the object. | 538 lookup->representation()); |
551 __ movp(FieldOperand(receiver_reg, index.offset()), value_reg); | 539 GenerateTailCall(masm(), stub.GetCode()); |
552 | |
553 // Update the write barrier for the array address. | |
554 // Pass the value being stored in the now unused name_reg. | |
555 __ movp(name_reg, value_reg); | |
556 __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1, | |
557 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
558 } else { | |
559 // Write to the properties array. | |
560 // Get the properties array (optimistically). | |
561 __ movp(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | |
562 __ movp(FieldOperand(scratch1, index.offset()), value_reg); | |
563 | |
564 // Update the write barrier for the array address. | |
565 // Pass the value being stored in the now unused name_reg. | |
566 __ movp(name_reg, value_reg); | |
567 __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg, | |
568 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
569 } | |
570 | |
571 // Return the value (register rax). | |
572 DCHECK(value_reg.is(rax)); | |
573 __ ret(0); | |
574 } | 540 } |
575 | 541 |
576 | 542 |
577 Register PropertyHandlerCompiler::CheckPrototypes( | 543 Register PropertyHandlerCompiler::CheckPrototypes( |
578 Register object_reg, Register holder_reg, Register scratch1, | 544 Register object_reg, Register holder_reg, Register scratch1, |
579 Register scratch2, Handle<Name> name, Label* miss, | 545 Register scratch2, Handle<Name> name, Label* miss, |
580 PrototypeCheckType check) { | 546 PrototypeCheckType check) { |
581 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); | 547 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); |
582 | 548 |
583 // Make sure there's no overlap between holder and object registers. | 549 // Make sure there's no overlap between holder and object registers. |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 // ----------------------------------- | 1139 // ----------------------------------- |
1174 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1140 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1175 } | 1141 } |
1176 | 1142 |
1177 | 1143 |
1178 #undef __ | 1144 #undef __ |
1179 | 1145 |
1180 } } // namespace v8::internal | 1146 } } // namespace v8::internal |
1181 | 1147 |
1182 #endif // V8_TARGET_ARCH_X64 | 1148 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |