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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/runtime/runtime-array.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 17601 matching lines...) Expand 10 before | Expand all | Expand 10 after
17612 // If the object is in dictionary mode, it is converted to fast elements 17612 // If the object is in dictionary mode, it is converted to fast elements
17613 // mode. 17613 // mode.
17614 Handle<Object> JSObject::PrepareElementsForSort(Handle<JSObject> object, 17614 Handle<Object> JSObject::PrepareElementsForSort(Handle<JSObject> object,
17615 uint32_t limit) { 17615 uint32_t limit) {
17616 Isolate* isolate = object->GetIsolate(); 17616 Isolate* isolate = object->GetIsolate();
17617 if (object->HasSloppyArgumentsElements() || 17617 if (object->HasSloppyArgumentsElements() ||
17618 object->map()->is_observed()) { 17618 object->map()->is_observed()) {
17619 return handle(Smi::FromInt(-1), isolate); 17619 return handle(Smi::FromInt(-1), isolate);
17620 } 17620 }
17621 17621
17622 if (object->HasStringWrapperElements()) {
17623 int len = String::cast(Handle<JSValue>::cast(object)->value())->length();
17624 return handle(Smi::FromInt(len), isolate);
17625 }
17626
17622 if (object->HasDictionaryElements()) { 17627 if (object->HasDictionaryElements()) {
17623 // Convert to fast elements containing only the existing properties. 17628 // Convert to fast elements containing only the existing properties.
17624 // Ordering is irrelevant, since we are going to sort anyway. 17629 // Ordering is irrelevant, since we are going to sort anyway.
17625 Handle<SeededNumberDictionary> dict(object->element_dictionary()); 17630 Handle<SeededNumberDictionary> dict(object->element_dictionary());
17626 if (object->IsJSArray() || dict->requires_slow_elements() || 17631 if (object->IsJSArray() || dict->requires_slow_elements() ||
17627 dict->max_number_key() >= limit) { 17632 dict->max_number_key() >= limit) {
17628 return JSObject::PrepareSlowElementsForSort(object, limit); 17633 return JSObject::PrepareSlowElementsForSort(object, limit);
17629 } 17634 }
17630 // Convert to fast elements. 17635 // Convert to fast elements.
17631 17636
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after
19800 if (cell->value() != *new_value) { 19805 if (cell->value() != *new_value) {
19801 cell->set_value(*new_value); 19806 cell->set_value(*new_value);
19802 Isolate* isolate = cell->GetIsolate(); 19807 Isolate* isolate = cell->GetIsolate();
19803 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19808 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19804 isolate, DependentCode::kPropertyCellChangedGroup); 19809 isolate, DependentCode::kPropertyCellChangedGroup);
19805 } 19810 }
19806 } 19811 }
19807 19812
19808 } // namespace internal 19813 } // namespace internal
19809 } // namespace v8 19814 } // namespace v8
OLDNEW
« 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