summaryrefslogtreecommitdiff
path: root/deps/v8/src/array.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/array.js')
-rw-r--r--deps/v8/src/array.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/deps/v8/src/array.js b/deps/v8/src/array.js
index 54f0b486e..599fd5cfe 100644
--- a/deps/v8/src/array.js
+++ b/deps/v8/src/array.js
@@ -416,6 +416,26 @@ function ArrayPop() {
}
+function ObservedArrayPush() {
+ var n = TO_UINT32(this.length);
+ var m = %_ArgumentsLength();
+
+ EnqueueSpliceRecord(this, n, [], 0, m);
+
+ try {
+ BeginPerformSplice(this);
+
+ for (var i = 0; i < m; i++) {
+ this[i+n] = %_Arguments(i);
+ }
+ this.length = n + m;
+ } finally {
+ EndPerformSplice(this);
+ }
+
+ return this.length;
+}
+
// Appends the arguments to the end of the array and returns the new
// length of the array. See ECMA-262, section 15.4.4.7.
function ArrayPush() {
@@ -424,6 +444,9 @@ function ArrayPush() {
["Array.prototype.push"]);
}
+ if (%IsObserved(this))
+ return ObservedArrayPush.apply(this, arguments);
+
var n = TO_UINT32(this.length);
var m = %_ArgumentsLength();
for (var i = 0; i < m; i++) {