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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ast.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 return current; 1307 return current;
1308 } 1308 }
1309 1309
1310 // ES5, 15.4.3.2 1310 // ES5, 15.4.3.2
1311 function ArrayIsArray(obj) { 1311 function ArrayIsArray(obj) {
1312 return IS_ARRAY(obj); 1312 return IS_ARRAY(obj);
1313 } 1313 }
1314 1314
1315 1315
1316 // ------------------------------------------------------------------- 1316 // -------------------------------------------------------------------
1317 function SetUpArray() { 1317 function SetupArray() {
1318 %CheckIsBootstrapping(); 1318 // Setup non-enumerable constructor property on the Array.prototype
1319 // Set up non-enumerable constructor property on the Array.prototype
1320 // object. 1319 // object.
1321 %SetProperty($Array.prototype, "constructor", $Array, DONT_ENUM); 1320 %SetProperty($Array.prototype, "constructor", $Array, DONT_ENUM);
1322 1321
1323 // Set up non-enumerable functions on the Array object. 1322 // Setup non-enumerable functions on the Array object.
1324 InstallFunctions($Array, DONT_ENUM, $Array( 1323 InstallFunctions($Array, DONT_ENUM, $Array(
1325 "isArray", ArrayIsArray 1324 "isArray", ArrayIsArray
1326 )); 1325 ));
1327 1326
1328 var specialFunctions = %SpecialArrayFunctions({}); 1327 var specialFunctions = %SpecialArrayFunctions({});
1329 1328
1330 function getFunction(name, jsBuiltin, len) { 1329 function getFunction(name, jsBuiltin, len) {
1331 var f = jsBuiltin; 1330 var f = jsBuiltin;
1332 if (specialFunctions.hasOwnProperty(name)) { 1331 if (specialFunctions.hasOwnProperty(name)) {
1333 f = specialFunctions[name]; 1332 f = specialFunctions[name];
1334 } 1333 }
1335 if (!IS_UNDEFINED(len)) { 1334 if (!IS_UNDEFINED(len)) {
1336 %FunctionSetLength(f, len); 1335 %FunctionSetLength(f, len);
1337 } 1336 }
1338 return f; 1337 return f;
1339 } 1338 }
1340 1339
1341 // Set up non-enumerable functions of the Array.prototype object and 1340 // Setup non-enumerable functions of the Array.prototype object and
1342 // set their names. 1341 // set their names.
1343 // Manipulate the length of some of the functions to meet 1342 // Manipulate the length of some of the functions to meet
1344 // expectations set by ECMA-262 or Mozilla. 1343 // expectations set by ECMA-262 or Mozilla.
1345 InstallFunctionsOnHiddenPrototype($Array.prototype, DONT_ENUM, $Array( 1344 InstallFunctionsOnHiddenPrototype($Array.prototype, DONT_ENUM, $Array(
1346 "toString", getFunction("toString", ArrayToString), 1345 "toString", getFunction("toString", ArrayToString),
1347 "toLocaleString", getFunction("toLocaleString", ArrayToLocaleString), 1346 "toLocaleString", getFunction("toLocaleString", ArrayToLocaleString),
1348 "join", getFunction("join", ArrayJoin), 1347 "join", getFunction("join", ArrayJoin),
1349 "pop", getFunction("pop", ArrayPop), 1348 "pop", getFunction("pop", ArrayPop),
1350 "push", getFunction("push", ArrayPush, 1), 1349 "push", getFunction("push", ArrayPush, 1),
1351 "concat", getFunction("concat", ArrayConcat, 1), 1350 "concat", getFunction("concat", ArrayConcat, 1),
(...skipping 10 matching lines...) Expand all
1362 "map", getFunction("map", ArrayMap, 1), 1361 "map", getFunction("map", ArrayMap, 1),
1363 "indexOf", getFunction("indexOf", ArrayIndexOf, 1), 1362 "indexOf", getFunction("indexOf", ArrayIndexOf, 1),
1364 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), 1363 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1),
1365 "reduce", getFunction("reduce", ArrayReduce, 1), 1364 "reduce", getFunction("reduce", ArrayReduce, 1),
1366 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) 1365 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1)
1367 )); 1366 ));
1368 1367
1369 %FinishArrayPrototypeSetup($Array.prototype); 1368 %FinishArrayPrototypeSetup($Array.prototype);
1370 1369
1371 // The internal Array prototype doesn't need to be fancy, since it's never 1370 // The internal Array prototype doesn't need to be fancy, since it's never
1372 // exposed to user code. 1371 // exposed to user code, so no hidden prototypes or DONT_ENUM attributes
1373 // Adding only the functions that are actually used. 1372 // are necessary.
1374 SetUpLockedPrototype(InternalArray, $Array(), $Array( 1373 // The null __proto__ ensures that we never inherit any user created
1375 "join", getFunction("join", ArrayJoin), 1374 // getters or setters from, e.g., Object.prototype.
1376 "pop", getFunction("pop", ArrayPop), 1375 InternalArray.prototype.__proto__ = null;
1377 "push", getFunction("push", ArrayPush) 1376 // Adding only the functions that are actually used, and a toString.
1378 )); 1377 InternalArray.prototype.join = getFunction("join", ArrayJoin);
1378 InternalArray.prototype.pop = getFunction("pop", ArrayPop);
1379 InternalArray.prototype.push = getFunction("push", ArrayPush);
1380 InternalArray.prototype.toString = function() {
1381 return "Internal Array, length " + this.length;
1382 };
1379 } 1383 }
1380 1384
1381 SetUpArray(); 1385
1386 SetupArray();
OLDNEW
« 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