| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 | 1093 |
| 1094 | 1094 |
| 1095 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1095 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1096 Register instance_reg = locs()->in(0).reg(); | 1096 Register instance_reg = locs()->in(0).reg(); |
| 1097 Register value_reg = locs()->in(1).reg(); | 1097 Register value_reg = locs()->in(1).reg(); |
| 1098 | 1098 |
| 1099 if (HasICData()) { | 1099 if (HasICData()) { |
| 1100 ASSERT(original() != NULL); | 1100 ASSERT(original() != NULL); |
| 1101 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), | 1101 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), |
| 1102 original()->try_index(), | 1102 original()->try_index(), |
| 1103 kDeoptInstanceGetterSameTarget, | 1103 kDeoptInstanceGetterSameTarget); |
| 1104 instance_reg, | |
| 1105 value_reg); | |
| 1106 // Smis do not have instance fields (Smi class is always first). | 1104 // Smis do not have instance fields (Smi class is always first). |
| 1107 Register temp_reg = locs()->temp(0).reg(); | 1105 Register temp_reg = locs()->temp(0).reg(); |
| 1108 ASSERT(temp_reg != instance_reg); | 1106 ASSERT(temp_reg != instance_reg); |
| 1109 ASSERT(temp_reg != value_reg); | 1107 ASSERT(temp_reg != value_reg); |
| 1110 ASSERT(ic_data() != NULL); | 1108 ASSERT(ic_data() != NULL); |
| 1111 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, temp_reg, deopt); | 1109 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, temp_reg, deopt); |
| 1112 } | 1110 } |
| 1113 __ StoreIntoObject(instance_reg, FieldAddress(instance_reg, field().Offset()), | 1111 __ StoreIntoObject(instance_reg, FieldAddress(instance_reg, field().Offset()), |
| 1114 value_reg); | 1112 value_reg); |
| 1115 } | 1113 } |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 LocationSummary* locs = | 1478 LocationSummary* locs = |
| 1481 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1479 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1482 // TODO(fschneider): Use Any() once it is supported by all code generators. | 1480 // TODO(fschneider): Use Any() once it is supported by all code generators. |
| 1483 locs->set_in(0, Location::RequiresRegister()); | 1481 locs->set_in(0, Location::RequiresRegister()); |
| 1484 return locs; | 1482 return locs; |
| 1485 } | 1483 } |
| 1486 | 1484 |
| 1487 | 1485 |
| 1488 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1486 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1489 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode | 1487 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode |
| 1490 // where PushArgument is handled in FrameRegisterAllocator::AllocateRegisters. | 1488 // where PushArgument is handled by BindInstr::EmitNativeCode. |
| 1491 // Instead of popping the value it is left alone on the simulated frame | |
| 1492 // and materialized on the physical stack before the call. | |
| 1493 // TODO(fschneider): Avoid special-casing for SSA mode here. | 1489 // TODO(fschneider): Avoid special-casing for SSA mode here. |
| 1494 if (compiler->is_ssa()) { | 1490 if (compiler->is_optimizing()) { |
| 1495 ASSERT(locs()->in(0).IsRegister()); | 1491 ASSERT(locs()->in(0).IsRegister()); |
| 1496 __ PushRegister(locs()->in(0).reg()); | 1492 __ PushRegister(locs()->in(0).reg()); |
| 1497 } | 1493 } |
| 1498 } | 1494 } |
| 1499 | 1495 |
| 1500 | 1496 |
| 1501 // Helper to either use the constant value of a definition or the definition. | 1497 // Helper to either use the constant value of a definition or the definition. |
| 1502 static Value* UseDefinition(Definition* defn) { | 1498 static Value* UseDefinition(Definition* defn) { |
| 1503 if (defn->IsBind() && defn->AsBind()->computation()->IsConstant()) { | 1499 if (defn->IsBind() && defn->AsBind()->computation()->IsConstant()) { |
| 1504 return defn->AsBind()->computation()->AsConstant(); | 1500 return defn->AsBind()->computation()->AsConstant(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1515 fixed_parameter_count_(fixed_parameter_count) { | 1511 fixed_parameter_count_(fixed_parameter_count) { |
| 1516 for (intptr_t i = 0; i < definitions.length(); ++i) { | 1512 for (intptr_t i = 0; i < definitions.length(); ++i) { |
| 1517 values_.Add(UseDefinition(definitions[i])); | 1513 values_.Add(UseDefinition(definitions[i])); |
| 1518 } | 1514 } |
| 1519 } | 1515 } |
| 1520 | 1516 |
| 1521 | 1517 |
| 1522 #undef __ | 1518 #undef __ |
| 1523 | 1519 |
| 1524 } // namespace dart | 1520 } // namespace dart |
| OLD | NEW |