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