| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/precompiler.h" | 5 #include "vm/precompiler.h" |
| 6 | 6 |
| 7 #include "vm/aot_optimizer.h" | 7 #include "vm/aot_optimizer.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/branch_optimizer.h" | 10 #include "vm/branch_optimizer.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if ((field_map_ != NULL )&& | 88 if ((field_map_ != NULL )&& |
| 89 flow_graph->function().IsGenerativeConstructor()) { | 89 flow_graph->function().IsGenerativeConstructor()) { |
| 90 for (BlockIterator block_it = flow_graph->reverse_postorder_iterator(); | 90 for (BlockIterator block_it = flow_graph->reverse_postorder_iterator(); |
| 91 !block_it.Done(); | 91 !block_it.Done(); |
| 92 block_it.Advance()) { | 92 block_it.Advance()) { |
| 93 ForwardInstructionIterator it(block_it.Current()); | 93 ForwardInstructionIterator it(block_it.Current()); |
| 94 for (; !it.Done(); it.Advance()) { | 94 for (; !it.Done(); it.Advance()) { |
| 95 StoreInstanceFieldInstr* store = it.Current()->AsStoreInstanceField(); | 95 StoreInstanceFieldInstr* store = it.Current()->AsStoreInstanceField(); |
| 96 if (store != NULL) { | 96 if (store != NULL) { |
| 97 if (!store->field().IsNull() && store->field().is_final()) { | 97 if (!store->field().IsNull() && store->field().is_final()) { |
| 98 if (FLAG_trace_precompiler) { | 98 if (FLAG_trace_precompiler && FLAG_support_il_printer) { |
| 99 THR_Print("Found store to %s <- %s\n", | 99 THR_Print("Found store to %s <- %s\n", |
| 100 store->field().ToCString(), | 100 store->field().ToCString(), |
| 101 store->value()->Type()->ToCString()); | 101 store->value()->Type()->ToCString()); |
| 102 } | 102 } |
| 103 FieldTypePair* entry = field_map_->Lookup(&store->field()); | 103 FieldTypePair* entry = field_map_->Lookup(&store->field()); |
| 104 if (entry == NULL) { | 104 if (entry == NULL) { |
| 105 field_map_->Insert(FieldTypePair( | 105 field_map_->Insert(FieldTypePair( |
| 106 &Field::Handle(zone_, store->field().raw()), // Re-wrap. | 106 &Field::Handle(zone_, store->field().raw()), // Re-wrap. |
| 107 store->value()->Type()->ToCid())); | 107 store->value()->Type()->ToCid())); |
| 108 if (FLAG_trace_precompiler) { | 108 if (FLAG_trace_precompiler && FLAG_support_il_printer) { |
| 109 THR_Print(" initial type = %s\n", | 109 THR_Print(" initial type = %s\n", |
| 110 store->value()->Type()->ToCString()); | 110 store->value()->Type()->ToCString()); |
| 111 } | 111 } |
| 112 continue; | 112 continue; |
| 113 } | 113 } |
| 114 CompileType type = CompileType::FromCid(entry->cid_); | 114 CompileType type = CompileType::FromCid(entry->cid_); |
| 115 if (FLAG_trace_precompiler) { | 115 if (FLAG_trace_precompiler && FLAG_support_il_printer) { |
| 116 THR_Print(" old type = %s\n", type.ToCString()); | 116 THR_Print(" old type = %s\n", type.ToCString()); |
| 117 } | 117 } |
| 118 type.Union(store->value()->Type()); | 118 type.Union(store->value()->Type()); |
| 119 if (FLAG_trace_precompiler) { | 119 if (FLAG_trace_precompiler && FLAG_support_il_printer) { |
| 120 THR_Print(" new type = %s\n", type.ToCString()); | 120 THR_Print(" new type = %s\n", type.ToCString()); |
| 121 } | 121 } |
| 122 entry->cid_ = type.ToCid(); | 122 entry->cid_ = type.ToCid(); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 CompileType result_type = CompileType::None(); | 129 CompileType result_type = CompileType::None(); |
| (...skipping 3049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3179 | 3179 |
| 3180 ASSERT(FLAG_precompiled_mode); | 3180 ASSERT(FLAG_precompiled_mode); |
| 3181 const bool optimized = function.IsOptimizable(); // False for natives. | 3181 const bool optimized = function.IsOptimizable(); // False for natives. |
| 3182 DartPrecompilationPipeline pipeline(zone, field_type_map); | 3182 DartPrecompilationPipeline pipeline(zone, field_type_map); |
| 3183 return PrecompileFunctionHelper(&pipeline, function, optimized); | 3183 return PrecompileFunctionHelper(&pipeline, function, optimized); |
| 3184 } | 3184 } |
| 3185 | 3185 |
| 3186 #endif // DART_PRECOMPILER | 3186 #endif // DART_PRECOMPILER |
| 3187 | 3187 |
| 3188 } // namespace dart | 3188 } // namespace dart |
| OLD | NEW |