| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS | 
| 6 | 6 | 
| 7 // Note on Mips implementation: | 7 // Note on Mips implementation: | 
| 8 // | 8 // | 
| 9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined | 
| 10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first | 
| (...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2118       __ lw(load_receiver, MemOperand(sp, kPointerSize)); | 2118       __ lw(load_receiver, MemOperand(sp, kPointerSize)); | 
| 2119       __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); | 2119       __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); | 
| 2120       __ li(LoadDescriptor::SlotRegister(), | 2120       __ li(LoadDescriptor::SlotRegister(), | 
| 2121             Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2121             Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 
| 2122       Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 2122       Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 
| 2123       CallIC(ic, TypeFeedbackId::None()); | 2123       CallIC(ic, TypeFeedbackId::None()); | 
| 2124       __ mov(a0, v0); | 2124       __ mov(a0, v0); | 
| 2125       __ mov(a1, a0); | 2125       __ mov(a1, a0); | 
| 2126       __ sw(a1, MemOperand(sp, 2 * kPointerSize)); | 2126       __ sw(a1, MemOperand(sp, 2 * kPointerSize)); | 
| 2127       SetCallPosition(expr, 1); | 2127       SetCallPosition(expr, 1); | 
| 2128       CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2128       __ li(a0, Operand(1)); | 
| 2129       __ CallStub(&stub); | 2129       __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 
| 2130 | 2130 | 
| 2131       __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2131       __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 
| 2132       __ Drop(1);  // The function is still on the stack; drop it. | 2132       __ Drop(1);  // The function is still on the stack; drop it. | 
| 2133 | 2133 | 
| 2134       // if (!result.done) goto l_try; | 2134       // if (!result.done) goto l_try; | 
| 2135       __ Move(load_receiver, v0); | 2135       __ Move(load_receiver, v0); | 
| 2136 | 2136 | 
| 2137       __ push(load_receiver);                               // save result | 2137       __ push(load_receiver);                               // save result | 
| 2138       __ LoadRoot(load_name, Heap::kdone_stringRootIndex);  // "done" | 2138       __ LoadRoot(load_name, Heap::kdone_stringRootIndex);  // "done" | 
| 2139       __ li(LoadDescriptor::SlotRegister(), | 2139       __ li(LoadDescriptor::SlotRegister(), | 
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2804                                TypeFeedbackId id) { | 2804                                TypeFeedbackId id) { | 
| 2805   ic_total_count_++; | 2805   ic_total_count_++; | 
| 2806   __ Call(code, RelocInfo::CODE_TARGET, id); | 2806   __ Call(code, RelocInfo::CODE_TARGET, id); | 
| 2807 } | 2807 } | 
| 2808 | 2808 | 
| 2809 | 2809 | 
| 2810 // Code common for calls using the IC. | 2810 // Code common for calls using the IC. | 
| 2811 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { | 2811 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { | 
| 2812   Expression* callee = expr->expression(); | 2812   Expression* callee = expr->expression(); | 
| 2813 | 2813 | 
| 2814   CallICState::CallType call_type = |  | 
| 2815       callee->IsVariableProxy() ? CallICState::FUNCTION : CallICState::METHOD; |  | 
| 2816 |  | 
| 2817   // Get the target function. | 2814   // Get the target function. | 
| 2818   if (call_type == CallICState::FUNCTION) { | 2815   if (callee->IsVariableProxy()) { | 
| 2819     { StackValueContext context(this); | 2816     { StackValueContext context(this); | 
| 2820       EmitVariableLoad(callee->AsVariableProxy()); | 2817       EmitVariableLoad(callee->AsVariableProxy()); | 
| 2821       PrepareForBailout(callee, NO_REGISTERS); | 2818       PrepareForBailout(callee, NO_REGISTERS); | 
| 2822     } | 2819     } | 
| 2823     // Push undefined as receiver. This is patched in the method prologue if it | 2820     // Push undefined as receiver. This is patched in the method prologue if it | 
| 2824     // is a sloppy mode method. | 2821     // is a sloppy mode method. | 
| 2825     __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 2822     __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 
| 2826     __ push(at); | 2823     __ push(at); | 
| 2827   } else { | 2824   } else { | 
| 2828     // Load the function from the receiver. | 2825     // Load the function from the receiver. | 
| 2829     DCHECK(callee->IsProperty()); | 2826     DCHECK(callee->IsProperty()); | 
| 2830     DCHECK(!callee->AsProperty()->IsSuperAccess()); | 2827     DCHECK(!callee->AsProperty()->IsSuperAccess()); | 
| 2831     __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 2828     __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 
| 2832     EmitNamedPropertyLoad(callee->AsProperty()); | 2829     EmitNamedPropertyLoad(callee->AsProperty()); | 
| 2833     PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2830     PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 
| 2834     // Push the target function under the receiver. | 2831     // Push the target function under the receiver. | 
| 2835     __ lw(at, MemOperand(sp, 0)); | 2832     __ lw(at, MemOperand(sp, 0)); | 
| 2836     __ push(at); | 2833     __ push(at); | 
| 2837     __ sw(v0, MemOperand(sp, kPointerSize)); | 2834     __ sw(v0, MemOperand(sp, kPointerSize)); | 
| 2838   } | 2835   } | 
| 2839 | 2836 | 
| 2840   EmitCall(expr, call_type); | 2837   EmitCall(expr); | 
| 2841 } | 2838 } | 
| 2842 | 2839 | 
| 2843 | 2840 | 
| 2844 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { | 2841 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { | 
| 2845   SetExpressionPosition(expr); | 2842   SetExpressionPosition(expr); | 
| 2846   Expression* callee = expr->expression(); | 2843   Expression* callee = expr->expression(); | 
| 2847   DCHECK(callee->IsProperty()); | 2844   DCHECK(callee->IsProperty()); | 
| 2848   Property* prop = callee->AsProperty(); | 2845   Property* prop = callee->AsProperty(); | 
| 2849   DCHECK(prop->IsSuperAccess()); | 2846   DCHECK(prop->IsSuperAccess()); | 
| 2850 | 2847 | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 2868   //  - key | 2865   //  - key | 
| 2869   //  - language_mode | 2866   //  - language_mode | 
| 2870   __ CallRuntime(Runtime::kLoadFromSuper, 4); | 2867   __ CallRuntime(Runtime::kLoadFromSuper, 4); | 
| 2871 | 2868 | 
| 2872   // Replace home_object with target function. | 2869   // Replace home_object with target function. | 
| 2873   __ sw(v0, MemOperand(sp, kPointerSize)); | 2870   __ sw(v0, MemOperand(sp, kPointerSize)); | 
| 2874 | 2871 | 
| 2875   // Stack here: | 2872   // Stack here: | 
| 2876   // - target function | 2873   // - target function | 
| 2877   // - this (receiver) | 2874   // - this (receiver) | 
| 2878   EmitCall(expr, CallICState::METHOD); | 2875   EmitCall(expr); | 
| 2879 } | 2876 } | 
| 2880 | 2877 | 
| 2881 | 2878 | 
| 2882 // Code common for calls using the IC. | 2879 // Code common for calls using the IC. | 
| 2883 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, | 2880 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, | 
| 2884                                                 Expression* key) { | 2881                                                 Expression* key) { | 
| 2885   // Load the key. | 2882   // Load the key. | 
| 2886   VisitForAccumulatorValue(key); | 2883   VisitForAccumulatorValue(key); | 
| 2887 | 2884 | 
| 2888   Expression* callee = expr->expression(); | 2885   Expression* callee = expr->expression(); | 
| 2889 | 2886 | 
| 2890   // Load the function from the receiver. | 2887   // Load the function from the receiver. | 
| 2891   DCHECK(callee->IsProperty()); | 2888   DCHECK(callee->IsProperty()); | 
| 2892   __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 2889   __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 
| 2893   __ Move(LoadDescriptor::NameRegister(), v0); | 2890   __ Move(LoadDescriptor::NameRegister(), v0); | 
| 2894   EmitKeyedPropertyLoad(callee->AsProperty()); | 2891   EmitKeyedPropertyLoad(callee->AsProperty()); | 
| 2895   PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2892   PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 
| 2896 | 2893 | 
| 2897   // Push the target function under the receiver. | 2894   // Push the target function under the receiver. | 
| 2898   __ lw(at, MemOperand(sp, 0)); | 2895   __ lw(at, MemOperand(sp, 0)); | 
| 2899   __ push(at); | 2896   __ push(at); | 
| 2900   __ sw(v0, MemOperand(sp, kPointerSize)); | 2897   __ sw(v0, MemOperand(sp, kPointerSize)); | 
| 2901 | 2898 | 
| 2902   EmitCall(expr, CallICState::METHOD); | 2899   EmitCall(expr); | 
| 2903 } | 2900 } | 
| 2904 | 2901 | 
| 2905 | 2902 | 
| 2906 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 2903 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 
| 2907   Expression* callee = expr->expression(); | 2904   Expression* callee = expr->expression(); | 
| 2908   DCHECK(callee->IsProperty()); | 2905   DCHECK(callee->IsProperty()); | 
| 2909   Property* prop = callee->AsProperty(); | 2906   Property* prop = callee->AsProperty(); | 
| 2910   DCHECK(prop->IsSuperAccess()); | 2907   DCHECK(prop->IsSuperAccess()); | 
| 2911 | 2908 | 
| 2912   SetExpressionPosition(prop); | 2909   SetExpressionPosition(prop); | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 2928   //  - key | 2925   //  - key | 
| 2929   //  - language_mode | 2926   //  - language_mode | 
| 2930   __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); | 2927   __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); | 
| 2931 | 2928 | 
| 2932   // Replace home_object with target function. | 2929   // Replace home_object with target function. | 
| 2933   __ sw(v0, MemOperand(sp, kPointerSize)); | 2930   __ sw(v0, MemOperand(sp, kPointerSize)); | 
| 2934 | 2931 | 
| 2935   // Stack here: | 2932   // Stack here: | 
| 2936   // - target function | 2933   // - target function | 
| 2937   // - this (receiver) | 2934   // - this (receiver) | 
| 2938   EmitCall(expr, CallICState::METHOD); | 2935   EmitCall(expr); | 
| 2939 } | 2936 } | 
| 2940 | 2937 | 
| 2941 | 2938 | 
| 2942 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 2939 void FullCodeGenerator::EmitCall(Call* expr) { | 
| 2943   // Load the arguments. | 2940   // Load the arguments. | 
| 2944   ZoneList<Expression*>* args = expr->arguments(); | 2941   ZoneList<Expression*>* args = expr->arguments(); | 
| 2945   int arg_count = args->length(); | 2942   int arg_count = args->length(); | 
| 2946   for (int i = 0; i < arg_count; i++) { | 2943   for (int i = 0; i < arg_count; i++) { | 
| 2947     VisitForStackValue(args->at(i)); | 2944     VisitForStackValue(args->at(i)); | 
| 2948   } | 2945   } | 
| 2949 | 2946 | 
| 2950   PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | 2947   PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | 
| 2951   // Record source position of the IC call. | 2948   // Record source position of the IC call. | 
| 2952   SetCallPosition(expr, arg_count); | 2949   SetCallPosition(expr, arg_count); | 
| 2953   Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 2950   Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count).code(); | 
| 2954   __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 2951   __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 
| 2955   __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2952   __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 
| 2956   // Don't assign a type feedback id to the IC, since type feedback is provided | 2953   // Don't assign a type feedback id to the IC, since type feedback is provided | 
| 2957   // by the vector above. | 2954   // by the vector above. | 
| 2958   CallIC(ic); | 2955   CallIC(ic); | 
| 2959 | 2956 | 
| 2960   RecordJSReturnSite(expr); | 2957   RecordJSReturnSite(expr); | 
| 2961   // Restore context register. | 2958   // Restore context register. | 
| 2962   __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2959   __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 
| 2963   context()->DropAndPlug(1, v0); | 2960   context()->DropAndPlug(1, v0); | 
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3050   __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3047   __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 
| 3051   __ push(a1); | 3048   __ push(a1); | 
| 3052   EmitResolvePossiblyDirectEval(arg_count); | 3049   EmitResolvePossiblyDirectEval(arg_count); | 
| 3053 | 3050 | 
| 3054   // Touch up the stack with the resolved function. | 3051   // Touch up the stack with the resolved function. | 
| 3055   __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3052   __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 
| 3056 | 3053 | 
| 3057   PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 3054   PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 
| 3058   // Record source position for debugger. | 3055   // Record source position for debugger. | 
| 3059   SetCallPosition(expr, arg_count); | 3056   SetCallPosition(expr, arg_count); | 
| 3060   CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |  | 
| 3061   __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3057   __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 
| 3062   __ CallStub(&stub); | 3058   __ li(a0, Operand(arg_count)); | 
|  | 3059   __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 
| 3063   RecordJSReturnSite(expr); | 3060   RecordJSReturnSite(expr); | 
| 3064   // Restore context register. | 3061   // Restore context register. | 
| 3065   __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3062   __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 
| 3066   context()->DropAndPlug(1, v0); | 3063   context()->DropAndPlug(1, v0); | 
| 3067 } | 3064 } | 
| 3068 | 3065 | 
| 3069 | 3066 | 
| 3070 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 3067 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 
| 3071   Comment cmnt(masm_, "[ CallNew"); | 3068   Comment cmnt(masm_, "[ CallNew"); | 
| 3072   // According to ECMA-262, section 11.2.2, page 44, the function | 3069   // According to ECMA-262, section 11.2.2, page 44, the function | 
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4294   __ lw(v0, FieldMemOperand(v0, JSGlobalObject::kNativeContextOffset)); | 4291   __ lw(v0, FieldMemOperand(v0, JSGlobalObject::kNativeContextOffset)); | 
| 4295   __ lw(v0, ContextOperand(v0, expr->context_index())); | 4292   __ lw(v0, ContextOperand(v0, expr->context_index())); | 
| 4296 } | 4293 } | 
| 4297 | 4294 | 
| 4298 | 4295 | 
| 4299 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4296 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 
| 4300   ZoneList<Expression*>* args = expr->arguments(); | 4297   ZoneList<Expression*>* args = expr->arguments(); | 
| 4301   int arg_count = args->length(); | 4298   int arg_count = args->length(); | 
| 4302 | 4299 | 
| 4303   SetCallPosition(expr, arg_count); | 4300   SetCallPosition(expr, arg_count); | 
| 4304   CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |  | 
| 4305   __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4301   __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 
| 4306   __ CallStub(&stub); | 4302   __ li(a0, Operand(arg_count)); | 
|  | 4303   __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 
| 4307 } | 4304 } | 
| 4308 | 4305 | 
| 4309 | 4306 | 
| 4310 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4307 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 
| 4311   ZoneList<Expression*>* args = expr->arguments(); | 4308   ZoneList<Expression*>* args = expr->arguments(); | 
| 4312   int arg_count = args->length(); | 4309   int arg_count = args->length(); | 
| 4313 | 4310 | 
| 4314   if (expr->is_jsruntime()) { | 4311   if (expr->is_jsruntime()) { | 
| 4315     Comment cmnt(masm_, "[ CallRuntime"); | 4312     Comment cmnt(masm_, "[ CallRuntime"); | 
| 4316     EmitLoadJSRuntimeFunction(expr); | 4313     EmitLoadJSRuntimeFunction(expr); | 
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5108          reinterpret_cast<uint32_t>( | 5105          reinterpret_cast<uint32_t>( | 
| 5109              isolate->builtins()->OsrAfterStackCheck()->entry())); | 5106              isolate->builtins()->OsrAfterStackCheck()->entry())); | 
| 5110   return OSR_AFTER_STACK_CHECK; | 5107   return OSR_AFTER_STACK_CHECK; | 
| 5111 } | 5108 } | 
| 5112 | 5109 | 
| 5113 | 5110 | 
| 5114 }  // namespace internal | 5111 }  // namespace internal | 
| 5115 }  // namespace v8 | 5112 }  // namespace v8 | 
| 5116 | 5113 | 
| 5117 #endif  // V8_TARGET_ARCH_MIPS | 5114 #endif  // V8_TARGET_ARCH_MIPS | 
| OLD | NEW | 
|---|