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

Unified Diff: src/array.js

Issue 1178193004: Add ToObject call in Array.prototype.sort (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 | test/mjsunit/array-sort.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 309871f6f95a7811537d1be6132e6afe7fea1be3..69f0910cee58b4ec09545a59fc941c8d4382fd9f 100644
--- a/src/array.js
+++ b/src/array.js
@@ -1176,8 +1176,9 @@ function InnerArraySort(length, comparefn) {
function ArraySort(comparefn) {
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.sort");
- var length = TO_UINT32(this.length);
- return %_CallFunction(this, length, comparefn, InnerArraySort);
+ var array = $toObject(this);
+ var length = TO_UINT32(array.length);
+ return %_CallFunction(array, length, comparefn, InnerArraySort);
}
« no previous file with comments | « no previous file | test/mjsunit/array-sort.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698