Chromium Code Reviews| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 761 AddConstObject(Instance::Cast(value)); | 761 AddConstObject(Instance::Cast(value)); |
| 762 } | 762 } |
| 763 | 763 |
| 764 if (field.has_initializer()) { | 764 if (field.has_initializer()) { |
| 765 // Should not be in the middle of initialization while precompiling. | 765 // Should not be in the middle of initialization while precompiling. |
| 766 ASSERT(value.raw() != Object::transition_sentinel().raw()); | 766 ASSERT(value.raw() != Object::transition_sentinel().raw()); |
| 767 | 767 |
| 768 const bool is_initialized = value.raw() != Object::sentinel().raw(); | 768 const bool is_initialized = value.raw() != Object::sentinel().raw(); |
| 769 if (is_initialized && !reset_fields_) return; | 769 if (is_initialized && !reset_fields_) return; |
| 770 | 770 |
| 771 if (!field.HasPrecompiledInitializer()) { | 771 if (!field.HasPrecompiledInitializer() || |
| 772 !Function::Handle(Z, field.PrecompiledInitializer()).HasCode()) { | |
| 772 if (FLAG_trace_precompiler) { | 773 if (FLAG_trace_precompiler) { |
| 773 THR_Print("Precompiling initializer for %s\n", field.ToCString()); | 774 THR_Print("Precompiling initializer for %s\n", field.ToCString()); |
| 774 } | 775 } |
| 775 ASSERT(Dart::snapshot_kind() != Snapshot::kAppNoJIT); | 776 ASSERT(Dart::snapshot_kind() != Snapshot::kAppNoJIT); |
| 776 field.SetStaticValue(Instance::Handle(field.SavedInitialStaticValue())); | |
| 777 const Function& initializer = | 777 const Function& initializer = |
| 778 Function::Handle(CompileStaticInitializer(field)); | 778 Function::Handle(CompileStaticInitializer(field)); |
|
rmacnak
2016/05/10 19:43:04
Handle(Z, ...
Florian Schneider
2016/05/10 19:49:59
Done.
| |
| 779 if (!initializer.IsNull()) { | 779 ASSERT(!initializer.IsNull()); |
| 780 field.SetPrecompiledInitializer(initializer); | 780 field.SetPrecompiledInitializer(initializer); |
| 781 } | 781 AddCalleesOf(initializer); |
| 782 ASSERT(field.HasPrecompiledInitializer()); | |
| 783 const Function& function = | |
| 784 Function::Handle(Z, field.PrecompiledInitializer()); | |
| 785 AddCalleesOf(function); | |
| 786 } | 782 } |
| 787 } | 783 } |
| 788 } | 784 } |
| 789 } | 785 } |
| 790 | 786 |
| 791 | 787 |
| 792 RawFunction* Precompiler::CompileStaticInitializer(const Field& field) { | 788 RawFunction* Precompiler::CompileStaticInitializer(const Field& field) { |
| 793 ASSERT(field.is_static()); | 789 ASSERT(field.is_static()); |
| 794 ASSERT(!field.HasPrecompiledInitializer()); | 790 ASSERT(!field.HasPrecompiledInitializer()); |
| 795 Thread* thread = Thread::Current(); | 791 Thread* thread = Thread::Current(); |
| (...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2767 CompilationPipeline::New(thread->zone(), function); | 2763 CompilationPipeline::New(thread->zone(), function); |
| 2768 | 2764 |
| 2769 ASSERT(FLAG_precompiled_mode); | 2765 ASSERT(FLAG_precompiled_mode); |
| 2770 const bool optimized = function.IsOptimizable(); // False for natives. | 2766 const bool optimized = function.IsOptimizable(); // False for natives. |
| 2771 return PrecompileFunctionHelper(pipeline, function, optimized); | 2767 return PrecompileFunctionHelper(pipeline, function, optimized); |
| 2772 } | 2768 } |
| 2773 | 2769 |
| 2774 #endif // DART_PRECOMPILER | 2770 #endif // DART_PRECOMPILER |
| 2775 | 2771 |
| 2776 } // namespace dart | 2772 } // namespace dart |
| OLD | NEW |