OLD | NEW |
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 Loading... |
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->LookupId(), | 2363 PrepareFrameState(pair, expr->EvalOrLookupId(), |
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 Loading... |
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 } | |
2443 // Fall through. | 2431 // Fall through. |
2444 case Call::OTHER_CALL: | 2432 case Call::OTHER_CALL: |
2445 VisitForValue(callee); | 2433 VisitForValue(callee); |
2446 callee_value = environment()->Pop(); | 2434 callee_value = environment()->Pop(); |
2447 receiver_value = jsgraph()->UndefinedConstant(); | 2435 receiver_value = jsgraph()->UndefinedConstant(); |
2448 break; | 2436 break; |
2449 } | 2437 } |
2450 | 2438 |
2451 // The callee and the receiver both have to be pushed onto the operand stack | 2439 // The callee and the receiver both have to be pushed onto the operand stack |
2452 // before arguments are being evaluated. | 2440 // before arguments are being evaluated. |
(...skipping 15 matching lines...) Expand all Loading... |
2468 | 2456 |
2469 // Create node to ask for help resolving potential eval call. This will | 2457 // Create node to ask for help resolving potential eval call. This will |
2470 // provide a fully resolved callee and the corresponding receiver. | 2458 // provide a fully resolved callee and the corresponding receiver. |
2471 Node* function = GetFunctionClosure(); | 2459 Node* function = GetFunctionClosure(); |
2472 Node* language = jsgraph()->Constant(language_mode()); | 2460 Node* language = jsgraph()->Constant(language_mode()); |
2473 Node* position = jsgraph()->Constant(current_scope()->start_position()); | 2461 Node* position = jsgraph()->Constant(current_scope()->start_position()); |
2474 const Operator* op = | 2462 const Operator* op = |
2475 javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 2463 javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |
2476 Node* new_callee = | 2464 Node* new_callee = |
2477 NewNode(op, callee, source, function, language, position); | 2465 NewNode(op, callee, source, function, language, position); |
2478 PrepareFrameState(new_callee, expr->EvalId(), | 2466 PrepareFrameState(new_callee, expr->EvalOrLookupId(), |
2479 OutputFrameStateCombine::PokeAt(arg_count + 1)); | 2467 OutputFrameStateCombine::PokeAt(arg_count + 1)); |
2480 | 2468 |
2481 // Patch callee on the environment. | 2469 // Patch callee on the environment. |
2482 environment()->Poke(arg_count + 1, new_callee); | 2470 environment()->Poke(arg_count + 1, new_callee); |
2483 } | 2471 } |
2484 | 2472 |
2485 // Create node to perform the function call. | 2473 // Create node to perform the function call. |
2486 VectorSlotPair feedback = CreateVectorSlotPair(expr->CallFeedbackICSlot()); | 2474 VectorSlotPair feedback = CreateVectorSlotPair(expr->CallFeedbackICSlot()); |
2487 const Operator* call = javascript()->CallFunction(args->length() + 2, flags, | 2475 const Operator* call = javascript()->CallFunction(args->length() + 2, flags, |
2488 language_mode(), feedback); | 2476 language_mode(), feedback); |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4174 // Phi does not exist yet, introduce one. | 4162 // Phi does not exist yet, introduce one. |
4175 value = NewPhi(inputs, value, control); | 4163 value = NewPhi(inputs, value, control); |
4176 value->ReplaceInput(inputs - 1, other); | 4164 value->ReplaceInput(inputs - 1, other); |
4177 } | 4165 } |
4178 return value; | 4166 return value; |
4179 } | 4167 } |
4180 | 4168 |
4181 } // namespace compiler | 4169 } // namespace compiler |
4182 } // namespace internal | 4170 } // namespace internal |
4183 } // namespace v8 | 4171 } // namespace v8 |
OLD | NEW |