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

Unified Diff: src/json-stringifier.h

Issue 396993004: Go to slow path when JSON.stringifying the global proxy. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json-stringifier.h
diff --git a/src/json-stringifier.h b/src/json-stringifier.h
index 0a453ef67f6d6404d714cf13e6a29a011014b426..4edc8d8d439e463962e96f4800f84ccdf6626af7 100644
--- a/src/json-stringifier.h
+++ b/src/json-stringifier.h
@@ -442,7 +442,8 @@ BasicJsonStringifier::Result BasicJsonStringifier::Serialize_(
SerializeString(Handle<String>::cast(object));
return SUCCESS;
} else if (object->IsJSObject()) {
- if (object->IsAccessCheckNeeded()) break;
+ // Go to slow path for global proxy and objects requiring access checks.
+ if (object->IsAccessCheckNeeded() || object->IsJSGlobalProxy()) break;
if (deferred_string_key) SerializeDeferredKey(comma, key);
return SerializeJSObject(Handle<JSObject>::cast(object));
}
@@ -630,11 +631,7 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject(
HandleScope handle_scope(isolate_);
Result stack_push = StackPush(object);
if (stack_push != SUCCESS) return stack_push;
- if (object->IsJSGlobalProxy()) {
- object = Handle<JSObject>(
- JSObject::cast(object->GetPrototype()), isolate_);
- ASSERT(object->IsGlobalObject());
- }
+ ASSERT(!object->IsJSGlobalProxy() && !object->IsGlobalObject());
Append('{');
bool comma = false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698