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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); | 210 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); |
211 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); | 211 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); |
212 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); | 212 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); |
213 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); | 213 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); |
214 __ Push(name, receiver, holder); | 214 __ Push(name, receiver, holder); |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 static void CompileCallLoadPropertyWithInterceptor( | 218 static void CompileCallLoadPropertyWithInterceptor( |
219 MacroAssembler* masm, Register receiver, Register holder, Register name, | 219 MacroAssembler* masm, Register receiver, Register holder, Register name, |
220 Handle<JSObject> holder_obj, IC::UtilityId id) { | 220 Handle<JSObject> holder_obj, Runtime::FunctionId id) { |
221 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 221 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
222 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), | 222 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength); |
223 NamedLoadHandlerCompiler::kInterceptorArgsLength); | |
224 } | 223 } |
225 | 224 |
226 | 225 |
227 // Generate call to api function. | 226 // Generate call to api function. |
228 void PropertyHandlerCompiler::GenerateApiAccessorCall( | 227 void PropertyHandlerCompiler::GenerateApiAccessorCall( |
229 MacroAssembler* masm, const CallOptimization& optimization, | 228 MacroAssembler* masm, const CallOptimization& optimization, |
230 Handle<Map> receiver_map, Register receiver, Register scratch_in, | 229 Handle<Map> receiver_map, Register receiver, Register scratch_in, |
231 bool is_store, Register store_parameter, Register accessor_holder, | 230 bool is_store, Register store_parameter, Register accessor_holder, |
232 int accessor_index) { | 231 int accessor_index) { |
233 DCHECK(!accessor_holder.is(scratch_in)); | 232 DCHECK(!accessor_holder.is(scratch_in)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 298 } |
300 | 299 |
301 | 300 |
302 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { | 301 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { |
303 // Push receiver, key and value for runtime call. | 302 // Push receiver, key and value for runtime call. |
304 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), | 303 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
305 StoreDescriptor::ValueRegister()); | 304 StoreDescriptor::ValueRegister()); |
306 | 305 |
307 // The slow case calls into the runtime to complete the store without causing | 306 // The slow case calls into the runtime to complete the store without causing |
308 // an IC miss that would otherwise cause a transition to the generic stub. | 307 // an IC miss that would otherwise cause a transition to the generic stub. |
309 ExternalReference ref = | 308 __ TailCallRuntime(Runtime::kStoreIC_Slow, 3, 1); |
310 ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate()); | |
311 __ TailCallExternalReference(ref, 3, 1); | |
312 } | 309 } |
313 | 310 |
314 | 311 |
315 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { | 312 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { |
316 // Push receiver, key and value for runtime call. | 313 // Push receiver, key and value for runtime call. |
317 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), | 314 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
318 StoreDescriptor::ValueRegister()); | 315 StoreDescriptor::ValueRegister()); |
319 | 316 |
320 // 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 |
321 // 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. |
322 ExternalReference ref = | 319 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 3, 1); |
323 ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate()); | |
324 __ TailCallExternalReference(ref, 3, 1); | |
325 } | 320 } |
326 | 321 |
327 | 322 |
328 #undef __ | 323 #undef __ |
329 #define __ ACCESS_MASM(masm()) | 324 #define __ ACCESS_MASM(masm()) |
330 | 325 |
331 | 326 |
332 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 327 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
333 Handle<Name> name) { | 328 Handle<Name> name) { |
334 if (!label->is_unused()) { | 329 if (!label->is_unused()) { |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 __ Push(receiver(), holder_reg, this->name()); | 645 __ Push(receiver(), holder_reg, this->name()); |
651 } else { | 646 } else { |
652 __ Push(holder_reg, this->name()); | 647 __ Push(holder_reg, this->name()); |
653 } | 648 } |
654 InterceptorVectorSlotPush(holder_reg); | 649 InterceptorVectorSlotPush(holder_reg); |
655 // Invoke an interceptor. Note: map checks from receiver to | 650 // Invoke an interceptor. Note: map checks from receiver to |
656 // interceptor's holder has been compiled before (see a caller | 651 // interceptor's holder has been compiled before (see a caller |
657 // of this method). | 652 // of this method). |
658 CompileCallLoadPropertyWithInterceptor( | 653 CompileCallLoadPropertyWithInterceptor( |
659 masm(), receiver(), holder_reg, this->name(), holder(), | 654 masm(), receiver(), holder_reg, this->name(), holder(), |
660 IC::kLoadPropertyWithInterceptorOnly); | 655 Runtime::kLoadPropertyWithInterceptorOnly); |
661 | 656 |
662 // Check if interceptor provided a value for property. If it's | 657 // Check if interceptor provided a value for property. If it's |
663 // the case, return immediately. | 658 // the case, return immediately. |
664 Label interceptor_failed; | 659 Label interceptor_failed; |
665 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); | 660 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); |
666 __ Branch(&interceptor_failed, eq, v0, Operand(scratch1())); | 661 __ Branch(&interceptor_failed, eq, v0, Operand(scratch1())); |
667 frame_scope.GenerateLeaveFrame(); | 662 frame_scope.GenerateLeaveFrame(); |
668 __ Ret(); | 663 __ Ret(); |
669 | 664 |
670 __ bind(&interceptor_failed); | 665 __ bind(&interceptor_failed); |
(...skipping 10 matching lines...) Expand all Loading... |
681 } | 676 } |
682 | 677 |
683 | 678 |
684 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 679 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
685 // Call the runtime system to load the interceptor. | 680 // Call the runtime system to load the interceptor. |
686 DCHECK(holder()->HasNamedInterceptor()); | 681 DCHECK(holder()->HasNamedInterceptor()); |
687 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 682 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
688 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 683 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
689 holder()); | 684 holder()); |
690 | 685 |
691 ExternalReference ref = ExternalReference( | 686 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor, |
692 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); | 687 NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); |
693 __ TailCallExternalReference( | |
694 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | |
695 } | 688 } |
696 | 689 |
697 | 690 |
698 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 691 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
699 Handle<JSObject> object, Handle<Name> name, | 692 Handle<JSObject> object, Handle<Name> name, |
700 Handle<ExecutableAccessorInfo> callback) { | 693 Handle<ExecutableAccessorInfo> callback) { |
701 Register holder_reg = Frontend(name); | 694 Register holder_reg = Frontend(name); |
702 | 695 |
703 __ Push(receiver(), holder_reg); // Receiver. | 696 __ Push(receiver(), holder_reg); // Receiver. |
704 // If the callback cannot leak, then push the callback directly, | 697 // If the callback cannot leak, then push the callback directly, |
705 // otherwise wrap it in a weak cell. | 698 // otherwise wrap it in a weak cell. |
706 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 699 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
707 __ li(at, Operand(callback)); | 700 __ li(at, Operand(callback)); |
708 } else { | 701 } else { |
709 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 702 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
710 __ li(at, Operand(cell)); | 703 __ li(at, Operand(cell)); |
711 } | 704 } |
712 __ push(at); | 705 __ push(at); |
713 __ li(at, Operand(name)); | 706 __ li(at, Operand(name)); |
714 __ Push(at, value()); | 707 __ Push(at, value()); |
715 | 708 |
716 // Do tail-call to the runtime system. | 709 // Do tail-call to the runtime system. |
717 ExternalReference store_callback_property = | 710 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5, 1); |
718 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | |
719 __ TailCallExternalReference(store_callback_property, 5, 1); | |
720 | 711 |
721 // Return the generated code. | 712 // Return the generated code. |
722 return GetCode(kind(), Code::FAST, name); | 713 return GetCode(kind(), Code::FAST, name); |
723 } | 714 } |
724 | 715 |
725 | 716 |
726 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 717 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
727 Handle<Name> name) { | 718 Handle<Name> name) { |
728 __ Push(receiver(), this->name(), value()); | 719 __ Push(receiver(), this->name(), value()); |
729 | 720 |
730 // Do tail-call to the runtime system. | 721 // Do tail-call to the runtime system. |
731 ExternalReference store_ic_property = ExternalReference( | 722 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3, 1); |
732 IC_Utility(IC::kStorePropertyWithInterceptor), isolate()); | |
733 __ TailCallExternalReference(store_ic_property, 3, 1); | |
734 | 723 |
735 // Return the generated code. | 724 // Return the generated code. |
736 return GetCode(kind(), Code::FAST, name); | 725 return GetCode(kind(), Code::FAST, name); |
737 } | 726 } |
738 | 727 |
739 | 728 |
740 Register NamedStoreHandlerCompiler::value() { | 729 Register NamedStoreHandlerCompiler::value() { |
741 return StoreDescriptor::ValueRegister(); | 730 return StoreDescriptor::ValueRegister(); |
742 } | 731 } |
743 | 732 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 // Return the generated code. | 765 // Return the generated code. |
777 return GetCode(kind(), Code::NORMAL, name); | 766 return GetCode(kind(), Code::NORMAL, name); |
778 } | 767 } |
779 | 768 |
780 | 769 |
781 #undef __ | 770 #undef __ |
782 } // namespace internal | 771 } // namespace internal |
783 } // namespace v8 | 772 } // namespace v8 |
784 | 773 |
785 #endif // V8_TARGET_ARCH_MIPS64 | 774 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |