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