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 #include "vm/bootstrap_natives.h" | 9 #include "vm/bootstrap_natives.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // instances. This allows us to just finalize function types without going | 225 // instances. This allows us to just finalize function types without going |
226 // through the hoops of trying to compile their scope class. | 226 // through the hoops of trying to compile their scope class. |
227 ObjectStore* object_store = thread->isolate()->object_store(); | 227 ObjectStore* object_store = thread->isolate()->object_store(); |
228 Zone* zone = thread->zone(); | 228 Zone* zone = thread->zone(); |
229 Class& cls = Class::Handle(zone, object_store->closure_class()); | 229 Class& cls = Class::Handle(zone, object_store->closure_class()); |
230 Compiler::CompileClass(cls); | 230 Compiler::CompileClass(cls); |
231 | 231 |
232 #if defined(DEBUG) | 232 #if defined(DEBUG) |
233 // Verify that closure field offsets are identical in Dart and C++. | 233 // Verify that closure field offsets are identical in Dart and C++. |
234 const Array& fields = Array::Handle(zone, cls.fields()); | 234 const Array& fields = Array::Handle(zone, cls.fields()); |
235 ASSERT(fields.Length() == 5); | 235 ASSERT(fields.Length() == 4); |
236 Field& field = Field::Handle(zone); | 236 Field& field = Field::Handle(zone); |
237 field ^= fields.At(0); | 237 field ^= fields.At(0); |
238 ASSERT(field.Offset() == Closure::instantiator_type_arguments_offset()); | 238 ASSERT(field.Offset() == Closure::instantiator_type_arguments_offset()); |
239 field ^= fields.At(1); | 239 field ^= fields.At(1); |
240 ASSERT(field.Offset() == Closure::function_type_arguments_offset()); | 240 ASSERT(field.Offset() == Closure::function_type_arguments_offset()); |
241 field ^= fields.At(2); | 241 field ^= fields.At(2); |
242 ASSERT(field.Offset() == Closure::function_offset()); | 242 ASSERT(field.Offset() == Closure::function_offset()); |
243 field ^= fields.At(3); | 243 field ^= fields.At(3); |
244 ASSERT(field.Offset() == Closure::context_offset()); | 244 ASSERT(field.Offset() == Closure::context_offset()); |
245 field ^= fields.At(4); | |
246 ASSERT(field.Offset() == Closure::hash_offset()); | |
247 #endif // defined(DEBUG) | 245 #endif // defined(DEBUG) |
248 | 246 |
249 // Eagerly compile Bool class, bool constants are used from within compiler. | 247 // Eagerly compile Bool class, bool constants are used from within compiler. |
250 cls = object_store->bool_class(); | 248 cls = object_store->bool_class(); |
251 Compiler::CompileClass(cls); | 249 Compiler::CompileClass(cls); |
252 } | 250 } |
253 | 251 |
254 static RawError* BootstrapFromSource(Thread* thread) { | 252 static RawError* BootstrapFromSource(Thread* thread) { |
255 Isolate* isolate = thread->isolate(); | 253 Isolate* isolate = thread->isolate(); |
256 Zone* zone = thread->zone(); | 254 Zone* zone = thread->zone(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 lib.Register(thread); | 373 lib.Register(thread); |
376 isolate->object_store()->set_bootstrap_library(id, lib); | 374 isolate->object_store()->set_bootstrap_library(id, lib); |
377 } | 375 } |
378 } | 376 } |
379 | 377 |
380 return (kernel_program == NULL) ? BootstrapFromSource(thread) | 378 return (kernel_program == NULL) ? BootstrapFromSource(thread) |
381 : BootstrapFromKernel(thread, kernel_program); | 379 : BootstrapFromKernel(thread, kernel_program); |
382 } | 380 } |
383 | 381 |
384 } // namespace dart | 382 } // namespace dart |
OLD | NEW |