| 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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 void BytecodeGraphBuilder::BuildCompareOp(const Operator* js_op) { | 1217 void BytecodeGraphBuilder::BuildCompareOp(const Operator* js_op) { |
| 1218 FrameStateBeforeAndAfter states(this); | 1218 FrameStateBeforeAndAfter states(this); |
| 1219 Node* left = | 1219 Node* left = |
| 1220 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1220 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 1221 Node* right = environment()->LookupAccumulator(); | 1221 Node* right = environment()->LookupAccumulator(); |
| 1222 Node* node = NewNode(js_op, left, right); | 1222 Node* node = NewNode(js_op, left, right); |
| 1223 environment()->BindAccumulator(node, &states); | 1223 environment()->BindAccumulator(node, &states); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 void BytecodeGraphBuilder::VisitTestEqual() { | 1226 void BytecodeGraphBuilder::VisitTestEqual() { |
| 1227 BuildCompareOp(javascript()->Equal()); | 1227 CompareOperationHints hints = CompareOperationHints::Any(); |
| 1228 BuildCompareOp(javascript()->Equal(hints)); |
| 1228 } | 1229 } |
| 1229 | 1230 |
| 1230 void BytecodeGraphBuilder::VisitTestNotEqual() { | 1231 void BytecodeGraphBuilder::VisitTestNotEqual() { |
| 1231 BuildCompareOp(javascript()->NotEqual()); | 1232 CompareOperationHints hints = CompareOperationHints::Any(); |
| 1233 BuildCompareOp(javascript()->NotEqual(hints)); |
| 1232 } | 1234 } |
| 1233 | 1235 |
| 1234 void BytecodeGraphBuilder::VisitTestEqualStrict() { | 1236 void BytecodeGraphBuilder::VisitTestEqualStrict() { |
| 1235 BuildCompareOp(javascript()->StrictEqual()); | 1237 CompareOperationHints hints = CompareOperationHints::Any(); |
| 1238 BuildCompareOp(javascript()->StrictEqual(hints)); |
| 1236 } | 1239 } |
| 1237 | 1240 |
| 1238 void BytecodeGraphBuilder::VisitTestLessThan() { | 1241 void BytecodeGraphBuilder::VisitTestLessThan() { |
| 1239 BuildCompareOp(javascript()->LessThan()); | 1242 CompareOperationHints hints = CompareOperationHints::Any(); |
| 1243 BuildCompareOp(javascript()->LessThan(hints)); |
| 1240 } | 1244 } |
| 1241 | 1245 |
| 1242 void BytecodeGraphBuilder::VisitTestGreaterThan() { | 1246 void BytecodeGraphBuilder::VisitTestGreaterThan() { |
| 1243 BuildCompareOp(javascript()->GreaterThan()); | 1247 CompareOperationHints hints = CompareOperationHints::Any(); |
| 1248 BuildCompareOp(javascript()->GreaterThan(hints)); |
| 1244 } | 1249 } |
| 1245 | 1250 |
| 1246 void BytecodeGraphBuilder::VisitTestLessThanOrEqual() { | 1251 void BytecodeGraphBuilder::VisitTestLessThanOrEqual() { |
| 1247 BuildCompareOp(javascript()->LessThanOrEqual()); | 1252 CompareOperationHints hints = CompareOperationHints::Any(); |
| 1253 BuildCompareOp(javascript()->LessThanOrEqual(hints)); |
| 1248 } | 1254 } |
| 1249 | 1255 |
| 1250 void BytecodeGraphBuilder::VisitTestGreaterThanOrEqual() { | 1256 void BytecodeGraphBuilder::VisitTestGreaterThanOrEqual() { |
| 1251 BuildCompareOp(javascript()->GreaterThanOrEqual()); | 1257 CompareOperationHints hints = CompareOperationHints::Any(); |
| 1258 BuildCompareOp(javascript()->GreaterThanOrEqual(hints)); |
| 1252 } | 1259 } |
| 1253 | 1260 |
| 1254 void BytecodeGraphBuilder::VisitTestIn() { | 1261 void BytecodeGraphBuilder::VisitTestIn() { |
| 1255 BuildCompareOp(javascript()->HasProperty()); | 1262 BuildCompareOp(javascript()->HasProperty()); |
| 1256 } | 1263 } |
| 1257 | 1264 |
| 1258 void BytecodeGraphBuilder::VisitTestInstanceOf() { | 1265 void BytecodeGraphBuilder::VisitTestInstanceOf() { |
| 1259 BuildCompareOp(javascript()->InstanceOf()); | 1266 BuildCompareOp(javascript()->InstanceOf()); |
| 1260 } | 1267 } |
| 1261 | 1268 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 NewIfTrue(); | 1518 NewIfTrue(); |
| 1512 MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset()); | 1519 MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset()); |
| 1513 set_environment(if_false_environment); | 1520 set_environment(if_false_environment); |
| 1514 NewIfFalse(); | 1521 NewIfFalse(); |
| 1515 } | 1522 } |
| 1516 | 1523 |
| 1517 | 1524 |
| 1518 void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) { | 1525 void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) { |
| 1519 Node* accumulator = environment()->LookupAccumulator(); | 1526 Node* accumulator = environment()->LookupAccumulator(); |
| 1520 Node* condition = | 1527 Node* condition = |
| 1521 NewNode(javascript()->StrictEqual(), accumulator, comperand); | 1528 NewNode(javascript()->StrictEqual(CompareOperationHints::Any()), |
| 1529 accumulator, comperand); |
| 1522 BuildConditionalJump(condition); | 1530 BuildConditionalJump(condition); |
| 1523 } | 1531 } |
| 1524 | 1532 |
| 1525 | 1533 |
| 1526 void BytecodeGraphBuilder::BuildJumpIfToBooleanEqual(Node* comperand) { | 1534 void BytecodeGraphBuilder::BuildJumpIfToBooleanEqual(Node* comperand) { |
| 1527 Node* accumulator = environment()->LookupAccumulator(); | 1535 Node* accumulator = environment()->LookupAccumulator(); |
| 1528 Node* to_boolean = | 1536 Node* to_boolean = |
| 1529 NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), accumulator); | 1537 NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), accumulator); |
| 1530 Node* condition = NewNode(javascript()->StrictEqual(), to_boolean, comperand); | 1538 Node* condition = |
| 1539 NewNode(javascript()->StrictEqual(CompareOperationHints::Any()), |
| 1540 to_boolean, comperand); |
| 1531 BuildConditionalJump(condition); | 1541 BuildConditionalJump(condition); |
| 1532 } | 1542 } |
| 1533 | 1543 |
| 1534 void BytecodeGraphBuilder::BuildJumpIfNotHole() { | 1544 void BytecodeGraphBuilder::BuildJumpIfNotHole() { |
| 1535 Node* accumulator = environment()->LookupAccumulator(); | 1545 Node* accumulator = environment()->LookupAccumulator(); |
| 1536 Node* condition = NewNode(javascript()->StrictEqual(), accumulator, | 1546 Node* condition = |
| 1537 jsgraph()->TheHoleConstant()); | 1547 NewNode(javascript()->StrictEqual(CompareOperationHints::Any()), |
| 1548 accumulator, jsgraph()->TheHoleConstant()); |
| 1538 Node* node = | 1549 Node* node = |
| 1539 NewNode(common()->Select(MachineRepresentation::kTagged), condition, | 1550 NewNode(common()->Select(MachineRepresentation::kTagged), condition, |
| 1540 jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); | 1551 jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); |
| 1541 BuildConditionalJump(node); | 1552 BuildConditionalJump(node); |
| 1542 } | 1553 } |
| 1543 | 1554 |
| 1544 Node** BytecodeGraphBuilder::EnsureInputBufferSize(int size) { | 1555 Node** BytecodeGraphBuilder::EnsureInputBufferSize(int size) { |
| 1545 if (size > input_buffer_size_) { | 1556 if (size > input_buffer_size_) { |
| 1546 size = size + kInputBufferSizeIncrement + input_buffer_size_; | 1557 size = size + kInputBufferSizeIncrement + input_buffer_size_; |
| 1547 input_buffer_ = local_zone()->NewArray<Node*>(size); | 1558 input_buffer_ = local_zone()->NewArray<Node*>(size); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 // Phi does not exist yet, introduce one. | 1740 // Phi does not exist yet, introduce one. |
| 1730 value = NewPhi(inputs, value, control); | 1741 value = NewPhi(inputs, value, control); |
| 1731 value->ReplaceInput(inputs - 1, other); | 1742 value->ReplaceInput(inputs - 1, other); |
| 1732 } | 1743 } |
| 1733 return value; | 1744 return value; |
| 1734 } | 1745 } |
| 1735 | 1746 |
| 1736 } // namespace compiler | 1747 } // namespace compiler |
| 1737 } // namespace internal | 1748 } // namespace internal |
| 1738 } // namespace v8 | 1749 } // namespace v8 |
| OLD | NEW |