Index: runtime/vm/bootstrap.cc |
diff --git a/runtime/vm/bootstrap.cc b/runtime/vm/bootstrap.cc |
index 9839c5a952c0805bec5d897b6e6663867a16a407..d90c7321eea087b51d8585725490b0e5b4118f63 100644 |
--- a/runtime/vm/bootstrap.cc |
+++ b/runtime/vm/bootstrap.cc |
@@ -267,8 +267,23 @@ static void Finish(Thread* thread, bool from_kernel) { |
// instances. This allows us to just finalize function types without going |
// through the hoops of trying to compile their scope class. |
ObjectStore* object_store = thread->isolate()->object_store(); |
- Class& cls = Class::Handle(thread->zone(), object_store->closure_class()); |
+ Zone* zone = thread->zone(); |
+ Class& cls = Class::Handle(zone, object_store->closure_class()); |
Compiler::CompileClass(cls); |
+ |
+#if defined(DEBUG) |
+ // Verify that closure field offsets are identical in Dart and C++. |
+ const Array& fields = Array::Handle(zone, cls.fields()); |
+ ASSERT(fields.Length() == 3); |
+ Field& field = Field::Handle(zone); |
+ field ^= fields.At(0); |
+ ASSERT(field.Offset() == Closure::instantiator_offset()); |
+ field ^= fields.At(1); |
+ ASSERT(field.Offset() == Closure::function_offset()); |
+ field ^= fields.At(2); |
+ ASSERT(field.Offset() == Closure::context_offset()); |
+#endif // defined(DEBUG) |
+ |
// Eagerly compile Bool class, bool constants are used from within compiler. |
cls = object_store->bool_class(); |
Compiler::CompileClass(cls); |