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 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2730 | 2730 |
2731 | 2731 |
2732 Node* AstGraphBuilder::BuildThrowIfStaticPrototype(Node* name, | 2732 Node* AstGraphBuilder::BuildThrowIfStaticPrototype(Node* name, |
2733 BailoutId bailout_id) { | 2733 BailoutId bailout_id) { |
2734 IfBuilder prototype_check(this); | 2734 IfBuilder prototype_check(this); |
2735 Node* prototype_string = | 2735 Node* prototype_string = |
2736 jsgraph()->Constant(isolate()->factory()->prototype_string()); | 2736 jsgraph()->Constant(isolate()->factory()->prototype_string()); |
2737 Node* check = NewNode(javascript()->StrictEqual(), name, prototype_string); | 2737 Node* check = NewNode(javascript()->StrictEqual(), name, prototype_string); |
2738 prototype_check.If(check); | 2738 prototype_check.If(check); |
2739 prototype_check.Then(); | 2739 prototype_check.Then(); |
2740 { | 2740 Node* error = BuildThrowStaticPrototypeError(bailout_id); |
2741 const Operator* op = | 2741 environment()->Push(error); |
2742 javascript()->CallRuntime(Runtime::kThrowStaticPrototypeError, 0); | |
2743 Node* call = NewNode(op); | |
2744 PrepareFrameState(call, bailout_id); | |
2745 environment()->Push(call); | |
2746 } | |
2747 prototype_check.Else(); | 2742 prototype_check.Else(); |
2748 environment()->Push(name); | 2743 environment()->Push(name); |
2749 prototype_check.End(); | 2744 prototype_check.End(); |
2750 return environment()->Pop(); | 2745 return environment()->Pop(); |
2751 } | 2746 } |
2752 | 2747 |
2753 | 2748 |
2754 Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, | 2749 Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, |
2755 BailoutId bailout_id, | 2750 BailoutId bailout_id, |
2756 const VectorSlotPair& feedback, | 2751 const VectorSlotPair& feedback, |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3095 BuildNamedStore(value, name, home_object, TypeFeedbackId::None()); | 3090 BuildNamedStore(value, name, home_object, TypeFeedbackId::None()); |
3096 PrepareFrameState(store, BailoutId::None()); | 3091 PrepareFrameState(store, BailoutId::None()); |
3097 return store; | 3092 return store; |
3098 } | 3093 } |
3099 | 3094 |
3100 | 3095 |
3101 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { | 3096 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { |
3102 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); | 3097 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); |
3103 Node* call = NewNode(op, exception); | 3098 Node* call = NewNode(op, exception); |
3104 PrepareFrameState(call, bailout_id); | 3099 PrepareFrameState(call, bailout_id); |
3105 return call; | 3100 Node* control = NewNode(common()->Throw(), call); |
| 3101 UpdateControlDependencyToLeaveFunction(control); |
| 3102 return control; |
3106 } | 3103 } |
3107 | 3104 |
3108 | 3105 |
3109 Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable, | 3106 Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable, |
3110 BailoutId bailout_id) { | 3107 BailoutId bailout_id) { |
3111 Node* variable_name = jsgraph()->Constant(variable->name()); | 3108 Node* variable_name = jsgraph()->Constant(variable->name()); |
3112 const Operator* op = | 3109 const Operator* op = |
3113 javascript()->CallRuntime(Runtime::kThrowReferenceError, 1); | 3110 javascript()->CallRuntime(Runtime::kThrowReferenceError, 1); |
3114 Node* call = NewNode(op, variable_name); | 3111 Node* call = NewNode(op, variable_name); |
3115 PrepareFrameState(call, bailout_id); | 3112 PrepareFrameState(call, bailout_id); |
3116 return call; | 3113 Node* control = NewNode(common()->Throw(), call); |
| 3114 UpdateControlDependencyToLeaveFunction(control); |
| 3115 return control; |
3117 } | 3116 } |
3118 | 3117 |
3119 | 3118 |
3120 Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) { | 3119 Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) { |
3121 const Operator* op = | 3120 const Operator* op = |
3122 javascript()->CallRuntime(Runtime::kThrowConstAssignError, 0); | 3121 javascript()->CallRuntime(Runtime::kThrowConstAssignError, 0); |
3123 Node* call = NewNode(op); | 3122 Node* call = NewNode(op); |
3124 PrepareFrameState(call, bailout_id); | 3123 PrepareFrameState(call, bailout_id); |
3125 return call; | 3124 Node* control = NewNode(common()->Throw(), call); |
| 3125 UpdateControlDependencyToLeaveFunction(control); |
| 3126 return control; |
3126 } | 3127 } |
3127 | 3128 |
3128 | 3129 |
| 3130 Node* AstGraphBuilder::BuildThrowStaticPrototypeError(BailoutId bailout_id) { |
| 3131 const Operator* op = |
| 3132 javascript()->CallRuntime(Runtime::kThrowStaticPrototypeError, 0); |
| 3133 Node* call = NewNode(op); |
| 3134 PrepareFrameState(call, bailout_id); |
| 3135 Node* control = NewNode(common()->Throw(), call); |
| 3136 UpdateControlDependencyToLeaveFunction(control); |
| 3137 return control; |
| 3138 } |
| 3139 |
| 3140 |
3129 Node* AstGraphBuilder::BuildReturn(Node* return_value) { | 3141 Node* AstGraphBuilder::BuildReturn(Node* return_value) { |
3130 Node* control = NewNode(common()->Return(), return_value); | 3142 Node* control = NewNode(common()->Return(), return_value); |
3131 UpdateControlDependencyToLeaveFunction(control); | 3143 UpdateControlDependencyToLeaveFunction(control); |
3132 return control; | 3144 return control; |
3133 } | 3145 } |
3134 | 3146 |
3135 | 3147 |
3136 Node* AstGraphBuilder::BuildThrow(Node* exception_value) { | 3148 Node* AstGraphBuilder::BuildThrow(Node* exception_value) { |
3137 NewNode(javascript()->CallRuntime(Runtime::kReThrow, 1), exception_value); | 3149 NewNode(javascript()->CallRuntime(Runtime::kReThrow, 1), exception_value); |
3138 Node* control = NewNode(common()->Throw(), exception_value); | 3150 Node* control = NewNode(common()->Throw(), exception_value); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3520 // Phi does not exist yet, introduce one. | 3532 // Phi does not exist yet, introduce one. |
3521 value = NewPhi(inputs, value, control); | 3533 value = NewPhi(inputs, value, control); |
3522 value->ReplaceInput(inputs - 1, other); | 3534 value->ReplaceInput(inputs - 1, other); |
3523 } | 3535 } |
3524 return value; | 3536 return value; |
3525 } | 3537 } |
3526 | 3538 |
3527 } // namespace compiler | 3539 } // namespace compiler |
3528 } // namespace internal | 3540 } // namespace internal |
3529 } // namespace v8 | 3541 } // namespace v8 |
OLD | NEW |