Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Side by Side Diff: runtime/vm/object.cc

Issue 2525623002: VM: [Kernel] Split kernel API into 3 steps: ([read binary], parse-binary, bootstrap, load program) (Closed)
Patch Set: addressed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/become.h" 10 #include "vm/become.h"
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 // 1129 //
1130 // There are three possibilities: 1130 // There are three possibilities:
1131 // 1. Running a Kernel binary. This function will bootstrap from the KERNEL 1131 // 1. Running a Kernel binary. This function will bootstrap from the KERNEL
1132 // file. 1132 // file.
1133 // 2. There is no snapshot. This function will bootstrap from source. 1133 // 2. There is no snapshot. This function will bootstrap from source.
1134 // 3. There is a snapshot. The caller should initialize from the snapshot. 1134 // 3. There is a snapshot. The caller should initialize from the snapshot.
1135 // 1135 //
1136 // A non-NULL kernel argument indicates (1). A NULL kernel indicates (2) or 1136 // A non-NULL kernel argument indicates (1). A NULL kernel indicates (2) or
1137 // (3), depending on whether the VM is compiled with DART_NO_SNAPSHOT defined or 1137 // (3), depending on whether the VM is compiled with DART_NO_SNAPSHOT defined or
1138 // not. 1138 // not.
1139 RawError* Object::Init(Isolate* isolate, 1139 RawError* Object::Init(Isolate* isolate, kernel::Program* kernel_program) {
1140 const uint8_t* kernel_buffer,
1141 intptr_t kernel_buffer_length) {
1142 Thread* thread = Thread::Current(); 1140 Thread* thread = Thread::Current();
1143 Zone* zone = thread->zone(); 1141 Zone* zone = thread->zone();
1144 ASSERT(isolate == thread->isolate()); 1142 ASSERT(isolate == thread->isolate());
1145 #if !defined(DART_PRECOMPILED_RUNTIME) 1143 #if !defined(DART_PRECOMPILED_RUNTIME)
1146 const bool is_kernel = (kernel_buffer != NULL); 1144 const bool is_kernel = (kernel_program != NULL);
1147 #endif 1145 #endif
1148 NOT_IN_PRODUCT(TimelineDurationScope tds(thread, Timeline::GetIsolateStream(), 1146 NOT_IN_PRODUCT(TimelineDurationScope tds(thread, Timeline::GetIsolateStream(),
1149 "Object::Init");) 1147 "Object::Init");)
1150 1148
1151 #if defined(DART_NO_SNAPSHOT) 1149 #if defined(DART_NO_SNAPSHOT)
1152 bool bootstrapping = true; 1150 bool bootstrapping = true;
1153 #elif defined(DART_PRECOMPILED_RUNTIME) 1151 #elif defined(DART_PRECOMPILED_RUNTIME)
1154 bool bootstrapping = false; 1152 bool bootstrapping = false;
1155 #else 1153 #else
1156 bool bootstrapping = is_kernel; 1154 bool bootstrapping = is_kernel;
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 cls = object_store->null_class(); 1610 cls = object_store->null_class();
1613 type = Type::NewNonParameterizedType(cls); 1611 type = Type::NewNonParameterizedType(cls);
1614 object_store->set_null_type(type); 1612 object_store->set_null_type(type);
1615 1613
1616 // Consider removing when/if Null becomes an ordinary class. 1614 // Consider removing when/if Null becomes an ordinary class.
1617 type = object_store->object_type(); 1615 type = object_store->object_type();
1618 cls.set_super_type(type); 1616 cls.set_super_type(type);
1619 1617
1620 // Finish the initialization by compiling the bootstrap scripts containing 1618 // Finish the initialization by compiling the bootstrap scripts containing
1621 // the base interfaces and the implementation of the internal classes. 1619 // the base interfaces and the implementation of the internal classes.
1622 const Error& error = Error::Handle( 1620 const Error& error =
1623 zone, Bootstrap::DoBootstrapping(kernel_buffer, kernel_buffer_length)); 1621 Error::Handle(zone, Bootstrap::DoBootstrapping(kernel_program));
1624 if (!error.IsNull()) { 1622 if (!error.IsNull()) {
1625 return error.raw(); 1623 return error.raw();
1626 } 1624 }
1627 1625
1628 ClassFinalizer::VerifyBootstrapClasses(); 1626 ClassFinalizer::VerifyBootstrapClasses();
1629 1627
1630 // Set up the intrinsic state of all functions (core, math and typed data). 1628 // Set up the intrinsic state of all functions (core, math and typed data).
1631 Intrinsifier::InitializeState(); 1629 Intrinsifier::InitializeState();
1632 1630
1633 // Set up recognized state of all functions (core, math and typed data). 1631 // Set up recognized state of all functions (core, math and typed data).
(...skipping 21132 matching lines...) Expand 10 before | Expand all | Expand 10 after
22766 return UserTag::null(); 22764 return UserTag::null();
22767 } 22765 }
22768 22766
22769 22767
22770 const char* UserTag::ToCString() const { 22768 const char* UserTag::ToCString() const {
22771 const String& tag_label = String::Handle(label()); 22769 const String& tag_label = String::Handle(label());
22772 return tag_label.ToCString(); 22770 return tag_label.ToCString();
22773 } 22771 }
22774 22772
22775 } // namespace dart 22773 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698