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