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 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2248 __ bind(&l_call); | 2248 __ bind(&l_call); |
2249 __ lw(load_receiver, MemOperand(sp, kPointerSize)); | 2249 __ lw(load_receiver, MemOperand(sp, kPointerSize)); |
2250 __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); | 2250 __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); |
2251 __ li(LoadDescriptor::SlotRegister(), | 2251 __ li(LoadDescriptor::SlotRegister(), |
2252 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2252 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2253 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 2253 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
2254 CallIC(ic, TypeFeedbackId::None()); | 2254 CallIC(ic, TypeFeedbackId::None()); |
2255 __ mov(a0, v0); | 2255 __ mov(a0, v0); |
2256 __ mov(a1, a0); | 2256 __ mov(a1, a0); |
2257 __ sw(a1, MemOperand(sp, 2 * kPointerSize)); | 2257 __ sw(a1, MemOperand(sp, 2 * kPointerSize)); |
| 2258 SetCallPosition(expr, 1); |
2258 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2259 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2259 __ CallStub(&stub); | 2260 __ CallStub(&stub); |
2260 | 2261 |
2261 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2262 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2262 __ Drop(1); // The function is still on the stack; drop it. | 2263 __ Drop(1); // The function is still on the stack; drop it. |
2263 | 2264 |
2264 // if (!result.done) goto l_try; | 2265 // if (!result.done) goto l_try; |
2265 __ Move(load_receiver, v0); | 2266 __ Move(load_receiver, v0); |
2266 | 2267 |
2267 __ push(load_receiver); // save result | 2268 __ push(load_receiver); // save result |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3071 | 3072 |
3072 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 3073 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
3073 // Load the arguments. | 3074 // Load the arguments. |
3074 ZoneList<Expression*>* args = expr->arguments(); | 3075 ZoneList<Expression*>* args = expr->arguments(); |
3075 int arg_count = args->length(); | 3076 int arg_count = args->length(); |
3076 for (int i = 0; i < arg_count; i++) { | 3077 for (int i = 0; i < arg_count; i++) { |
3077 VisitForStackValue(args->at(i)); | 3078 VisitForStackValue(args->at(i)); |
3078 } | 3079 } |
3079 | 3080 |
3080 // Record source position of the IC call. | 3081 // Record source position of the IC call. |
3081 SetExpressionPosition(expr); | 3082 SetCallPosition(expr, arg_count); |
3082 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 3083 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
3083 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 3084 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
3084 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3085 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3085 // Don't assign a type feedback id to the IC, since type feedback is provided | 3086 // Don't assign a type feedback id to the IC, since type feedback is provided |
3086 // by the vector above. | 3087 // by the vector above. |
3087 CallIC(ic); | 3088 CallIC(ic); |
3088 | 3089 |
3089 RecordJSReturnSite(expr); | 3090 RecordJSReturnSite(expr); |
3090 // Restore context register. | 3091 // Restore context register. |
3091 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3092 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3187 Comment cmnt(masm_, "[ Call"); | 3188 Comment cmnt(masm_, "[ Call"); |
3188 Expression* callee = expr->expression(); | 3189 Expression* callee = expr->expression(); |
3189 Call::CallType call_type = expr->GetCallType(isolate()); | 3190 Call::CallType call_type = expr->GetCallType(isolate()); |
3190 | 3191 |
3191 if (call_type == Call::POSSIBLY_EVAL_CALL) { | 3192 if (call_type == Call::POSSIBLY_EVAL_CALL) { |
3192 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval | 3193 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
3193 // to resolve the function we need to call. Then we call the resolved | 3194 // to resolve the function we need to call. Then we call the resolved |
3194 // function using the given arguments. | 3195 // function using the given arguments. |
3195 ZoneList<Expression*>* args = expr->arguments(); | 3196 ZoneList<Expression*>* args = expr->arguments(); |
3196 int arg_count = args->length(); | 3197 int arg_count = args->length(); |
3197 PushCalleeAndWithBaseObject(expr); | 3198 PushCalleeAndWithBaseObject(expr); |
3198 | 3199 |
3199 // Push the arguments. | 3200 // Push the arguments. |
3200 for (int i = 0; i < arg_count; i++) { | 3201 for (int i = 0; i < arg_count; i++) { |
3201 VisitForStackValue(args->at(i)); | 3202 VisitForStackValue(args->at(i)); |
3202 } | 3203 } |
3203 | 3204 |
3204 // Push a copy of the function (found below the arguments) and | 3205 // Push a copy of the function (found below the arguments) and |
3205 // resolve eval. | 3206 // resolve eval. |
3206 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3207 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3207 __ push(a1); | 3208 __ push(a1); |
3208 EmitResolvePossiblyDirectEval(arg_count); | 3209 EmitResolvePossiblyDirectEval(arg_count); |
3209 | 3210 |
3210 // Touch up the stack with the resolved function. | 3211 // Touch up the stack with the resolved function. |
3211 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3212 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3212 | 3213 |
3213 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 3214 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
3214 // Record source position for debugger. | 3215 // Record source position for debugger. |
3215 SetExpressionPosition(expr); | 3216 SetCallPosition(expr, arg_count); |
3216 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 3217 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
3217 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3218 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3218 __ CallStub(&stub); | 3219 __ CallStub(&stub); |
3219 RecordJSReturnSite(expr); | 3220 RecordJSReturnSite(expr); |
3220 // Restore context register. | 3221 // Restore context register. |
3221 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3222 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3222 context()->DropAndPlug(1, v0); | 3223 context()->DropAndPlug(1, v0); |
3223 } else if (call_type == Call::GLOBAL_CALL) { | 3224 } else if (call_type == Call::GLOBAL_CALL) { |
3224 EmitCallWithLoadIC(expr); | 3225 EmitCallWithLoadIC(expr); |
3225 } else if (call_type == Call::LOOKUP_SLOT_CALL) { | 3226 } else if (call_type == Call::LOOKUP_SLOT_CALL) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3276 | 3277 |
3277 // Push the arguments ("left-to-right") on the stack. | 3278 // Push the arguments ("left-to-right") on the stack. |
3278 ZoneList<Expression*>* args = expr->arguments(); | 3279 ZoneList<Expression*>* args = expr->arguments(); |
3279 int arg_count = args->length(); | 3280 int arg_count = args->length(); |
3280 for (int i = 0; i < arg_count; i++) { | 3281 for (int i = 0; i < arg_count; i++) { |
3281 VisitForStackValue(args->at(i)); | 3282 VisitForStackValue(args->at(i)); |
3282 } | 3283 } |
3283 | 3284 |
3284 // Call the construct call builtin that handles allocation and | 3285 // Call the construct call builtin that handles allocation and |
3285 // constructor invocation. | 3286 // constructor invocation. |
3286 SetExpressionPosition(expr); | 3287 SetConstructCallPosition(expr); |
3287 | 3288 |
3288 // Load function and argument count into a1 and a0. | 3289 // Load function and argument count into a1 and a0. |
3289 __ li(a0, Operand(arg_count)); | 3290 __ li(a0, Operand(arg_count)); |
3290 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); | 3291 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); |
3291 | 3292 |
3292 // Record call targets in unoptimized code. | 3293 // Record call targets in unoptimized code. |
3293 if (FLAG_pretenuring_call_new) { | 3294 if (FLAG_pretenuring_call_new) { |
3294 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3295 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
3295 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 3296 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
3296 expr->CallNewFeedbackSlot().ToInt() + 1); | 3297 expr->CallNewFeedbackSlot().ToInt() + 1); |
(...skipping 22 matching lines...) Expand all Loading... |
3319 | 3320 |
3320 // Push the arguments ("left-to-right") on the stack. | 3321 // Push the arguments ("left-to-right") on the stack. |
3321 ZoneList<Expression*>* args = expr->arguments(); | 3322 ZoneList<Expression*>* args = expr->arguments(); |
3322 int arg_count = args->length(); | 3323 int arg_count = args->length(); |
3323 for (int i = 0; i < arg_count; i++) { | 3324 for (int i = 0; i < arg_count; i++) { |
3324 VisitForStackValue(args->at(i)); | 3325 VisitForStackValue(args->at(i)); |
3325 } | 3326 } |
3326 | 3327 |
3327 // Call the construct call builtin that handles allocation and | 3328 // Call the construct call builtin that handles allocation and |
3328 // constructor invocation. | 3329 // constructor invocation. |
3329 SetExpressionPosition(expr); | 3330 SetConstructCallPosition(expr); |
3330 | 3331 |
3331 // Load function and argument count into a1 and a0. | 3332 // Load function and argument count into a1 and a0. |
3332 __ li(a0, Operand(arg_count)); | 3333 __ li(a0, Operand(arg_count)); |
3333 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); | 3334 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); |
3334 | 3335 |
3335 // Record call targets in unoptimized code. | 3336 // Record call targets in unoptimized code. |
3336 if (FLAG_pretenuring_call_new) { | 3337 if (FLAG_pretenuring_call_new) { |
3337 UNREACHABLE(); | 3338 UNREACHABLE(); |
3338 /* TODO(dslomov): support pretenuring. | 3339 /* TODO(dslomov): support pretenuring. |
3339 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3340 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4733 __ li(LoadDescriptor::SlotRegister(), | 4734 __ li(LoadDescriptor::SlotRegister(), |
4734 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4735 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4735 CallLoadIC(NOT_CONTEXTUAL); | 4736 CallLoadIC(NOT_CONTEXTUAL); |
4736 } | 4737 } |
4737 | 4738 |
4738 | 4739 |
4739 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4740 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4740 ZoneList<Expression*>* args = expr->arguments(); | 4741 ZoneList<Expression*>* args = expr->arguments(); |
4741 int arg_count = args->length(); | 4742 int arg_count = args->length(); |
4742 | 4743 |
4743 SetExpressionPosition(expr); | 4744 SetCallPosition(expr, arg_count); |
4744 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4745 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
4745 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4746 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
4746 __ CallStub(&stub); | 4747 __ CallStub(&stub); |
4747 } | 4748 } |
4748 | 4749 |
4749 | 4750 |
4750 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4751 void FullCodeGenerator::VisitCallRuntime(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 |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5576 reinterpret_cast<uint32_t>( | 5577 reinterpret_cast<uint32_t>( |
5577 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5578 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5578 return OSR_AFTER_STACK_CHECK; | 5579 return OSR_AFTER_STACK_CHECK; |
5579 } | 5580 } |
5580 | 5581 |
5581 | 5582 |
5582 } // namespace internal | 5583 } // namespace internal |
5583 } // namespace v8 | 5584 } // namespace v8 |
5584 | 5585 |
5585 #endif // V8_TARGET_ARCH_MIPS | 5586 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |