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 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 } | 2335 } |
2336 | 2336 |
2337 void Visit(const Function& function) { | 2337 void Visit(const Function& function) { |
2338 if (!function.HasCode()) { | 2338 if (!function.HasCode()) { |
2339 ASSERT(function.HasImplicitClosureFunction()); | 2339 ASSERT(function.HasImplicitClosureFunction()); |
2340 return; | 2340 return; |
2341 } | 2341 } |
2342 code_ = function.CurrentCode(); | 2342 code_ = function.CurrentCode(); |
2343 instructions_ = code_.instructions(); | 2343 instructions_ = code_.instructions(); |
2344 instructions_ = DedupOneInstructions(instructions_); | 2344 instructions_ = DedupOneInstructions(instructions_); |
2345 code_.SetActiveInstructions(instructions_.raw()); | 2345 code_.SetActiveInstructions(instructions_); |
2346 code_.set_instructions(instructions_.raw()); | 2346 code_.set_instructions(instructions_); |
2347 function.SetInstructions(code_); // Update cached entry point. | 2347 function.SetInstructions(code_); // Update cached entry point. |
2348 } | 2348 } |
2349 | 2349 |
2350 RawInstructions* DedupOneInstructions(const Instructions& instructions) { | 2350 RawInstructions* DedupOneInstructions(const Instructions& instructions) { |
2351 const Instructions* canonical_instructions = | 2351 const Instructions* canonical_instructions = |
2352 canonical_instructions_set_.LookupValue(&instructions); | 2352 canonical_instructions_set_.LookupValue(&instructions); |
2353 if (canonical_instructions == NULL) { | 2353 if (canonical_instructions == NULL) { |
2354 canonical_instructions_set_.Insert( | 2354 canonical_instructions_set_.Insert( |
2355 &Instructions::ZoneHandle(zone_, instructions.raw())); | 2355 &Instructions::ZoneHandle(zone_, instructions.raw())); |
2356 return instructions.raw(); | 2356 return instructions.raw(); |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3340 | 3340 |
3341 ASSERT(FLAG_precompiled_mode); | 3341 ASSERT(FLAG_precompiled_mode); |
3342 const bool optimized = function.IsOptimizable(); // False for natives. | 3342 const bool optimized = function.IsOptimizable(); // False for natives. |
3343 DartPrecompilationPipeline pipeline(zone, field_type_map); | 3343 DartPrecompilationPipeline pipeline(zone, field_type_map); |
3344 return PrecompileFunctionHelper(&pipeline, function, optimized); | 3344 return PrecompileFunctionHelper(&pipeline, function, optimized); |
3345 } | 3345 } |
3346 | 3346 |
3347 #endif // DART_PRECOMPILER | 3347 #endif // DART_PRECOMPILER |
3348 | 3348 |
3349 } // namespace dart | 3349 } // namespace dart |
OLD | NEW |