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