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

Unified Diff: src/v8natives.js

Issue 384003003: Replace AddProperty by AddNamedProperty to speed up the common case (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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/typedarray.js ('k') | src/weak_collection.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 5ffff2ecacd9f789d475595aa506c3093d20bfe4..d5b7a4917bcd7b4191fb0592f60abf085b97ec76 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -28,7 +28,7 @@ function InstallFunctions(object, attributes, functions) {
var f = functions[i + 1];
%FunctionSetName(f, key);
%FunctionRemovePrototype(f);
- %AddProperty(object, key, f, attributes);
+ %AddNamedProperty(object, key, f, attributes);
%SetNativeFlag(f);
}
%ToFastProperties(object);
@@ -65,7 +65,7 @@ function InstallConstants(object, constants) {
for (var i = 0; i < constants.length; i += 2) {
var name = constants[i];
var k = constants[i + 1];
- %AddProperty(object, name, k, attributes);
+ %AddNamedProperty(object, name, k, attributes);
}
%ToFastProperties(object);
}
@@ -86,13 +86,14 @@ function SetUpLockedPrototype(constructor, fields, methods) {
}
if (fields) {
for (var i = 0; i < fields.length; i++) {
- %AddProperty(prototype, fields[i], UNDEFINED, DONT_ENUM | DONT_DELETE);
+ %AddNamedProperty(prototype, fields[i],
+ UNDEFINED, DONT_ENUM | DONT_DELETE);
}
}
for (var i = 0; i < methods.length; i += 2) {
var key = methods[i];
var f = methods[i + 1];
- %AddProperty(prototype, key, f, DONT_ENUM | DONT_DELETE | READ_ONLY);
+ %AddNamedProperty(prototype, key, f, DONT_ENUM | DONT_DELETE | READ_ONLY);
%SetNativeFlag(f);
}
%SetPrototype(prototype, null);
@@ -190,13 +191,13 @@ function SetUpGlobal() {
var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY;
// ECMA 262 - 15.1.1.1.
- %AddProperty(global, "NaN", NAN, attributes);
+ %AddNamedProperty(global, "NaN", NAN, attributes);
// ECMA-262 - 15.1.1.2.
- %AddProperty(global, "Infinity", INFINITY, attributes);
+ %AddNamedProperty(global, "Infinity", INFINITY, attributes);
// ECMA-262 - 15.1.1.3.
- %AddProperty(global, "undefined", UNDEFINED, attributes);
+ %AddNamedProperty(global, "undefined", UNDEFINED, attributes);
// Set up non-enumerable function on the global object.
InstallFunctions(global, DONT_ENUM, $Array(
@@ -386,22 +387,22 @@ function FromGenericPropertyDescriptor(desc) {
var obj = new $Object();
if (desc.hasValue()) {
- %AddProperty(obj, "value", desc.getValue(), NONE);
+ %AddNamedProperty(obj, "value", desc.getValue(), NONE);
}
if (desc.hasWritable()) {
- %AddProperty(obj, "writable", desc.isWritable(), NONE);
+ %AddNamedProperty(obj, "writable", desc.isWritable(), NONE);
}
if (desc.hasGetter()) {
- %AddProperty(obj, "get", desc.getGet(), NONE);
+ %AddNamedProperty(obj, "get", desc.getGet(), NONE);
}
if (desc.hasSetter()) {
- %AddProperty(obj, "set", desc.getSet(), NONE);
+ %AddNamedProperty(obj, "set", desc.getSet(), NONE);
}
if (desc.hasEnumerable()) {
- %AddProperty(obj, "enumerable", desc.isEnumerable(), NONE);
+ %AddNamedProperty(obj, "enumerable", desc.isEnumerable(), NONE);
}
if (desc.hasConfigurable()) {
- %AddProperty(obj, "configurable", desc.isConfigurable(), NONE);
+ %AddNamedProperty(obj, "configurable", desc.isConfigurable(), NONE);
}
return obj;
}
@@ -1395,7 +1396,7 @@ function SetUpObject() {
%SetNativeFlag($Object);
%SetCode($Object, ObjectConstructor);
- %AddProperty($Object.prototype, "constructor", $Object, DONT_ENUM);
+ %AddNamedProperty($Object.prototype, "constructor", $Object, DONT_ENUM);
// Set up non-enumerable functions on the Object.prototype object.
InstallFunctions($Object.prototype, DONT_ENUM, $Array(
@@ -1482,7 +1483,7 @@ function SetUpBoolean () {
%SetCode($Boolean, BooleanConstructor);
%FunctionSetPrototype($Boolean, new $Boolean(false));
- %AddProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
+ %AddNamedProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
InstallFunctions($Boolean.prototype, DONT_ENUM, $Array(
"toString", BooleanToString,
@@ -1665,7 +1666,7 @@ function SetUpNumber() {
%OptimizeObjectForAddingMultipleProperties($Number.prototype, 8);
// Set up the constructor property on the Number prototype object.
- %AddProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
+ %AddNamedProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
InstallConstants($Number, $Array(
// ECMA-262 section 15.7.3.1.
@@ -1848,7 +1849,7 @@ function SetUpFunction() {
%CheckIsBootstrapping();
%SetCode($Function, FunctionConstructor);
- %AddProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
+ %AddNamedProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
InstallFunctions($Function.prototype, DONT_ENUM, $Array(
"bind", FunctionBind,
« no previous file with comments | « src/typedarray.js ('k') | src/weak_collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698