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

Side by Side Diff: src/lookup.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/factory.cc ('k') | src/objects.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/lookup.h" 5 #include "src/lookup.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/deoptimizer.h" 8 #include "src/deoptimizer.h"
9 #include "src/elements.h" 9 #include "src/elements.h"
10 #include "src/field-type.h" 10 #include "src/field-type.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 attributes); 268 attributes);
269 ReloadPropertyInformation<true>(); 269 ReloadPropertyInformation<true>();
270 } else if (holder->HasFastProperties()) { 270 } else if (holder->HasFastProperties()) {
271 Handle<Map> old_map(holder->map(), isolate_); 271 Handle<Map> old_map(holder->map(), isolate_);
272 Handle<Map> new_map = Map::ReconfigureExistingProperty( 272 Handle<Map> new_map = Map::ReconfigureExistingProperty(
273 old_map, descriptor_number(), i::kData, attributes); 273 old_map, descriptor_number(), i::kData, attributes);
274 new_map = Map::PrepareForDataProperty(new_map, descriptor_number(), value); 274 new_map = Map::PrepareForDataProperty(new_map, descriptor_number(), value);
275 JSObject::MigrateToMap(holder, new_map); 275 JSObject::MigrateToMap(holder, new_map);
276 ReloadPropertyInformation<false>(); 276 ReloadPropertyInformation<false>();
277 } else { 277 } else {
278 PropertyDetails details(attributes, v8::internal::DATA, 0, 278 PropertyDetails details(kData, attributes, 0, PropertyCellType::kMutable);
279 PropertyCellType::kMutable);
280 if (holder->IsJSGlobalObject()) { 279 if (holder->IsJSGlobalObject()) {
281 Handle<GlobalDictionary> dictionary(holder->global_dictionary()); 280 Handle<GlobalDictionary> dictionary(holder->global_dictionary());
282 281
283 Handle<PropertyCell> cell = PropertyCell::PrepareForValue( 282 Handle<PropertyCell> cell = PropertyCell::PrepareForValue(
284 dictionary, dictionary_entry(), value, details); 283 dictionary, dictionary_entry(), value, details);
285 cell->set_value(*value); 284 cell->set_value(*value);
286 property_details_ = cell->property_details(); 285 property_details_ = cell->property_details();
287 } else { 286 } else {
288 Handle<NameDictionary> dictionary(holder->property_dictionary()); 287 Handle<NameDictionary> dictionary(holder->property_dictionary());
289 PropertyDetails original_details = 288 PropertyDetails original_details =
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 global, name(), PropertyCellType::kUninitialized, &entry); 336 global, name(), PropertyCellType::kUninitialized, &entry);
338 Handle<GlobalDictionary> dictionary(global->global_dictionary(), 337 Handle<GlobalDictionary> dictionary(global->global_dictionary(),
339 isolate_); 338 isolate_);
340 DCHECK(cell->value()->IsTheHole(isolate_)); 339 DCHECK(cell->value()->IsTheHole(isolate_));
341 DCHECK(!value->IsTheHole(isolate_)); 340 DCHECK(!value->IsTheHole(isolate_));
342 transition_ = cell; 341 transition_ = cell;
343 // Assign an enumeration index to the property and update 342 // Assign an enumeration index to the property and update
344 // SetNextEnumerationIndex. 343 // SetNextEnumerationIndex.
345 int index = dictionary->NextEnumerationIndex(); 344 int index = dictionary->NextEnumerationIndex();
346 dictionary->SetNextEnumerationIndex(index + 1); 345 dictionary->SetNextEnumerationIndex(index + 1);
347 property_details_ = PropertyDetails(attributes, i::DATA, index, 346 property_details_ = PropertyDetails(kData, attributes, index,
348 PropertyCellType::kUninitialized); 347 PropertyCellType::kUninitialized);
349 PropertyCellType new_type = 348 PropertyCellType new_type =
350 PropertyCell::UpdatedType(cell, value, property_details_); 349 PropertyCell::UpdatedType(cell, value, property_details_);
351 property_details_ = property_details_.set_cell_type(new_type); 350 property_details_ = property_details_.set_cell_type(new_type);
352 cell->set_property_details(property_details_); 351 cell->set_property_details(property_details_);
353 number_ = entry; 352 number_ = entry;
354 has_property_ = true; 353 has_property_ = true;
355 } else { 354 } else {
356 // Don't set enumeration index (it will be set during value store). 355 // Don't set enumeration index (it will be set during value store).
357 property_details_ = 356 property_details_ =
358 PropertyDetails(attributes, i::DATA, 0, PropertyCellType::kNoCell); 357 PropertyDetails(kData, attributes, 0, PropertyCellType::kNoCell);
359 transition_ = map; 358 transition_ = map;
360 } 359 }
361 return; 360 return;
362 } 361 }
363 362
364 Handle<Map> transition = 363 Handle<Map> transition =
365 Map::TransitionToDataProperty(map, name_, value, attributes, store_mode); 364 Map::TransitionToDataProperty(map, name_, value, attributes, store_mode);
366 state_ = TRANSITION; 365 state_ = TRANSITION;
367 transition_ = transition; 366 transition_ = transition;
368 367
369 if (transition->is_dictionary_map()) { 368 if (transition->is_dictionary_map()) {
370 // Don't set enumeration index (it will be set during value store). 369 // Don't set enumeration index (it will be set during value store).
371 property_details_ = 370 property_details_ =
372 PropertyDetails(attributes, i::DATA, 0, PropertyCellType::kNoCell); 371 PropertyDetails(kData, attributes, 0, PropertyCellType::kNoCell);
373 } else { 372 } else {
374 property_details_ = transition->GetLastDescriptorDetails(); 373 property_details_ = transition->GetLastDescriptorDetails();
375 has_property_ = true; 374 has_property_ = true;
376 } 375 }
377 } 376 }
378 377
379 void LookupIterator::ApplyTransitionToDataProperty(Handle<JSObject> receiver) { 378 void LookupIterator::ApplyTransitionToDataProperty(Handle<JSObject> receiver) {
380 DCHECK_EQ(TRANSITION, state_); 379 DCHECK_EQ(TRANSITION, state_);
381 380
382 DCHECK(receiver.is_identical_to(GetStoreTarget())); 381 DCHECK(receiver.is_identical_to(GetStoreTarget()));
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 510 }
512 #endif 511 #endif
513 } 512 }
514 513
515 514
516 void LookupIterator::TransitionToAccessorPair(Handle<Object> pair, 515 void LookupIterator::TransitionToAccessorPair(Handle<Object> pair,
517 PropertyAttributes attributes) { 516 PropertyAttributes attributes) {
518 Handle<JSObject> receiver = GetStoreTarget(); 517 Handle<JSObject> receiver = GetStoreTarget();
519 holder_ = receiver; 518 holder_ = receiver;
520 519
521 PropertyDetails details(attributes, ACCESSOR_CONSTANT, 0, 520 PropertyDetails details(kAccessor, attributes, 0, PropertyCellType::kMutable);
522 PropertyCellType::kMutable);
523 521
524 if (IsElement()) { 522 if (IsElement()) {
525 // TODO(verwaest): Move code into the element accessor. 523 // TODO(verwaest): Move code into the element accessor.
526 Handle<SeededNumberDictionary> dictionary = 524 Handle<SeededNumberDictionary> dictionary =
527 JSObject::NormalizeElements(receiver); 525 JSObject::NormalizeElements(receiver);
528 526
529 dictionary = SeededNumberDictionary::Set(dictionary, index_, pair, details, 527 dictionary = SeededNumberDictionary::Set(dictionary, index_, pair, details,
530 receiver); 528 receiver);
531 receiver->RequireSlowElements(*dictionary); 529 receiver->RequireSlowElements(*dictionary);
532 530
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 872
875 // We have found a cached property! Modify the iterator accordingly. 873 // We have found a cached property! Modify the iterator accordingly.
876 name_ = maybe_name.ToHandleChecked(); 874 name_ = maybe_name.ToHandleChecked();
877 Restart(); 875 Restart();
878 CHECK_EQ(state(), LookupIterator::DATA); 876 CHECK_EQ(state(), LookupIterator::DATA);
879 return true; 877 return true;
880 } 878 }
881 879
882 } // namespace internal 880 } // namespace internal
883 } // namespace v8 881 } // namespace v8
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698