OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 524 } |
525 } | 525 } |
526 | 526 |
527 __ Bind(&exit); | 527 __ Bind(&exit); |
528 // Return the value (register x0). | 528 // Return the value (register x0). |
529 DCHECK(value_reg.is(x0)); | 529 DCHECK(value_reg.is(x0)); |
530 __ Ret(); | 530 __ Ret(); |
531 } | 531 } |
532 | 532 |
533 | 533 |
534 // Generate StoreField code, value is passed in x0 register. | 534 void NamedStoreHandlerCompiler::GenerateStoreField(LookupResult* lookup, |
535 // When leaving generated code after success, the receiver_reg and name_reg may | 535 Register value_reg, |
536 // be clobbered. Upon branch to miss_label, the receiver and name registers have | 536 Label* miss_label) { |
537 // their original values. | |
538 void NamedStoreHandlerCompiler::GenerateStoreField( | |
539 Handle<JSObject> object, LookupResult* lookup, Register receiver_reg, | |
540 Register name_reg, Register value_reg, Register scratch1, Register scratch2, | |
541 Label* miss_label) { | |
542 // x0 : value | |
543 Label exit; | |
544 | |
545 // Stub never generated for objects that require access checks. | |
546 DCHECK(!object->IsAccessCheckNeeded()); | |
547 DCHECK(!object->IsJSGlobalProxy()); | |
548 | |
549 FieldIndex index = lookup->GetFieldIndex(); | |
550 | |
551 DCHECK(lookup->representation().IsHeapObject()); | 537 DCHECK(lookup->representation().IsHeapObject()); |
552 __ JumpIfSmi(value_reg, miss_label); | 538 __ JumpIfSmi(value_reg, miss_label); |
553 HeapType* field_type = lookup->GetFieldType(); | 539 HeapType::Iterator<Map> it = lookup->GetFieldType()->Classes(); |
554 HeapType::Iterator<Map> it = field_type->Classes(); | 540 __ Ldr(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset)); |
555 if (!it.Done()) { | 541 Label do_store; |
556 __ Ldr(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset)); | 542 while (true) { |
557 Label do_store; | 543 __ CompareMap(scratch1(), it.Current()); |
558 while (true) { | 544 it.Advance(); |
559 __ CompareMap(scratch1, it.Current()); | 545 if (it.Done()) { |
560 it.Advance(); | 546 __ B(ne, miss_label); |
561 if (it.Done()) { | 547 break; |
562 __ B(ne, miss_label); | |
563 break; | |
564 } | |
565 __ B(eq, &do_store); | |
566 } | 548 } |
567 __ Bind(&do_store); | 549 __ B(eq, &do_store); |
568 } | 550 } |
| 551 __ Bind(&do_store); |
569 | 552 |
570 if (index.is_inobject()) { | 553 StoreFieldStub stub(isolate(), lookup->GetFieldIndex(), |
571 // Set the property straight into the object. | 554 lookup->representation()); |
572 __ Str(value_reg, FieldMemOperand(receiver_reg, index.offset())); | 555 GenerateTailCall(masm(), stub.GetCode()); |
573 | |
574 // Skip updating write barrier if storing a smi. | |
575 __ JumpIfSmi(value_reg, &exit); | |
576 | |
577 // Update the write barrier for the array address. | |
578 // Pass the now unused name_reg as a scratch register. | |
579 __ Mov(name_reg, value_reg); | |
580 __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1, | |
581 kLRHasNotBeenSaved, kDontSaveFPRegs, | |
582 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
583 } else { | |
584 // Write to the properties array. | |
585 // Get the properties array | |
586 __ Ldr(scratch1, | |
587 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | |
588 __ Str(value_reg, FieldMemOperand(scratch1, index.offset())); | |
589 | |
590 // Skip updating write barrier if storing a smi. | |
591 __ JumpIfSmi(value_reg, &exit); | |
592 | |
593 // Update the write barrier for the array address. | |
594 // Ok to clobber receiver_reg and name_reg, since we return. | |
595 __ Mov(name_reg, value_reg); | |
596 __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg, | |
597 kLRHasNotBeenSaved, kDontSaveFPRegs, | |
598 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
599 } | |
600 | |
601 __ Bind(&exit); | |
602 // Return the value (register x0). | |
603 DCHECK(value_reg.is(x0)); | |
604 __ Ret(); | |
605 } | 556 } |
606 | 557 |
607 | 558 |
608 Register PropertyHandlerCompiler::CheckPrototypes( | 559 Register PropertyHandlerCompiler::CheckPrototypes( |
609 Register object_reg, Register holder_reg, Register scratch1, | 560 Register object_reg, Register holder_reg, Register scratch1, |
610 Register scratch2, Handle<Name> name, Label* miss, | 561 Register scratch2, Handle<Name> name, Label* miss, |
611 PrototypeCheckType check) { | 562 PrototypeCheckType check) { |
612 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); | 563 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); |
613 | 564 |
614 // object_reg and holder_reg registers can alias. | 565 // object_reg and holder_reg registers can alias. |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 | 1146 |
1196 // Miss case, call the runtime. | 1147 // Miss case, call the runtime. |
1197 __ Bind(&miss); | 1148 __ Bind(&miss); |
1198 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1149 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1199 } | 1150 } |
1200 | 1151 |
1201 | 1152 |
1202 } } // namespace v8::internal | 1153 } } // namespace v8::internal |
1203 | 1154 |
1204 #endif // V8_TARGET_ARCH_ARM64 | 1155 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |