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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 589 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
590 // Return the constant value. | 590 // Return the constant value. |
591 __ Move(r0, value); | 591 __ Move(r0, value); |
592 __ Ret(); | 592 __ Ret(); |
593 } | 593 } |
594 | 594 |
595 | 595 |
596 void NamedLoadHandlerCompiler::GenerateLoadCallback( | 596 void NamedLoadHandlerCompiler::GenerateLoadCallback( |
597 Register reg, Handle<AccessorInfo> callback) { | 597 Register reg, Handle<AccessorInfo> callback) { |
598 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver())); | 598 // Build AccessorInfo::args_ list on the stack and push property name below |
599 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg)); | 599 // the exit frame to make GC aware of them and store pointers to them. |
600 | 600 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
601 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | 601 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
602 // name below the exit frame to make GC aware of them. | 602 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
603 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | 603 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
604 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); | 604 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
605 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); | 605 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
606 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); | 606 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
607 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); | 607 DCHECK(!scratch2().is(reg)); |
608 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); | 608 DCHECK(!scratch3().is(reg)); |
609 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); | 609 DCHECK(!scratch4().is(reg)); |
610 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); | |
611 | |
612 __ push(receiver()); | 610 __ push(receiver()); |
613 // Push data from AccessorInfo. | 611 // Push data from AccessorInfo. |
614 Handle<Object> data(callback->data(), isolate()); | 612 Handle<Object> data(callback->data(), isolate()); |
615 if (data->IsUndefined() || data->IsSmi()) { | 613 if (data->IsUndefined() || data->IsSmi()) { |
616 __ Move(scratch2(), data); | 614 __ Move(scratch3(), data); |
617 } else { | 615 } else { |
618 Handle<WeakCell> cell = | 616 Handle<WeakCell> cell = |
619 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); | 617 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
620 // The callback is alive if this instruction is executed, | 618 // The callback is alive if this instruction is executed, |
621 // so the weak cell is not cleared and points to data. | 619 // so the weak cell is not cleared and points to data. |
622 __ GetWeakValue(scratch2(), cell); | 620 __ GetWeakValue(scratch3(), cell); |
623 } | 621 } |
624 __ push(scratch2()); | 622 __ push(scratch3()); |
625 __ LoadRoot(scratch2(), Heap::kUndefinedValueRootIndex); | 623 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); |
626 __ Push(scratch2(), scratch2()); | 624 __ mov(scratch4(), scratch3()); |
627 __ mov(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); | 625 __ Push(scratch3(), scratch4()); |
628 __ Push(scratch2(), reg); | 626 __ mov(scratch4(), Operand(ExternalReference::isolate_address(isolate()))); |
629 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false | 627 __ Push(scratch4(), reg); |
| 628 __ mov(scratch2(), sp); // scratch2 = PropertyAccessorInfo::args_ |
630 __ push(name()); | 629 __ push(name()); |
631 | 630 |
632 // Abi for CallApiGetter | 631 // Abi for CallApiGetter |
633 Register getter_address_reg = ApiGetterDescriptor::function_address(); | 632 Register getter_address_reg = ApiGetterDescriptor::function_address(); |
634 | 633 |
635 Address getter_address = v8::ToCData<Address>(callback->getter()); | 634 Address getter_address = v8::ToCData<Address>(callback->getter()); |
636 ApiFunction fun(getter_address); | 635 ApiFunction fun(getter_address); |
637 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; | 636 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; |
638 ExternalReference ref = ExternalReference(&fun, type, isolate()); | 637 ExternalReference ref = ExternalReference(&fun, type, isolate()); |
639 __ mov(getter_address_reg, Operand(ref)); | 638 __ mov(getter_address_reg, Operand(ref)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 DCHECK(holder()->HasNamedInterceptor()); | 707 DCHECK(holder()->HasNamedInterceptor()); |
709 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 708 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
710 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 709 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
711 holder()); | 710 holder()); |
712 | 711 |
713 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 712 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
714 } | 713 } |
715 | 714 |
716 | 715 |
717 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 716 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
718 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, | 717 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback) { |
719 LanguageMode language_mode) { | |
720 Register holder_reg = Frontend(name); | 718 Register holder_reg = Frontend(name); |
721 | 719 |
722 __ push(receiver()); // receiver | 720 __ push(receiver()); // receiver |
723 __ push(holder_reg); | 721 __ push(holder_reg); |
724 | 722 |
725 // If the callback cannot leak, then push the callback directly, | 723 // If the callback cannot leak, then push the callback directly, |
726 // otherwise wrap it in a weak cell. | 724 // otherwise wrap it in a weak cell. |
727 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 725 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
728 __ mov(ip, Operand(callback)); | 726 __ mov(ip, Operand(callback)); |
729 } else { | 727 } else { |
730 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 728 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
731 __ mov(ip, Operand(cell)); | 729 __ mov(ip, Operand(cell)); |
732 } | 730 } |
733 __ push(ip); | 731 __ push(ip); |
734 __ mov(ip, Operand(name)); | 732 __ mov(ip, Operand(name)); |
735 __ Push(ip, value()); | 733 __ Push(ip, value()); |
736 __ Push(Smi::FromInt(language_mode)); | |
737 | 734 |
738 // Do tail-call to the runtime system. | 735 // Do tail-call to the runtime system. |
739 __ TailCallRuntime(Runtime::kStoreCallbackProperty); | 736 __ TailCallRuntime(Runtime::kStoreCallbackProperty); |
740 | 737 |
741 // Return the generated code. | 738 // Return the generated code. |
742 return GetCode(kind(), Code::FAST, name); | 739 return GetCode(kind(), Code::FAST, name); |
743 } | 740 } |
744 | 741 |
745 | 742 |
746 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 743 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 // Return the generated code. | 790 // Return the generated code. |
794 return GetCode(kind(), Code::NORMAL, name); | 791 return GetCode(kind(), Code::NORMAL, name); |
795 } | 792 } |
796 | 793 |
797 | 794 |
798 #undef __ | 795 #undef __ |
799 } // namespace internal | 796 } // namespace internal |
800 } // namespace v8 | 797 } // namespace v8 |
801 | 798 |
802 #endif // V8_TARGET_ARCH_ARM | 799 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |