Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 681 // Check that value is always smi. | 681 // Check that value is always smi. |
| 682 value_check = ICData::New(Function::Handle(), | 682 value_check = ICData::New(Function::Handle(), |
| 683 String::Handle(), | 683 String::Handle(), |
| 684 Isolate::kNoDeoptId, | 684 Isolate::kNoDeoptId, |
| 685 1); | 685 1); |
| 686 value_check.AddReceiverCheck(kSmiCid, Function::Handle()); | 686 value_check.AddReceiverCheck(kSmiCid, Function::Handle()); |
| 687 break; | 687 break; |
| 688 } | 688 } |
| 689 case kInt32ArrayCid: | 689 case kInt32ArrayCid: |
| 690 case kUint32ArrayCid: | 690 case kUint32ArrayCid: |
| 691 // Check if elements fit into a smi or the platform supports unboxed | |
|
Vyacheslav Egorov (Google)
2013/02/22 13:20:43
Consider moving this to the function start and usi
| |
| 692 // mints. | |
| 693 if ((kSmiBits < 32) && !FlowGraphCompiler::SupportsUnboxedMints()) { | |
| 694 return false; | |
| 695 } | |
| 691 // We don't have ICData for the value stored, so we optimistically assume | 696 // We don't have ICData for the value stored, so we optimistically assume |
| 692 // smis first. If we ever deoptimized here, we require to unbox the value | 697 // smis first. If we ever deoptimized here, we require to unbox the value |
| 693 // before storing to handle the mint case, too. | 698 // before storing to handle the mint case, too. |
| 694 if (call->ic_data()->deopt_reason() == kDeoptUnknown) { | 699 if (call->ic_data()->deopt_reason() == kDeoptUnknown) { |
| 695 value_check = ICData::New(Function::Handle(), | 700 value_check = ICData::New(Function::Handle(), |
| 696 String::Handle(), | 701 String::Handle(), |
| 697 Isolate::kNoDeoptId, | 702 Isolate::kNoDeoptId, |
| 698 1); | 703 1); |
| 699 value_check.AddReceiverCheck(kSmiCid, Function::Handle()); | 704 value_check.AddReceiverCheck(kSmiCid, Function::Handle()); |
| 700 } | 705 } |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1519 case MethodRecognizer::kByteArrayBaseGetUint8: | 1524 case MethodRecognizer::kByteArrayBaseGetUint8: |
| 1520 array_op = BuildByteArrayViewLoad(call, class_ids[0], kUint8ArrayCid); | 1525 array_op = BuildByteArrayViewLoad(call, class_ids[0], kUint8ArrayCid); |
| 1521 break; | 1526 break; |
| 1522 case MethodRecognizer::kByteArrayBaseGetInt16: | 1527 case MethodRecognizer::kByteArrayBaseGetInt16: |
| 1523 array_op = BuildByteArrayViewLoad(call, class_ids[0], kInt16ArrayCid); | 1528 array_op = BuildByteArrayViewLoad(call, class_ids[0], kInt16ArrayCid); |
| 1524 break; | 1529 break; |
| 1525 case MethodRecognizer::kByteArrayBaseGetUint16: | 1530 case MethodRecognizer::kByteArrayBaseGetUint16: |
| 1526 array_op = BuildByteArrayViewLoad(call, class_ids[0], kUint16ArrayCid); | 1531 array_op = BuildByteArrayViewLoad(call, class_ids[0], kUint16ArrayCid); |
| 1527 break; | 1532 break; |
| 1528 case MethodRecognizer::kByteArrayBaseGetInt32: | 1533 case MethodRecognizer::kByteArrayBaseGetInt32: |
| 1534 // Check if elements fit into a smi or the platform supports unboxed | |
|
Vyacheslav Egorov (Google)
2013/02/22 13:20:43
Consider moving this to the function start and usi
| |
| 1535 // mints. | |
| 1536 if ((kSmiBits < 32) && !FlowGraphCompiler::SupportsUnboxedMints()) { | |
| 1537 return false; | |
| 1538 } | |
| 1529 array_op = BuildByteArrayViewLoad(call, class_ids[0], kInt32ArrayCid); | 1539 array_op = BuildByteArrayViewLoad(call, class_ids[0], kInt32ArrayCid); |
| 1530 break; | 1540 break; |
| 1531 case MethodRecognizer::kByteArrayBaseGetUint32: | 1541 case MethodRecognizer::kByteArrayBaseGetUint32: |
| 1542 // Check if elements fit into a smi or the platform supports unboxed | |
|
Vyacheslav Egorov (Google)
2013/02/22 13:20:43
Consider moving this to the function start and usi
| |
| 1543 // mints. | |
| 1544 if ((kSmiBits < 32) && !FlowGraphCompiler::SupportsUnboxedMints()) { | |
| 1545 return false; | |
| 1546 } | |
| 1532 array_op = BuildByteArrayViewLoad(call, class_ids[0], kUint32ArrayCid); | 1547 array_op = BuildByteArrayViewLoad(call, class_ids[0], kUint32ArrayCid); |
| 1533 break; | 1548 break; |
| 1534 case MethodRecognizer::kByteArrayBaseGetFloat32: | 1549 case MethodRecognizer::kByteArrayBaseGetFloat32: |
| 1535 array_op = BuildByteArrayViewLoad(call, class_ids[0], kFloat32ArrayCid); | 1550 array_op = BuildByteArrayViewLoad(call, class_ids[0], kFloat32ArrayCid); |
| 1536 break; | 1551 break; |
| 1537 case MethodRecognizer::kByteArrayBaseGetFloat64: | 1552 case MethodRecognizer::kByteArrayBaseGetFloat64: |
| 1538 array_op = BuildByteArrayViewLoad(call, class_ids[0], kFloat64ArrayCid); | 1553 array_op = BuildByteArrayViewLoad(call, class_ids[0], kFloat64ArrayCid); |
| 1539 break; | 1554 break; |
| 1540 default: | 1555 default: |
| 1541 // Unsupported method. | 1556 // Unsupported method. |
| (...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4257 | 4272 |
| 4258 if (FLAG_trace_constant_propagation) { | 4273 if (FLAG_trace_constant_propagation) { |
| 4259 OS::Print("\n==== After constant propagation ====\n"); | 4274 OS::Print("\n==== After constant propagation ====\n"); |
| 4260 FlowGraphPrinter printer(*graph_); | 4275 FlowGraphPrinter printer(*graph_); |
| 4261 printer.PrintBlocks(); | 4276 printer.PrintBlocks(); |
| 4262 } | 4277 } |
| 4263 } | 4278 } |
| 4264 | 4279 |
| 4265 | 4280 |
| 4266 } // namespace dart | 4281 } // namespace dart |
| OLD | NEW |