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

Unified Diff: src/runtime.cc

Issue 475423003: Implement Function.prototype.toMethod. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/harmony/toMethod.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 97a52710a5c82cf8a0931ef612d3befb141088e3..d7fcfcdb704f972935f741829a4f71efef089d61 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -2050,6 +2050,27 @@ RUNTIME_FUNCTION(Runtime_PreventExtensions) {
}
+RUNTIME_FUNCTION(Runtime_ToMethod) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 2);
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
+ Handle<JSFunction> clone(Handle<JSFunction>::cast(
+ isolate->factory()->CopyJSObject(fun)));
+ Handle<Symbol> home_object_symbol(isolate->heap()->home_object_symbol());
+ RETURN_FAILURE_ON_EXCEPTION(
+ isolate,
+ Object::SetProperty(clone, home_object_symbol, home_object, STRICT));
+ return *clone;
+}
+
+
+RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) {
+ DCHECK(args.length() == 0);
+ return isolate->heap()->home_object_symbol();
arv (Not doing code reviews) 2014/08/15 22:28:47 Why do you need this?
+}
+
+
RUNTIME_FUNCTION(Runtime_IsExtensible) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 1);
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/harmony/toMethod.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698