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/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 | 639 |
640 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 640 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
641 // Return the constant value. | 641 // Return the constant value. |
642 __ LoadObject(x0, value); | 642 __ LoadObject(x0, value); |
643 __ Ret(); | 643 __ Ret(); |
644 } | 644 } |
645 | 645 |
646 | 646 |
647 void NamedLoadHandlerCompiler::GenerateLoadCallback( | 647 void NamedLoadHandlerCompiler::GenerateLoadCallback( |
648 Register reg, Handle<AccessorInfo> callback) { | 648 Register reg, Handle<AccessorInfo> callback) { |
649 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver())); | |
650 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg)); | 649 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg)); |
651 | 650 |
652 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | 651 // Build AccessorInfo::args_ list on the stack and push property |
653 // name below the exit frame to make GC aware of them. | 652 // name below the exit frame to make GC aware of them and store pointers to |
654 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | 653 // them. |
655 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); | 654 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
656 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); | 655 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
657 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); | 656 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
658 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); | 657 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
659 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); | 658 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
660 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); | 659 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
661 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); | 660 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
662 | 661 |
663 __ Push(receiver()); | 662 __ Push(receiver()); |
664 | 663 |
665 Handle<Object> data(callback->data(), isolate()); | 664 Handle<Object> data(callback->data(), isolate()); |
666 if (data->IsUndefined() || data->IsSmi()) { | 665 if (data->IsUndefined() || data->IsSmi()) { |
667 __ Mov(scratch3(), Operand(data)); | 666 __ Mov(scratch3(), Operand(data)); |
668 } else { | 667 } else { |
669 Handle<WeakCell> cell = | 668 Handle<WeakCell> cell = |
670 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); | 669 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
671 // The callback is alive if this instruction is executed, | 670 // The callback is alive if this instruction is executed, |
672 // so the weak cell is not cleared and points to data. | 671 // so the weak cell is not cleared and points to data. |
673 __ GetWeakValue(scratch3(), cell); | 672 __ GetWeakValue(scratch3(), cell); |
674 } | 673 } |
675 __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex); | 674 __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex); |
676 __ Mov(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); | 675 __ Mov(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); |
677 __ Push(scratch3(), scratch4(), scratch4(), scratch2(), reg); | 676 __ Push(scratch3(), scratch4(), scratch4(), scratch2(), reg, name()); |
678 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false | 677 |
679 __ Push(name()); | 678 Register args_addr = scratch2(); |
| 679 __ Add(args_addr, __ StackPointer(), kPointerSize); |
| 680 |
| 681 // Stack at this point: |
| 682 // sp[40] callback data |
| 683 // sp[32] undefined |
| 684 // sp[24] undefined |
| 685 // sp[16] isolate |
| 686 // args_addr -> sp[8] reg |
| 687 // sp[0] name |
680 | 688 |
681 // Abi for CallApiGetter. | 689 // Abi for CallApiGetter. |
682 Register getter_address_reg = x2; | 690 Register getter_address_reg = x2; |
683 | 691 |
684 // Set up the call. | 692 // Set up the call. |
685 Address getter_address = v8::ToCData<Address>(callback->getter()); | 693 Address getter_address = v8::ToCData<Address>(callback->getter()); |
686 ApiFunction fun(getter_address); | 694 ApiFunction fun(getter_address); |
687 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; | 695 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; |
688 ExternalReference ref = ExternalReference(&fun, type, isolate()); | 696 ExternalReference ref = ExternalReference(&fun, type, isolate()); |
689 __ Mov(getter_address_reg, ref); | 697 __ Mov(getter_address_reg, ref); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 DCHECK(holder()->HasNamedInterceptor()); | 767 DCHECK(holder()->HasNamedInterceptor()); |
760 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 768 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
761 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 769 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
762 holder()); | 770 holder()); |
763 | 771 |
764 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 772 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
765 } | 773 } |
766 | 774 |
767 | 775 |
768 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 776 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
769 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, | 777 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback) { |
770 LanguageMode language_mode) { | |
771 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); | 778 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); |
772 Register holder_reg = Frontend(name); | 779 Register holder_reg = Frontend(name); |
773 | 780 |
774 // Stub never generated for non-global objects that require access checks. | 781 // Stub never generated for non-global objects that require access checks. |
775 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); | 782 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); |
776 | 783 |
777 // receiver() and holder_reg can alias. | 784 // receiver() and holder_reg can alias. |
778 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); | 785 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); |
779 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); | 786 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); |
780 // If the callback cannot leak, then push the callback directly, | 787 // If the callback cannot leak, then push the callback directly, |
781 // otherwise wrap it in a weak cell. | 788 // otherwise wrap it in a weak cell. |
782 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 789 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
783 __ Mov(scratch1(), Operand(callback)); | 790 __ Mov(scratch1(), Operand(callback)); |
784 } else { | 791 } else { |
785 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 792 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
786 __ Mov(scratch1(), Operand(cell)); | 793 __ Mov(scratch1(), Operand(cell)); |
787 } | 794 } |
788 __ Mov(scratch2(), Operand(name)); | 795 __ Mov(scratch2(), Operand(name)); |
789 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); | 796 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); |
790 __ Push(Smi::FromInt(language_mode)); | |
791 | 797 |
792 // Do tail-call to the runtime system. | 798 // Do tail-call to the runtime system. |
793 __ TailCallRuntime(Runtime::kStoreCallbackProperty); | 799 __ TailCallRuntime(Runtime::kStoreCallbackProperty); |
794 | 800 |
795 // Return the generated code. | 801 // Return the generated code. |
796 return GetCode(kind(), Code::FAST, name); | 802 return GetCode(kind(), Code::FAST, name); |
797 } | 803 } |
798 | 804 |
799 | 805 |
800 #undef __ | 806 #undef __ |
801 } // namespace internal | 807 } // namespace internal |
802 } // namespace v8 | 808 } // namespace v8 |
803 | 809 |
804 #endif // V8_TARGET_ARCH_IA32 | 810 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |