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

Unified Diff: src/harmony-classes.js

Issue 475423003: Implement Function.prototype.toMethod. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback 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/bootstrapper.cc ('k') | src/heap/heap.h » ('j') | src/objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-classes.js
diff --git a/src/harmony-classes.js b/src/harmony-classes.js
new file mode 100644
index 0000000000000000000000000000000000000000..b6605a902c3059bef54ad3b0956931fcaf19e1d3
--- /dev/null
+++ b/src/harmony-classes.js
@@ -0,0 +1,32 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// This file relies on the fact that the following declarations have been made
+// in runtime.js:
+// var $Function = global.Function;
+// var $Array = global.Array;
+
+
+(function() {
+ function FunctionToMethod(homeObject) {
+ if (!IS_SPEC_FUNCTION(this)) {
+ throw MakeTypeError('toMethod_non_function',
+ [%ToString(this), typeof this]);
+
+ }
+
+ if (!IS_SPEC_OBJECT(homeObject)) {
+ throw MakeTypeError('toMethod_non_object',
+ [%ToString(homeObject)]);
+ }
+
+ return %ToMethod(this, homeObject);
+ }
+
+ %CheckIsBootstrapping();
+
+ InstallFunctions($Function.prototype, DONT_ENUM, $Array(
+ "toMethod", FunctionToMethod
+ ));
+}());
« no previous file with comments | « src/bootstrapper.cc ('k') | src/heap/heap.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698