Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: src/full-codegen/mips/full-codegen-mips.cc

Issue 1854713002: Correctly annotate eval origin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 // by the vector above. 2561 // by the vector above.
2562 CallIC(ic); 2562 CallIC(ic);
2563 OperandStackDepthDecrement(arg_count + 1); 2563 OperandStackDepthDecrement(arg_count + 1);
2564 2564
2565 RecordJSReturnSite(expr); 2565 RecordJSReturnSite(expr);
2566 // Restore context register. 2566 // Restore context register.
2567 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2567 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2568 context()->DropAndPlug(1, v0); 2568 context()->DropAndPlug(1, v0);
2569 } 2569 }
2570 2570
2571 2571 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
2572 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 2572 int arg_count = expr->arguments()->length();
2573 // t3: copy of the first argument or undefined if it doesn't exist. 2573 // t4: copy of the first argument or undefined if it doesn't exist.
2574 if (arg_count > 0) { 2574 if (arg_count > 0) {
2575 __ lw(t3, MemOperand(sp, arg_count * kPointerSize)); 2575 __ lw(t4, MemOperand(sp, arg_count * kPointerSize));
2576 } else { 2576 } else {
2577 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); 2577 __ LoadRoot(t4, Heap::kUndefinedValueRootIndex);
2578 } 2578 }
2579 2579
2580 // t2: the receiver of the enclosing function. 2580 // t3: the receiver of the enclosing function.
2581 __ lw(t2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 2581 __ lw(t3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2582 2582
2583 // t1: the language mode. 2583 // t2: the language mode.
2584 __ li(t1, Operand(Smi::FromInt(language_mode()))); 2584 __ li(t2, Operand(Smi::FromInt(language_mode())));
2585 2585
2586 // t0: the start position of the scope the calls resides in. 2586 // t1: the start position of the scope the calls resides in.
2587 __ li(t0, Operand(Smi::FromInt(scope()->start_position()))); 2587 __ li(t1, Operand(Smi::FromInt(scope()->start_position())));
2588
2589 // t0: the source position of the eval call.
2590 __ li(t0, Operand(Smi::FromInt(expr->position())));
2588 2591
2589 // Do the runtime call. 2592 // Do the runtime call.
2590 __ Push(t3, t2, t1, t0); 2593 __ Push(t4, t3, t2, t1, t0);
2591 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); 2594 __ CallRuntime(Runtime::kResolvePossiblyDirectEval);
2592 } 2595 }
2593 2596
2594 2597
2595 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. 2598 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls.
2596 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { 2599 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
2597 VariableProxy* callee = expr->expression()->AsVariableProxy(); 2600 VariableProxy* callee = expr->expression()->AsVariableProxy();
2598 if (callee->var()->IsLookupSlot()) { 2601 if (callee->var()->IsLookupSlot()) {
2599 Label slow, done; 2602 Label slow, done;
2600 2603
(...skipping 28 matching lines...) Expand all
2629 } else { 2632 } else {
2630 VisitForStackValue(callee); 2633 VisitForStackValue(callee);
2631 // refEnv.WithBaseObject() 2634 // refEnv.WithBaseObject()
2632 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 2635 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
2633 PushOperand(a2); // Reserved receiver slot. 2636 PushOperand(a2); // Reserved receiver slot.
2634 } 2637 }
2635 } 2638 }
2636 2639
2637 2640
2638 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { 2641 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
2639 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval 2642 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
2640 // to resolve the function we need to call. Then we call the resolved 2643 // to resolve the function we need to call. Then we call the resolved
2641 // function using the given arguments. 2644 // function using the given arguments.
2642 ZoneList<Expression*>* args = expr->arguments(); 2645 ZoneList<Expression*>* args = expr->arguments();
2643 int arg_count = args->length(); 2646 int arg_count = args->length();
2644 PushCalleeAndWithBaseObject(expr); 2647 PushCalleeAndWithBaseObject(expr);
2645 2648
2646 // Push the arguments. 2649 // Push the arguments.
2647 for (int i = 0; i < arg_count; i++) { 2650 for (int i = 0; i < arg_count; i++) {
2648 VisitForStackValue(args->at(i)); 2651 VisitForStackValue(args->at(i));
2649 } 2652 }
2650 2653
2651 // Push a copy of the function (found below the arguments) and 2654 // Push a copy of the function (found below the arguments) and
2652 // resolve eval. 2655 // resolve eval.
2653 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2656 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2654 __ push(a1); 2657 __ push(a1);
2655 EmitResolvePossiblyDirectEval(arg_count); 2658 EmitResolvePossiblyDirectEval(expr);
2656 2659
2657 // Touch up the stack with the resolved function. 2660 // Touch up the stack with the resolved function.
2658 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2661 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize));
2659 2662
2660 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); 2663 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
2661 // Record source position for debugger. 2664 // Record source position for debugger.
2662 SetCallPosition(expr); 2665 SetCallPosition(expr);
2663 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2666 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2664 __ li(a0, Operand(arg_count)); 2667 __ li(a0, Operand(arg_count));
2665 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, 2668 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny,
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
4010 reinterpret_cast<uint32_t>( 4013 reinterpret_cast<uint32_t>(
4011 isolate->builtins()->OnStackReplacement()->entry())); 4014 isolate->builtins()->OnStackReplacement()->entry()));
4012 return ON_STACK_REPLACEMENT; 4015 return ON_STACK_REPLACEMENT;
4013 } 4016 }
4014 4017
4015 4018
4016 } // namespace internal 4019 } // namespace internal
4017 } // namespace v8 4020 } // namespace v8
4018 4021
4019 #endif // V8_TARGET_ARCH_MIPS 4022 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698