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

Unified Diff: src/objects.cc

Issue 1670153002: Fix Array.prototype.sort for *_STRING_WRAPPER_ELEMENTS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | src/runtime/runtime-array.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 6e0b3d5a4f1a4d56c72d2adb55f4deecf63d3a0d..296acd3988af34f67bea11729edfc314168b33cb 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -17619,6 +17619,11 @@ Handle<Object> JSObject::PrepareElementsForSort(Handle<JSObject> object,
return handle(Smi::FromInt(-1), isolate);
}
+ if (object->HasStringWrapperElements()) {
+ int len = String::cast(Handle<JSValue>::cast(object)->value())->length();
+ return handle(Smi::FromInt(len), isolate);
+ }
+
if (object->HasDictionaryElements()) {
// Convert to fast elements containing only the existing properties.
// Ordering is irrelevant, since we are going to sort anyway.
« no previous file with comments | « no previous file | src/runtime/runtime-array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698