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

Unified Diff: runtime/vm/object.cc

Issue 12314055: Use browsers JSON.parse for parsing JSON (#3) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/bootstrap.cc ('k') | runtime/vm/vm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index b2dba5a4c7fcef7c894f80b7a774224e6e195f27..21ad9435c26ae2340c71840786e981053ab34de9 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -641,6 +641,12 @@ void Object::RegisterPrivateClass(const Class& cls,
return error.raw(); \
} \
+#define PATCH_LIBRARY(lib, raw_patch_script) \
+ patch_script ^= raw_patch_script; \
+ error = lib.Patch(patch_script); \
+ if (!error.IsNull()) { \
+ return error.raw(); \
+ } \
siva 2013/02/22 18:25:39 Could you leave this the way it was without a macr
RawError* Object::Init(Isolate* isolate) {
TIMERSCOPE(time_bootstrap);
@@ -1005,11 +1011,9 @@ RawError* Object::Init(Isolate* isolate) {
if (!error.IsNull()) {
return error.raw();
}
- Script& patch_script = Script::Handle(Bootstrap::LoadCoreScript(true));
- error = core_lib.Patch(patch_script);
- if (!error.IsNull()) {
- return error.raw();
- }
+ Script& patch_script = Script::Handle();
+ PATCH_LIBRARY(core_lib, Bootstrap::LoadCoreScript(true));
+
Library::InitASyncLibrary(isolate);
const Script& async_script =
Script::Handle(Bootstrap::LoadASyncScript(false));
@@ -1019,11 +1023,8 @@ RawError* Object::Init(Isolate* isolate) {
if (!error.IsNull()) {
return error.raw();
}
- patch_script = Bootstrap::LoadASyncScript(true);
- error = async_lib.Patch(patch_script);
- if (!error.IsNull()) {
- return error.raw();
- }
+ PATCH_LIBRARY(async_lib, Bootstrap::LoadASyncScript(true));
+
const Script& collection_script =
Script::Handle(Bootstrap::LoadCollectionScript(false));
const Library& collection_lib =
@@ -1049,11 +1050,8 @@ RawError* Object::Init(Isolate* isolate) {
if (!error.IsNull()) {
return error.raw();
}
- patch_script = Bootstrap::LoadMathScript(true);
- error = math_lib.Patch(patch_script);
- if (!error.IsNull()) {
- return error.raw();
- }
+ PATCH_LIBRARY(math_lib, Bootstrap::LoadMathScript(true));
+
const Script& isolate_script = Script::Handle(
Bootstrap::LoadIsolateScript(false));
Library::InitIsolateLibrary(isolate);
@@ -1063,11 +1061,8 @@ RawError* Object::Init(Isolate* isolate) {
if (!error.IsNull()) {
return error.raw();
}
- patch_script = Bootstrap::LoadIsolateScript(true);
- error = isolate_lib.Patch(patch_script);
- if (!error.IsNull()) {
- return error.raw();
- }
+ PATCH_LIBRARY(isolate_lib, Bootstrap::LoadIsolateScript(true));
+
const Script& mirrors_script = Script::Handle(
Bootstrap::LoadMirrorsScript(false));
Library::InitMirrorsLibrary(isolate);
@@ -1077,11 +1072,8 @@ RawError* Object::Init(Isolate* isolate) {
if (!error.IsNull()) {
return error.raw();
}
- patch_script = Bootstrap::LoadMirrorsScript(true);
- error = mirrors_lib.Patch(patch_script);
- if (!error.IsNull()) {
- return error.raw();
- }
+ PATCH_LIBRARY(mirrors_lib, Bootstrap::LoadMirrorsScript(true));
+
const Script& scalarlist_script = Script::Handle(
Bootstrap::LoadScalarlistScript(false));
ASSERT(!scalarlist_lib.IsNull());
@@ -1089,11 +1081,8 @@ RawError* Object::Init(Isolate* isolate) {
if (!error.IsNull()) {
return error.raw();
}
- patch_script = Bootstrap::LoadScalarlistScript(true);
- error = scalarlist_lib.Patch(patch_script);
- if (!error.IsNull()) {
- return error.raw();
- }
+ PATCH_LIBRARY(scalarlist_lib, Bootstrap::LoadScalarlistScript(true));
+
Library& lib = Library::Handle();
INIT_LIBRARY(Crypto,
Bootstrap::LoadCryptoScript(false),
@@ -1101,6 +1090,7 @@ RawError* Object::Init(Isolate* isolate) {
INIT_LIBRARY(Json,
Bootstrap::LoadJsonScript(false),
Library::JsonLibrary());
+ PATCH_LIBRARY(lib, Bootstrap::LoadJsonScript(true));
siva 2013/02/22 18:25:39 Just add the patch code inline here.
INIT_LIBRARY(Utf,
Bootstrap::LoadUtfScript(false),
Library::UtfLibrary());
« no previous file with comments | « runtime/vm/bootstrap.cc ('k') | runtime/vm/vm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698