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 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 } | 1111 } |
1112 } | 1112 } |
1113 } | 1113 } |
1114 } | 1114 } |
1115 | 1115 |
1116 | 1116 |
1117 RawFunction* Precompiler::CompileStaticInitializer(const Field& field, | 1117 RawFunction* Precompiler::CompileStaticInitializer(const Field& field, |
1118 bool compute_type) { | 1118 bool compute_type) { |
1119 ASSERT(field.is_static()); | 1119 ASSERT(field.is_static()); |
1120 Thread* thread = Thread::Current(); | 1120 Thread* thread = Thread::Current(); |
1121 StackZone zone(thread); | 1121 StackZone stack_zone(thread); |
| 1122 Zone* zone = stack_zone.GetZone(); |
1122 | 1123 |
1123 ParsedFunction* parsed_function = Parser::ParseStaticFieldInitializer(field); | 1124 ParsedFunction* parsed_function; |
| 1125 // Check if this field is comming from the Kernel binary. |
| 1126 if (field.kernel_field() != NULL) { |
| 1127 parsed_function = kernel::ParseStaticFieldInitializer(zone, field); |
| 1128 } else { |
| 1129 parsed_function = Parser::ParseStaticFieldInitializer(field); |
| 1130 parsed_function->AllocateVariables(); |
| 1131 } |
1124 | 1132 |
1125 parsed_function->AllocateVariables(); | 1133 |
1126 DartPrecompilationPipeline pipeline(zone.GetZone()); | 1134 DartPrecompilationPipeline pipeline(zone); |
1127 PrecompileParsedFunctionHelper helper(/* precompiler = */ NULL, | 1135 PrecompileParsedFunctionHelper helper(/* precompiler = */ NULL, |
1128 parsed_function, | 1136 parsed_function, |
1129 /* optimized = */ true); | 1137 /* optimized = */ true); |
1130 bool success = helper.Compile(&pipeline); | 1138 bool success = helper.Compile(&pipeline); |
1131 ASSERT(success); | 1139 ASSERT(success); |
1132 | 1140 |
1133 if (compute_type && field.is_final()) { | 1141 if (compute_type && field.is_final()) { |
1134 intptr_t result_cid = pipeline.result_type().ToCid(); | 1142 intptr_t result_cid = pipeline.result_type().ToCid(); |
1135 if (result_cid != kDynamicCid) { | 1143 if (result_cid != kDynamicCid) { |
1136 if (FLAG_trace_precompiler && FLAG_support_il_printer) { | 1144 if (FLAG_trace_precompiler && FLAG_support_il_printer) { |
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3285 | 3293 |
3286 ASSERT(FLAG_precompiled_mode); | 3294 ASSERT(FLAG_precompiled_mode); |
3287 const bool optimized = function.IsOptimizable(); // False for natives. | 3295 const bool optimized = function.IsOptimizable(); // False for natives. |
3288 DartPrecompilationPipeline pipeline(zone, field_type_map); | 3296 DartPrecompilationPipeline pipeline(zone, field_type_map); |
3289 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); | 3297 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); |
3290 } | 3298 } |
3291 | 3299 |
3292 #endif // DART_PRECOMPILER | 3300 #endif // DART_PRECOMPILER |
3293 | 3301 |
3294 } // namespace dart | 3302 } // namespace dart |
OLD | NEW |