Chromium Code Reviews| 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-typed-lowering.h" | 5 #include "src/compiler/js-typed-lowering.h" |
| 6 | 6 |
| 7 #include "src/builtins/builtins-utils.h" | 7 #include "src/builtins/builtins-utils.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
| 10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 972 | 972 |
| 973 control = graph()->NewNode(common()->Merge(2), if_true, if_false); | 973 control = graph()->NewNode(common()->Merge(2), if_true, if_false); |
| 974 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); | 974 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); |
| 975 | 975 |
| 976 // Morph the {node} into an appropriate Phi. | 976 // Morph the {node} into an appropriate Phi. |
| 977 ReplaceWithValue(node, node, effect, control); | 977 ReplaceWithValue(node, node, effect, control); |
| 978 node->ReplaceInput(0, rtrue); | 978 node->ReplaceInput(0, rtrue); |
| 979 node->ReplaceInput(1, rfalse); | 979 node->ReplaceInput(1, rfalse); |
| 980 node->ReplaceInput(2, control); | 980 node->ReplaceInput(2, control); |
| 981 node->TrimInputCount(3); | 981 node->TrimInputCount(3); |
| 982 NodeProperties::ChangeOp(node, | 982 NodeProperties::ChangeOp( |
|
mvstanton
2016/09/13 13:03:54
per current contract, this would be ignored.
| |
| 983 common()->Phi(MachineRepresentation::kTagged, 2)); | 983 node, common()->Phi(MachineRepresentation::kTaggedPointer, 2)); |
| 984 return Changed(node); | 984 return Changed(node); |
| 985 } | 985 } |
| 986 | 986 |
| 987 Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) { | 987 Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) { |
| 988 DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode()); | 988 DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode()); |
| 989 Node* receiver = NodeProperties::GetValueInput(node, 0); | 989 Node* receiver = NodeProperties::GetValueInput(node, 0); |
| 990 Type* receiver_type = NodeProperties::GetType(receiver); | 990 Type* receiver_type = NodeProperties::GetType(receiver); |
| 991 Node* effect = NodeProperties::GetEffectInput(node); | 991 Node* effect = NodeProperties::GetEffectInput(node); |
| 992 Node* control = NodeProperties::GetControlInput(node); | 992 Node* control = NodeProperties::GetControlInput(node); |
| 993 Handle<Name> name = NamedAccessOf(node->op()).name(); | 993 Handle<Name> name = NamedAccessOf(node->op()).name(); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1179 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); | 1179 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); |
| 1180 Node* etrue0 = effect; | 1180 Node* etrue0 = effect; |
| 1181 Node* vtrue0 = jsgraph()->FalseConstant(); | 1181 Node* vtrue0 = jsgraph()->FalseConstant(); |
| 1182 | 1182 |
| 1183 control = graph()->NewNode(common()->IfFalse(), branch0); | 1183 control = graph()->NewNode(common()->IfFalse(), branch0); |
| 1184 | 1184 |
| 1185 // Loop through the {object}s prototype chain looking for the {prototype}. | 1185 // Loop through the {object}s prototype chain looking for the {prototype}. |
| 1186 Node* loop = control = graph()->NewNode(common()->Loop(2), control, control); | 1186 Node* loop = control = graph()->NewNode(common()->Loop(2), control, control); |
| 1187 Node* eloop = effect = | 1187 Node* eloop = effect = |
| 1188 graph()->NewNode(common()->EffectPhi(2), effect, effect, loop); | 1188 graph()->NewNode(common()->EffectPhi(2), effect, effect, loop); |
| 1189 Node* vloop = object = graph()->NewNode( | 1189 Node* vloop = object = |
| 1190 common()->Phi(MachineRepresentation::kTagged, 2), object, object, loop); | 1190 graph()->NewNode(common()->Phi(MachineRepresentation::kTaggedPointer, 2), |
| 1191 object, object, loop); | |
| 1191 // TODO(jarin): This is a very ugly hack to work-around the super-smart | 1192 // TODO(jarin): This is a very ugly hack to work-around the super-smart |
| 1192 // implicit typing of the Phi, which goes completely nuts if the {object} | 1193 // implicit typing of the Phi, which goes completely nuts if the {object} |
| 1193 // is for example a HeapConstant. | 1194 // is for example a HeapConstant. |
| 1194 NodeProperties::SetType(vloop, Type::NonInternal()); | 1195 NodeProperties::SetType(vloop, Type::NonInternal()); |
| 1195 | 1196 |
| 1196 // Load the {object} map and instance type. | 1197 // Load the {object} map and instance type. |
| 1197 Node* object_map = effect = | 1198 Node* object_map = effect = |
| 1198 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), object, | 1199 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), object, |
| 1199 effect, control); | 1200 effect, control); |
| 1200 Node* object_instance_type = effect = graph()->NewNode( | 1201 Node* object_instance_type = effect = graph()->NewNode( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1277 | 1278 |
| 1278 // Morph the {node} into an appropriate Phi. | 1279 // Morph the {node} into an appropriate Phi. |
| 1279 ReplaceWithValue(node, node, effect, control); | 1280 ReplaceWithValue(node, node, effect, control); |
| 1280 node->ReplaceInput(0, vtrue0); | 1281 node->ReplaceInput(0, vtrue0); |
| 1281 node->ReplaceInput(1, vtrue1); | 1282 node->ReplaceInput(1, vtrue1); |
| 1282 node->ReplaceInput(2, vtrue2); | 1283 node->ReplaceInput(2, vtrue2); |
| 1283 node->ReplaceInput(3, vtrue3); | 1284 node->ReplaceInput(3, vtrue3); |
| 1284 node->ReplaceInput(4, vfalse1); | 1285 node->ReplaceInput(4, vfalse1); |
| 1285 node->ReplaceInput(5, control); | 1286 node->ReplaceInput(5, control); |
| 1286 node->TrimInputCount(6); | 1287 node->TrimInputCount(6); |
| 1287 NodeProperties::ChangeOp(node, | 1288 NodeProperties::ChangeOp( |
| 1288 common()->Phi(MachineRepresentation::kTagged, 5)); | 1289 node, common()->Phi(MachineRepresentation::kTaggedPointer, 5)); |
| 1289 return Changed(node); | 1290 return Changed(node); |
| 1290 } | 1291 } |
| 1291 | 1292 |
| 1292 Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) { | 1293 Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) { |
| 1293 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode()); | 1294 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode()); |
| 1294 ContextAccess const& access = ContextAccessOf(node->op()); | 1295 ContextAccess const& access = ContextAccessOf(node->op()); |
| 1295 Node* effect = NodeProperties::GetEffectInput(node); | 1296 Node* effect = NodeProperties::GetEffectInput(node); |
| 1296 Node* control = graph()->start(); | 1297 Node* control = graph()->start(); |
| 1297 for (size_t i = 0; i < access.depth(); ++i) { | 1298 for (size_t i = 0; i < access.depth(); ++i) { |
| 1298 Node* previous = effect = graph()->NewNode( | 1299 Node* previous = effect = graph()->NewNode( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1395 | 1396 |
| 1396 control = graph()->NewNode(common()->Merge(2), if_true, if_false); | 1397 control = graph()->NewNode(common()->Merge(2), if_true, if_false); |
| 1397 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); | 1398 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); |
| 1398 | 1399 |
| 1399 // Morph the {node} into an appropriate Phi. | 1400 // Morph the {node} into an appropriate Phi. |
| 1400 ReplaceWithValue(node, node, effect, control); | 1401 ReplaceWithValue(node, node, effect, control); |
| 1401 node->ReplaceInput(0, rtrue); | 1402 node->ReplaceInput(0, rtrue); |
| 1402 node->ReplaceInput(1, rfalse); | 1403 node->ReplaceInput(1, rfalse); |
| 1403 node->ReplaceInput(2, control); | 1404 node->ReplaceInput(2, control); |
| 1404 node->TrimInputCount(3); | 1405 node->TrimInputCount(3); |
| 1405 NodeProperties::ChangeOp(node, | 1406 NodeProperties::ChangeOp( |
| 1406 common()->Phi(MachineRepresentation::kTagged, 2)); | 1407 node, common()->Phi(MachineRepresentation::kTaggedPointer, 2)); |
| 1407 return Changed(node); | 1408 return Changed(node); |
| 1408 } | 1409 } |
| 1409 | 1410 |
| 1410 // Check if {receiver} is already a JSReceiver. | 1411 // Check if {receiver} is already a JSReceiver. |
| 1411 Node* check0 = graph()->NewNode(simplified()->ObjectIsReceiver(), receiver); | 1412 Node* check0 = graph()->NewNode(simplified()->ObjectIsReceiver(), receiver); |
| 1412 Node* branch0 = | 1413 Node* branch0 = |
| 1413 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); | 1414 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); |
| 1414 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); | 1415 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); |
| 1415 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); | 1416 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); |
| 1416 | 1417 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1816 if_false0 = graph()->NewNode(common()->IfSuccess(), vfalse0); | 1817 if_false0 = graph()->NewNode(common()->IfSuccess(), vfalse0); |
| 1817 } | 1818 } |
| 1818 | 1819 |
| 1819 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 1820 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
| 1820 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 1821 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
| 1821 ReplaceWithValue(node, node, effect, control); | 1822 ReplaceWithValue(node, node, effect, control); |
| 1822 node->ReplaceInput(0, vtrue0); | 1823 node->ReplaceInput(0, vtrue0); |
| 1823 node->ReplaceInput(1, vfalse0); | 1824 node->ReplaceInput(1, vfalse0); |
| 1824 node->ReplaceInput(2, control); | 1825 node->ReplaceInput(2, control); |
| 1825 node->TrimInputCount(3); | 1826 node->TrimInputCount(3); |
| 1826 NodeProperties::ChangeOp(node, | 1827 NodeProperties::ChangeOp( |
| 1827 common()->Phi(MachineRepresentation::kTagged, 2)); | 1828 node, common()->Phi(MachineRepresentation::kTaggedPointer, 2)); |
| 1828 return Changed(node); | 1829 return Changed(node); |
| 1829 } | 1830 } |
| 1830 | 1831 |
| 1831 Reduction JSTypedLowering::ReduceJSGeneratorStore(Node* node) { | 1832 Reduction JSTypedLowering::ReduceJSGeneratorStore(Node* node) { |
| 1832 DCHECK_EQ(IrOpcode::kJSGeneratorStore, node->opcode()); | 1833 DCHECK_EQ(IrOpcode::kJSGeneratorStore, node->opcode()); |
| 1833 Node* generator = NodeProperties::GetValueInput(node, 0); | 1834 Node* generator = NodeProperties::GetValueInput(node, 0); |
| 1834 Node* continuation = NodeProperties::GetValueInput(node, 1); | 1835 Node* continuation = NodeProperties::GetValueInput(node, 1); |
| 1835 Node* offset = NodeProperties::GetValueInput(node, 2); | 1836 Node* offset = NodeProperties::GetValueInput(node, 2); |
| 1836 Node* context = NodeProperties::GetContextInput(node); | 1837 Node* context = NodeProperties::GetContextInput(node); |
| 1837 Node* effect = NodeProperties::GetEffectInput(node); | 1838 Node* effect = NodeProperties::GetEffectInput(node); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2006 } | 2007 } |
| 2007 | 2008 |
| 2008 | 2009 |
| 2009 CompilationDependencies* JSTypedLowering::dependencies() const { | 2010 CompilationDependencies* JSTypedLowering::dependencies() const { |
| 2010 return dependencies_; | 2011 return dependencies_; |
| 2011 } | 2012 } |
| 2012 | 2013 |
| 2013 } // namespace compiler | 2014 } // namespace compiler |
| 2014 } // namespace internal | 2015 } // namespace internal |
| 2015 } // namespace v8 | 2016 } // namespace v8 |
| OLD | NEW |