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

Side by Side Diff: src/objects-inl.h

Issue 1033653002: Move prototype metadata from internal properties to prototype maps (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 4541 matching lines...) Expand 10 before | Expand all | Expand 10 after
4552 int Map::unused_property_fields() { 4552 int Map::unused_property_fields() {
4553 return READ_BYTE_FIELD(this, kUnusedPropertyFieldsOffset); 4553 return READ_BYTE_FIELD(this, kUnusedPropertyFieldsOffset);
4554 } 4554 }
4555 4555
4556 4556
4557 void Map::set_unused_property_fields(int value) { 4557 void Map::set_unused_property_fields(int value) {
4558 WRITE_BYTE_FIELD(this, kUnusedPropertyFieldsOffset, Min(value, 255)); 4558 WRITE_BYTE_FIELD(this, kUnusedPropertyFieldsOffset, Min(value, 255));
4559 } 4559 }
4560 4560
4561 4561
4562 byte Map::bit_field() { 4562 byte Map::bit_field() const { return READ_BYTE_FIELD(this, kBitFieldOffset); }
4563 return READ_BYTE_FIELD(this, kBitFieldOffset);
4564 }
4565 4563
4566 4564
4567 void Map::set_bit_field(byte value) { 4565 void Map::set_bit_field(byte value) {
4568 WRITE_BYTE_FIELD(this, kBitFieldOffset, value); 4566 WRITE_BYTE_FIELD(this, kBitFieldOffset, value);
4569 } 4567 }
4570 4568
4571 4569
4572 byte Map::bit_field2() { 4570 byte Map::bit_field2() const { return READ_BYTE_FIELD(this, kBitField2Offset); }
4573 return READ_BYTE_FIELD(this, kBitField2Offset);
4574 }
4575 4571
4576 4572
4577 void Map::set_bit_field2(byte value) { 4573 void Map::set_bit_field2(byte value) {
4578 WRITE_BYTE_FIELD(this, kBitField2Offset, value); 4574 WRITE_BYTE_FIELD(this, kBitField2Offset, value);
4579 } 4575 }
4580 4576
4581 4577
4582 void Map::set_non_instance_prototype(bool value) { 4578 void Map::set_non_instance_prototype(bool value) {
4583 if (value) { 4579 if (value) {
4584 set_bit_field(bit_field() | (1 << kHasNonInstancePrototype)); 4580 set_bit_field(bit_field() | (1 << kHasNonInstancePrototype));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4627 4623
4628 bool Map::is_extensible() { 4624 bool Map::is_extensible() {
4629 return ((1 << kIsExtensible) & bit_field2()) != 0; 4625 return ((1 << kIsExtensible) & bit_field2()) != 0;
4630 } 4626 }
4631 4627
4632 4628
4633 void Map::set_is_prototype_map(bool value) { 4629 void Map::set_is_prototype_map(bool value) {
4634 set_bit_field2(IsPrototypeMapBits::update(bit_field2(), value)); 4630 set_bit_field2(IsPrototypeMapBits::update(bit_field2(), value));
4635 } 4631 }
4636 4632
4637 bool Map::is_prototype_map() { 4633 bool Map::is_prototype_map() const {
4638 return IsPrototypeMapBits::decode(bit_field2()); 4634 return IsPrototypeMapBits::decode(bit_field2());
4639 } 4635 }
4640 4636
4641 4637
4642 void Map::set_dictionary_map(bool value) { 4638 void Map::set_dictionary_map(bool value) {
4643 uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value); 4639 uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value);
4644 new_bit_field3 = IsUnstable::update(new_bit_field3, value); 4640 new_bit_field3 = IsUnstable::update(new_bit_field3, value);
4645 set_bit_field3(new_bit_field3); 4641 set_bit_field3(new_bit_field3);
4646 } 4642 }
4647 4643
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
5321 5317
5322 5318
5323 void Map::set_bit_field3(uint32_t bits) { 5319 void Map::set_bit_field3(uint32_t bits) {
5324 if (kInt32Size != kPointerSize) { 5320 if (kInt32Size != kPointerSize) {
5325 WRITE_UINT32_FIELD(this, kBitField3Offset + kInt32Size, 0); 5321 WRITE_UINT32_FIELD(this, kBitField3Offset + kInt32Size, 0);
5326 } 5322 }
5327 WRITE_UINT32_FIELD(this, kBitField3Offset, bits); 5323 WRITE_UINT32_FIELD(this, kBitField3Offset, bits);
5328 } 5324 }
5329 5325
5330 5326
5331 uint32_t Map::bit_field3() { 5327 uint32_t Map::bit_field3() const {
5332 return READ_UINT32_FIELD(this, kBitField3Offset); 5328 return READ_UINT32_FIELD(this, kBitField3Offset);
5333 } 5329 }
5334 5330
5335 5331
5336 LayoutDescriptor* Map::GetLayoutDescriptor() { 5332 LayoutDescriptor* Map::GetLayoutDescriptor() {
5337 return FLAG_unbox_double_fields ? layout_descriptor() 5333 return FLAG_unbox_double_fields ? layout_descriptor()
5338 : LayoutDescriptor::FastPointerLayout(); 5334 : LayoutDescriptor::FastPointerLayout();
5339 } 5335 }
5340 5336
5341 5337
(...skipping 21 matching lines...) Expand all
5363 return GetIsolate()->heap()->undefined_value(); 5359 return GetIsolate()->heap()->undefined_value();
5364 } 5360 }
5365 5361
5366 5362
5367 Map* Map::ElementsTransitionMap() { 5363 Map* Map::ElementsTransitionMap() {
5368 return TransitionArray::SearchSpecial( 5364 return TransitionArray::SearchSpecial(
5369 this, GetHeap()->elements_transition_symbol()); 5365 this, GetHeap()->elements_transition_symbol());
5370 } 5366 }
5371 5367
5372 5368
5373 ACCESSORS(Map, raw_transitions, Object, kTransitionsOffset) 5369 ACCESSORS(Map, raw_transitions, Object, kTransitionsOrPrototypeInfoOffset)
5370
5371
5372 Object* Map::prototype_info() const {
5373 DCHECK(is_prototype_map());
5374 return READ_FIELD(this, Map::kTransitionsOrPrototypeInfoOffset);
5375 }
5376 void Map::set_prototype_info(Object* value, WriteBarrierMode mode) {
5377 DCHECK(is_prototype_map());
5378 WRITE_FIELD(this, Map::kTransitionsOrPrototypeInfoOffset, value);
5379 CONDITIONAL_WRITE_BARRIER(
5380 GetHeap(), this, Map::kTransitionsOrPrototypeInfoOffset, value, mode);
5381 }
5374 5382
5375 5383
5376 void Map::SetBackPointer(Object* value, WriteBarrierMode mode) { 5384 void Map::SetBackPointer(Object* value, WriteBarrierMode mode) {
5377 DCHECK(instance_type() >= FIRST_JS_RECEIVER_TYPE); 5385 DCHECK(instance_type() >= FIRST_JS_RECEIVER_TYPE);
5378 DCHECK((value->IsUndefined() && GetBackPointer()->IsMap()) || 5386 DCHECK((value->IsUndefined() && GetBackPointer()->IsMap()) ||
5379 (value->IsMap() && GetBackPointer()->IsUndefined())); 5387 (value->IsMap() && GetBackPointer()->IsUndefined()));
5380 DCHECK(!value->IsMap() || 5388 DCHECK(!value->IsMap() ||
5381 Map::cast(value)->GetConstructor() == constructor_or_backpointer()); 5389 Map::cast(value)->GetConstructor() == constructor_or_backpointer());
5382 set_constructor_or_backpointer(value, mode); 5390 set_constructor_or_backpointer(value, mode);
5383 } 5391 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5423 ACCESSORS_TO_SMI(AccessorInfo, flag, kFlagOffset) 5431 ACCESSORS_TO_SMI(AccessorInfo, flag, kFlagOffset)
5424 ACCESSORS(AccessorInfo, expected_receiver_type, Object, 5432 ACCESSORS(AccessorInfo, expected_receiver_type, Object,
5425 kExpectedReceiverTypeOffset) 5433 kExpectedReceiverTypeOffset)
5426 5434
5427 ACCESSORS(ExecutableAccessorInfo, getter, Object, kGetterOffset) 5435 ACCESSORS(ExecutableAccessorInfo, getter, Object, kGetterOffset)
5428 ACCESSORS(ExecutableAccessorInfo, setter, Object, kSetterOffset) 5436 ACCESSORS(ExecutableAccessorInfo, setter, Object, kSetterOffset)
5429 ACCESSORS(ExecutableAccessorInfo, data, Object, kDataOffset) 5437 ACCESSORS(ExecutableAccessorInfo, data, Object, kDataOffset)
5430 5438
5431 ACCESSORS(Box, value, Object, kValueOffset) 5439 ACCESSORS(Box, value, Object, kValueOffset)
5432 5440
5441 ACCESSORS(PrototypeInfo, prototype_object, JSObject, kPrototypeObjectOffset)
5442 ACCESSORS(PrototypeInfo, prototype_users, Object, kPrototypeUsersOffset)
5443 ACCESSORS(PrototypeInfo, validity_cell, Object, kValidityCellOffset)
5444
5433 ACCESSORS(AccessorPair, getter, Object, kGetterOffset) 5445 ACCESSORS(AccessorPair, getter, Object, kGetterOffset)
5434 ACCESSORS(AccessorPair, setter, Object, kSetterOffset) 5446 ACCESSORS(AccessorPair, setter, Object, kSetterOffset)
5435 5447
5436 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset) 5448 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset)
5437 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset) 5449 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset)
5438 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset) 5450 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset)
5439 5451
5440 ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset) 5452 ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset)
5441 ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset) 5453 ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset)
5442 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset) 5454 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset)
(...skipping 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after
7496 #undef READ_SHORT_FIELD 7508 #undef READ_SHORT_FIELD
7497 #undef WRITE_SHORT_FIELD 7509 #undef WRITE_SHORT_FIELD
7498 #undef READ_BYTE_FIELD 7510 #undef READ_BYTE_FIELD
7499 #undef WRITE_BYTE_FIELD 7511 #undef WRITE_BYTE_FIELD
7500 #undef NOBARRIER_READ_BYTE_FIELD 7512 #undef NOBARRIER_READ_BYTE_FIELD
7501 #undef NOBARRIER_WRITE_BYTE_FIELD 7513 #undef NOBARRIER_WRITE_BYTE_FIELD
7502 7514
7503 } } // namespace v8::internal 7515 } } // namespace v8::internal
7504 7516
7505 #endif // V8_OBJECTS_INL_H_ 7517 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.cc ('K') | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698