| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
| 8 | 8 |
| 9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
| 10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); | 216 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); |
| 217 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); | 217 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); |
| 218 __ push(name); | 218 __ push(name); |
| 219 __ push(receiver); | 219 __ push(receiver); |
| 220 __ push(holder); | 220 __ push(holder); |
| 221 } | 221 } |
| 222 | 222 |
| 223 | 223 |
| 224 static void CompileCallLoadPropertyWithInterceptor( | 224 static void CompileCallLoadPropertyWithInterceptor( |
| 225 MacroAssembler* masm, Register receiver, Register holder, Register name, | 225 MacroAssembler* masm, Register receiver, Register holder, Register name, |
| 226 Handle<JSObject> holder_obj, IC::UtilityId id) { | 226 Handle<JSObject> holder_obj, Runtime::FunctionId id) { |
| 227 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 227 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
| 228 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), | 228 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength); |
| 229 NamedLoadHandlerCompiler::kInterceptorArgsLength); | |
| 230 } | 229 } |
| 231 | 230 |
| 232 | 231 |
| 233 // Generate call to api function. | 232 // Generate call to api function. |
| 234 void PropertyHandlerCompiler::GenerateApiAccessorCall( | 233 void PropertyHandlerCompiler::GenerateApiAccessorCall( |
| 235 MacroAssembler* masm, const CallOptimization& optimization, | 234 MacroAssembler* masm, const CallOptimization& optimization, |
| 236 Handle<Map> receiver_map, Register receiver, Register scratch_in, | 235 Handle<Map> receiver_map, Register receiver, Register scratch_in, |
| 237 bool is_store, Register store_parameter, Register accessor_holder, | 236 bool is_store, Register store_parameter, Register accessor_holder, |
| 238 int accessor_index) { | 237 int accessor_index) { |
| 239 DCHECK(!accessor_holder.is(scratch_in)); | 238 DCHECK(!accessor_holder.is(scratch_in)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 307 } |
| 309 | 308 |
| 310 | 309 |
| 311 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { | 310 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { |
| 312 // Push receiver, key and value for runtime call. | 311 // Push receiver, key and value for runtime call. |
| 313 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), | 312 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
| 314 StoreDescriptor::ValueRegister()); | 313 StoreDescriptor::ValueRegister()); |
| 315 | 314 |
| 316 // The slow case calls into the runtime to complete the store without causing | 315 // The slow case calls into the runtime to complete the store without causing |
| 317 // an IC miss that would otherwise cause a transition to the generic stub. | 316 // an IC miss that would otherwise cause a transition to the generic stub. |
| 318 ExternalReference ref = | 317 __ TailCallRuntime(Runtime::kStoreIC_Slow, 3, 1); |
| 319 ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate()); | |
| 320 __ TailCallExternalReference(ref, 3, 1); | |
| 321 } | 318 } |
| 322 | 319 |
| 323 | 320 |
| 324 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { | 321 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { |
| 325 // Push receiver, key and value for runtime call. | 322 // Push receiver, key and value for runtime call. |
| 326 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), | 323 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
| 327 StoreDescriptor::ValueRegister()); | 324 StoreDescriptor::ValueRegister()); |
| 328 | 325 |
| 329 // The slow case calls into the runtime to complete the store without causing | 326 // The slow case calls into the runtime to complete the store without causing |
| 330 // an IC miss that would otherwise cause a transition to the generic stub. | 327 // an IC miss that would otherwise cause a transition to the generic stub. |
| 331 ExternalReference ref = | 328 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 3, 1); |
| 332 ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate()); | |
| 333 __ TailCallExternalReference(ref, 3, 1); | |
| 334 } | 329 } |
| 335 | 330 |
| 336 | 331 |
| 337 #undef __ | 332 #undef __ |
| 338 #define __ ACCESS_MASM(masm()) | 333 #define __ ACCESS_MASM(masm()) |
| 339 | 334 |
| 340 | 335 |
| 341 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 336 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
| 342 Handle<Name> name) { | 337 Handle<Name> name) { |
| 343 if (!label->is_unused()) { | 338 if (!label->is_unused()) { |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 __ Push(receiver(), holder_reg, this->name()); | 652 __ Push(receiver(), holder_reg, this->name()); |
| 658 } else { | 653 } else { |
| 659 __ Push(holder_reg, this->name()); | 654 __ Push(holder_reg, this->name()); |
| 660 } | 655 } |
| 661 InterceptorVectorSlotPush(holder_reg); | 656 InterceptorVectorSlotPush(holder_reg); |
| 662 // Invoke an interceptor. Note: map checks from receiver to | 657 // Invoke an interceptor. Note: map checks from receiver to |
| 663 // interceptor's holder has been compiled before (see a caller | 658 // interceptor's holder has been compiled before (see a caller |
| 664 // of this method.) | 659 // of this method.) |
| 665 CompileCallLoadPropertyWithInterceptor( | 660 CompileCallLoadPropertyWithInterceptor( |
| 666 masm(), receiver(), holder_reg, this->name(), holder(), | 661 masm(), receiver(), holder_reg, this->name(), holder(), |
| 667 IC::kLoadPropertyWithInterceptorOnly); | 662 Runtime::kLoadPropertyWithInterceptorOnly); |
| 668 | 663 |
| 669 // Check if interceptor provided a value for property. If it's | 664 // Check if interceptor provided a value for property. If it's |
| 670 // the case, return immediately. | 665 // the case, return immediately. |
| 671 Label interceptor_failed; | 666 Label interceptor_failed; |
| 672 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); | 667 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); |
| 673 __ cmp(r0, scratch1()); | 668 __ cmp(r0, scratch1()); |
| 674 __ b(eq, &interceptor_failed); | 669 __ b(eq, &interceptor_failed); |
| 675 frame_scope.GenerateLeaveFrame(); | 670 frame_scope.GenerateLeaveFrame(); |
| 676 __ Ret(); | 671 __ Ret(); |
| 677 | 672 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 689 } | 684 } |
| 690 | 685 |
| 691 | 686 |
| 692 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 687 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
| 693 // Call the runtime system to load the interceptor. | 688 // Call the runtime system to load the interceptor. |
| 694 DCHECK(holder()->HasNamedInterceptor()); | 689 DCHECK(holder()->HasNamedInterceptor()); |
| 695 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 690 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
| 696 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 691 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
| 697 holder()); | 692 holder()); |
| 698 | 693 |
| 699 ExternalReference ref = ExternalReference( | 694 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor, |
| 700 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); | 695 NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); |
| 701 __ TailCallExternalReference( | |
| 702 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | |
| 703 } | 696 } |
| 704 | 697 |
| 705 | 698 |
| 706 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 699 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
| 707 Handle<JSObject> object, Handle<Name> name, | 700 Handle<JSObject> object, Handle<Name> name, |
| 708 Handle<ExecutableAccessorInfo> callback) { | 701 Handle<ExecutableAccessorInfo> callback) { |
| 709 Register holder_reg = Frontend(name); | 702 Register holder_reg = Frontend(name); |
| 710 | 703 |
| 711 __ push(receiver()); // receiver | 704 __ push(receiver()); // receiver |
| 712 __ push(holder_reg); | 705 __ push(holder_reg); |
| 713 | 706 |
| 714 // If the callback cannot leak, then push the callback directly, | 707 // If the callback cannot leak, then push the callback directly, |
| 715 // otherwise wrap it in a weak cell. | 708 // otherwise wrap it in a weak cell. |
| 716 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 709 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
| 717 __ mov(ip, Operand(callback)); | 710 __ mov(ip, Operand(callback)); |
| 718 } else { | 711 } else { |
| 719 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 712 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
| 720 __ mov(ip, Operand(cell)); | 713 __ mov(ip, Operand(cell)); |
| 721 } | 714 } |
| 722 __ push(ip); | 715 __ push(ip); |
| 723 __ mov(ip, Operand(name)); | 716 __ mov(ip, Operand(name)); |
| 724 __ Push(ip, value()); | 717 __ Push(ip, value()); |
| 725 | 718 |
| 726 // Do tail-call to the runtime system. | 719 // Do tail-call to the runtime system. |
| 727 ExternalReference store_callback_property = | 720 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5, 1); |
| 728 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | |
| 729 __ TailCallExternalReference(store_callback_property, 5, 1); | |
| 730 | 721 |
| 731 // Return the generated code. | 722 // Return the generated code. |
| 732 return GetCode(kind(), Code::FAST, name); | 723 return GetCode(kind(), Code::FAST, name); |
| 733 } | 724 } |
| 734 | 725 |
| 735 | 726 |
| 736 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 727 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
| 737 Handle<Name> name) { | 728 Handle<Name> name) { |
| 738 __ Push(receiver(), this->name(), value()); | 729 __ Push(receiver(), this->name(), value()); |
| 739 | 730 |
| 740 // Do tail-call to the runtime system. | 731 // Do tail-call to the runtime system. |
| 741 ExternalReference store_ic_property = ExternalReference( | 732 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3, 1); |
| 742 IC_Utility(IC::kStorePropertyWithInterceptor), isolate()); | |
| 743 __ TailCallExternalReference(store_ic_property, 3, 1); | |
| 744 | 733 |
| 745 // Return the generated code. | 734 // Return the generated code. |
| 746 return GetCode(kind(), Code::FAST, name); | 735 return GetCode(kind(), Code::FAST, name); |
| 747 } | 736 } |
| 748 | 737 |
| 749 | 738 |
| 750 Register NamedStoreHandlerCompiler::value() { | 739 Register NamedStoreHandlerCompiler::value() { |
| 751 return StoreDescriptor::ValueRegister(); | 740 return StoreDescriptor::ValueRegister(); |
| 752 } | 741 } |
| 753 | 742 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 // Return the generated code. | 774 // Return the generated code. |
| 786 return GetCode(kind(), Code::NORMAL, name); | 775 return GetCode(kind(), Code::NORMAL, name); |
| 787 } | 776 } |
| 788 | 777 |
| 789 | 778 |
| 790 #undef __ | 779 #undef __ |
| 791 } // namespace internal | 780 } // namespace internal |
| 792 } // namespace v8 | 781 } // namespace v8 |
| 793 | 782 |
| 794 #endif // V8_TARGET_ARCH_ARM | 783 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |