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

Unified Diff: src/js/array.js

Issue 1677063005: Revert of [builtins] Remove bunch of uses of %_Arguments and %_ArgumentsLength. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/js/json.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/array.js
diff --git a/src/js/array.js b/src/js/array.js
index c0fbbb05107f954d206d86d2c5a8f8411e6f676b..da6e02ededdcd7bd79dc53ff04dfaa05040c5719 100644
--- a/src/js/array.js
+++ b/src/js/array.js
@@ -515,12 +515,12 @@
function ObservedArrayPush() {
var n = TO_LENGTH(this.length);
- var m = arguments.length;
+ var m = %_ArgumentsLength();
try {
ObserveBeginPerformSplice(this);
for (var i = 0; i < m; i++) {
- this[i+n] = arguments[i];
+ this[i+n] = %_Arguments(i);
}
var new_length = n + m;
this.length = new_length;
@@ -543,7 +543,7 @@
var array = TO_OBJECT(this);
var n = TO_LENGTH(array.length);
- var m = arguments.length;
+ var m = %_ArgumentsLength();
// It appears that there is no enforced, absolute limit on the number of
// arguments, but it would surely blow the stack to use 2**30 or more.
@@ -555,7 +555,7 @@
}
for (var i = 0; i < m; i++) {
- array[i+n] = arguments[i];
+ array[i+n] = %_Arguments(i);
}
var new_length = n + m;
@@ -711,13 +711,13 @@
function ObservedArrayUnshift() {
var len = TO_LENGTH(this.length);
- var num_arguments = arguments.length;
+ var num_arguments = %_ArgumentsLength();
try {
ObserveBeginPerformSplice(this);
SimpleMove(this, 0, 0, len, num_arguments);
for (var i = 0; i < num_arguments; i++) {
- this[i] = arguments[i];
+ this[i] = %_Arguments(i);
}
var new_length = len + num_arguments;
this.length = new_length;
@@ -738,7 +738,7 @@
var array = TO_OBJECT(this);
var len = TO_LENGTH(array.length);
- var num_arguments = arguments.length;
+ var num_arguments = %_ArgumentsLength();
if (len > 0 && UseSparseVariant(array, len, IS_ARRAY(array), len) &&
!%object_is_sealed(array)) {
@@ -748,7 +748,7 @@
}
for (var i = 0; i < num_arguments; i++) {
- array[i] = arguments[i];
+ array[i] = %_Arguments(i);
}
var new_length = len + num_arguments;
@@ -831,7 +831,7 @@
function ObservedArraySplice(start, delete_count) {
- var num_arguments = arguments.length;
+ var num_arguments = %_ArgumentsLength();
var len = TO_LENGTH(this.length);
var start_i = ComputeSpliceStartIndex(TO_INTEGER(start), len);
var del_count = ComputeSpliceDeleteCount(delete_count, num_arguments, len,
@@ -850,9 +850,9 @@
// place of the deleted elements.
var i = start_i;
var arguments_index = 2;
- var arguments_length = arguments.length;
+ var arguments_length = %_ArgumentsLength();
while (arguments_index < arguments_length) {
- this[i++] = arguments[arguments_index++];
+ this[i++] = %_Arguments(arguments_index++);
}
this.length = len - del_count + num_elements_to_add;
@@ -877,7 +877,7 @@
if (%IsObserved(this))
return ObservedArraySplice.apply(this, arguments);
- var num_arguments = arguments.length;
+ var num_arguments = %_ArgumentsLength();
var array = TO_OBJECT(this);
var len = TO_LENGTH(array.length);
var start_i = ComputeSpliceStartIndex(TO_INTEGER(start), len);
@@ -913,9 +913,9 @@
// place of the deleted elements.
var i = start_i;
var arguments_index = 2;
- var arguments_length = arguments.length;
+ var arguments_length = %_ArgumentsLength();
while (arguments_index < arguments_length) {
- array[i++] = arguments[arguments_index++];
+ array[i++] = %_Arguments(arguments_index++);
}
array.length = len - del_count + num_elements_to_add;
@@ -1469,7 +1469,7 @@
var length = TO_LENGTH(this.length);
return InnerArrayLastIndexOf(this, element, index, length,
- arguments.length);
+ %_ArgumentsLength());
}
@@ -1508,7 +1508,7 @@
var array = TO_OBJECT(this);
var length = TO_LENGTH(array.length);
return InnerArrayReduce(callback, current, array, length,
- arguments.length);
+ %_ArgumentsLength());
}
@@ -1548,7 +1548,7 @@
var array = TO_OBJECT(this);
var length = TO_LENGTH(array.length);
return InnerArrayReduceRight(callback, current, array, length,
- arguments.length);
+ %_ArgumentsLength());
}
@@ -1822,13 +1822,13 @@
// ES6, draft 05-22-14, section 22.1.2.3
-function ArrayOf(...args) {
- var length = args.length;
+function ArrayOf() {
+ var length = %_ArgumentsLength();
var constructor = this;
// TODO: Implement IsConstructor (ES6 section 7.2.5)
var array = %IsConstructor(constructor) ? new constructor(length) : [];
for (var i = 0; i < length; i++) {
- AddArrayElement(constructor, array, i, args[i]);
+ AddArrayElement(constructor, array, i, %_Arguments(i));
}
array.length = length;
return array;
« no previous file with comments | « no previous file | src/js/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698