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

Side by Side Diff: src/elements.cc

Issue 2622413004: [runtime] Remove further usages of PropertyType in favor of PropertyKind/PropertyLocation. (Closed)
Patch Set: Created 3 years, 11 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 | « src/crankshaft/hydrogen.h ('k') | src/factory.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/elements.h" 5 #include "src/elements.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 1240
1241 uint32_t GetEntryForIndex(Isolate* isolate, JSObject* holder, 1241 uint32_t GetEntryForIndex(Isolate* isolate, JSObject* holder,
1242 FixedArrayBase* backing_store, 1242 FixedArrayBase* backing_store,
1243 uint32_t index) final { 1243 uint32_t index) final {
1244 return Subclass::GetEntryForIndexImpl(isolate, holder, backing_store, index, 1244 return Subclass::GetEntryForIndexImpl(isolate, holder, backing_store, index,
1245 ALL_PROPERTIES); 1245 ALL_PROPERTIES);
1246 } 1246 }
1247 1247
1248 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store, 1248 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
1249 uint32_t entry) { 1249 uint32_t entry) {
1250 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell); 1250 return PropertyDetails(kData, NONE, 0, PropertyCellType::kNoCell);
1251 } 1251 }
1252 1252
1253 static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) { 1253 static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) {
1254 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell); 1254 return PropertyDetails(kData, NONE, 0, PropertyCellType::kNoCell);
1255 } 1255 }
1256 1256
1257 PropertyDetails GetDetails(JSObject* holder, uint32_t entry) final { 1257 PropertyDetails GetDetails(JSObject* holder, uint32_t entry) final {
1258 return Subclass::GetDetailsImpl(holder, entry); 1258 return Subclass::GetDetailsImpl(holder, entry);
1259 } 1259 }
1260 1260
1261 Handle<FixedArray> CreateListFromArray(Isolate* isolate, 1261 Handle<FixedArray> CreateListFromArray(Isolate* isolate,
1262 Handle<JSArray> array) final { 1262 Handle<JSArray> array) final {
1263 return Subclass::CreateListFromArrayImpl(isolate, array); 1263 return Subclass::CreateListFromArrayImpl(isolate, array);
1264 }; 1264 };
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 } 1410 }
1411 1411
1412 static void ReconfigureImpl(Handle<JSObject> object, 1412 static void ReconfigureImpl(Handle<JSObject> object,
1413 Handle<FixedArrayBase> store, uint32_t entry, 1413 Handle<FixedArrayBase> store, uint32_t entry,
1414 Handle<Object> value, 1414 Handle<Object> value,
1415 PropertyAttributes attributes) { 1415 PropertyAttributes attributes) {
1416 SeededNumberDictionary* dictionary = SeededNumberDictionary::cast(*store); 1416 SeededNumberDictionary* dictionary = SeededNumberDictionary::cast(*store);
1417 if (attributes != NONE) object->RequireSlowElements(dictionary); 1417 if (attributes != NONE) object->RequireSlowElements(dictionary);
1418 dictionary->ValueAtPut(entry, *value); 1418 dictionary->ValueAtPut(entry, *value);
1419 PropertyDetails details = dictionary->DetailsAt(entry); 1419 PropertyDetails details = dictionary->DetailsAt(entry);
1420 details = PropertyDetails(attributes, DATA, details.dictionary_index(), 1420 details = PropertyDetails(kData, attributes, details.dictionary_index(),
1421 PropertyCellType::kNoCell); 1421 PropertyCellType::kNoCell);
1422 dictionary->DetailsAtPut(entry, details); 1422 dictionary->DetailsAtPut(entry, details);
1423 } 1423 }
1424 1424
1425 static void AddImpl(Handle<JSObject> object, uint32_t index, 1425 static void AddImpl(Handle<JSObject> object, uint32_t index,
1426 Handle<Object> value, PropertyAttributes attributes, 1426 Handle<Object> value, PropertyAttributes attributes,
1427 uint32_t new_capacity) { 1427 uint32_t new_capacity) {
1428 PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell); 1428 PropertyDetails details(kData, attributes, 0, PropertyCellType::kNoCell);
1429 Handle<SeededNumberDictionary> dictionary = 1429 Handle<SeededNumberDictionary> dictionary =
1430 object->HasFastElements() || object->HasFastStringWrapperElements() 1430 object->HasFastElements() || object->HasFastStringWrapperElements()
1431 ? JSObject::NormalizeElements(object) 1431 ? JSObject::NormalizeElements(object)
1432 : handle(SeededNumberDictionary::cast(object->elements())); 1432 : handle(SeededNumberDictionary::cast(object->elements()));
1433 Handle<SeededNumberDictionary> new_dictionary = 1433 Handle<SeededNumberDictionary> new_dictionary =
1434 SeededNumberDictionary::AddNumberEntry(dictionary, index, value, 1434 SeededNumberDictionary::AddNumberEntry(dictionary, index, value,
1435 details, object); 1435 details, object);
1436 if (attributes != NONE) object->RequireSlowElements(*new_dictionary); 1436 if (attributes != NONE) object->RequireSlowElements(*new_dictionary);
1437 if (dictionary.is_identical_to(new_dictionary)) return; 1437 if (dictionary.is_identical_to(new_dictionary)) return;
1438 object->set_elements(*new_dictionary); 1438 object->set_elements(*new_dictionary);
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 Object* value, WriteBarrierMode mode) { 2714 Object* value, WriteBarrierMode mode) {
2715 BackingStore::cast(backing_store)->SetValue(entry, value); 2715 BackingStore::cast(backing_store)->SetValue(entry, value);
2716 } 2716 }
2717 2717
2718 static Handle<Object> GetImpl(Isolate* isolate, FixedArrayBase* backing_store, 2718 static Handle<Object> GetImpl(Isolate* isolate, FixedArrayBase* backing_store,
2719 uint32_t entry) { 2719 uint32_t entry) {
2720 return BackingStore::get(BackingStore::cast(backing_store), entry); 2720 return BackingStore::get(BackingStore::cast(backing_store), entry);
2721 } 2721 }
2722 2722
2723 static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) { 2723 static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) {
2724 return PropertyDetails(DONT_DELETE, DATA, 0, PropertyCellType::kNoCell); 2724 return PropertyDetails(kData, DONT_DELETE, 0, PropertyCellType::kNoCell);
2725 } 2725 }
2726 2726
2727 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store, 2727 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
2728 uint32_t entry) { 2728 uint32_t entry) {
2729 return PropertyDetails(DONT_DELETE, DATA, 0, PropertyCellType::kNoCell); 2729 return PropertyDetails(kData, DONT_DELETE, 0, PropertyCellType::kNoCell);
2730 } 2730 }
2731 2731
2732 static bool HasElementImpl(Isolate* isolate, Handle<JSObject> holder, 2732 static bool HasElementImpl(Isolate* isolate, Handle<JSObject> holder,
2733 uint32_t index, 2733 uint32_t index,
2734 Handle<FixedArrayBase> backing_store, 2734 Handle<FixedArrayBase> backing_store,
2735 PropertyFilter filter) { 2735 PropertyFilter filter) {
2736 return index < AccessorClass::GetCapacityImpl(*holder, *backing_store); 2736 return index < AccessorClass::GetCapacityImpl(*holder, *backing_store);
2737 } 2737 }
2738 2738
2739 static bool HasAccessorsImpl(JSObject* holder, 2739 static bool HasAccessorsImpl(JSObject* holder,
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 uint32_t entry = ArgumentsAccessor::GetEntryForIndexImpl( 3078 uint32_t entry = ArgumentsAccessor::GetEntryForIndexImpl(
3079 isolate, holder, arguments, index, filter); 3079 isolate, holder, arguments, index, filter);
3080 if (entry == kMaxUInt32) return kMaxUInt32; 3080 if (entry == kMaxUInt32) return kMaxUInt32;
3081 return (parameter_map->length() - 2) + entry; 3081 return (parameter_map->length() - 2) + entry;
3082 } 3082 }
3083 3083
3084 static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) { 3084 static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) {
3085 FixedArray* parameter_map = FixedArray::cast(holder->elements()); 3085 FixedArray* parameter_map = FixedArray::cast(holder->elements());
3086 uint32_t length = parameter_map->length() - 2; 3086 uint32_t length = parameter_map->length() - 2;
3087 if (entry < length) { 3087 if (entry < length) {
3088 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell); 3088 return PropertyDetails(kData, NONE, 0, PropertyCellType::kNoCell);
3089 } 3089 }
3090 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); 3090 FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
3091 return ArgumentsAccessor::GetDetailsImpl(arguments, entry - length); 3091 return ArgumentsAccessor::GetDetailsImpl(arguments, entry - length);
3092 } 3092 }
3093 3093
3094 static bool HasParameterMapArg(FixedArray* parameter_map, uint32_t index) { 3094 static bool HasParameterMapArg(FixedArray* parameter_map, uint32_t index) {
3095 uint32_t length = parameter_map->length() - 2; 3095 uint32_t length = parameter_map->length() - 2;
3096 if (index >= length) return false; 3096 if (index >= length) return false;
3097 return !parameter_map->get(index + 2)->IsTheHole( 3097 return !parameter_map->get(index + 2)->IsTheHole(
3098 parameter_map->GetIsolate()); 3098 parameter_map->GetIsolate());
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 static void AddImpl(Handle<JSObject> object, uint32_t index, 3265 static void AddImpl(Handle<JSObject> object, uint32_t index,
3266 Handle<Object> value, PropertyAttributes attributes, 3266 Handle<Object> value, PropertyAttributes attributes,
3267 uint32_t new_capacity) { 3267 uint32_t new_capacity) {
3268 Handle<FixedArray> parameter_map(FixedArray::cast(object->elements())); 3268 Handle<FixedArray> parameter_map(FixedArray::cast(object->elements()));
3269 Handle<FixedArrayBase> old_elements( 3269 Handle<FixedArrayBase> old_elements(
3270 FixedArrayBase::cast(parameter_map->get(1))); 3270 FixedArrayBase::cast(parameter_map->get(1)));
3271 Handle<SeededNumberDictionary> dictionary = 3271 Handle<SeededNumberDictionary> dictionary =
3272 old_elements->IsSeededNumberDictionary() 3272 old_elements->IsSeededNumberDictionary()
3273 ? Handle<SeededNumberDictionary>::cast(old_elements) 3273 ? Handle<SeededNumberDictionary>::cast(old_elements)
3274 : JSObject::NormalizeElements(object); 3274 : JSObject::NormalizeElements(object);
3275 PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell); 3275 PropertyDetails details(kData, attributes, 0, PropertyCellType::kNoCell);
3276 Handle<SeededNumberDictionary> new_dictionary = 3276 Handle<SeededNumberDictionary> new_dictionary =
3277 SeededNumberDictionary::AddNumberEntry(dictionary, index, value, 3277 SeededNumberDictionary::AddNumberEntry(dictionary, index, value,
3278 details, object); 3278 details, object);
3279 if (attributes != NONE) object->RequireSlowElements(*new_dictionary); 3279 if (attributes != NONE) object->RequireSlowElements(*new_dictionary);
3280 if (*dictionary != *new_dictionary) { 3280 if (*dictionary != *new_dictionary) {
3281 FixedArray::cast(object->elements())->set(1, *new_dictionary); 3281 FixedArray::cast(object->elements())->set(1, *new_dictionary);
3282 } 3282 }
3283 } 3283 }
3284 3284
3285 static void ReconfigureImpl(Handle<JSObject> object, 3285 static void ReconfigureImpl(Handle<JSObject> object,
(...skipping 11 matching lines...) Expand all
3297 DCHECK(!context->get(context_entry)->IsTheHole(isolate)); 3297 DCHECK(!context->get(context_entry)->IsTheHole(isolate));
3298 context->set(context_entry, *value); 3298 context->set(context_entry, *value);
3299 3299
3300 // Redefining attributes of an aliased element destroys fast aliasing. 3300 // Redefining attributes of an aliased element destroys fast aliasing.
3301 parameter_map->set_the_hole(isolate, entry + 2); 3301 parameter_map->set_the_hole(isolate, entry + 2);
3302 // For elements that are still writable we re-establish slow aliasing. 3302 // For elements that are still writable we re-establish slow aliasing.
3303 if ((attributes & READ_ONLY) == 0) { 3303 if ((attributes & READ_ONLY) == 0) {
3304 value = isolate->factory()->NewAliasedArgumentsEntry(context_entry); 3304 value = isolate->factory()->NewAliasedArgumentsEntry(context_entry);
3305 } 3305 }
3306 3306
3307 PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell); 3307 PropertyDetails details(kData, attributes, 0, PropertyCellType::kNoCell);
3308 Handle<SeededNumberDictionary> arguments( 3308 Handle<SeededNumberDictionary> arguments(
3309 SeededNumberDictionary::cast(parameter_map->get(1)), isolate); 3309 SeededNumberDictionary::cast(parameter_map->get(1)), isolate);
3310 arguments = SeededNumberDictionary::AddNumberEntry( 3310 arguments = SeededNumberDictionary::AddNumberEntry(
3311 arguments, entry, value, details, object); 3311 arguments, entry, value, details, object);
3312 // If the attributes were NONE, we would have called set rather than 3312 // If the attributes were NONE, we would have called set rather than
3313 // reconfigure. 3313 // reconfigure.
3314 DCHECK_NE(NONE, attributes); 3314 DCHECK_NE(NONE, attributes);
3315 object->RequireSlowElements(*arguments); 3315 object->RequireSlowElements(*arguments);
3316 parameter_map->set(1, *arguments); 3316 parameter_map->set(1, *arguments);
3317 } else { 3317 } else {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
3476 uint32_t entry) { 3476 uint32_t entry) {
3477 UNREACHABLE(); 3477 UNREACHABLE();
3478 return Handle<Object>(); 3478 return Handle<Object>();
3479 } 3479 }
3480 3480
3481 static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) { 3481 static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) {
3482 uint32_t length = static_cast<uint32_t>(GetString(holder)->length()); 3482 uint32_t length = static_cast<uint32_t>(GetString(holder)->length());
3483 if (entry < length) { 3483 if (entry < length) {
3484 PropertyAttributes attributes = 3484 PropertyAttributes attributes =
3485 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); 3485 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
3486 return PropertyDetails(attributes, v8::internal::DATA, 0, 3486 return PropertyDetails(kData, attributes, 0, PropertyCellType::kNoCell);
3487 PropertyCellType::kNoCell);
3488 } 3487 }
3489 return BackingStoreAccessor::GetDetailsImpl(holder, entry - length); 3488 return BackingStoreAccessor::GetDetailsImpl(holder, entry - length);
3490 } 3489 }
3491 3490
3492 static uint32_t GetEntryForIndexImpl(Isolate* isolate, JSObject* holder, 3491 static uint32_t GetEntryForIndexImpl(Isolate* isolate, JSObject* holder,
3493 FixedArrayBase* backing_store, 3492 FixedArrayBase* backing_store,
3494 uint32_t index, PropertyFilter filter) { 3493 uint32_t index, PropertyFilter filter) {
3495 uint32_t length = static_cast<uint32_t>(GetString(holder)->length()); 3494 uint32_t length = static_cast<uint32_t>(GetString(holder)->length());
3496 if (index < length) return index; 3495 if (index < length) return index;
3497 uint32_t backing_store_entry = BackingStoreAccessor::GetEntryForIndexImpl( 3496 uint32_t backing_store_entry = BackingStoreAccessor::GetEntryForIndexImpl(
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
3853 insertion_index += len; 3852 insertion_index += len;
3854 } 3853 }
3855 3854
3856 DCHECK_EQ(insertion_index, result_len); 3855 DCHECK_EQ(insertion_index, result_len);
3857 return result_array; 3856 return result_array;
3858 } 3857 }
3859 3858
3860 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 3859 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
3861 } // namespace internal 3860 } // namespace internal
3862 } // namespace v8 3861 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698