| 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 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 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2653 // by the vector above. | 2653 // by the vector above. |
| 2654 CallIC(ic); | 2654 CallIC(ic); |
| 2655 OperandStackDepthDecrement(arg_count + 1); | 2655 OperandStackDepthDecrement(arg_count + 1); |
| 2656 | 2656 |
| 2657 RecordJSReturnSite(expr); | 2657 RecordJSReturnSite(expr); |
| 2658 // Restore context register. | 2658 // Restore context register. |
| 2659 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2659 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2660 context()->DropAndPlug(1, v0); | 2660 context()->DropAndPlug(1, v0); |
| 2661 } | 2661 } |
| 2662 | 2662 |
| 2663 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { | 2663 |
| 2664 int arg_count = expr->arguments()->length(); | 2664 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
| 2665 // t3: copy of the first argument or undefined if it doesn't exist. | 2665 // t3: copy of the first argument or undefined if it doesn't exist. |
| 2666 if (arg_count > 0) { | 2666 if (arg_count > 0) { |
| 2667 __ lw(t3, MemOperand(sp, arg_count * kPointerSize)); | 2667 __ lw(t3, MemOperand(sp, arg_count * kPointerSize)); |
| 2668 } else { | 2668 } else { |
| 2669 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); | 2669 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); |
| 2670 } | 2670 } |
| 2671 | 2671 |
| 2672 // t2: the receiver of the enclosing function. | 2672 // t2: the receiver of the enclosing function. |
| 2673 __ lw(t2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2673 __ lw(t2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2674 | 2674 |
| 2675 // t1: the language mode. | 2675 // t1: the language mode. |
| 2676 __ li(t1, Operand(Smi::FromInt(language_mode()))); | 2676 __ li(t1, Operand(Smi::FromInt(language_mode()))); |
| 2677 | 2677 |
| 2678 // t0: the source position of the eval call. | 2678 // t0: the start position of the scope the calls resides in. |
| 2679 __ li(t0, Operand(Smi::FromInt(expr->position()))); | 2679 __ li(t0, Operand(Smi::FromInt(scope()->start_position()))); |
| 2680 | 2680 |
| 2681 // Do the runtime call. | 2681 // Do the runtime call. |
| 2682 __ Push(t3, t2, t1, t0); | 2682 __ Push(t3, t2, t1, t0); |
| 2683 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); | 2683 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); |
| 2684 } | 2684 } |
| 2685 | 2685 |
| 2686 | 2686 |
| 2687 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 2687 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
| 2688 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 2688 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
| 2689 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 2689 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2721 } else { | 2721 } else { |
| 2722 VisitForStackValue(callee); | 2722 VisitForStackValue(callee); |
| 2723 // refEnv.WithBaseObject() | 2723 // refEnv.WithBaseObject() |
| 2724 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 2724 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
| 2725 PushOperand(a2); // Reserved receiver slot. | 2725 PushOperand(a2); // Reserved receiver slot. |
| 2726 } | 2726 } |
| 2727 } | 2727 } |
| 2728 | 2728 |
| 2729 | 2729 |
| 2730 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { | 2730 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
| 2731 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval | 2731 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
| 2732 // to resolve the function we need to call. Then we call the resolved | 2732 // to resolve the function we need to call. Then we call the resolved |
| 2733 // function using the given arguments. | 2733 // function using the given arguments. |
| 2734 ZoneList<Expression*>* args = expr->arguments(); | 2734 ZoneList<Expression*>* args = expr->arguments(); |
| 2735 int arg_count = args->length(); | 2735 int arg_count = args->length(); |
| 2736 PushCalleeAndWithBaseObject(expr); | 2736 PushCalleeAndWithBaseObject(expr); |
| 2737 | 2737 |
| 2738 // Push the arguments. | 2738 // Push the arguments. |
| 2739 for (int i = 0; i < arg_count; i++) { | 2739 for (int i = 0; i < arg_count; i++) { |
| 2740 VisitForStackValue(args->at(i)); | 2740 VisitForStackValue(args->at(i)); |
| 2741 } | 2741 } |
| 2742 | 2742 |
| 2743 // Push a copy of the function (found below the arguments) and | 2743 // Push a copy of the function (found below the arguments) and |
| 2744 // resolve eval. | 2744 // resolve eval. |
| 2745 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2745 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 2746 __ push(a1); | 2746 __ push(a1); |
| 2747 EmitResolvePossiblyDirectEval(expr); | 2747 EmitResolvePossiblyDirectEval(arg_count); |
| 2748 | 2748 |
| 2749 // Touch up the stack with the resolved function. | 2749 // Touch up the stack with the resolved function. |
| 2750 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2750 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 2751 | 2751 |
| 2752 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2752 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
| 2753 // Record source position for debugger. | 2753 // Record source position for debugger. |
| 2754 SetCallPosition(expr); | 2754 SetCallPosition(expr); |
| 2755 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2755 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 2756 __ li(a0, Operand(arg_count)); | 2756 __ li(a0, Operand(arg_count)); |
| 2757 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 2757 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4102 reinterpret_cast<uint32_t>( | 4102 reinterpret_cast<uint32_t>( |
| 4103 isolate->builtins()->OnStackReplacement()->entry())); | 4103 isolate->builtins()->OnStackReplacement()->entry())); |
| 4104 return ON_STACK_REPLACEMENT; | 4104 return ON_STACK_REPLACEMENT; |
| 4105 } | 4105 } |
| 4106 | 4106 |
| 4107 | 4107 |
| 4108 } // namespace internal | 4108 } // namespace internal |
| 4109 } // namespace v8 | 4109 } // namespace v8 |
| 4110 | 4110 |
| 4111 #endif // V8_TARGET_ARCH_MIPS | 4111 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |