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