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

Unified Diff: src/runtime.cc

Issue 7623011: Implement function proxies (except for their use as constructors). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Eps: refined a comment. Created 9 years, 4 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
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 38199f8c5826fbbee560d6dde3bb78a317009d35..5d6727a0a486ac794405deb13e42657c29d97a73 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -612,6 +612,19 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSProxy) {
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSFunctionProxy) {
+ ASSERT(args.length() == 4);
+ Object* handler = args[0];
+ Object* call_trap = args[1];
+ Object* construct_trap = args[2];
+ Object* prototype = args[3];
+ Object* used_prototype =
+ prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value();
+ return isolate->heap()->AllocateJSFunctionProxy(
+ handler, call_trap, construct_trap, used_prototype);
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSProxy) {
ASSERT(args.length() == 1);
Object* obj = args[0];
@@ -619,6 +632,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSProxy) {
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSFunctionProxy) {
+ ASSERT(args.length() == 1);
+ Object* obj = args[0];
+ return obj->IsJSFunctionProxy()
+ ? isolate->heap()->true_value() : isolate->heap()->false_value();
Kevin Millikin (Chromium) 2011/09/08 17:30:40 return isolate->heap()->ToBoolean(obj->IsJSFunctio
rossberg 2011/09/09 17:05:30 Done.
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) {
ASSERT(args.length() == 1);
CONVERT_CHECKED(JSProxy, proxy, args[0]);
@@ -626,6 +647,20 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) {
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_GetCallTrap) {
+ ASSERT(args.length() == 1);
+ CONVERT_CHECKED(JSFunctionProxy, proxy, args[0]);
+ return proxy->call_trap();
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructTrap) {
+ ASSERT(args.length() == 1);
+ CONVERT_CHECKED(JSFunctionProxy, proxy, args[0]);
+ return proxy->construct_trap();
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) {
ASSERT(args.length() == 1);
CONVERT_CHECKED(JSProxy, proxy, args[0]);
@@ -4860,6 +4895,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Typeof) {
ASSERT(heap_obj->IsUndefined());
return isolate->heap()->undefined_symbol();
case JS_FUNCTION_TYPE:
+ case JS_FUNCTION_PROXY_TYPE:
return isolate->heap()->function_symbol();
default:
// For any kind of object not handled above, the spec rule for

Powered by Google App Engine
This is Rietveld 408576698