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

Unified Diff: src/array.js

Issue 1266013006: [stubs] Unify (and optimize) implementation of ToObject. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add missing support for %_ToObject in TurboFan and Crankshaft. Created 5 years, 5 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/arm64/interface-descriptors-arm64.cc ('k') | src/array-iterator.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/array.js
diff --git a/src/array.js b/src/array.js
index e0cc0695cc600462546ab55f813f3e3b3a2c87f3..7d0fdcafb3d3ef86a9a03c91baef02778553dbe0 100644
--- a/src/array.js
+++ b/src/array.js
@@ -227,7 +227,7 @@ function ConvertToLocaleString(e) {
// According to ES5, section 15.4.4.3, the toLocaleString conversion
// must throw a TypeError if ToObject(e).toLocaleString isn't
// callable.
- var e_obj = $toObject(e);
+ var e_obj = TO_OBJECT(e);
return $toString(e_obj.toLocaleString());
}
}
@@ -388,7 +388,7 @@ function ArrayToString() {
}
array = this;
} else {
- array = $toObject(this);
+ array = TO_OBJECT(this);
func = array.join;
}
if (!IS_SPEC_FUNCTION(func)) {
@@ -406,7 +406,7 @@ function InnerArrayToLocaleString(array, length) {
function ArrayToLocaleString() {
- var array = $toObject(this);
+ var array = TO_OBJECT(this);
var arrayLen = array.length;
return InnerArrayToLocaleString(array, arrayLen);
}
@@ -437,7 +437,7 @@ function InnerArrayJoin(separator, array, length) {
function ArrayJoin(separator) {
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.join");
- var array = TO_OBJECT_INLINE(this);
+ var array = TO_OBJECT(this);
var length = TO_UINT32(array.length);
return InnerArrayJoin(separator, array, length);
@@ -466,7 +466,7 @@ function ObservedArrayPop(n) {
function ArrayPop() {
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.pop");
- var array = TO_OBJECT_INLINE(this);
+ var array = TO_OBJECT(this);
var n = TO_UINT32(array.length);
if (n == 0) {
array.length = n;
@@ -512,7 +512,7 @@ function ArrayPush() {
if (%IsObserved(this))
return ObservedArrayPush.apply(this, arguments);
- var array = TO_OBJECT_INLINE(this);
+ var array = TO_OBJECT(this);
var n = TO_UINT32(array.length);
var m = %_ArgumentsLength();
@@ -532,7 +532,7 @@ function ArrayPush() {
function ArrayConcatJS(arg1) { // length == 1
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.concat");
- var array = $toObject(this);
+ var array = TO_OBJECT(this);
var arg_count = %_ArgumentsLength();
var arrays = new InternalArray(1 + arg_count);
arrays[0] = array;
@@ -627,7 +627,7 @@ function GenericArrayReverse(array, len) {
function ArrayReverse() {
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.reverse");
- var array = TO_OBJECT_INLINE(this);
+ var array = TO_OBJECT(this);
var len = TO_UINT32(array.length);
var isArray = IS_ARRAY(array);
@@ -662,7 +662,7 @@ function ObservedArrayShift(len) {
function ArrayShift() {
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.shift");
- var array = TO_OBJECT_INLINE(this);
+ var array = TO_OBJECT(this);
var len = TO_UINT32(array.length);
if (len === 0) {
@@ -716,7 +716,7 @@ function ArrayUnshift(arg1) { // length == 1
if (%IsObserved(this))
return ObservedArrayUnshift.apply(this, arguments);
- var array = TO_OBJECT_INLINE(this);
+ var array = TO_OBJECT(this);
var len = TO_UINT32(array.length);
var num_arguments = %_ArgumentsLength();
@@ -740,7 +740,7 @@ function ArrayUnshift(arg1) { // length == 1
function ArraySlice(start, end) {
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.slice");
- var array = TO_OBJECT_INLINE(this);
+ var array = TO_OBJECT(this);
var len = TO_UINT32(array.length);
var start_i = TO_INTEGER(start);
var end_i = len;
@@ -858,7 +858,7 @@ function ArraySplice(start, delete_count) {
return ObservedArraySplice.apply(this, arguments);
var num_arguments = %_ArgumentsLength();
- var array = TO_OBJECT_INLINE(this);
+ var array = TO_OBJECT(this);
var len = TO_UINT32(array.length);
var start_i = ComputeSpliceStartIndex(TO_INTEGER(start), len);
var del_count = ComputeSpliceDeleteCount(delete_count, num_arguments, len,
@@ -1190,7 +1190,7 @@ function InnerArraySort(length, comparefn) {
function ArraySort(comparefn) {
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.sort");
- var array = $toObject(this);
+ var array = TO_OBJECT(this);
var length = TO_UINT32(array.length);
return %_CallFunction(array, length, comparefn, InnerArraySort);
}
@@ -1217,7 +1217,7 @@ function InnerArrayFilter(f, receiver, array, length) {
var element = array[i];
// Prepare break slots for debugger step in.
if (stepping) %DebugPrepareStepInIfStepping(f);
- var new_receiver = needs_wrapper ? $toObject(receiver) : receiver;
+ var new_receiver = needs_wrapper ? TO_OBJECT(receiver) : receiver;
if (%_CallFunction(new_receiver, element, i, array, f)) {
accumulator[accumulator_length++] = element;
}
@@ -1231,7 +1231,7 @@ function ArrayFilter(f, receiver) {
// Pull out the length so that modifications to the length in the
// loop will not affect the looping and side effects are visible.
- var array = $toObject(this);
+ var array = TO_OBJECT(this);
var length = $toUint32(array.length);
var accumulator = InnerArrayFilter(f, receiver, array, length);
var result = new GlobalArray();
@@ -1255,7 +1255,7 @@ function InnerArrayForEach(f, receiver, array, length) {
var element = array[i];
// Prepare break slots for debugger step in.
if (stepping) %DebugPrepareStepInIfStepping(f);
- var new_receiver = needs_wrapper ? $toObject(receiver) : receiver;
+ var new_receiver = needs_wrapper ? TO_OBJECT(receiver) : receiver;
%_CallFunction(new_receiver, element, i, array, f);
}
}
@@ -1266,7 +1266,7 @@ function ArrayForEach(f, receiver) {
// Pull out the length so that modifications to the length in the
// loop will not affect the looping and side effects are visible.
- var array = $toObject(this);
+ var array = TO_OBJECT(this);
var length = TO_UINT32(array.length);
InnerArrayForEach(f, receiver, array, length);
}
@@ -1288,7 +1288,7 @@ function InnerArraySome(f, receiver, array, length) {
var element = array[i];
// Prepare break slots for debugger step in.
if (stepping) %DebugPrepareStepInIfStepping(f);
- var new_receiver = needs_wrapper ? $toObject(receiver) : receiver;
+ var new_receiver = needs_wrapper ? TO_OBJECT(receiver) : receiver;
if (%_CallFunction(new_receiver, element, i, array, f)) return true;
}
}
@@ -1303,7 +1303,7 @@ function ArraySome(f, receiver) {
// Pull out the length so that modifications to the length in the
// loop will not affect the looping and side effects are visible.
- var array = $toObject(this);
+ var array = TO_OBJECT(this);
var length = TO_UINT32(array.length);
return InnerArraySome(f, receiver, array, length);
}
@@ -1325,7 +1325,7 @@ function InnerArrayEvery(f, receiver, array, length) {
var element = array[i];
// Prepare break slots for debugger step in.
if (stepping) %DebugPrepareStepInIfStepping(f);
- var new_receiver = needs_wrapper ? $toObject(receiver) : receiver;
+ var new_receiver = needs_wrapper ? TO_OBJECT(receiver) : receiver;
if (!%_CallFunction(new_receiver, element, i, array, f)) return false;
}
}
@@ -1337,7 +1337,7 @@ function ArrayEvery(f, receiver) {
// Pull out the length so that modifications to the length in the
// loop will not affect the looping and side effects are visible.
- var array = $toObject(this);
+ var array = TO_OBJECT(this);
var length = TO_UINT32(array.length);
return InnerArrayEvery(f, receiver, array, length);
}
@@ -1360,7 +1360,7 @@ function InnerArrayMap(f, receiver, array, length) {
var element = array[i];
// Prepare break slots for debugger step in.
if (stepping) %DebugPrepareStepInIfStepping(f);
- var new_receiver = needs_wrapper ? $toObject(receiver) : receiver;
+ var new_receiver = needs_wrapper ? TO_OBJECT(receiver) : receiver;
accumulator[i] = %_CallFunction(new_receiver, element, i, array, f);
}
}
@@ -1373,7 +1373,7 @@ function ArrayMap(f, receiver) {
// Pull out the length so that modifications to the length in the
// loop will not affect the looping and side effects are visible.
- var array = $toObject(this);
+ var array = TO_OBJECT(this);
var length = TO_UINT32(array.length);
var accumulator = InnerArrayMap(f, receiver, array, length);
var result = new GlobalArray();
@@ -1542,7 +1542,7 @@ function ArrayReduce(callback, current) {
// Pull out the length so that modifications to the length in the
// loop will not affect the looping and side effects are visible.
- var array = $toObject(this);
+ var array = TO_OBJECT(this);
var length = $toUint32(array.length);
return InnerArrayReduce(callback, current, array, length,
%_ArgumentsLength());
@@ -1585,7 +1585,7 @@ function ArrayReduceRight(callback, current) {
// Pull out the length so that side effects are visible before the
// callback function is checked.
- var array = $toObject(this);
+ var array = TO_OBJECT(this);
var length = $toUint32(array.length);
return InnerArrayReduceRight(callback, current, array, length,
%_ArgumentsLength());
« no previous file with comments | « src/arm64/interface-descriptors-arm64.cc ('k') | src/array-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698