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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // instances. This allows us to just finalize function types without going | 267 // instances. This allows us to just finalize function types without going |
268 // through the hoops of trying to compile their scope class. | 268 // through the hoops of trying to compile their scope class. |
269 ObjectStore* object_store = thread->isolate()->object_store(); | 269 ObjectStore* object_store = thread->isolate()->object_store(); |
270 Zone* zone = thread->zone(); | 270 Zone* zone = thread->zone(); |
271 Class& cls = Class::Handle(zone, object_store->closure_class()); | 271 Class& cls = Class::Handle(zone, object_store->closure_class()); |
272 Compiler::CompileClass(cls); | 272 Compiler::CompileClass(cls); |
273 | 273 |
274 #if defined(DEBUG) | 274 #if defined(DEBUG) |
275 // Verify that closure field offsets are identical in Dart and C++. | 275 // Verify that closure field offsets are identical in Dart and C++. |
276 const Array& fields = Array::Handle(zone, cls.fields()); | 276 const Array& fields = Array::Handle(zone, cls.fields()); |
277 ASSERT(fields.Length() == 3); | 277 ASSERT(fields.Length() == 4); |
278 Field& field = Field::Handle(zone); | 278 Field& field = Field::Handle(zone); |
279 field ^= fields.At(0); | 279 field ^= fields.At(0); |
280 ASSERT(field.Offset() == Closure::instantiator_offset()); | 280 ASSERT(field.Offset() == Closure::instantiator_type_arguments_offset()); |
281 field ^= fields.At(1); | 281 field ^= fields.At(1); |
| 282 ASSERT(field.Offset() == Closure::function_type_arguments_offset()); |
| 283 field ^= fields.At(2); |
282 ASSERT(field.Offset() == Closure::function_offset()); | 284 ASSERT(field.Offset() == Closure::function_offset()); |
283 field ^= fields.At(2); | 285 field ^= fields.At(3); |
284 ASSERT(field.Offset() == Closure::context_offset()); | 286 ASSERT(field.Offset() == Closure::context_offset()); |
285 #endif // defined(DEBUG) | 287 #endif // defined(DEBUG) |
286 | 288 |
287 // Eagerly compile Bool class, bool constants are used from within compiler. | 289 // Eagerly compile Bool class, bool constants are used from within compiler. |
288 cls = object_store->bool_class(); | 290 cls = object_store->bool_class(); |
289 Compiler::CompileClass(cls); | 291 Compiler::CompileClass(cls); |
290 } | 292 } |
291 | 293 |
292 | 294 |
293 static RawError* BootstrapFromSource(Thread* thread) { | 295 static RawError* BootstrapFromSource(Thread* thread) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 lib.Register(thread); | 409 lib.Register(thread); |
408 isolate->object_store()->set_bootstrap_library(id, lib); | 410 isolate->object_store()->set_bootstrap_library(id, lib); |
409 } | 411 } |
410 } | 412 } |
411 | 413 |
412 return (kernel_program == NULL) ? BootstrapFromSource(thread) | 414 return (kernel_program == NULL) ? BootstrapFromSource(thread) |
413 : BootstrapFromKernel(thread, kernel_program); | 415 : BootstrapFromKernel(thread, kernel_program); |
414 } | 416 } |
415 | 417 |
416 } // namespace dart | 418 } // namespace dart |
OLD | NEW |