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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 2549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2560 // by the vector above. | 2560 // by the vector above. |
2561 CallIC(ic); | 2561 CallIC(ic); |
2562 OperandStackDepthDecrement(arg_count + 1); | 2562 OperandStackDepthDecrement(arg_count + 1); |
2563 | 2563 |
2564 RecordJSReturnSite(expr); | 2564 RecordJSReturnSite(expr); |
2565 // Restore context register. | 2565 // Restore context register. |
2566 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2566 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2567 context()->DropAndPlug(1, v0); | 2567 context()->DropAndPlug(1, v0); |
2568 } | 2568 } |
2569 | 2569 |
2570 | 2570 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { |
2571 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2571 int arg_count = expr->arguments()->length(); |
2572 // a6: copy of the first argument or undefined if it doesn't exist. | 2572 // a6: copy of the first argument or undefined if it doesn't exist. |
2573 if (arg_count > 0) { | 2573 if (arg_count > 0) { |
2574 __ ld(a6, MemOperand(sp, arg_count * kPointerSize)); | 2574 __ ld(a6, MemOperand(sp, arg_count * kPointerSize)); |
2575 } else { | 2575 } else { |
2576 __ LoadRoot(a6, Heap::kUndefinedValueRootIndex); | 2576 __ LoadRoot(a6, Heap::kUndefinedValueRootIndex); |
2577 } | 2577 } |
2578 | 2578 |
2579 // a5: the receiver of the enclosing function. | 2579 // a5: the receiver of the enclosing function. |
2580 __ ld(a5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2580 __ ld(a5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
2581 | 2581 |
2582 // a4: the language mode. | 2582 // a4: the language mode. |
2583 __ li(a4, Operand(Smi::FromInt(language_mode()))); | 2583 __ li(a4, Operand(Smi::FromInt(language_mode()))); |
2584 | 2584 |
2585 // a1: the start position of the scope the calls resides in. | 2585 // a1: the start position of the scope the calls resides in. |
2586 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); | 2586 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); |
2587 | 2587 |
| 2588 // a0: the source position of the eval call. |
| 2589 __ li(a0, Operand(Smi::FromInt(expr->position()))); |
| 2590 |
2588 // Do the runtime call. | 2591 // Do the runtime call. |
2589 __ Push(a6, a5, a4, a1); | 2592 __ Push(a6, a5, a4, a1, a0); |
2590 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); | 2593 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); |
2591 } | 2594 } |
2592 | 2595 |
2593 | 2596 |
2594 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 2597 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
2595 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 2598 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
2596 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 2599 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
2597 if (callee->var()->IsLookupSlot()) { | 2600 if (callee->var()->IsLookupSlot()) { |
2598 Label slow, done; | 2601 Label slow, done; |
2599 | 2602 |
(...skipping 28 matching lines...) Expand all Loading... |
2628 } else { | 2631 } else { |
2629 VisitForStackValue(callee); | 2632 VisitForStackValue(callee); |
2630 // refEnv.WithBaseObject() | 2633 // refEnv.WithBaseObject() |
2631 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 2634 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
2632 PushOperand(a2); // Reserved receiver slot. | 2635 PushOperand(a2); // Reserved receiver slot. |
2633 } | 2636 } |
2634 } | 2637 } |
2635 | 2638 |
2636 | 2639 |
2637 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { | 2640 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
2638 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval | 2641 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval |
2639 // to resolve the function we need to call. Then we call the resolved | 2642 // to resolve the function we need to call. Then we call the resolved |
2640 // function using the given arguments. | 2643 // function using the given arguments. |
2641 ZoneList<Expression*>* args = expr->arguments(); | 2644 ZoneList<Expression*>* args = expr->arguments(); |
2642 int arg_count = args->length(); | 2645 int arg_count = args->length(); |
2643 PushCalleeAndWithBaseObject(expr); | 2646 PushCalleeAndWithBaseObject(expr); |
2644 | 2647 |
2645 // Push the arguments. | 2648 // Push the arguments. |
2646 for (int i = 0; i < arg_count; i++) { | 2649 for (int i = 0; i < arg_count; i++) { |
2647 VisitForStackValue(args->at(i)); | 2650 VisitForStackValue(args->at(i)); |
2648 } | 2651 } |
2649 | 2652 |
2650 // Push a copy of the function (found below the arguments) and | 2653 // Push a copy of the function (found below the arguments) and |
2651 // resolve eval. | 2654 // resolve eval. |
2652 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2655 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2653 __ push(a1); | 2656 __ push(a1); |
2654 EmitResolvePossiblyDirectEval(arg_count); | 2657 EmitResolvePossiblyDirectEval(expr); |
2655 | 2658 |
2656 // Touch up the stack with the resolved function. | 2659 // Touch up the stack with the resolved function. |
2657 __ sd(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2660 __ sd(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2658 | 2661 |
2659 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2662 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2660 // Record source position for debugger. | 2663 // Record source position for debugger. |
2661 SetCallPosition(expr); | 2664 SetCallPosition(expr); |
2662 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2665 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2663 __ li(a0, Operand(arg_count)); | 2666 __ li(a0, Operand(arg_count)); |
2664 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 2667 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4018 reinterpret_cast<uint64_t>( | 4021 reinterpret_cast<uint64_t>( |
4019 isolate->builtins()->OnStackReplacement()->entry())); | 4022 isolate->builtins()->OnStackReplacement()->entry())); |
4020 return ON_STACK_REPLACEMENT; | 4023 return ON_STACK_REPLACEMENT; |
4021 } | 4024 } |
4022 | 4025 |
4023 | 4026 |
4024 } // namespace internal | 4027 } // namespace internal |
4025 } // namespace v8 | 4028 } // namespace v8 |
4026 | 4029 |
4027 #endif // V8_TARGET_ARCH_MIPS64 | 4030 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |