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

Side by Side Diff: src/objects.cc

Issue 1221303019: Fix keyed access of primitive objects in the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 12308 matching lines...) Expand 10 before | Expand all | Expand 10 after
12319 void JSObject::ValidateElements(Handle<JSObject> object) { 12319 void JSObject::ValidateElements(Handle<JSObject> object) {
12320 #ifdef ENABLE_SLOW_DCHECKS 12320 #ifdef ENABLE_SLOW_DCHECKS
12321 if (FLAG_enable_slow_asserts) { 12321 if (FLAG_enable_slow_asserts) {
12322 ElementsAccessor* accessor = object->GetElementsAccessor(); 12322 ElementsAccessor* accessor = object->GetElementsAccessor();
12323 accessor->Validate(object); 12323 accessor->Validate(object);
12324 } 12324 }
12325 #endif 12325 #endif
12326 } 12326 }
12327 12327
12328 12328
12329 // static
12330 MaybeHandle<Object> JSReceiver::SetElement(Handle<JSReceiver> object,
12331 uint32_t index, Handle<Object> value,
12332 LanguageMode language_mode) {
12333 Isolate* isolate = object->GetIsolate();
12334 LookupIterator it(isolate, object, index);
12335 return SetProperty(&it, value, language_mode, MAY_BE_STORE_FROM_KEYED);
12336 }
12337
12338
12339 static bool ShouldConvertToSlowElements(JSObject* object, uint32_t capacity, 12329 static bool ShouldConvertToSlowElements(JSObject* object, uint32_t capacity,
12340 uint32_t index, 12330 uint32_t index,
12341 uint32_t* new_capacity) { 12331 uint32_t* new_capacity) {
12342 STATIC_ASSERT(JSObject::kMaxUncheckedOldFastElementsLength <= 12332 STATIC_ASSERT(JSObject::kMaxUncheckedOldFastElementsLength <=
12343 JSObject::kMaxUncheckedFastElementsLength); 12333 JSObject::kMaxUncheckedFastElementsLength);
12344 if (index < capacity) { 12334 if (index < capacity) {
12345 *new_capacity = capacity; 12335 *new_capacity = capacity;
12346 return false; 12336 return false;
12347 } 12337 }
12348 if (index - capacity >= JSObject::kMaxGap) return true; 12338 if (index - capacity >= JSObject::kMaxGap) return true;
(...skipping 3777 matching lines...) Expand 10 before | Expand all | Expand 10 after
16126 Handle<Object> new_value) { 16116 Handle<Object> new_value) {
16127 if (cell->value() != *new_value) { 16117 if (cell->value() != *new_value) {
16128 cell->set_value(*new_value); 16118 cell->set_value(*new_value);
16129 Isolate* isolate = cell->GetIsolate(); 16119 Isolate* isolate = cell->GetIsolate();
16130 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16120 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16131 isolate, DependentCode::kPropertyCellChangedGroup); 16121 isolate, DependentCode::kPropertyCellChangedGroup);
16132 } 16122 }
16133 } 16123 }
16134 } // namespace internal 16124 } // namespace internal
16135 } // namespace v8 16125 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698