summaryrefslogtreecommitdiffstats
path: root/src/array.js
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-24 12:43:12 +0100
committerSteve Block <steveblock@google.com>2011-05-24 13:42:09 +0100
commit1e0659c275bb392c045087af4f6b0d7565cb3d77 (patch)
tree09febd313ccef178417974f7b7098e89e20bfd93 /src/array.js
parentb8e0da25ee8efac3bb05cd6b2730aafbd96119f4 (diff)
downloadandroid_external_v8-1e0659c275bb392c045087af4f6b0d7565cb3d77.tar.gz
android_external_v8-1e0659c275bb392c045087af4f6b0d7565cb3d77.tar.bz2
android_external_v8-1e0659c275bb392c045087af4f6b0d7565cb3d77.zip
Update V8 to r6768 as required by WebKit r78450
Change-Id: Ib8868ff7147a76547a8d1d85f257ebe8546a3d3f
Diffstat (limited to 'src/array.js')
-rw-r--r--src/array.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/array.js b/src/array.js
index 0d7a7cbc..1298434d 100644
--- a/src/array.js
+++ b/src/array.js
@@ -171,8 +171,9 @@ function Join(array, length, separator, convert) {
}
return %StringBuilderConcat(elements, length2, '');
} finally {
- // Make sure to pop the visited array no matter what happens.
- if (is_array) visited_arrays.pop();
+ // Make sure to remove the last element of the visited array no
+ // matter what happens.
+ if (is_array) visited_arrays.length = visited_arrays.length - 1;
}
}
@@ -603,16 +604,17 @@ function ArraySplice(start, delete_count) {
}
// SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is
- // given differently from when an undefined delete count is given.
+ // given as a request to delete all the elements from the start.
+ // And it differs from the case of undefined delete count.
// This does not follow ECMA-262, but we do the same for
// compatibility.
var del_count = 0;
- if (num_arguments > 1) {
+ if (num_arguments == 1) {
+ del_count = len - start_i;
+ } else {
del_count = TO_INTEGER(delete_count);
if (del_count < 0) del_count = 0;
if (del_count > len - start_i) del_count = len - start_i;
- } else {
- del_count = len - start_i;
}
var deleted_elements = [];
@@ -1016,9 +1018,11 @@ function ArrayIndexOf(element, index) {
} else {
index = TO_INTEGER(index);
// If index is negative, index from the end of the array.
- if (index < 0) index = length + index;
- // If index is still negative, search the entire array.
- if (index < 0) index = 0;
+ if (index < 0) {
+ index = length + index;
+ // If index is still negative, search the entire array.
+ if (index < 0) index = 0;
+ }
}
var min = index;
var max = length;