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 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 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2566 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2567 context()->DropAndPlug(1, v0); | 2567 context()->DropAndPlug(1, v0); |
2568 } | 2568 } |
2569 | 2569 |
2570 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { | 2570 |
2571 int arg_count = expr->arguments()->length(); | 2571 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
2572 // t3: copy of the first argument or undefined if it doesn't exist. | 2572 // t3: copy of the first argument or undefined if it doesn't exist. |
2573 if (arg_count > 0) { | 2573 if (arg_count > 0) { |
2574 __ lw(t3, MemOperand(sp, arg_count * kPointerSize)); | 2574 __ lw(t3, MemOperand(sp, arg_count * kPointerSize)); |
2575 } else { | 2575 } else { |
2576 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); | 2576 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); |
2577 } | 2577 } |
2578 | 2578 |
2579 // t2: the receiver of the enclosing function. | 2579 // t2: the receiver of the enclosing function. |
2580 __ lw(t2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2580 __ lw(t2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
2581 | 2581 |
2582 // t1: the language mode. | 2582 // t1: the language mode. |
2583 __ li(t1, Operand(Smi::FromInt(language_mode()))); | 2583 __ li(t1, Operand(Smi::FromInt(language_mode()))); |
2584 | 2584 |
2585 // t0: the source position of the eval call. | 2585 // t0: the start position of the scope the calls resides in. |
2586 __ li(t0, Operand(Smi::FromInt(expr->position()))); | 2586 __ li(t0, Operand(Smi::FromInt(scope()->start_position()))); |
2587 | 2587 |
2588 // Do the runtime call. | 2588 // Do the runtime call. |
2589 __ Push(t3, t2, t1, t0); | 2589 __ Push(t3, t2, t1, t0); |
2590 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); | 2590 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); |
2591 } | 2591 } |
2592 | 2592 |
2593 | 2593 |
2594 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 2594 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
2595 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 2595 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
2596 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 2596 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 } else { | 2628 } else { |
2629 VisitForStackValue(callee); | 2629 VisitForStackValue(callee); |
2630 // refEnv.WithBaseObject() | 2630 // refEnv.WithBaseObject() |
2631 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 2631 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
2632 PushOperand(a2); // Reserved receiver slot. | 2632 PushOperand(a2); // Reserved receiver slot. |
2633 } | 2633 } |
2634 } | 2634 } |
2635 | 2635 |
2636 | 2636 |
2637 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { | 2637 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { |
2638 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval | 2638 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
2639 // to resolve the function we need to call. Then we call the resolved | 2639 // to resolve the function we need to call. Then we call the resolved |
2640 // function using the given arguments. | 2640 // function using the given arguments. |
2641 ZoneList<Expression*>* args = expr->arguments(); | 2641 ZoneList<Expression*>* args = expr->arguments(); |
2642 int arg_count = args->length(); | 2642 int arg_count = args->length(); |
2643 PushCalleeAndWithBaseObject(expr); | 2643 PushCalleeAndWithBaseObject(expr); |
2644 | 2644 |
2645 // Push the arguments. | 2645 // Push the arguments. |
2646 for (int i = 0; i < arg_count; i++) { | 2646 for (int i = 0; i < arg_count; i++) { |
2647 VisitForStackValue(args->at(i)); | 2647 VisitForStackValue(args->at(i)); |
2648 } | 2648 } |
2649 | 2649 |
2650 // Push a copy of the function (found below the arguments) and | 2650 // Push a copy of the function (found below the arguments) and |
2651 // resolve eval. | 2651 // resolve eval. |
2652 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2652 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2653 __ push(a1); | 2653 __ push(a1); |
2654 EmitResolvePossiblyDirectEval(expr); | 2654 EmitResolvePossiblyDirectEval(arg_count); |
2655 | 2655 |
2656 // Touch up the stack with the resolved function. | 2656 // Touch up the stack with the resolved function. |
2657 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2657 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2658 | 2658 |
2659 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2659 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2660 // Record source position for debugger. | 2660 // Record source position for debugger. |
2661 SetCallPosition(expr); | 2661 SetCallPosition(expr); |
2662 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2662 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2663 __ li(a0, Operand(arg_count)); | 2663 __ li(a0, Operand(arg_count)); |
2664 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 2664 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4009 reinterpret_cast<uint32_t>( | 4009 reinterpret_cast<uint32_t>( |
4010 isolate->builtins()->OnStackReplacement()->entry())); | 4010 isolate->builtins()->OnStackReplacement()->entry())); |
4011 return ON_STACK_REPLACEMENT; | 4011 return ON_STACK_REPLACEMENT; |
4012 } | 4012 } |
4013 | 4013 |
4014 | 4014 |
4015 } // namespace internal | 4015 } // namespace internal |
4016 } // namespace v8 | 4016 } // namespace v8 |
4017 | 4017 |
4018 #endif // V8_TARGET_ARCH_MIPS | 4018 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |