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

Unified Diff: src/js/array.js

Issue 1420663003: Avoid calling %AddElement with a number out of array index range (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix naming Created 5 years, 2 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/harmony-array.js » ('j') | src/js/runtime.js » ('J')
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 0eb06fac8fd8fbd876446aab61a0515559884359..91c5fa443bedf1a2eb4b657874315422418b0d72 100644
--- a/src/js/array.js
+++ b/src/js/array.js
@@ -11,6 +11,7 @@
// -------------------------------------------------------------------
// Imports
+var AddIndexedProperty;
var Delete;
var FLAG_harmony_tolength;
var GlobalArray = global.Array;
@@ -28,6 +29,7 @@ var ObserveEnqueueSpliceRecord;
var unscopablesSymbol = utils.ImportNow("unscopables_symbol");
utils.Import(function(from) {
+ AddIndexedProperty = from.AddIndexedProperty;
Delete = from.Delete;
MakeTypeError = from.MakeTypeError;
MinSimple = from.MinSimple;
@@ -245,7 +247,7 @@ function SparseSlice(array, start_i, del_count, len, deleted_elements) {
for (var i = start_i; i < limit; ++i) {
var current = array[i];
if (!IS_UNDEFINED(current) || i in array) {
- %AddElement(deleted_elements, i - start_i, current);
+ AddIndexedProperty(deleted_elements, i - start_i, current);
}
}
} else {
@@ -256,7 +258,7 @@ function SparseSlice(array, start_i, del_count, len, deleted_elements) {
if (key >= start_i) {
var current = array[key];
if (!IS_UNDEFINED(current) || key in array) {
- %AddElement(deleted_elements, key - start_i, current);
+ AddIndexedProperty(deleted_elements, key - start_i, current);
}
}
}
@@ -336,9 +338,9 @@ function SimpleSlice(array, start_i, del_count, len, deleted_elements) {
var index = start_i + i;
if (HAS_INDEX(array, index, is_array)) {
var current = array[index];
- // The spec requires [[DefineOwnProperty]] here, %AddElement is close
- // enough (in that it ignores the prototype).
- %AddElement(deleted_elements, i, current);
+ // The spec requires [[DefineOwnProperty]] here, AddIndexedProperty is
+ // close enough (in that it ignores the prototype).
+ AddIndexedProperty(deleted_elements, i, current);
}
}
}
« no previous file with comments | « no previous file | src/js/harmony-array.js » ('j') | src/js/runtime.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698