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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // However, the 'more specific than' relation is transitive and is used | 285 // However, the 'more specific than' relation is transitive and is used |
286 // here. In other words, if the compile type of the value is more specific | 286 // here. In other words, if the compile type of the value is more specific |
287 // than the destination type, the run time type of the value, which is | 287 // than the destination type, the run time type of the value, which is |
288 // guaranteed to be a subtype of the compile type, is also guaranteed to be | 288 // guaranteed to be a subtype of the compile type, is also guaranteed to be |
289 // a subtype of the destination type and the type check can therefore be | 289 // a subtype of the destination type and the type check can therefore be |
290 // eliminated. | 290 // eliminated. |
291 return compile_type.IsMoreSpecificThan(dst_type, NULL); | 291 return compile_type.IsMoreSpecificThan(dst_type, NULL); |
292 } | 292 } |
293 | 293 |
294 | 294 |
| 295 bool Value::NeedsStoreBuffer() const { |
| 296 const intptr_t cid = ResultCid(); |
| 297 if ((cid == kSmiCid) || (cid == kBoolCid) || (cid == kNullCid)) { |
| 298 return false; |
| 299 } |
| 300 return !BindsToConstant(); |
| 301 } |
| 302 |
| 303 |
295 RawAbstractType* PhiInstr::CompileType() const { | 304 RawAbstractType* PhiInstr::CompileType() const { |
296 ASSERT(!HasPropagatedType()); | 305 ASSERT(!HasPropagatedType()); |
297 // Since type propagation has not yet occured, we are reaching this phi via a | 306 // Since type propagation has not yet occured, we are reaching this phi via a |
298 // back edge phi input. Return null as compile type so that this input is | 307 // back edge phi input. Return null as compile type so that this input is |
299 // ignored in the first iteration of type propagation. | 308 // ignored in the first iteration of type propagation. |
300 return AbstractType::null(); | 309 return AbstractType::null(); |
301 } | 310 } |
302 | 311 |
303 | 312 |
304 RawAbstractType* PhiInstr::LeastSpecificInputType() const { | 313 RawAbstractType* PhiInstr::LeastSpecificInputType() const { |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 Location::SameAsFirstInput(), | 1434 Location::SameAsFirstInput(), |
1426 LocationSummary::kNoCall); | 1435 LocationSummary::kNoCall); |
1427 } | 1436 } |
1428 | 1437 |
1429 | 1438 |
1430 void StoreVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1439 void StoreVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
1431 Register value_reg = locs()->in(0).reg(); | 1440 Register value_reg = locs()->in(0).reg(); |
1432 Register dest_reg = locs()->in(1).reg(); | 1441 Register dest_reg = locs()->in(1).reg(); |
1433 ASSERT(value_reg == locs()->out().reg()); | 1442 ASSERT(value_reg == locs()->out().reg()); |
1434 | 1443 |
1435 __ StoreIntoObject(dest_reg, FieldAddress(dest_reg, offset_in_bytes()), | 1444 if (value()->NeedsStoreBuffer()) { |
1436 value_reg); | 1445 __ StoreIntoObject(dest_reg, FieldAddress(dest_reg, offset_in_bytes()), |
| 1446 value_reg); |
| 1447 } else { |
| 1448 __ StoreIntoObjectNoBarrier( |
| 1449 dest_reg, FieldAddress(dest_reg, offset_in_bytes()), value_reg); |
| 1450 } |
1437 } | 1451 } |
1438 | 1452 |
1439 | 1453 |
1440 LocationSummary* AllocateObjectComp::MakeLocationSummary() const { | 1454 LocationSummary* AllocateObjectComp::MakeLocationSummary() const { |
1441 return MakeCallSummary(); | 1455 return MakeCallSummary(); |
1442 } | 1456 } |
1443 | 1457 |
1444 | 1458 |
1445 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1459 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
1446 const Class& cls = Class::ZoneHandle(constructor().Owner()); | 1460 const Class& cls = Class::ZoneHandle(constructor().Owner()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 ? UseDefinition(values()[i]->AsUse()->definition()) | 1539 ? UseDefinition(values()[i]->AsUse()->definition()) |
1526 : val); | 1540 : val); |
1527 } | 1541 } |
1528 return copy; | 1542 return copy; |
1529 } | 1543 } |
1530 | 1544 |
1531 | 1545 |
1532 #undef __ | 1546 #undef __ |
1533 | 1547 |
1534 } // namespace dart | 1548 } // namespace dart |
OLD | NEW |