OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
6 | 6 |
7 #include "src/compiler/bytecode-branch-analysis.h" | 7 #include "src/compiler/bytecode-branch-analysis.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/operator-properties.h" | 9 #include "src/compiler/operator-properties.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 const Operator* call = javascript()->CallConstruct( | 1231 const Operator* call = javascript()->CallConstruct( |
1232 static_cast<int>(arg_count) + 2, VectorSlotPair()); | 1232 static_cast<int>(arg_count) + 2, VectorSlotPair()); |
1233 Node* value = ProcessCallNewArguments(call, callee, first_arg, arg_count + 2); | 1233 Node* value = ProcessCallNewArguments(call, callee, first_arg, arg_count + 2); |
1234 environment()->BindAccumulator(value, &states); | 1234 environment()->BindAccumulator(value, &states); |
1235 } | 1235 } |
1236 | 1236 |
1237 void BytecodeGraphBuilder::VisitNew() { BuildCallConstruct(); } | 1237 void BytecodeGraphBuilder::VisitNew() { BuildCallConstruct(); } |
1238 | 1238 |
1239 void BytecodeGraphBuilder::VisitNewWide() { BuildCallConstruct(); } | 1239 void BytecodeGraphBuilder::VisitNewWide() { BuildCallConstruct(); } |
1240 | 1240 |
1241 void BytecodeGraphBuilder::BuildThrowOp(const Operator* call_op) { | 1241 void BytecodeGraphBuilder::BuildThrow() { |
1242 FrameStateBeforeAndAfter states(this); | 1242 FrameStateBeforeAndAfter states(this); |
1243 Node* value = environment()->LookupAccumulator(); | 1243 Node* value = environment()->LookupAccumulator(); |
1244 Node* call = NewNode(call_op, value); | 1244 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); |
1245 environment()->RecordAfterState(call, &states); | 1245 environment()->BindAccumulator(call, &states); |
1246 } | 1246 } |
1247 | 1247 |
1248 void BytecodeGraphBuilder::VisitThrow() { | 1248 void BytecodeGraphBuilder::VisitThrow() { |
1249 BuildThrowOp(javascript()->CallRuntime(Runtime::kThrow)); | 1249 BuildThrow(); |
1250 Node* control = | 1250 Node* call = environment()->LookupAccumulator(); |
1251 NewNode(common()->Throw(), environment()->LookupAccumulator()); | 1251 Node* control = NewNode(common()->Throw(), call); |
1252 MergeControlToLeaveFunction(control); | 1252 MergeControlToLeaveFunction(control); |
1253 } | 1253 } |
1254 | 1254 |
1255 void BytecodeGraphBuilder::VisitReThrow() { | 1255 void BytecodeGraphBuilder::VisitReThrow() { |
1256 BuildThrowOp(javascript()->CallRuntime(Runtime::kReThrow)); | 1256 Node* value = environment()->LookupAccumulator(); |
1257 Node* control = | 1257 Node* call = NewNode(javascript()->CallRuntime(Runtime::kReThrow), value); |
1258 NewNode(common()->Throw(), environment()->LookupAccumulator()); | 1258 Node* control = NewNode(common()->Throw(), call); |
1259 MergeControlToLeaveFunction(control); | 1259 MergeControlToLeaveFunction(control); |
1260 } | 1260 } |
1261 | 1261 |
1262 void BytecodeGraphBuilder::BuildBinaryOp(const Operator* js_op) { | 1262 void BytecodeGraphBuilder::BuildBinaryOp(const Operator* js_op) { |
1263 FrameStateBeforeAndAfter states(this); | 1263 FrameStateBeforeAndAfter states(this); |
1264 Node* left = | 1264 Node* left = |
1265 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1265 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
1266 Node* right = environment()->LookupAccumulator(); | 1266 Node* right = environment()->LookupAccumulator(); |
1267 Node* node = NewNode(js_op, left, right); | 1267 Node* node = NewNode(js_op, left, right); |
1268 environment()->BindAccumulator(node, &states); | 1268 environment()->BindAccumulator(node, &states); |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 // Phi does not exist yet, introduce one. | 1841 // Phi does not exist yet, introduce one. |
1842 value = NewPhi(inputs, value, control); | 1842 value = NewPhi(inputs, value, control); |
1843 value->ReplaceInput(inputs - 1, other); | 1843 value->ReplaceInput(inputs - 1, other); |
1844 } | 1844 } |
1845 return value; | 1845 return value; |
1846 } | 1846 } |
1847 | 1847 |
1848 } // namespace compiler | 1848 } // namespace compiler |
1849 } // namespace internal | 1849 } // namespace internal |
1850 } // namespace v8 | 1850 } // namespace v8 |
OLD | NEW |