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

Unified Diff: src/js/array.js

Issue 1909433003: Remove support for Object.observe (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 8 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 | « src/ic/x87/ic-x87.cc ('k') | src/js/harmony-object-observe.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 b65167ebde1275992a86ec34520898e51b11db8c..4816dfbdf1c4729f5507f499bb77e21eebe1a2cc 100644
--- a/src/js/array.js
+++ b/src/js/array.js
@@ -23,9 +23,6 @@ var MinSimple;
var ObjectDefineProperty;
var ObjectHasOwnProperty;
var ObjectToString = utils.ImportNow("object_to_string");
-var ObserveBeginPerformSplice;
-var ObserveEndPerformSplice;
-var ObserveEnqueueSpliceRecord;
var iteratorSymbol = utils.ImportNow("iterator_symbol");
var unscopablesSymbol = utils.ImportNow("unscopables_symbol");
@@ -37,9 +34,6 @@ utils.Import(function(from) {
MinSimple = from.MinSimple;
ObjectDefineProperty = from.ObjectDefineProperty;
ObjectHasOwnProperty = from.ObjectHasOwnProperty;
- ObserveBeginPerformSplice = from.ObserveBeginPerformSplice;
- ObserveEndPerformSplice = from.ObserveEndPerformSplice;
- ObserveEnqueueSpliceRecord = from.ObserveEnqueueSpliceRecord;
});
utils.ImportFromExperimental(function(from) {
@@ -110,8 +104,7 @@ function UseSparseVariant(array, length, is_array, touched) {
// Only use the sparse variant on arrays that are likely to be sparse and the
// number of elements touched in the operation is relatively small compared to
// the overall size of the array.
- if (!is_array || length < 1000 || %IsObserved(array) ||
- %HasComplexElements(array)) {
+ if (!is_array || length < 1000 || %HasComplexElements(array)) {
return false;
}
if (!%_IsSmi(length)) {
@@ -443,23 +436,6 @@ function ArrayJoin(separator) {
}
-function ObservedArrayPop(n) {
- n--;
- var value = this[n];
-
- try {
- ObserveBeginPerformSplice(this);
- delete this[n];
- this.length = n;
- } finally {
- ObserveEndPerformSplice(this);
- ObserveEnqueueSpliceRecord(this, n, [value], 0);
- }
-
- return value;
-}
-
-
// Removes the last element from the array and returns it. See
// ECMA-262, section 15.4.4.6.
function ArrayPop() {
@@ -472,9 +448,6 @@ function ArrayPop() {
return;
}
- if (%IsObserved(array))
- return ObservedArrayPop.call(array, n);
-
n--;
var value = array[n];
%DeleteProperty_Strict(array, n);
@@ -483,34 +456,11 @@ function ArrayPop() {
}
-function ObservedArrayPush() {
- var n = TO_LENGTH(this.length);
- var m = arguments.length;
-
- try {
- ObserveBeginPerformSplice(this);
- for (var i = 0; i < m; i++) {
- this[i+n] = arguments[i];
- }
- var new_length = n + m;
- this.length = new_length;
- } finally {
- ObserveEndPerformSplice(this);
- ObserveEnqueueSpliceRecord(this, n, [], m);
- }
-
- return new_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() {
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.push");
- if (%IsObserved(this))
- return ObservedArrayPush.apply(this, arguments);
-
var array = TO_OBJECT(this);
var n = TO_LENGTH(array.length);
var m = arguments.length;
@@ -633,22 +583,6 @@ function ArrayReverse() {
}
-function ObservedArrayShift(len) {
- var first = this[0];
-
- try {
- ObserveBeginPerformSplice(this);
- SimpleMove(this, 0, 1, len, 0);
- this.length = len - 1;
- } finally {
- ObserveEndPerformSplice(this);
- ObserveEnqueueSpliceRecord(this, 0, [first], 0);
- }
-
- return first;
-}
-
-
function ArrayShift() {
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.shift");
@@ -662,9 +596,6 @@ function ArrayShift() {
if (%object_is_sealed(array)) throw MakeTypeError(kArrayFunctionsOnSealed);
- if (%IsObserved(array))
- return ObservedArrayShift.call(array, len);
-
var first = array[0];
if (UseSparseVariant(array, len, IS_ARRAY(array), len)) {
@@ -679,33 +610,9 @@ function ArrayShift() {
}
-function ObservedArrayUnshift() {
- var len = TO_LENGTH(this.length);
- var num_arguments = arguments.length;
-
- try {
- ObserveBeginPerformSplice(this);
- SimpleMove(this, 0, 0, len, num_arguments);
- for (var i = 0; i < num_arguments; i++) {
- this[i] = arguments[i];
- }
- var new_length = len + num_arguments;
- this.length = new_length;
- } finally {
- ObserveEndPerformSplice(this);
- ObserveEnqueueSpliceRecord(this, 0, [], num_arguments);
- }
-
- return new_length;
-}
-
-
function ArrayUnshift(arg1) { // length == 1
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.unshift");
- if (%IsObserved(this))
- return ObservedArrayUnshift.apply(this, arguments);
-
var array = TO_OBJECT(this);
var len = TO_LENGTH(array.length);
var num_arguments = arguments.length;
@@ -800,53 +707,9 @@ function ComputeSpliceDeleteCount(delete_count, num_arguments, len, start_i) {
}
-function ObservedArraySplice(start, delete_count) {
- var num_arguments = arguments.length;
- var len = TO_LENGTH(this.length);
- var start_i = ComputeSpliceStartIndex(TO_INTEGER(start), len);
- var del_count = ComputeSpliceDeleteCount(delete_count, num_arguments, len,
- start_i);
- var deleted_elements = [];
- deleted_elements.length = del_count;
- var num_elements_to_add = num_arguments > 2 ? num_arguments - 2 : 0;
-
- try {
- ObserveBeginPerformSplice(this);
-
- SimpleSlice(this, start_i, del_count, len, deleted_elements);
- SimpleMove(this, start_i, del_count, len, num_elements_to_add);
-
- // Insert the arguments into the resulting array in
- // place of the deleted elements.
- var i = start_i;
- var arguments_index = 2;
- var arguments_length = arguments.length;
- while (arguments_index < arguments_length) {
- this[i++] = arguments[arguments_index++];
- }
- this.length = len - del_count + num_elements_to_add;
-
- } finally {
- ObserveEndPerformSplice(this);
- if (deleted_elements.length || num_elements_to_add) {
- ObserveEnqueueSpliceRecord(this,
- start_i,
- deleted_elements.slice(),
- num_elements_to_add);
- }
- }
-
- // Return the deleted elements.
- return deleted_elements;
-}
-
-
function ArraySplice(start, delete_count) {
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.splice");
- if (%IsObserved(this))
- return ObservedArraySplice.apply(this, arguments);
-
var num_arguments = arguments.length;
var array = TO_OBJECT(this);
var len = TO_LENGTH(array.length);
« no previous file with comments | « src/ic/x87/ic-x87.cc ('k') | src/js/harmony-object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698