OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/bootstrap.h" | 5 #include "vm/bootstrap.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #if !defined(DART_PRECOMPILED_RUNTIME) | 9 #if !defined(DART_PRECOMPILED_RUNTIME) |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // instances. This allows us to just finalize function types without going | 42 // instances. This allows us to just finalize function types without going |
43 // through the hoops of trying to compile their scope class. | 43 // through the hoops of trying to compile their scope class. |
44 ObjectStore* object_store = thread->isolate()->object_store(); | 44 ObjectStore* object_store = thread->isolate()->object_store(); |
45 Zone* zone = thread->zone(); | 45 Zone* zone = thread->zone(); |
46 Class& cls = Class::Handle(zone, object_store->closure_class()); | 46 Class& cls = Class::Handle(zone, object_store->closure_class()); |
47 Compiler::CompileClass(cls); | 47 Compiler::CompileClass(cls); |
48 | 48 |
49 #if defined(DEBUG) | 49 #if defined(DEBUG) |
50 // Verify that closure field offsets are identical in Dart and C++. | 50 // Verify that closure field offsets are identical in Dart and C++. |
51 const Array& fields = Array::Handle(zone, cls.fields()); | 51 const Array& fields = Array::Handle(zone, cls.fields()); |
52 ASSERT(fields.Length() == 5); | 52 ASSERT(fields.Length() == 4); |
53 Field& field = Field::Handle(zone); | 53 Field& field = Field::Handle(zone); |
54 field ^= fields.At(0); | 54 field ^= fields.At(0); |
55 ASSERT(field.Offset() == Closure::instantiator_type_arguments_offset()); | 55 ASSERT(field.Offset() == Closure::instantiator_type_arguments_offset()); |
56 field ^= fields.At(1); | 56 field ^= fields.At(1); |
57 ASSERT(field.Offset() == Closure::function_type_arguments_offset()); | 57 ASSERT(field.Offset() == Closure::function_type_arguments_offset()); |
58 field ^= fields.At(2); | 58 field ^= fields.At(2); |
59 ASSERT(field.Offset() == Closure::function_offset()); | 59 ASSERT(field.Offset() == Closure::function_offset()); |
60 field ^= fields.At(3); | 60 field ^= fields.At(3); |
61 ASSERT(field.Offset() == Closure::context_offset()); | 61 ASSERT(field.Offset() == Closure::context_offset()); |
62 field ^= fields.At(4); | |
63 ASSERT(field.Offset() == Closure::hash_offset()); | |
64 #endif // defined(DEBUG) | 62 #endif // defined(DEBUG) |
65 | 63 |
66 // Eagerly compile Bool class, bool constants are used from within compiler. | 64 // Eagerly compile Bool class, bool constants are used from within compiler. |
67 cls = object_store->bool_class(); | 65 cls = object_store->bool_class(); |
68 Compiler::CompileClass(cls); | 66 Compiler::CompileClass(cls); |
69 } | 67 } |
70 | 68 |
71 RawError* BootstrapFromKernel(Thread* thread, kernel::Program* program) { | 69 RawError* BootstrapFromKernel(Thread* thread, kernel::Program* program) { |
72 Zone* zone = thread->zone(); | 70 Zone* zone = thread->zone(); |
73 kernel::KernelReader reader(program); | 71 kernel::KernelReader reader(program); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return BootstrapFromKernel(thread, program); | 138 return BootstrapFromKernel(thread, program); |
141 } | 139 } |
142 #else | 140 #else |
143 RawError* Bootstrap::DoBootstrapping(kernel::Program* program) { | 141 RawError* Bootstrap::DoBootstrapping(kernel::Program* program) { |
144 UNREACHABLE(); | 142 UNREACHABLE(); |
145 return Error::null(); | 143 return Error::null(); |
146 } | 144 } |
147 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 145 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
148 | 146 |
149 } // namespace dart | 147 } // namespace dart |
OLD | NEW |