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

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

Issue 2108203002: Implement immutable prototype chains (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: simplify Created 4 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 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 4697 matching lines...) Expand 10 before | Expand all | Expand 10 after
4708 4708
4709 void Map::set_migration_target(bool value) { 4709 void Map::set_migration_target(bool value) {
4710 set_bit_field3(IsMigrationTarget::update(bit_field3(), value)); 4710 set_bit_field3(IsMigrationTarget::update(bit_field3(), value));
4711 } 4711 }
4712 4712
4713 4713
4714 bool Map::is_migration_target() { 4714 bool Map::is_migration_target() {
4715 return IsMigrationTarget::decode(bit_field3()); 4715 return IsMigrationTarget::decode(bit_field3());
4716 } 4716 }
4717 4717
4718 void Map::set_immutable_proto(bool value) {
4719 set_bit_field3(ImmutablePrototype::update(bit_field3(), value));
4720 }
4721
4722 bool Map::is_immutable_proto() {
4723 return ImmutablePrototype::decode(bit_field3());
4724 }
4718 4725
4719 void Map::set_new_target_is_base(bool value) { 4726 void Map::set_new_target_is_base(bool value) {
4720 set_bit_field3(NewTargetIsBase::update(bit_field3(), value)); 4727 set_bit_field3(NewTargetIsBase::update(bit_field3(), value));
4721 } 4728 }
4722 4729
4723 4730
4724 bool Map::new_target_is_base() { return NewTargetIsBase::decode(bit_field3()); } 4731 bool Map::new_target_is_base() { return NewTargetIsBase::decode(bit_field3()); }
4725 4732
4726 4733
4727 void Map::set_construction_counter(int value) { 4734 void Map::set_construction_counter(int value) {
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
5614 ACCESSORS(FunctionTemplateInfo, instance_call_handler, Object, 5621 ACCESSORS(FunctionTemplateInfo, instance_call_handler, Object,
5615 kInstanceCallHandlerOffset) 5622 kInstanceCallHandlerOffset)
5616 ACCESSORS(FunctionTemplateInfo, access_check_info, Object, 5623 ACCESSORS(FunctionTemplateInfo, access_check_info, Object,
5617 kAccessCheckInfoOffset) 5624 kAccessCheckInfoOffset)
5618 ACCESSORS(FunctionTemplateInfo, shared_function_info, Object, 5625 ACCESSORS(FunctionTemplateInfo, shared_function_info, Object,
5619 kSharedFunctionInfoOffset) 5626 kSharedFunctionInfoOffset)
5620 5627
5621 SMI_ACCESSORS(FunctionTemplateInfo, flag, kFlagOffset) 5628 SMI_ACCESSORS(FunctionTemplateInfo, flag, kFlagOffset)
5622 5629
5623 ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset) 5630 ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset)
5624 ACCESSORS(ObjectTemplateInfo, internal_field_count, Object, 5631 ACCESSORS(ObjectTemplateInfo, data, Object, kDataOffset)
5625 kInternalFieldCountOffset) 5632 int ObjectTemplateInfo::internal_field_count() const {
5633 Object* value = data();
5634 DCHECK(value->IsSmi());
5635 return Smi::cast(value)->value() >> 1;
Toon Verwaest 2016/06/30 15:35:33 You probably want to use BitField to designate the
Dan Ehrenberg 2016/06/30 23:12:41 Done
5636 }
5637 void ObjectTemplateInfo::set_internal_field_count(int count) {
5638 DCHECK(count << 1 < Smi::kMaxValue);
5639 return set_data(Smi::FromInt((immutable_proto() ? 1 : 0) | (count << 1)));
5640 }
5641 bool ObjectTemplateInfo::immutable_proto() const {
5642 Object* value = data();
5643 DCHECK(value->IsSmi());
5644 return Smi::cast(value)->value() & 1;
5645 }
5646 void ObjectTemplateInfo::set_immutable_proto(bool immutable) {
5647 return set_data(
5648 Smi::FromInt((immutable ? 1 : 0) | (internal_field_count() << 1)));
5649 }
5626 5650
5627 ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset) 5651 ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset)
5628 ACCESSORS(AllocationSite, nested_site, Object, kNestedSiteOffset) 5652 ACCESSORS(AllocationSite, nested_site, Object, kNestedSiteOffset)
5629 SMI_ACCESSORS(AllocationSite, pretenure_data, kPretenureDataOffset) 5653 SMI_ACCESSORS(AllocationSite, pretenure_data, kPretenureDataOffset)
5630 SMI_ACCESSORS(AllocationSite, pretenure_create_count, 5654 SMI_ACCESSORS(AllocationSite, pretenure_create_count,
5631 kPretenureCreateCountOffset) 5655 kPretenureCreateCountOffset)
5632 ACCESSORS(AllocationSite, dependent_code, DependentCode, 5656 ACCESSORS(AllocationSite, dependent_code, DependentCode,
5633 kDependentCodeOffset) 5657 kDependentCodeOffset)
5634 ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset) 5658 ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset)
5635 ACCESSORS(AllocationMemento, allocation_site, Object, kAllocationSiteOffset) 5659 ACCESSORS(AllocationMemento, allocation_site, Object, kAllocationSiteOffset)
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
8038 #undef WRITE_INT64_FIELD 8062 #undef WRITE_INT64_FIELD
8039 #undef READ_BYTE_FIELD 8063 #undef READ_BYTE_FIELD
8040 #undef WRITE_BYTE_FIELD 8064 #undef WRITE_BYTE_FIELD
8041 #undef NOBARRIER_READ_BYTE_FIELD 8065 #undef NOBARRIER_READ_BYTE_FIELD
8042 #undef NOBARRIER_WRITE_BYTE_FIELD 8066 #undef NOBARRIER_WRITE_BYTE_FIELD
8043 8067
8044 } // namespace internal 8068 } // namespace internal
8045 } // namespace v8 8069 } // namespace v8
8046 8070
8047 #endif // V8_OBJECTS_INL_H_ 8071 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698