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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1202963005: Fix receiver when calling eval() bound by with scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Full-codegen impls for all arches Created 5 years, 5 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/ast.h ('k') | src/full-codegen.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 case Call::LOOKUP_SLOT_CALL: { 2353 case Call::LOOKUP_SLOT_CALL: {
2354 Variable* variable = callee->AsVariableProxy()->var(); 2354 Variable* variable = callee->AsVariableProxy()->var();
2355 DCHECK(variable->location() == Variable::LOOKUP); 2355 DCHECK(variable->location() == Variable::LOOKUP);
2356 Node* name = jsgraph()->Constant(variable->name()); 2356 Node* name = jsgraph()->Constant(variable->name());
2357 const Operator* op = 2357 const Operator* op =
2358 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2); 2358 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2);
2359 Node* pair = NewNode(op, current_context(), name); 2359 Node* pair = NewNode(op, current_context(), name);
2360 callee_value = NewNode(common()->Projection(0), pair); 2360 callee_value = NewNode(common()->Projection(0), pair);
2361 receiver_value = NewNode(common()->Projection(1), pair); 2361 receiver_value = NewNode(common()->Projection(1), pair);
2362 2362
2363 PrepareFrameState(pair, expr->EvalOrLookupId(), 2363 PrepareFrameState(pair, expr->LookupId(),
2364 OutputFrameStateCombine::Push(2)); 2364 OutputFrameStateCombine::Push(2));
2365 break; 2365 break;
2366 } 2366 }
2367 case Call::PROPERTY_CALL: { 2367 case Call::PROPERTY_CALL: {
2368 Property* property = callee->AsProperty(); 2368 Property* property = callee->AsProperty();
2369 VectorSlotPair pair = 2369 VectorSlotPair pair =
2370 CreateVectorSlotPair(property->PropertyFeedbackSlot()); 2370 CreateVectorSlotPair(property->PropertyFeedbackSlot());
2371 if (!property->IsSuperAccess()) { 2371 if (!property->IsSuperAccess()) {
2372 VisitForValue(property->obj()); 2372 VisitForValue(property->obj());
2373 Node* object = environment()->Top(); 2373 Node* object = environment()->Top();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 break; 2421 break;
2422 } 2422 }
2423 case Call::SUPER_CALL: 2423 case Call::SUPER_CALL:
2424 // TODO(dslomov): Implement super calls. 2424 // TODO(dslomov): Implement super calls.
2425 callee_value = jsgraph()->UndefinedConstant(); 2425 callee_value = jsgraph()->UndefinedConstant();
2426 receiver_value = jsgraph()->UndefinedConstant(); 2426 receiver_value = jsgraph()->UndefinedConstant();
2427 SetStackOverflow(); 2427 SetStackOverflow();
2428 break; 2428 break;
2429 case Call::POSSIBLY_EVAL_CALL: 2429 case Call::POSSIBLY_EVAL_CALL:
2430 possibly_eval = true; 2430 possibly_eval = true;
2431 if (callee->AsVariableProxy()->var()->IsLookupSlot()) {
2432 Variable* variable = callee->AsVariableProxy()->var();
2433 Node* name = jsgraph()->Constant(variable->name());
2434 const Operator* op =
2435 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2);
2436 Node* pair = NewNode(op, current_context(), name);
2437 callee_value = NewNode(common()->Projection(0), pair);
2438 receiver_value = NewNode(common()->Projection(1), pair);
2439 PrepareFrameState(pair, expr->LookupId(),
2440 OutputFrameStateCombine::Push(2));
2441 break;
2442 }
2431 // Fall through. 2443 // Fall through.
2432 case Call::OTHER_CALL: 2444 case Call::OTHER_CALL:
2433 VisitForValue(callee); 2445 VisitForValue(callee);
2434 callee_value = environment()->Pop(); 2446 callee_value = environment()->Pop();
2435 receiver_value = jsgraph()->UndefinedConstant(); 2447 receiver_value = jsgraph()->UndefinedConstant();
2436 break; 2448 break;
2437 } 2449 }
2438 2450
2439 // The callee and the receiver both have to be pushed onto the operand stack 2451 // The callee and the receiver both have to be pushed onto the operand stack
2440 // before arguments are being evaluated. 2452 // before arguments are being evaluated.
(...skipping 15 matching lines...) Expand all
2456 2468
2457 // Create node to ask for help resolving potential eval call. This will 2469 // Create node to ask for help resolving potential eval call. This will
2458 // provide a fully resolved callee and the corresponding receiver. 2470 // provide a fully resolved callee and the corresponding receiver.
2459 Node* function = GetFunctionClosure(); 2471 Node* function = GetFunctionClosure();
2460 Node* language = jsgraph()->Constant(language_mode()); 2472 Node* language = jsgraph()->Constant(language_mode());
2461 Node* position = jsgraph()->Constant(current_scope()->start_position()); 2473 Node* position = jsgraph()->Constant(current_scope()->start_position());
2462 const Operator* op = 2474 const Operator* op =
2463 javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 2475 javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval, 5);
2464 Node* new_callee = 2476 Node* new_callee =
2465 NewNode(op, callee, source, function, language, position); 2477 NewNode(op, callee, source, function, language, position);
2466 PrepareFrameState(new_callee, expr->EvalOrLookupId(), 2478 PrepareFrameState(new_callee, expr->EvalId(),
2467 OutputFrameStateCombine::PokeAt(arg_count + 1)); 2479 OutputFrameStateCombine::PokeAt(arg_count + 1));
2468 2480
2469 // Patch callee on the environment. 2481 // Patch callee on the environment.
2470 environment()->Poke(arg_count + 1, new_callee); 2482 environment()->Poke(arg_count + 1, new_callee);
2471 } 2483 }
2472 2484
2473 // Create node to perform the function call. 2485 // Create node to perform the function call.
2474 VectorSlotPair feedback = CreateVectorSlotPair(expr->CallFeedbackICSlot()); 2486 VectorSlotPair feedback = CreateVectorSlotPair(expr->CallFeedbackICSlot());
2475 const Operator* call = javascript()->CallFunction(args->length() + 2, flags, 2487 const Operator* call = javascript()->CallFunction(args->length() + 2, flags,
2476 language_mode(), feedback); 2488 language_mode(), feedback);
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
4162 // Phi does not exist yet, introduce one. 4174 // Phi does not exist yet, introduce one.
4163 value = NewPhi(inputs, value, control); 4175 value = NewPhi(inputs, value, control);
4164 value->ReplaceInput(inputs - 1, other); 4176 value->ReplaceInput(inputs - 1, other);
4165 } 4177 }
4166 return value; 4178 return value;
4167 } 4179 }
4168 4180
4169 } // namespace compiler 4181 } // namespace compiler
4170 } // namespace internal 4182 } // namespace internal
4171 } // namespace v8 4183 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698