Index: runtime/vm/object.cc |
=================================================================== |
--- runtime/vm/object.cc (revision 7858) |
+++ runtime/vm/object.cc (working copy) |
@@ -781,9 +781,17 @@ |
if (!error.IsNull()) { |
return error.raw(); |
} |
+ const Script& math_script = Script::Handle(Bootstrap::LoadMathScript()); |
+ Library::InitMathLibrary(isolate); |
+ const Library& math_lib = Library::Handle(Library::MathLibrary()); |
+ ASSERT(!math_lib.IsNull()); |
+ error = Bootstrap::Compile(math_lib, math_script); |
+ if (!error.IsNull()) { |
+ return error.raw(); |
+ } |
const Script& isolate_script = Script::Handle(Bootstrap::LoadIsolateScript()); |
Library::InitIsolateLibrary(isolate); |
- Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); |
+ const Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); |
ASSERT(!isolate_lib.IsNull()); |
error = Bootstrap::Compile(isolate_lib, isolate_script); |
if (!error.IsNull()) { |
@@ -791,7 +799,7 @@ |
} |
const Script& mirrors_script = Script::Handle(Bootstrap::LoadMirrorsScript()); |
Library::InitMirrorsLibrary(isolate); |
- Library& mirrors_lib = Library::Handle(Library::MirrorsLibrary()); |
+ const Library& mirrors_lib = Library::Handle(Library::MirrorsLibrary()); |
ASSERT(!mirrors_lib.IsNull()); |
error = Bootstrap::Compile(mirrors_lib, mirrors_script); |
if (!error.IsNull()) { |
@@ -5361,6 +5369,16 @@ |
} |
+void Library::InitMathLibrary(Isolate* isolate) { |
+ const String& url = String::Handle(String::NewSymbol("dart:math")); |
+ const Library& lib = Library::Handle(Library::New(url)); |
+ lib.Register(); |
+ const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); |
+ lib.AddImport(core_impl_lib); |
+ isolate->object_store()->set_math_library(lib); |
+} |
+ |
+ |
void Library::InitIsolateLibrary(Isolate* isolate) { |
const String& url = String::Handle(String::NewSymbol("dart:isolate")); |
const Library& lib = Library::Handle(Library::New(url)); |
@@ -5486,6 +5504,11 @@ |
} |
+RawLibrary* Library::MathLibrary() { |
+ return Isolate::Current()->object_store()->math_library(); |
+} |
+ |
+ |
RawLibrary* Library::IsolateLibrary() { |
return Isolate::Current()->object_store()->isolate_library(); |
} |