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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); | 125 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); |
126 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); | 126 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); |
127 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); | 127 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); |
128 | 128 |
129 __ Push(name, receiver, holder); | 129 __ Push(name, receiver, holder); |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 static void CompileCallLoadPropertyWithInterceptor( | 133 static void CompileCallLoadPropertyWithInterceptor( |
134 MacroAssembler* masm, Register receiver, Register holder, Register name, | 134 MacroAssembler* masm, Register receiver, Register holder, Register name, |
135 Handle<JSObject> holder_obj, IC::UtilityId id) { | 135 Handle<JSObject> holder_obj, Runtime::FunctionId id) { |
136 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 136 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
137 | 137 |
138 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), | 138 __ CallExternalReference( |
139 NamedLoadHandlerCompiler::kInterceptorArgsLength); | 139 ExternalReference(Runtime::FunctionForId(id), masm->isolate()), |
| 140 NamedLoadHandlerCompiler::kInterceptorArgsLength); |
140 } | 141 } |
141 | 142 |
142 | 143 |
143 // Generate call to api function. | 144 // Generate call to api function. |
144 void PropertyHandlerCompiler::GenerateApiAccessorCall( | 145 void PropertyHandlerCompiler::GenerateApiAccessorCall( |
145 MacroAssembler* masm, const CallOptimization& optimization, | 146 MacroAssembler* masm, const CallOptimization& optimization, |
146 Handle<Map> receiver_map, Register receiver, Register scratch, | 147 Handle<Map> receiver_map, Register receiver, Register scratch, |
147 bool is_store, Register store_parameter, Register accessor_holder, | 148 bool is_store, Register store_parameter, Register accessor_holder, |
148 int accessor_index) { | 149 int accessor_index) { |
149 DCHECK(!AreAliased(accessor_holder, scratch)); | 150 DCHECK(!AreAliased(accessor_holder, scratch)); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 302 } |
302 | 303 |
303 | 304 |
304 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { | 305 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { |
305 // Push receiver, name and value for runtime call. | 306 // Push receiver, name and value for runtime call. |
306 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), | 307 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
307 StoreDescriptor::ValueRegister()); | 308 StoreDescriptor::ValueRegister()); |
308 | 309 |
309 // The slow case calls into the runtime to complete the store without causing | 310 // The slow case calls into the runtime to complete the store without causing |
310 // an IC miss that would otherwise cause a transition to the generic stub. | 311 // an IC miss that would otherwise cause a transition to the generic stub. |
311 ExternalReference ref = | 312 ExternalReference ref = ExternalReference( |
312 ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate()); | 313 Runtime::FunctionForId(Runtime::kStoreIC_Slow), masm->isolate()); |
313 __ TailCallExternalReference(ref, 3, 1); | 314 __ TailCallExternalReference(ref, 3, 1); |
314 } | 315 } |
315 | 316 |
316 | 317 |
317 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { | 318 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { |
318 ASM_LOCATION("ElementHandlerCompiler::GenerateStoreSlow"); | 319 ASM_LOCATION("ElementHandlerCompiler::GenerateStoreSlow"); |
319 | 320 |
320 // Push receiver, key and value for runtime call. | 321 // Push receiver, key and value for runtime call. |
321 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), | 322 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
322 StoreDescriptor::ValueRegister()); | 323 StoreDescriptor::ValueRegister()); |
323 | 324 |
324 // The slow case calls into the runtime to complete the store without causing | 325 // The slow case calls into the runtime to complete the store without causing |
325 // an IC miss that would otherwise cause a transition to the generic stub. | 326 // an IC miss that would otherwise cause a transition to the generic stub. |
326 ExternalReference ref = | 327 ExternalReference ref = ExternalReference( |
327 ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate()); | 328 Runtime::FunctionForId(Runtime::kKeyedStoreIC_Slow), masm->isolate()); |
328 __ TailCallExternalReference(ref, 3, 1); | 329 __ TailCallExternalReference(ref, 3, 1); |
329 } | 330 } |
330 | 331 |
331 | 332 |
332 #undef __ | 333 #undef __ |
333 #define __ ACCESS_MASM(masm()) | 334 #define __ ACCESS_MASM(masm()) |
334 | 335 |
335 | 336 |
336 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( | 337 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( |
337 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { | 338 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 370 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
370 Handle<Name> name) { | 371 Handle<Name> name) { |
371 Label miss; | 372 Label miss; |
372 | 373 |
373 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreInterceptor"); | 374 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreInterceptor"); |
374 | 375 |
375 __ Push(receiver(), this->name(), value()); | 376 __ Push(receiver(), this->name(), value()); |
376 | 377 |
377 // Do tail-call to the runtime system. | 378 // Do tail-call to the runtime system. |
378 ExternalReference store_ic_property = ExternalReference( | 379 ExternalReference store_ic_property = ExternalReference( |
379 IC_Utility(IC::kStorePropertyWithInterceptor), isolate()); | 380 Runtime::FunctionForId(Runtime::kStorePropertyWithInterceptor), |
| 381 isolate()); |
380 __ TailCallExternalReference(store_ic_property, 3, 1); | 382 __ TailCallExternalReference(store_ic_property, 3, 1); |
381 | 383 |
382 // Return the generated code. | 384 // Return the generated code. |
383 return GetCode(kind(), Code::FAST, name); | 385 return GetCode(kind(), Code::FAST, name); |
384 } | 386 } |
385 | 387 |
386 | 388 |
387 Register NamedStoreHandlerCompiler::value() { | 389 Register NamedStoreHandlerCompiler::value() { |
388 return StoreDescriptor::ValueRegister(); | 390 return StoreDescriptor::ValueRegister(); |
389 } | 391 } |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 __ Push(receiver(), holder_reg, this->name()); | 723 __ Push(receiver(), holder_reg, this->name()); |
722 } else { | 724 } else { |
723 __ Push(holder_reg, this->name()); | 725 __ Push(holder_reg, this->name()); |
724 } | 726 } |
725 InterceptorVectorSlotPush(holder_reg); | 727 InterceptorVectorSlotPush(holder_reg); |
726 // Invoke an interceptor. Note: map checks from receiver to | 728 // Invoke an interceptor. Note: map checks from receiver to |
727 // interceptor's holder has been compiled before (see a caller | 729 // interceptor's holder has been compiled before (see a caller |
728 // of this method.) | 730 // of this method.) |
729 CompileCallLoadPropertyWithInterceptor( | 731 CompileCallLoadPropertyWithInterceptor( |
730 masm(), receiver(), holder_reg, this->name(), holder(), | 732 masm(), receiver(), holder_reg, this->name(), holder(), |
731 IC::kLoadPropertyWithInterceptorOnly); | 733 Runtime::kLoadPropertyWithInterceptorOnly); |
732 | 734 |
733 // Check if interceptor provided a value for property. If it's | 735 // Check if interceptor provided a value for property. If it's |
734 // the case, return immediately. | 736 // the case, return immediately. |
735 Label interceptor_failed; | 737 Label interceptor_failed; |
736 __ JumpIfRoot(x0, Heap::kNoInterceptorResultSentinelRootIndex, | 738 __ JumpIfRoot(x0, Heap::kNoInterceptorResultSentinelRootIndex, |
737 &interceptor_failed); | 739 &interceptor_failed); |
738 frame_scope.GenerateLeaveFrame(); | 740 frame_scope.GenerateLeaveFrame(); |
739 __ Ret(); | 741 __ Ret(); |
740 | 742 |
741 __ Bind(&interceptor_failed); | 743 __ Bind(&interceptor_failed); |
(...skipping 11 matching lines...) Expand all Loading... |
753 | 755 |
754 | 756 |
755 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 757 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
756 // Call the runtime system to load the interceptor. | 758 // Call the runtime system to load the interceptor. |
757 DCHECK(holder()->HasNamedInterceptor()); | 759 DCHECK(holder()->HasNamedInterceptor()); |
758 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 760 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
759 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 761 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
760 holder()); | 762 holder()); |
761 | 763 |
762 ExternalReference ref = ExternalReference( | 764 ExternalReference ref = ExternalReference( |
763 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); | 765 Runtime::FunctionForId(Runtime::kLoadPropertyWithInterceptor), isolate()); |
764 __ TailCallExternalReference( | 766 __ TailCallExternalReference( |
765 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | 767 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); |
766 } | 768 } |
767 | 769 |
768 | 770 |
769 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 771 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
770 Handle<JSObject> object, Handle<Name> name, | 772 Handle<JSObject> object, Handle<Name> name, |
771 Handle<ExecutableAccessorInfo> callback) { | 773 Handle<ExecutableAccessorInfo> callback) { |
772 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); | 774 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); |
773 Register holder_reg = Frontend(name); | 775 Register holder_reg = Frontend(name); |
774 | 776 |
775 // Stub never generated for non-global objects that require access checks. | 777 // Stub never generated for non-global objects that require access checks. |
776 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); | 778 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); |
777 | 779 |
778 // receiver() and holder_reg can alias. | 780 // receiver() and holder_reg can alias. |
779 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); | 781 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); |
780 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); | 782 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); |
781 // If the callback cannot leak, then push the callback directly, | 783 // If the callback cannot leak, then push the callback directly, |
782 // otherwise wrap it in a weak cell. | 784 // otherwise wrap it in a weak cell. |
783 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 785 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
784 __ Mov(scratch1(), Operand(callback)); | 786 __ Mov(scratch1(), Operand(callback)); |
785 } else { | 787 } else { |
786 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 788 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
787 __ Mov(scratch1(), Operand(cell)); | 789 __ Mov(scratch1(), Operand(cell)); |
788 } | 790 } |
789 __ Mov(scratch2(), Operand(name)); | 791 __ Mov(scratch2(), Operand(name)); |
790 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); | 792 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); |
791 | 793 |
792 // Do tail-call to the runtime system. | 794 // Do tail-call to the runtime system. |
793 ExternalReference store_callback_property = | 795 ExternalReference store_callback_property = ExternalReference( |
794 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 796 Runtime::FunctionForId(Runtime::kStoreCallbackProperty), isolate()); |
795 __ TailCallExternalReference(store_callback_property, 5, 1); | 797 __ TailCallExternalReference(store_callback_property, 5, 1); |
796 | 798 |
797 // Return the generated code. | 799 // Return the generated code. |
798 return GetCode(kind(), Code::FAST, name); | 800 return GetCode(kind(), Code::FAST, name); |
799 } | 801 } |
800 | 802 |
801 | 803 |
802 #undef __ | 804 #undef __ |
803 } // namespace internal | 805 } // namespace internal |
804 } // namespace v8 | 806 } // namespace v8 |
805 | 807 |
806 #endif // V8_TARGET_ARCH_IA32 | 808 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |