OLD | NEW |
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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 TYPE_CHECKER(JSSet, JS_SET_TYPE) | 700 TYPE_CHECKER(JSSet, JS_SET_TYPE) |
701 TYPE_CHECKER(JSMap, JS_MAP_TYPE) | 701 TYPE_CHECKER(JSMap, JS_MAP_TYPE) |
702 TYPE_CHECKER(JSSetIterator, JS_SET_ITERATOR_TYPE) | 702 TYPE_CHECKER(JSSetIterator, JS_SET_ITERATOR_TYPE) |
703 TYPE_CHECKER(JSMapIterator, JS_MAP_ITERATOR_TYPE) | 703 TYPE_CHECKER(JSMapIterator, JS_MAP_ITERATOR_TYPE) |
704 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE) | 704 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE) |
705 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE) | 705 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE) |
706 TYPE_CHECKER(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE) | 706 TYPE_CHECKER(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE) |
707 TYPE_CHECKER(Map, MAP_TYPE) | 707 TYPE_CHECKER(Map, MAP_TYPE) |
708 TYPE_CHECKER(FixedArray, FIXED_ARRAY_TYPE) | 708 TYPE_CHECKER(FixedArray, FIXED_ARRAY_TYPE) |
709 TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE) | 709 TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE) |
| 710 TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE) |
710 TYPE_CHECKER(ConstantPoolArray, CONSTANT_POOL_ARRAY_TYPE) | 711 TYPE_CHECKER(ConstantPoolArray, CONSTANT_POOL_ARRAY_TYPE) |
711 | 712 |
712 | 713 |
713 bool Object::IsJSWeakCollection() const { | 714 bool Object::IsJSWeakCollection() const { |
714 return IsJSWeakMap() || IsJSWeakSet(); | 715 return IsJSWeakMap() || IsJSWeakSet(); |
715 } | 716 } |
716 | 717 |
717 | 718 |
718 bool Object::IsDescriptorArray() const { | 719 bool Object::IsDescriptorArray() const { |
719 return IsFixedArray(); | 720 return IsFixedArray(); |
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2361 } | 2362 } |
2362 | 2363 |
2363 | 2364 |
2364 void FixedDoubleArray::FillWithHoles(int from, int to) { | 2365 void FixedDoubleArray::FillWithHoles(int from, int to) { |
2365 for (int i = from; i < to; i++) { | 2366 for (int i = from; i < to; i++) { |
2366 set_the_hole(i); | 2367 set_the_hole(i); |
2367 } | 2368 } |
2368 } | 2369 } |
2369 | 2370 |
2370 | 2371 |
| 2372 Object* WeakFixedArray::Get(int index) const { |
| 2373 Object* raw = FixedArray::cast(this)->get(index + kFirstIndex); |
| 2374 if (raw->IsSmi()) return raw; |
| 2375 return WeakCell::cast(raw)->value(); |
| 2376 } |
| 2377 |
| 2378 |
| 2379 bool WeakFixedArray::IsEmptySlot(int index) const { |
| 2380 DCHECK(index < Length()); |
| 2381 return Get(index)->IsSmi(); |
| 2382 } |
| 2383 |
| 2384 |
| 2385 void WeakFixedArray::clear(int index) { |
| 2386 FixedArray::cast(this)->set(index + kFirstIndex, Smi::FromInt(0)); |
| 2387 } |
| 2388 |
| 2389 |
| 2390 int WeakFixedArray::Length() const { |
| 2391 return FixedArray::cast(this)->length() - kFirstIndex; |
| 2392 } |
| 2393 |
| 2394 |
| 2395 int WeakFixedArray::last_used_index() const { |
| 2396 return Smi::cast(FixedArray::cast(this)->get(kLastUsedIndexIndex))->value(); |
| 2397 } |
| 2398 |
| 2399 |
| 2400 void WeakFixedArray::set_last_used_index(int index) { |
| 2401 FixedArray::cast(this)->set(kLastUsedIndexIndex, Smi::FromInt(index)); |
| 2402 } |
| 2403 |
| 2404 |
2371 void ConstantPoolArray::NumberOfEntries::increment(Type type) { | 2405 void ConstantPoolArray::NumberOfEntries::increment(Type type) { |
2372 DCHECK(type < NUMBER_OF_TYPES); | 2406 DCHECK(type < NUMBER_OF_TYPES); |
2373 element_counts_[type]++; | 2407 element_counts_[type]++; |
2374 } | 2408 } |
2375 | 2409 |
2376 | 2410 |
2377 int ConstantPoolArray::NumberOfEntries::equals( | 2411 int ConstantPoolArray::NumberOfEntries::equals( |
2378 const ConstantPoolArray::NumberOfEntries& other) const { | 2412 const ConstantPoolArray::NumberOfEntries& other) const { |
2379 for (int i = 0; i < NUMBER_OF_TYPES; i++) { | 2413 for (int i = 0; i < NUMBER_OF_TYPES; i++) { |
2380 if (element_counts_[i] != other.element_counts_[i]) return false; | 2414 if (element_counts_[i] != other.element_counts_[i]) return false; |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3357 CAST_ACCESSOR(SeqTwoByteString) | 3391 CAST_ACCESSOR(SeqTwoByteString) |
3358 CAST_ACCESSOR(SharedFunctionInfo) | 3392 CAST_ACCESSOR(SharedFunctionInfo) |
3359 CAST_ACCESSOR(SlicedString) | 3393 CAST_ACCESSOR(SlicedString) |
3360 CAST_ACCESSOR(Smi) | 3394 CAST_ACCESSOR(Smi) |
3361 CAST_ACCESSOR(String) | 3395 CAST_ACCESSOR(String) |
3362 CAST_ACCESSOR(StringTable) | 3396 CAST_ACCESSOR(StringTable) |
3363 CAST_ACCESSOR(Struct) | 3397 CAST_ACCESSOR(Struct) |
3364 CAST_ACCESSOR(Symbol) | 3398 CAST_ACCESSOR(Symbol) |
3365 CAST_ACCESSOR(UnseededNumberDictionary) | 3399 CAST_ACCESSOR(UnseededNumberDictionary) |
3366 CAST_ACCESSOR(WeakCell) | 3400 CAST_ACCESSOR(WeakCell) |
| 3401 CAST_ACCESSOR(WeakFixedArray) |
3367 CAST_ACCESSOR(WeakHashTable) | 3402 CAST_ACCESSOR(WeakHashTable) |
3368 | 3403 |
3369 | 3404 |
3370 template <class Traits> | 3405 template <class Traits> |
3371 FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) { | 3406 FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) { |
3372 SLOW_DCHECK(object->IsHeapObject() && | 3407 SLOW_DCHECK(object->IsHeapObject() && |
3373 HeapObject::cast(object)->map()->instance_type() == | 3408 HeapObject::cast(object)->map()->instance_type() == |
3374 Traits::kInstanceType); | 3409 Traits::kInstanceType); |
3375 return reinterpret_cast<FixedTypedArray<Traits>*>(object); | 3410 return reinterpret_cast<FixedTypedArray<Traits>*>(object); |
3376 } | 3411 } |
(...skipping 4141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7518 #undef READ_SHORT_FIELD | 7553 #undef READ_SHORT_FIELD |
7519 #undef WRITE_SHORT_FIELD | 7554 #undef WRITE_SHORT_FIELD |
7520 #undef READ_BYTE_FIELD | 7555 #undef READ_BYTE_FIELD |
7521 #undef WRITE_BYTE_FIELD | 7556 #undef WRITE_BYTE_FIELD |
7522 #undef NOBARRIER_READ_BYTE_FIELD | 7557 #undef NOBARRIER_READ_BYTE_FIELD |
7523 #undef NOBARRIER_WRITE_BYTE_FIELD | 7558 #undef NOBARRIER_WRITE_BYTE_FIELD |
7524 | 7559 |
7525 } } // namespace v8::internal | 7560 } } // namespace v8::internal |
7526 | 7561 |
7527 #endif // V8_OBJECTS_INL_H_ | 7562 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |