| 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 3359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3370 return store; | 3370 return store; |
| 3371 } | 3371 } |
| 3372 | 3372 |
| 3373 | 3373 |
| 3374 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { | 3374 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { |
| 3375 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); | 3375 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); |
| 3376 Node* call = NewNode(op, exception); | 3376 Node* call = NewNode(op, exception); |
| 3377 PrepareFrameState(call, bailout_id); | 3377 PrepareFrameState(call, bailout_id); |
| 3378 Node* control = NewNode(common()->Throw(), call); | 3378 Node* control = NewNode(common()->Throw(), call); |
| 3379 UpdateControlDependencyToLeaveFunction(control); | 3379 UpdateControlDependencyToLeaveFunction(control); |
| 3380 return control; | 3380 return call; |
| 3381 } | 3381 } |
| 3382 | 3382 |
| 3383 | 3383 |
| 3384 Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable, | 3384 Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable, |
| 3385 BailoutId bailout_id) { | 3385 BailoutId bailout_id) { |
| 3386 Node* variable_name = jsgraph()->Constant(variable->name()); | 3386 Node* variable_name = jsgraph()->Constant(variable->name()); |
| 3387 const Operator* op = | 3387 const Operator* op = |
| 3388 javascript()->CallRuntime(Runtime::kThrowReferenceError, 1); | 3388 javascript()->CallRuntime(Runtime::kThrowReferenceError, 1); |
| 3389 Node* call = NewNode(op, variable_name); | 3389 Node* call = NewNode(op, variable_name); |
| 3390 PrepareFrameState(call, bailout_id); | 3390 PrepareFrameState(call, bailout_id); |
| 3391 Node* control = NewNode(common()->Throw(), call); | 3391 Node* control = NewNode(common()->Throw(), call); |
| 3392 UpdateControlDependencyToLeaveFunction(control); | 3392 UpdateControlDependencyToLeaveFunction(control); |
| 3393 return control; | 3393 return call; |
| 3394 } | 3394 } |
| 3395 | 3395 |
| 3396 | 3396 |
| 3397 Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) { | 3397 Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) { |
| 3398 const Operator* op = | 3398 const Operator* op = |
| 3399 javascript()->CallRuntime(Runtime::kThrowConstAssignError, 0); | 3399 javascript()->CallRuntime(Runtime::kThrowConstAssignError, 0); |
| 3400 Node* call = NewNode(op); | 3400 Node* call = NewNode(op); |
| 3401 PrepareFrameState(call, bailout_id); | 3401 PrepareFrameState(call, bailout_id); |
| 3402 Node* control = NewNode(common()->Throw(), call); | 3402 Node* control = NewNode(common()->Throw(), call); |
| 3403 UpdateControlDependencyToLeaveFunction(control); | 3403 UpdateControlDependencyToLeaveFunction(control); |
| 3404 return control; | 3404 return call; |
| 3405 } | 3405 } |
| 3406 | 3406 |
| 3407 | 3407 |
| 3408 Node* AstGraphBuilder::BuildThrowStaticPrototypeError(BailoutId bailout_id) { | 3408 Node* AstGraphBuilder::BuildThrowStaticPrototypeError(BailoutId bailout_id) { |
| 3409 const Operator* op = | 3409 const Operator* op = |
| 3410 javascript()->CallRuntime(Runtime::kThrowStaticPrototypeError, 0); | 3410 javascript()->CallRuntime(Runtime::kThrowStaticPrototypeError, 0); |
| 3411 Node* call = NewNode(op); | 3411 Node* call = NewNode(op); |
| 3412 PrepareFrameState(call, bailout_id); | 3412 PrepareFrameState(call, bailout_id); |
| 3413 Node* control = NewNode(common()->Throw(), call); | 3413 Node* control = NewNode(common()->Throw(), call); |
| 3414 UpdateControlDependencyToLeaveFunction(control); | 3414 UpdateControlDependencyToLeaveFunction(control); |
| 3415 return control; | 3415 return call; |
| 3416 } | 3416 } |
| 3417 | 3417 |
| 3418 | 3418 |
| 3419 Node* AstGraphBuilder::BuildReturn(Node* return_value) { | 3419 Node* AstGraphBuilder::BuildReturn(Node* return_value) { |
| 3420 Node* control = NewNode(common()->Return(), return_value); | 3420 Node* control = NewNode(common()->Return(), return_value); |
| 3421 UpdateControlDependencyToLeaveFunction(control); | 3421 UpdateControlDependencyToLeaveFunction(control); |
| 3422 return control; | 3422 return control; |
| 3423 } | 3423 } |
| 3424 | 3424 |
| 3425 | 3425 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3549 // with the real frame state. | 3549 // with the real frame state. |
| 3550 *current_input++ = jsgraph()->DeadControl(); | 3550 *current_input++ = jsgraph()->DeadControl(); |
| 3551 } | 3551 } |
| 3552 if (has_effect) { | 3552 if (has_effect) { |
| 3553 *current_input++ = environment_->GetEffectDependency(); | 3553 *current_input++ = environment_->GetEffectDependency(); |
| 3554 } | 3554 } |
| 3555 if (has_control) { | 3555 if (has_control) { |
| 3556 *current_input++ = environment_->GetControlDependency(); | 3556 *current_input++ = environment_->GetControlDependency(); |
| 3557 } | 3557 } |
| 3558 result = graph()->NewNode(op, input_count_with_deps, buffer, incomplete); | 3558 result = graph()->NewNode(op, input_count_with_deps, buffer, incomplete); |
| 3559 if (has_effect) { | |
| 3560 environment_->UpdateEffectDependency(result); | |
| 3561 } | |
| 3562 if (!environment()->IsMarkedAsUnreachable()) { | 3559 if (!environment()->IsMarkedAsUnreachable()) { |
| 3563 // Update the current control dependency for control-producing nodes. | 3560 // Update the current control dependency for control-producing nodes. |
| 3564 if (NodeProperties::IsControl(result)) { | 3561 if (NodeProperties::IsControl(result)) { |
| 3565 environment_->UpdateControlDependency(result); | 3562 environment_->UpdateControlDependency(result); |
| 3566 } | 3563 } |
| 3564 // Update the current effect dependency for effect-producing nodes. |
| 3565 if (result->op()->EffectOutputCount() > 0) { |
| 3566 environment_->UpdateEffectDependency(result); |
| 3567 } |
| 3567 // Add implicit exception continuation for throwing nodes. | 3568 // Add implicit exception continuation for throwing nodes. |
| 3568 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_try_scope) { | 3569 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_try_scope) { |
| 3569 // Conservative prediction whether caught locally. | 3570 // Conservative prediction whether caught locally. |
| 3570 IfExceptionHint hint = try_catch_nesting_level_ > 0 | 3571 IfExceptionHint hint = try_catch_nesting_level_ > 0 |
| 3571 ? IfExceptionHint::kLocallyCaught | 3572 ? IfExceptionHint::kLocallyCaught |
| 3572 : IfExceptionHint::kLocallyUncaught; | 3573 : IfExceptionHint::kLocallyUncaught; |
| 3573 // Copy the environment for the success continuation. | 3574 // Copy the environment for the success continuation. |
| 3574 Environment* success_env = environment()->CopyForConditional(); | 3575 Environment* success_env = environment()->CopyForConditional(); |
| 3575 const Operator* op = common()->IfException(hint); | 3576 const Operator* op = common()->IfException(hint); |
| 3576 Node* on_exception = graph()->NewNode(op, result); | 3577 Node* on_exception = graph()->NewNode(op, result); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3804 // Phi does not exist yet, introduce one. | 3805 // Phi does not exist yet, introduce one. |
| 3805 value = NewPhi(inputs, value, control); | 3806 value = NewPhi(inputs, value, control); |
| 3806 value->ReplaceInput(inputs - 1, other); | 3807 value->ReplaceInput(inputs - 1, other); |
| 3807 } | 3808 } |
| 3808 return value; | 3809 return value; |
| 3809 } | 3810 } |
| 3810 | 3811 |
| 3811 } // namespace compiler | 3812 } // namespace compiler |
| 3812 } // namespace internal | 3813 } // namespace internal |
| 3813 } // namespace v8 | 3814 } // namespace v8 |
| OLD | NEW |