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

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

Issue 2624903003: [runtime] Use PropertyKind/PropertyLocation instead of PropertyType. (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
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 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2211 return JSObject::kHeaderSize; 2211 return JSObject::kHeaderSize;
2212 case JS_MESSAGE_OBJECT_TYPE: 2212 case JS_MESSAGE_OBJECT_TYPE:
2213 return JSMessageObject::kSize; 2213 return JSMessageObject::kSize;
2214 case JS_ARGUMENTS_TYPE: 2214 case JS_ARGUMENTS_TYPE:
2215 return JSArgumentsObject::kHeaderSize; 2215 return JSArgumentsObject::kHeaderSize;
2216 case JS_ERROR_TYPE: 2216 case JS_ERROR_TYPE:
2217 return JSObject::kHeaderSize; 2217 return JSObject::kHeaderSize;
2218 case JS_STRING_ITERATOR_TYPE: 2218 case JS_STRING_ITERATOR_TYPE:
2219 return JSStringIterator::kSize; 2219 return JSStringIterator::kSize;
2220 case JS_MODULE_NAMESPACE_TYPE: 2220 case JS_MODULE_NAMESPACE_TYPE:
2221 return JSModuleNamespace::kSize; 2221 return JSModuleNamespace::kHeaderSize;
2222 default: 2222 default:
2223 if (type >= FIRST_ARRAY_ITERATOR_TYPE && 2223 if (type >= FIRST_ARRAY_ITERATOR_TYPE &&
2224 type <= LAST_ARRAY_ITERATOR_TYPE) { 2224 type <= LAST_ARRAY_ITERATOR_TYPE) {
2225 return JSArrayIterator::kSize; 2225 return JSArrayIterator::kSize;
2226 } 2226 }
2227 UNREACHABLE(); 2227 UNREACHABLE();
2228 return 0; 2228 return 0;
2229 } 2229 }
2230 } 2230 }
2231 2231
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2330 if (IsUnboxedDoubleField(index)) { 2330 if (IsUnboxedDoubleField(index)) {
2331 DCHECK(value->IsMutableHeapNumber()); 2331 DCHECK(value->IsMutableHeapNumber());
2332 RawFastDoublePropertyAtPut(index, HeapNumber::cast(value)->value()); 2332 RawFastDoublePropertyAtPut(index, HeapNumber::cast(value)->value());
2333 } else { 2333 } else {
2334 RawFastPropertyAtPut(index, value); 2334 RawFastPropertyAtPut(index, value);
2335 } 2335 }
2336 } 2336 }
2337 2337
2338 void JSObject::WriteToField(int descriptor, PropertyDetails details, 2338 void JSObject::WriteToField(int descriptor, PropertyDetails details,
2339 Object* value) { 2339 Object* value) {
2340 DCHECK(details.type() == DATA); 2340 DCHECK(details.location() == kField);
2341 DisallowHeapAllocation no_gc; 2341 DisallowHeapAllocation no_gc;
2342 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor); 2342 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor);
2343 if (details.representation().IsDouble()) { 2343 if (details.representation().IsDouble()) {
2344 // Nothing more to be done. 2344 // Nothing more to be done.
2345 if (value->IsUninitialized(this->GetIsolate())) { 2345 if (value->IsUninitialized(this->GetIsolate())) {
2346 return; 2346 return;
2347 } 2347 }
2348 if (IsUnboxedDoubleField(index)) { 2348 if (IsUnboxedDoubleField(index)) {
2349 RawFastDoublePropertyAtPut(index, value->Number()); 2349 RawFastDoublePropertyAtPut(index, value->Number());
2350 } else { 2350 } else {
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
3201 } 3201 }
3202 3202
3203 3203
3204 void DescriptorArray::SwapSortedKeys(int first, int second) { 3204 void DescriptorArray::SwapSortedKeys(int first, int second) {
3205 int first_key = GetSortedKeyIndex(first); 3205 int first_key = GetSortedKeyIndex(first);
3206 SetSortedKey(first, GetSortedKeyIndex(second)); 3206 SetSortedKey(first, GetSortedKeyIndex(second));
3207 SetSortedKey(second, first_key); 3207 SetSortedKey(second, first_key);
3208 } 3208 }
3209 3209
3210 3210
3211 PropertyType DescriptorArray::Entry::type() { return descs_->GetType(index_); }
3212
3213
3214 Object* DescriptorArray::Entry::GetCallbackObject() {
3215 return descs_->GetValue(index_);
3216 }
3217
3218
3219 int HashTableBase::NumberOfElements() { 3211 int HashTableBase::NumberOfElements() {
3220 return Smi::cast(get(kNumberOfElementsIndex))->value(); 3212 return Smi::cast(get(kNumberOfElementsIndex))->value();
3221 } 3213 }
3222 3214
3223 3215
3224 int HashTableBase::NumberOfDeletedElements() { 3216 int HashTableBase::NumberOfDeletedElements() {
3225 return Smi::cast(get(kNumberOfDeletedElementsIndex))->value(); 3217 return Smi::cast(get(kNumberOfDeletedElementsIndex))->value();
3226 } 3218 }
3227 3219
3228 3220
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
4914 4906
4915 4907
4916 bool Map::CanBeDeprecated() { 4908 bool Map::CanBeDeprecated() {
4917 int descriptor = LastAdded(); 4909 int descriptor = LastAdded();
4918 for (int i = 0; i <= descriptor; i++) { 4910 for (int i = 0; i <= descriptor; i++) {
4919 PropertyDetails details = instance_descriptors()->GetDetails(i); 4911 PropertyDetails details = instance_descriptors()->GetDetails(i);
4920 if (details.representation().IsNone()) return true; 4912 if (details.representation().IsNone()) return true;
4921 if (details.representation().IsSmi()) return true; 4913 if (details.representation().IsSmi()) return true;
4922 if (details.representation().IsDouble()) return true; 4914 if (details.representation().IsDouble()) return true;
4923 if (details.representation().IsHeapObject()) return true; 4915 if (details.representation().IsHeapObject()) return true;
4924 if (details.type() == DATA_CONSTANT) return true; 4916 if (details.kind() == kData && details.location() == kDescriptor) {
4917 return true;
4918 }
4925 } 4919 }
4926 return false; 4920 return false;
4927 } 4921 }
4928 4922
4929 4923
4930 void Map::NotifyLeafMapLayoutChange() { 4924 void Map::NotifyLeafMapLayoutChange() {
4931 if (is_stable()) { 4925 if (is_stable()) {
4932 mark_unstable(); 4926 mark_unstable();
4933 dependent_code()->DeoptimizeDependentCodeGroup( 4927 dependent_code()->DeoptimizeDependentCodeGroup(
4934 GetIsolate(), 4928 GetIsolate(),
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
5638 DescriptorArray* descriptors = instance_descriptors(); 5632 DescriptorArray* descriptors = instance_descriptors();
5639 int number_of_own_descriptors = NumberOfOwnDescriptors(); 5633 int number_of_own_descriptors = NumberOfOwnDescriptors();
5640 DCHECK(descriptors->number_of_descriptors() == number_of_own_descriptors); 5634 DCHECK(descriptors->number_of_descriptors() == number_of_own_descriptors);
5641 descriptors->Append(desc); 5635 descriptors->Append(desc);
5642 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1); 5636 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1);
5643 5637
5644 // This function does not support appending double field descriptors and 5638 // This function does not support appending double field descriptors and
5645 // it should never try to (otherwise, layout descriptor must be updated too). 5639 // it should never try to (otherwise, layout descriptor must be updated too).
5646 #ifdef DEBUG 5640 #ifdef DEBUG
5647 PropertyDetails details = desc->GetDetails(); 5641 PropertyDetails details = desc->GetDetails();
5648 CHECK(details.type() != DATA || !details.representation().IsDouble()); 5642 CHECK(details.location() != kField || !details.representation().IsDouble());
5649 #endif 5643 #endif
5650 } 5644 }
5651 5645
5652 5646
5653 Object* Map::GetBackPointer() { 5647 Object* Map::GetBackPointer() {
5654 Object* object = constructor_or_backpointer(); 5648 Object* object = constructor_or_backpointer();
5655 if (object->IsMap()) { 5649 if (object->IsMap()) {
5656 return object; 5650 return object;
5657 } 5651 }
5658 return GetIsolate()->heap()->undefined_value(); 5652 return GetIsolate()->heap()->undefined_value();
(...skipping 2794 matching lines...) Expand 10 before | Expand all | Expand 10 after
8453 #undef WRITE_INT64_FIELD 8447 #undef WRITE_INT64_FIELD
8454 #undef READ_BYTE_FIELD 8448 #undef READ_BYTE_FIELD
8455 #undef WRITE_BYTE_FIELD 8449 #undef WRITE_BYTE_FIELD
8456 #undef NOBARRIER_READ_BYTE_FIELD 8450 #undef NOBARRIER_READ_BYTE_FIELD
8457 #undef NOBARRIER_WRITE_BYTE_FIELD 8451 #undef NOBARRIER_WRITE_BYTE_FIELD
8458 8452
8459 } // namespace internal 8453 } // namespace internal
8460 } // namespace v8 8454 } // namespace v8
8461 8455
8462 #endif // V8_OBJECTS_INL_H_ 8456 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/lookup.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