Index: runtime/vm/bootstrap.cc |
diff --git a/runtime/vm/bootstrap.cc b/runtime/vm/bootstrap.cc |
index 562392ff15aefa52fcb84c88187dfab2f12c0509..c445f4ab7c33708c25f7b17f5fbab31879ecdf22 100644 |
--- a/runtime/vm/bootstrap.cc |
+++ b/runtime/vm/bootstrap.cc |
@@ -161,28 +161,30 @@ static RawError* Compile(const Library& library, const Script& script) { |
} |
-static Dart_Handle LoadPartSource(Isolate* isolate, |
+static Dart_Handle LoadPartSource(Thread* thread, |
const Library& lib, |
const String& uri) { |
+ Zone* zone = thread->zone(); |
+ Isolate* isolate = thread->isolate(); |
const String& part_source = String::Handle( |
- isolate, GetLibrarySource(lib, uri, false)); |
- const String& lib_uri = String::Handle(isolate, lib.url()); |
+ zone, GetLibrarySource(lib, uri, false)); |
+ const String& lib_uri = String::Handle(zone, lib.url()); |
if (part_source.IsNull()) { |
return Api::NewError("Unable to read part file '%s' of library '%s'", |
uri.ToCString(), lib_uri.ToCString()); |
} |
// Prepend the library URI to form a unique script URI for the part. |
- const Array& strings = Array::Handle(isolate, Array::New(3)); |
+ const Array& strings = Array::Handle(zone, Array::New(3)); |
strings.SetAt(0, lib_uri); |
strings.SetAt(1, Symbols::Slash()); |
strings.SetAt(2, uri); |
- const String& part_uri = String::Handle(isolate, String::ConcatAll(strings)); |
+ const String& part_uri = String::Handle(zone, String::ConcatAll(strings)); |
// Create a script object and compile the part. |
const Script& part_script = Script::Handle( |
- isolate, Script::New(part_uri, part_source, RawScript::kSourceTag)); |
- const Error& error = Error::Handle(isolate, Compile(lib, part_script)); |
+ zone, Script::New(part_uri, part_source, RawScript::kSourceTag)); |
+ const Error& error = Error::Handle(zone, Compile(lib, part_script)); |
return Api::NewHandle(isolate, error.raw()); |
} |
@@ -190,7 +192,8 @@ static Dart_Handle LoadPartSource(Isolate* isolate, |
static Dart_Handle BootstrapLibraryTagHandler(Dart_LibraryTag tag, |
Dart_Handle library, |
Dart_Handle uri) { |
- Isolate* isolate = Isolate::Current(); |
+ Thread* thread = Thread::Current(); |
+ Zone* zone = thread->zone(); |
if (!Dart_IsLibrary(library)) { |
return Api::NewError("not a library"); |
} |
@@ -201,7 +204,7 @@ static Dart_Handle BootstrapLibraryTagHandler(Dart_LibraryTag tag, |
// In the bootstrap loader we do not try and do any canonicalization. |
return uri; |
} |
- const String& uri_str = Api::UnwrapStringHandle(isolate, uri); |
+ const String& uri_str = Api::UnwrapStringHandle(zone, uri); |
ASSERT(!uri_str.IsNull()); |
if (tag == Dart_kImportTag) { |
// We expect the core bootstrap libraries to only import other |
@@ -213,21 +216,21 @@ static Dart_Handle BootstrapLibraryTagHandler(Dart_LibraryTag tag, |
uri_str.ToCString()); |
} |
ASSERT(tag == Dart_kSourceTag); |
- const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
+ const Library& lib = Api::UnwrapLibraryHandle(zone, library); |
ASSERT(!lib.IsNull()); |
- return LoadPartSource(isolate, lib, uri_str); |
+ return LoadPartSource(thread, lib, uri_str); |
} |
-static RawError* LoadPatchFiles(Isolate* isolate, |
+static RawError* LoadPatchFiles(Zone* zone, |
const Library& lib, |
const String& patch_uri, |
const char** patch_files) { |
- String& patch_file_uri = String::Handle(isolate); |
- String& source = String::Handle(isolate); |
- Script& script = Script::Handle(isolate); |
- Error& error = Error::Handle(isolate); |
- const Array& strings = Array::Handle(isolate, Array::New(3)); |
+ String& patch_file_uri = String::Handle(zone); |
+ String& source = String::Handle(zone); |
+ Script& script = Script::Handle(zone); |
+ Error& error = Error::Handle(zone); |
+ const Array& strings = Array::Handle(zone, Array::New(3)); |
strings.SetAt(0, patch_uri); |
strings.SetAt(1, Symbols::Slash()); |
for (intptr_t j = 0; patch_files[j] != NULL; j += 2) { |
@@ -255,12 +258,13 @@ static RawError* LoadPatchFiles(Isolate* isolate, |
RawError* Bootstrap::LoadandCompileScripts() { |
Thread* thread = Thread::Current(); |
Isolate* isolate = thread->isolate(); |
- String& uri = String::Handle(isolate); |
- String& patch_uri = String::Handle(isolate); |
- String& source = String::Handle(isolate); |
- Script& script = Script::Handle(isolate); |
- Library& lib = Library::Handle(isolate); |
- Error& error = Error::Handle(isolate); |
+ Zone* zone = thread->zone(); |
+ String& uri = String::Handle(zone); |
+ String& patch_uri = String::Handle(zone); |
+ String& source = String::Handle(zone); |
+ Script& script = Script::Handle(zone); |
+ Library& lib = Library::Handle(zone); |
+ Error& error = Error::Handle(zone); |
Dart_LibraryTagHandler saved_tag_handler = isolate->library_tag_handler(); |
// Set the library tag handler for the isolate to the bootstrap |
@@ -307,7 +311,7 @@ RawError* Bootstrap::LoadandCompileScripts() { |
// If a patch exists, load and patch the script. |
if (bootstrap_libraries[i].patch_paths_ != NULL) { |
patch_uri = Symbols::New(bootstrap_libraries[i].patch_uri_); |
- error = LoadPatchFiles(isolate, |
+ error = LoadPatchFiles(zone, |
lib, |
patch_uri, |
bootstrap_libraries[i].patch_paths_); |
@@ -320,12 +324,12 @@ RawError* Bootstrap::LoadandCompileScripts() { |
SetupNativeResolver(); |
ClassFinalizer::ProcessPendingClasses(); |
- Class& cls = Class::Handle(isolate); |
+ Class& cls = Class::Handle(zone); |
// Eagerly compile the function implementation class as it is the super |
// class of signature classes. This allows us to just finalize signature |
// classes without going through the hoops of trying to compile them. |
const Type& type = |
- Type::Handle(isolate, isolate->object_store()->function_impl_type()); |
+ Type::Handle(zone, isolate->object_store()->function_impl_type()); |
cls = type.type_class(); |
Compiler::CompileClass(cls); |
} |