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

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

Issue 1854713002: Correctly annotate eval origin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix mips64 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_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after
2543 OperandStackDepthDecrement(arg_count + 1); 2543 OperandStackDepthDecrement(arg_count + 1);
2544 2544
2545 RecordJSReturnSite(expr); 2545 RecordJSReturnSite(expr);
2546 2546
2547 // Restore context register. 2547 // Restore context register.
2548 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2548 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2549 2549
2550 context()->DropAndPlug(1, eax); 2550 context()->DropAndPlug(1, eax);
2551 } 2551 }
2552 2552
2553 2553 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
2554 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 2554 int arg_count = expr->arguments()->length();
2555 // Push copy of the first argument or undefined if it doesn't exist. 2555 // Push copy of the first argument or undefined if it doesn't exist.
2556 if (arg_count > 0) { 2556 if (arg_count > 0) {
2557 __ push(Operand(esp, arg_count * kPointerSize)); 2557 __ push(Operand(esp, arg_count * kPointerSize));
2558 } else { 2558 } else {
2559 __ push(Immediate(isolate()->factory()->undefined_value())); 2559 __ push(Immediate(isolate()->factory()->undefined_value()));
2560 } 2560 }
2561 2561
2562 // Push the enclosing function. 2562 // Push the enclosing function.
2563 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 2563 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
2564 2564
2565 // Push the language mode. 2565 // Push the language mode.
2566 __ push(Immediate(Smi::FromInt(language_mode()))); 2566 __ push(Immediate(Smi::FromInt(language_mode())));
2567 2567
2568 // Push the start position of the scope the calls resides in. 2568 // Push the start position of the scope the calls resides in.
2569 __ push(Immediate(Smi::FromInt(scope()->start_position()))); 2569 __ push(Immediate(Smi::FromInt(expr->position())));
2570 2570
2571 // Do the runtime call. 2571 // Do the runtime call.
2572 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); 2572 __ CallRuntime(Runtime::kResolvePossiblyDirectEval);
2573 } 2573 }
2574 2574
2575 2575
2576 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. 2576 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls.
2577 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { 2577 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
2578 VariableProxy* callee = expr->expression()->AsVariableProxy(); 2578 VariableProxy* callee = expr->expression()->AsVariableProxy();
2579 if (callee->var()->IsLookupSlot()) { 2579 if (callee->var()->IsLookupSlot()) {
(...skipping 27 matching lines...) Expand all
2607 } 2607 }
2608 } else { 2608 } else {
2609 VisitForStackValue(callee); 2609 VisitForStackValue(callee);
2610 // refEnv.WithBaseObject() 2610 // refEnv.WithBaseObject()
2611 PushOperand(isolate()->factory()->undefined_value()); 2611 PushOperand(isolate()->factory()->undefined_value());
2612 } 2612 }
2613 } 2613 }
2614 2614
2615 2615
2616 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { 2616 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
2617 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval 2617 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
Michael Starzinger 2016/04/05 09:56:49 nit: Nice catch. Would you be willing to port it t
2618 // to resolve the function we need to call. Then we call the resolved 2618 // to resolve the function we need to call. Then we call the resolved
2619 // function using the given arguments. 2619 // function using the given arguments.
2620 ZoneList<Expression*>* args = expr->arguments(); 2620 ZoneList<Expression*>* args = expr->arguments();
2621 int arg_count = args->length(); 2621 int arg_count = args->length();
2622 2622
2623 PushCalleeAndWithBaseObject(expr); 2623 PushCalleeAndWithBaseObject(expr);
2624 2624
2625 // Push the arguments. 2625 // Push the arguments.
2626 for (int i = 0; i < arg_count; i++) { 2626 for (int i = 0; i < arg_count; i++) {
2627 VisitForStackValue(args->at(i)); 2627 VisitForStackValue(args->at(i));
2628 } 2628 }
2629 2629
2630 // Push a copy of the function (found below the arguments) and 2630 // Push a copy of the function (found below the arguments) and
2631 // resolve eval. 2631 // resolve eval.
2632 __ push(Operand(esp, (arg_count + 1) * kPointerSize)); 2632 __ push(Operand(esp, (arg_count + 1) * kPointerSize));
2633 EmitResolvePossiblyDirectEval(arg_count); 2633 EmitResolvePossiblyDirectEval(expr);
2634 2634
2635 // Touch up the stack with the resolved function. 2635 // Touch up the stack with the resolved function.
2636 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax); 2636 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
2637 2637
2638 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); 2638 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
2639 2639
2640 SetCallPosition(expr); 2640 SetCallPosition(expr);
2641 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 2641 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
2642 __ Set(eax, arg_count); 2642 __ Set(eax, arg_count);
2643 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, 2643 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny,
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3985 isolate->builtins()->OnStackReplacement()->entry(), 3985 isolate->builtins()->OnStackReplacement()->entry(),
3986 Assembler::target_address_at(call_target_address, unoptimized_code)); 3986 Assembler::target_address_at(call_target_address, unoptimized_code));
3987 return ON_STACK_REPLACEMENT; 3987 return ON_STACK_REPLACEMENT;
3988 } 3988 }
3989 3989
3990 3990
3991 } // namespace internal 3991 } // namespace internal
3992 } // namespace v8 3992 } // namespace v8
3993 3993
3994 #endif // V8_TARGET_ARCH_IA32 3994 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698