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

Unified Diff: src/array.js

Issue 12342003: Use InternalArray in Object.getOwnPropertyNames() implementation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Reworked concat usage Created 7 years, 10 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 | « no previous file | src/v8natives.js » ('j') | src/v8natives.js » ('J')
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 9b0bfe19e6a25f25936901c5d206dffe54cad007..7e772ba6f8e203ce89555defdbaec4666f47c4d8 100644
--- a/src/array.js
+++ b/src/array.js
@@ -1549,10 +1549,22 @@ function SetUpArray() {
%FinishArrayPrototypeSetup($Array.prototype);
+ // Make InternalArray.prototype.concat return an InternalArray
+ // instead of an Array.
+ var getInternalArrayConcat = function(concatFn) {
Michael Starzinger 2013/03/12 12:09:06 Drop this wrapper generator for a wrapper function
adamk 2013/03/12 18:25:19 Done.
+ return function() {
+ var result = %Apply(concatFn, this, arguments, 0, %_ArgumentsLength());
+ var internalResult = new InternalArray();
+ %MoveArrayContents(result, internalResult);
+ return internalResult;
+ };
+ };
+
// 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(
+ "concat", getInternalArrayConcat(getFunction("concat", ArrayConcat)),
Michael Starzinger 2013/03/12 12:09:06 Just install the plain unwrapped ArrayConcat funct
adamk 2013/03/12 18:25:19 Done.
"indexOf", getFunction("indexOf", ArrayIndexOf),
"join", getFunction("join", ArrayJoin),
"pop", getFunction("pop", ArrayPop),
« no previous file with comments | « no previous file | src/v8natives.js » ('j') | src/v8natives.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698