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