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 #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 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 __ bind(&l_call); | 2259 __ bind(&l_call); |
2260 __ lw(load_receiver, MemOperand(sp, kPointerSize)); | 2260 __ lw(load_receiver, MemOperand(sp, kPointerSize)); |
2261 __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); | 2261 __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); |
2262 __ li(LoadDescriptor::SlotRegister(), | 2262 __ li(LoadDescriptor::SlotRegister(), |
2263 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2263 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2264 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 2264 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
2265 CallIC(ic, TypeFeedbackId::None()); | 2265 CallIC(ic, TypeFeedbackId::None()); |
2266 __ mov(a0, v0); | 2266 __ mov(a0, v0); |
2267 __ mov(a1, a0); | 2267 __ mov(a1, a0); |
2268 __ sw(a1, MemOperand(sp, 2 * kPointerSize)); | 2268 __ sw(a1, MemOperand(sp, 2 * kPointerSize)); |
| 2269 SetCallPosition(expr, 1); |
2269 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2270 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2270 __ CallStub(&stub); | 2271 __ CallStub(&stub); |
2271 | 2272 |
2272 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2273 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2273 __ Drop(1); // The function is still on the stack; drop it. | 2274 __ Drop(1); // The function is still on the stack; drop it. |
2274 | 2275 |
2275 // if (!result.done) goto l_try; | 2276 // if (!result.done) goto l_try; |
2276 __ Move(load_receiver, v0); | 2277 __ Move(load_receiver, v0); |
2277 | 2278 |
2278 __ push(load_receiver); // save result | 2279 __ push(load_receiver); // save result |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3082 | 3083 |
3083 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 3084 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
3084 // Load the arguments. | 3085 // Load the arguments. |
3085 ZoneList<Expression*>* args = expr->arguments(); | 3086 ZoneList<Expression*>* args = expr->arguments(); |
3086 int arg_count = args->length(); | 3087 int arg_count = args->length(); |
3087 for (int i = 0; i < arg_count; i++) { | 3088 for (int i = 0; i < arg_count; i++) { |
3088 VisitForStackValue(args->at(i)); | 3089 VisitForStackValue(args->at(i)); |
3089 } | 3090 } |
3090 | 3091 |
3091 // Record source position of the IC call. | 3092 // Record source position of the IC call. |
3092 SetExpressionPosition(expr); | 3093 SetCallPosition(expr, arg_count); |
3093 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 3094 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
3094 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 3095 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
3095 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3096 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3096 // Don't assign a type feedback id to the IC, since type feedback is provided | 3097 // Don't assign a type feedback id to the IC, since type feedback is provided |
3097 // by the vector above. | 3098 // by the vector above. |
3098 CallIC(ic); | 3099 CallIC(ic); |
3099 | 3100 |
3100 RecordJSReturnSite(expr); | 3101 RecordJSReturnSite(expr); |
3101 // Restore context register. | 3102 // Restore context register. |
3102 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3103 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3198 Comment cmnt(masm_, "[ Call"); | 3199 Comment cmnt(masm_, "[ Call"); |
3199 Expression* callee = expr->expression(); | 3200 Expression* callee = expr->expression(); |
3200 Call::CallType call_type = expr->GetCallType(isolate()); | 3201 Call::CallType call_type = expr->GetCallType(isolate()); |
3201 | 3202 |
3202 if (call_type == Call::POSSIBLY_EVAL_CALL) { | 3203 if (call_type == Call::POSSIBLY_EVAL_CALL) { |
3203 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval | 3204 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
3204 // to resolve the function we need to call. Then we call the resolved | 3205 // to resolve the function we need to call. Then we call the resolved |
3205 // function using the given arguments. | 3206 // function using the given arguments. |
3206 ZoneList<Expression*>* args = expr->arguments(); | 3207 ZoneList<Expression*>* args = expr->arguments(); |
3207 int arg_count = args->length(); | 3208 int arg_count = args->length(); |
3208 PushCalleeAndWithBaseObject(expr); | 3209 PushCalleeAndWithBaseObject(expr); |
3209 | 3210 |
3210 // Push the arguments. | 3211 // Push the arguments. |
3211 for (int i = 0; i < arg_count; i++) { | 3212 for (int i = 0; i < arg_count; i++) { |
3212 VisitForStackValue(args->at(i)); | 3213 VisitForStackValue(args->at(i)); |
3213 } | 3214 } |
3214 | 3215 |
3215 // Push a copy of the function (found below the arguments) and | 3216 // Push a copy of the function (found below the arguments) and |
3216 // resolve eval. | 3217 // resolve eval. |
3217 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3218 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3218 __ push(a1); | 3219 __ push(a1); |
3219 EmitResolvePossiblyDirectEval(arg_count); | 3220 EmitResolvePossiblyDirectEval(arg_count); |
3220 | 3221 |
3221 // Touch up the stack with the resolved function. | 3222 // Touch up the stack with the resolved function. |
3222 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3223 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3223 | 3224 |
3224 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 3225 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
3225 // Record source position for debugger. | 3226 // Record source position for debugger. |
3226 SetExpressionPosition(expr); | 3227 SetCallPosition(expr, arg_count); |
3227 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 3228 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
3228 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3229 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3229 __ CallStub(&stub); | 3230 __ CallStub(&stub); |
3230 RecordJSReturnSite(expr); | 3231 RecordJSReturnSite(expr); |
3231 // Restore context register. | 3232 // Restore context register. |
3232 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3233 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3233 context()->DropAndPlug(1, v0); | 3234 context()->DropAndPlug(1, v0); |
3234 } else if (call_type == Call::GLOBAL_CALL) { | 3235 } else if (call_type == Call::GLOBAL_CALL) { |
3235 EmitCallWithLoadIC(expr); | 3236 EmitCallWithLoadIC(expr); |
3236 } else if (call_type == Call::LOOKUP_SLOT_CALL) { | 3237 } else if (call_type == Call::LOOKUP_SLOT_CALL) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3287 | 3288 |
3288 // Push the arguments ("left-to-right") on the stack. | 3289 // Push the arguments ("left-to-right") on the stack. |
3289 ZoneList<Expression*>* args = expr->arguments(); | 3290 ZoneList<Expression*>* args = expr->arguments(); |
3290 int arg_count = args->length(); | 3291 int arg_count = args->length(); |
3291 for (int i = 0; i < arg_count; i++) { | 3292 for (int i = 0; i < arg_count; i++) { |
3292 VisitForStackValue(args->at(i)); | 3293 VisitForStackValue(args->at(i)); |
3293 } | 3294 } |
3294 | 3295 |
3295 // Call the construct call builtin that handles allocation and | 3296 // Call the construct call builtin that handles allocation and |
3296 // constructor invocation. | 3297 // constructor invocation. |
3297 SetExpressionPosition(expr); | 3298 SetConstructCallPosition(expr); |
3298 | 3299 |
3299 // Load function and argument count into a1 and a0. | 3300 // Load function and argument count into a1 and a0. |
3300 __ li(a0, Operand(arg_count)); | 3301 __ li(a0, Operand(arg_count)); |
3301 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); | 3302 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); |
3302 | 3303 |
3303 // Record call targets in unoptimized code. | 3304 // Record call targets in unoptimized code. |
3304 if (FLAG_pretenuring_call_new) { | 3305 if (FLAG_pretenuring_call_new) { |
3305 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3306 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
3306 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 3307 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
3307 expr->CallNewFeedbackSlot().ToInt() + 1); | 3308 expr->CallNewFeedbackSlot().ToInt() + 1); |
(...skipping 22 matching lines...) Expand all Loading... |
3330 | 3331 |
3331 // Push the arguments ("left-to-right") on the stack. | 3332 // Push the arguments ("left-to-right") on the stack. |
3332 ZoneList<Expression*>* args = expr->arguments(); | 3333 ZoneList<Expression*>* args = expr->arguments(); |
3333 int arg_count = args->length(); | 3334 int arg_count = args->length(); |
3334 for (int i = 0; i < arg_count; i++) { | 3335 for (int i = 0; i < arg_count; i++) { |
3335 VisitForStackValue(args->at(i)); | 3336 VisitForStackValue(args->at(i)); |
3336 } | 3337 } |
3337 | 3338 |
3338 // Call the construct call builtin that handles allocation and | 3339 // Call the construct call builtin that handles allocation and |
3339 // constructor invocation. | 3340 // constructor invocation. |
3340 SetExpressionPosition(expr); | 3341 SetConstructCallPosition(expr); |
3341 | 3342 |
3342 // Load function and argument count into a1 and a0. | 3343 // Load function and argument count into a1 and a0. |
3343 __ li(a0, Operand(arg_count)); | 3344 __ li(a0, Operand(arg_count)); |
3344 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); | 3345 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); |
3345 | 3346 |
3346 // Record call targets in unoptimized code. | 3347 // Record call targets in unoptimized code. |
3347 if (FLAG_pretenuring_call_new) { | 3348 if (FLAG_pretenuring_call_new) { |
3348 UNREACHABLE(); | 3349 UNREACHABLE(); |
3349 /* TODO(dslomov): support pretenuring. | 3350 /* TODO(dslomov): support pretenuring. |
3350 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3351 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4744 __ li(LoadDescriptor::SlotRegister(), | 4745 __ li(LoadDescriptor::SlotRegister(), |
4745 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4746 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4746 CallLoadIC(NOT_CONTEXTUAL); | 4747 CallLoadIC(NOT_CONTEXTUAL); |
4747 } | 4748 } |
4748 | 4749 |
4749 | 4750 |
4750 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4751 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4751 ZoneList<Expression*>* args = expr->arguments(); | 4752 ZoneList<Expression*>* args = expr->arguments(); |
4752 int arg_count = args->length(); | 4753 int arg_count = args->length(); |
4753 | 4754 |
4754 SetExpressionPosition(expr); | 4755 SetCallPosition(expr, arg_count); |
4755 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4756 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
4756 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4757 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
4757 __ CallStub(&stub); | 4758 __ CallStub(&stub); |
4758 } | 4759 } |
4759 | 4760 |
4760 | 4761 |
4761 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4762 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4762 ZoneList<Expression*>* args = expr->arguments(); | 4763 ZoneList<Expression*>* args = expr->arguments(); |
4763 int arg_count = args->length(); | 4764 int arg_count = args->length(); |
4764 | 4765 |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5550 reinterpret_cast<uint32_t>( | 5551 reinterpret_cast<uint32_t>( |
5551 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5552 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5552 return OSR_AFTER_STACK_CHECK; | 5553 return OSR_AFTER_STACK_CHECK; |
5553 } | 5554 } |
5554 | 5555 |
5555 | 5556 |
5556 } // namespace internal | 5557 } // namespace internal |
5557 } // namespace v8 | 5558 } // namespace v8 |
5558 | 5559 |
5559 #endif // V8_TARGET_ARCH_MIPS | 5560 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |