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

Unified Diff: src/runtime.cc

Issue 7056041: Reapply: "Make instanceof and Object.getPrototypeOf work for proxies, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix for Runtime_GetPrototype Created 9 years, 7 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 | « src/runtime.h ('k') | src/v8natives.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 4997d56df54b8dceb95b98938b0bff0dca4283d7..ff1ad67313ad909f351b7210ebbe1966beb9706a 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -594,12 +594,26 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSProxy) {
Object* handler = args[0];
Object* prototype = args[1];
Object* used_prototype =
- (prototype->IsJSObject() || prototype->IsJSProxy()) ? prototype
- : isolate->heap()->null_value();
+ prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value();
return isolate->heap()->AllocateJSProxy(handler, used_prototype);
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSProxy) {
+ ASSERT(args.length() == 1);
+ Object* obj = args[0];
+ return obj->IsJSProxy()
+ ? isolate->heap()->true_value() : isolate->heap()->false_value();
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) {
+ ASSERT(args.length() == 1);
+ CONVERT_CHECKED(JSProxy, proxy, args[0]);
+ return proxy->handler();
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateCatchExtensionObject) {
ASSERT(args.length() == 2);
CONVERT_CHECKED(String, key, args[0]);
@@ -634,6 +648,19 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) {
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) {
+ NoHandleAllocation ha;
+ ASSERT(args.length() == 1);
+ Object* obj = args[0];
+ obj = obj->GetPrototype();
+ while (obj->IsJSObject() &&
Kevin Millikin (Chromium) 2011/06/03 09:52:48 Maybe clearer with do...while, if you like that so
+ JSObject::cast(obj)->map()->is_hidden_prototype()) {
+ obj = obj->GetPrototype();
+ }
+ return obj;
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) {
NoHandleAllocation ha;
ASSERT(args.length() == 2);
« no previous file with comments | « src/runtime.h ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698