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

Unified Diff: src/v8natives.js

Issue 1093183006: [es6] Map/Set size getter should have "get size" name (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use IS_UNDEFINED instead Created 5 years, 8 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/string-iterator.js ('k') | test/mjsunit/es6/built-in-accessor-names.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 8080e12753df3bb8ac7b9b585d36028fc094d94b..1e42ac5d1eb2e100444303cc78e19bfe9e243525 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -15,13 +15,26 @@ var $isFinite = GlobalIsFinite;
// ----------------------------------------------------------------------------
+// ES6 - 9.2.11 SetFunctionName
+function SetFunctionName(f, name, prefix) {
+ if (IS_SYMBOL(name)) {
+ name = "[" + %SymbolDescription(name) + "]";
+ }
+ if (IS_UNDEFINED(prefix)) {
+ %FunctionSetName(f, name);
+ } else {
+ %FunctionSetName(f, prefix + " " + name);
+ }
+}
+
+
// Helper function used to install functions on objects.
function InstallFunctions(object, attributes, functions) {
%OptimizeObjectForAddingMultipleProperties(object, functions.length >> 1);
for (var i = 0; i < functions.length; i += 2) {
var key = functions[i];
var f = functions[i + 1];
- %FunctionSetName(f, key);
+ SetFunctionName(f, key);
%FunctionRemovePrototype(f);
%AddNamedProperty(object, key, f, attributes);
%SetNativeFlag(f);
@@ -35,7 +48,7 @@ function OverrideFunction(object, name, f) {
writeable: true,
configurable: true,
enumerable: false });
- %FunctionSetName(f, name);
+ SetFunctionName(f, name);
%FunctionRemovePrototype(f);
%SetNativeFlag(f);
}
@@ -46,7 +59,7 @@ function InstallGetter(object, name, getter, attributes) {
if (typeof attributes == "undefined") {
attributes = DONT_ENUM;
}
- %FunctionSetName(getter, name);
+ SetFunctionName(getter, name, "get");
%FunctionRemovePrototype(getter);
%DefineAccessorPropertyUnchecked(object, name, getter, null, attributes);
%SetNativeFlag(getter);
@@ -55,8 +68,8 @@ function InstallGetter(object, name, getter, attributes) {
// Helper function to install a getter/setter accessor property.
function InstallGetterSetter(object, name, getter, setter) {
- %FunctionSetName(getter, name);
- %FunctionSetName(setter, name);
+ SetFunctionName(getter, name, "get");
+ SetFunctionName(setter, name, "set");
%FunctionRemovePrototype(getter);
%FunctionRemovePrototype(setter);
%DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM);
« no previous file with comments | « src/string-iterator.js ('k') | test/mjsunit/es6/built-in-accessor-names.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698