| 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/js-builtin-reducer.h" | 5 #include "src/compiler/js-builtin-reducer.h" |
| 6 | 6 |
| 7 #include "src/compilation-dependencies.h" | 7 #include "src/compilation-dependencies.h" |
| 8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 Node* etrue0 = effect; | 1109 Node* etrue0 = effect; |
| 1110 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); | 1110 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); |
| 1111 Node* done_true; | 1111 Node* done_true; |
| 1112 Node* vtrue0; | 1112 Node* vtrue0; |
| 1113 { | 1113 { |
| 1114 done_true = jsgraph()->FalseConstant(); | 1114 done_true = jsgraph()->FalseConstant(); |
| 1115 Node* lead = graph()->NewNode(simplified()->StringCharCodeAt(), string, | 1115 Node* lead = graph()->NewNode(simplified()->StringCharCodeAt(), string, |
| 1116 index, if_true0); | 1116 index, if_true0); |
| 1117 | 1117 |
| 1118 // branch1: if ((lead & 0xFC00) === 0xD800) | 1118 // branch1: if ((lead & 0xFC00) === 0xD800) |
| 1119 Node* check1 = graph()->NewNode( | 1119 Node* check1 = |
| 1120 simplified()->NumberEqual(), | 1120 graph()->NewNode(simplified()->NumberEqual(), |
| 1121 graph()->NewNode(simplified()->NumberBitwiseAnd(), lead, | 1121 graph()->NewNode(simplified()->NumberBitwiseAnd(), |
| 1122 jsgraph()->Int32Constant(0xFC00)), | 1122 lead, jsgraph()->Constant(0xFC00)), |
| 1123 jsgraph()->Int32Constant(0xD800)); | 1123 jsgraph()->Constant(0xD800)); |
| 1124 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse), | 1124 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse), |
| 1125 check1, if_true0); | 1125 check1, if_true0); |
| 1126 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); | 1126 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); |
| 1127 Node* vtrue1; | 1127 Node* vtrue1; |
| 1128 { | 1128 { |
| 1129 Node* next_index = graph()->NewNode(simplified()->NumberAdd(), index, | 1129 Node* next_index = graph()->NewNode(simplified()->NumberAdd(), index, |
| 1130 jsgraph()->OneConstant()); | 1130 jsgraph()->OneConstant()); |
| 1131 // branch2: if ((index + 1) < length) | 1131 // branch2: if ((index + 1) < length) |
| 1132 Node* check2 = graph()->NewNode(simplified()->NumberLessThan(), | 1132 Node* check2 = graph()->NewNode(simplified()->NumberLessThan(), |
| 1133 next_index, length); | 1133 next_index, length); |
| 1134 Node* branch2 = graph()->NewNode(common()->Branch(BranchHint::kTrue), | 1134 Node* branch2 = graph()->NewNode(common()->Branch(BranchHint::kTrue), |
| 1135 check2, if_true1); | 1135 check2, if_true1); |
| 1136 Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2); | 1136 Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2); |
| 1137 Node* vtrue2; | 1137 Node* vtrue2; |
| 1138 { | 1138 { |
| 1139 Node* trail = graph()->NewNode(simplified()->StringCharCodeAt(), | 1139 Node* trail = graph()->NewNode(simplified()->StringCharCodeAt(), |
| 1140 string, next_index, if_true2); | 1140 string, next_index, if_true2); |
| 1141 // branch3: if ((trail & 0xFC00) === 0xDC00) | 1141 // branch3: if ((trail & 0xFC00) === 0xDC00) |
| 1142 Node* check3 = graph()->NewNode( | 1142 Node* check3 = graph()->NewNode( |
| 1143 simplified()->NumberEqual(), | 1143 simplified()->NumberEqual(), |
| 1144 graph()->NewNode(simplified()->NumberBitwiseAnd(), trail, | 1144 graph()->NewNode(simplified()->NumberBitwiseAnd(), trail, |
| 1145 jsgraph()->Int32Constant(0xFC00)), | 1145 jsgraph()->Constant(0xFC00)), |
| 1146 jsgraph()->Int32Constant(0xDC00)); | 1146 jsgraph()->Constant(0xDC00)); |
| 1147 Node* branch3 = graph()->NewNode(common()->Branch(BranchHint::kTrue), | 1147 Node* branch3 = graph()->NewNode(common()->Branch(BranchHint::kTrue), |
| 1148 check3, if_true2); | 1148 check3, if_true2); |
| 1149 Node* if_true3 = graph()->NewNode(common()->IfTrue(), branch3); | 1149 Node* if_true3 = graph()->NewNode(common()->IfTrue(), branch3); |
| 1150 Node* vtrue3; | 1150 Node* vtrue3; |
| 1151 { | 1151 { |
| 1152 vtrue3 = graph()->NewNode( | 1152 vtrue3 = graph()->NewNode( |
| 1153 simplified()->NumberBitwiseOr(), | 1153 simplified()->NumberBitwiseOr(), |
| 1154 // Need to swap the order for big-endian platforms | 1154 // Need to swap the order for big-endian platforms |
| 1155 #if V8_TARGET_BIG_ENDIAN | 1155 #if V8_TARGET_BIG_ENDIAN |
| 1156 graph()->NewNode(simplified()->NumberShiftLeft(), lead, | 1156 graph()->NewNode(simplified()->NumberShiftLeft(), lead, |
| 1157 jsgraph()->Int32Constant(16)), | 1157 jsgraph()->Constant(16)), |
| 1158 trail); | 1158 trail); |
| 1159 #else | 1159 #else |
| 1160 graph()->NewNode(simplified()->NumberShiftLeft(), trail, | 1160 graph()->NewNode(simplified()->NumberShiftLeft(), trail, |
| 1161 jsgraph()->Int32Constant(16)), | 1161 jsgraph()->Constant(16)), |
| 1162 lead); | 1162 lead); |
| 1163 #endif | 1163 #endif |
| 1164 } | 1164 } |
| 1165 | 1165 |
| 1166 Node* if_false3 = graph()->NewNode(common()->IfFalse(), branch3); | 1166 Node* if_false3 = graph()->NewNode(common()->IfFalse(), branch3); |
| 1167 Node* vfalse3 = lead; | 1167 Node* vfalse3 = lead; |
| 1168 if_true2 = graph()->NewNode(common()->Merge(2), if_true3, if_false3); | 1168 if_true2 = graph()->NewNode(common()->Merge(2), if_true3, if_false3); |
| 1169 vtrue2 = | 1169 vtrue2 = |
| 1170 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), | 1170 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), |
| 1171 vtrue3, vfalse3, if_true2); | 1171 vtrue3, vfalse3, if_true2); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 return jsgraph()->simplified(); | 1456 return jsgraph()->simplified(); |
| 1457 } | 1457 } |
| 1458 | 1458 |
| 1459 JSOperatorBuilder* JSBuiltinReducer::javascript() const { | 1459 JSOperatorBuilder* JSBuiltinReducer::javascript() const { |
| 1460 return jsgraph()->javascript(); | 1460 return jsgraph()->javascript(); |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 } // namespace compiler | 1463 } // namespace compiler |
| 1464 } // namespace internal | 1464 } // namespace internal |
| 1465 } // namespace v8 | 1465 } // namespace v8 |
| OLD | NEW |