| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 6 | 6 |
| 7 #include "src/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
| 8 | 8 |
| 9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
| 10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 } | 625 } |
| 626 } | 626 } |
| 627 | 627 |
| 628 | 628 |
| 629 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 629 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 630 // Return the constant value. | 630 // Return the constant value. |
| 631 __ LoadObject(x0, value); | 631 __ LoadObject(x0, value); |
| 632 __ Ret(); | 632 __ Ret(); |
| 633 } | 633 } |
| 634 | 634 |
| 635 | |
| 636 void NamedLoadHandlerCompiler::GenerateLoadCallback( | |
| 637 Register reg, Handle<AccessorInfo> callback) { | |
| 638 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver())); | |
| 639 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg)); | |
| 640 | |
| 641 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | |
| 642 // name below the exit frame to make GC aware of them. | |
| 643 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | |
| 644 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); | |
| 645 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); | |
| 646 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); | |
| 647 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); | |
| 648 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); | |
| 649 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); | |
| 650 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); | |
| 651 | |
| 652 __ Push(receiver()); | |
| 653 | |
| 654 Handle<Object> data(callback->data(), isolate()); | |
| 655 if (data->IsUndefined() || data->IsSmi()) { | |
| 656 __ Mov(scratch3(), Operand(data)); | |
| 657 } else { | |
| 658 Handle<WeakCell> cell = | |
| 659 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); | |
| 660 // The callback is alive if this instruction is executed, | |
| 661 // so the weak cell is not cleared and points to data. | |
| 662 __ GetWeakValue(scratch3(), cell); | |
| 663 } | |
| 664 __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex); | |
| 665 __ Mov(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); | |
| 666 __ Push(scratch3(), scratch4(), scratch4(), scratch2(), reg); | |
| 667 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false | |
| 668 __ Push(name()); | |
| 669 | |
| 670 // Abi for CallApiGetter. | |
| 671 Register getter_address_reg = x2; | |
| 672 | |
| 673 // Set up the call. | |
| 674 Address getter_address = v8::ToCData<Address>(callback->getter()); | |
| 675 ApiFunction fun(getter_address); | |
| 676 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; | |
| 677 ExternalReference ref = ExternalReference(&fun, type, isolate()); | |
| 678 __ Mov(getter_address_reg, ref); | |
| 679 | |
| 680 CallApiGetterStub stub(isolate()); | |
| 681 __ TailCallStub(&stub); | |
| 682 } | |
| 683 | |
| 684 | |
| 685 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 635 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
| 686 LookupIterator* it, Register holder_reg) { | 636 LookupIterator* it, Register holder_reg) { |
| 687 DCHECK(!AreAliased(receiver(), this->name(), scratch1(), scratch2(), | 637 DCHECK(!AreAliased(receiver(), this->name(), scratch1(), scratch2(), |
| 688 scratch3())); | 638 scratch3())); |
| 689 DCHECK(holder()->HasNamedInterceptor()); | 639 DCHECK(holder()->HasNamedInterceptor()); |
| 690 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 640 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
| 691 | 641 |
| 692 // Compile the interceptor call, followed by inline code to load the | 642 // Compile the interceptor call, followed by inline code to load the |
| 693 // property from further up the prototype chain if the call fails. | 643 // property from further up the prototype chain if the call fails. |
| 694 // Check that the maps haven't changed. | 644 // Check that the maps haven't changed. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 // Return the generated code. | 734 // Return the generated code. |
| 785 return GetCode(kind(), name); | 735 return GetCode(kind(), name); |
| 786 } | 736 } |
| 787 | 737 |
| 788 | 738 |
| 789 #undef __ | 739 #undef __ |
| 790 } // namespace internal | 740 } // namespace internal |
| 791 } // namespace v8 | 741 } // namespace v8 |
| 792 | 742 |
| 793 #endif // V8_TARGET_ARCH_IA32 | 743 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |