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

Unified Diff: src/array.js

Issue 7830036: Optimize isFinite and isNaN. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Made the change general by moving putting it in the NUMBER_IS_FINITE macro. Created 9 years, 3 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/arm/code-stubs-arm.cc ('k') | src/ast.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/array.js
diff --git a/src/array.js b/src/array.js
index 32a370fda862f81c293b3b39f6a075438ae96ec5..281c507f5a6d6e83b4dd196e3170a0538950fa33 100644
--- a/src/array.js
+++ b/src/array.js
@@ -1314,13 +1314,12 @@ function ArrayIsArray(obj) {
// -------------------------------------------------------------------
-function SetUpArray() {
- %CheckIsBootstrapping();
- // Set up non-enumerable constructor property on the Array.prototype
+function SetupArray() {
+ // Setup non-enumerable constructor property on the Array.prototype
// object.
%SetProperty($Array.prototype, "constructor", $Array, DONT_ENUM);
- // Set up non-enumerable functions on the Array object.
+ // Setup non-enumerable functions on the Array object.
InstallFunctions($Array, DONT_ENUM, $Array(
"isArray", ArrayIsArray
));
@@ -1338,7 +1337,7 @@ function SetUpArray() {
return f;
}
- // Set up non-enumerable functions of the Array.prototype object and
+ // Setup non-enumerable functions of the Array.prototype object and
// set their names.
// Manipulate the length of some of the functions to meet
// expectations set by ECMA-262 or Mozilla.
@@ -1369,13 +1368,19 @@ function SetUpArray() {
%FinishArrayPrototypeSetup($Array.prototype);
// The internal Array prototype doesn't need to be fancy, since it's never
- // exposed to user code.
- // Adding only the functions that are actually used.
- SetUpLockedPrototype(InternalArray, $Array(), $Array(
- "join", getFunction("join", ArrayJoin),
- "pop", getFunction("pop", ArrayPop),
- "push", getFunction("push", ArrayPush)
- ));
+ // exposed to user code, so no hidden prototypes or DONT_ENUM attributes
+ // are necessary.
+ // The null __proto__ ensures that we never inherit any user created
+ // getters or setters from, e.g., Object.prototype.
+ InternalArray.prototype.__proto__ = null;
+ // Adding only the functions that are actually used, and a toString.
+ InternalArray.prototype.join = getFunction("join", ArrayJoin);
+ InternalArray.prototype.pop = getFunction("pop", ArrayPop);
+ InternalArray.prototype.push = getFunction("push", ArrayPush);
+ InternalArray.prototype.toString = function() {
+ return "Internal Array, length " + this.length;
+ };
}
-SetUpArray();
+
+SetupArray();
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698