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

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: 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
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 OperandStackDepthDecrement(arg_count + 1); 2454 OperandStackDepthDecrement(arg_count + 1);
2455 2455
2456 RecordJSReturnSite(expr); 2456 RecordJSReturnSite(expr);
2457 2457
2458 // Restore context register. 2458 // Restore context register.
2459 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2459 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2460 2460
2461 context()->DropAndPlug(1, eax); 2461 context()->DropAndPlug(1, eax);
2462 } 2462 }
2463 2463
2464 2464 void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
2465 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 2465 int arg_count = expr->arguments()->length();
2466 // Push copy of the first argument or undefined if it doesn't exist. 2466 // Push copy of the first argument or undefined if it doesn't exist.
2467 if (arg_count > 0) { 2467 if (arg_count > 0) {
2468 __ push(Operand(esp, arg_count * kPointerSize)); 2468 __ push(Operand(esp, arg_count * kPointerSize));
2469 } else { 2469 } else {
2470 __ push(Immediate(isolate()->factory()->undefined_value())); 2470 __ push(Immediate(isolate()->factory()->undefined_value()));
2471 } 2471 }
2472 2472
2473 // Push the enclosing function. 2473 // Push the enclosing function.
2474 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 2474 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
2475 2475
2476 // Push the language mode. 2476 // Push the language mode.
2477 __ push(Immediate(Smi::FromInt(language_mode()))); 2477 __ push(Immediate(Smi::FromInt(language_mode())));
2478 2478
2479 // Push the start position of the scope the calls resides in. 2479 // Push the start position of the scope the calls resides in.
2480 __ push(Immediate(Smi::FromInt(scope()->start_position()))); 2480 __ push(Immediate(Smi::FromInt(scope()->start_position())));
2481 2481
2482 // Push the source position of the eval call.
2483 __ push(Immediate(Smi::FromInt(expr->position())));
2484
2482 // Do the runtime call. 2485 // Do the runtime call.
2483 __ CallRuntime(Runtime::kResolvePossiblyDirectEval); 2486 __ CallRuntime(Runtime::kResolvePossiblyDirectEval);
2484 } 2487 }
2485 2488
2486 2489
2487 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. 2490 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls.
2488 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { 2491 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
2489 VariableProxy* callee = expr->expression()->AsVariableProxy(); 2492 VariableProxy* callee = expr->expression()->AsVariableProxy();
2490 if (callee->var()->IsLookupSlot()) { 2493 if (callee->var()->IsLookupSlot()) {
2491 Label slow, done; 2494 Label slow, done;
(...skipping 26 matching lines...) Expand all
2518 } 2521 }
2519 } else { 2522 } else {
2520 VisitForStackValue(callee); 2523 VisitForStackValue(callee);
2521 // refEnv.WithBaseObject() 2524 // refEnv.WithBaseObject()
2522 PushOperand(isolate()->factory()->undefined_value()); 2525 PushOperand(isolate()->factory()->undefined_value());
2523 } 2526 }
2524 } 2527 }
2525 2528
2526 2529
2527 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { 2530 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
2528 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval 2531 // In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
2529 // to resolve the function we need to call. Then we call the resolved 2532 // to resolve the function we need to call. Then we call the resolved
2530 // function using the given arguments. 2533 // function using the given arguments.
2531 ZoneList<Expression*>* args = expr->arguments(); 2534 ZoneList<Expression*>* args = expr->arguments();
2532 int arg_count = args->length(); 2535 int arg_count = args->length();
2533 2536
2534 PushCalleeAndWithBaseObject(expr); 2537 PushCalleeAndWithBaseObject(expr);
2535 2538
2536 // Push the arguments. 2539 // Push the arguments.
2537 for (int i = 0; i < arg_count; i++) { 2540 for (int i = 0; i < arg_count; i++) {
2538 VisitForStackValue(args->at(i)); 2541 VisitForStackValue(args->at(i));
2539 } 2542 }
2540 2543
2541 // Push a copy of the function (found below the arguments) and 2544 // Push a copy of the function (found below the arguments) and
2542 // resolve eval. 2545 // resolve eval.
2543 __ push(Operand(esp, (arg_count + 1) * kPointerSize)); 2546 __ push(Operand(esp, (arg_count + 1) * kPointerSize));
2544 EmitResolvePossiblyDirectEval(arg_count); 2547 EmitResolvePossiblyDirectEval(expr);
2545 2548
2546 // Touch up the stack with the resolved function. 2549 // Touch up the stack with the resolved function.
2547 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax); 2550 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
2548 2551
2549 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); 2552 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
2550 2553
2551 SetCallPosition(expr); 2554 SetCallPosition(expr);
2552 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 2555 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
2553 __ Set(eax, arg_count); 2556 __ Set(eax, arg_count);
2554 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, 2557 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny,
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3896 isolate->builtins()->OnStackReplacement()->entry(), 3899 isolate->builtins()->OnStackReplacement()->entry(),
3897 Assembler::target_address_at(call_target_address, unoptimized_code)); 3900 Assembler::target_address_at(call_target_address, unoptimized_code));
3898 return ON_STACK_REPLACEMENT; 3901 return ON_STACK_REPLACEMENT;
3899 } 3902 }
3900 3903
3901 3904
3902 } // namespace internal 3905 } // namespace internal
3903 } // namespace v8 3906 } // namespace v8
3904 3907
3905 #endif // V8_TARGET_ARCH_IA32 3908 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698