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