OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2364 if (number != TransitionArray::kNotFound) { | 2364 if (number != TransitionArray::kNotFound) { |
2365 return result->TransitionResult(holder, number); | 2365 return result->TransitionResult(holder, number); |
2366 } | 2366 } |
2367 } | 2367 } |
2368 result->NotFound(); | 2368 result->NotFound(); |
2369 } | 2369 } |
2370 | 2370 |
2371 | 2371 |
2372 Object** DescriptorArray::GetKeySlot(int descriptor_number) { | 2372 Object** DescriptorArray::GetKeySlot(int descriptor_number) { |
2373 ASSERT(descriptor_number < number_of_descriptors()); | 2373 ASSERT(descriptor_number < number_of_descriptors()); |
2374 return HeapObject::RawField( | 2374 return RawFieldOfElementAt(ToKeyIndex(descriptor_number)); |
titzer
2013/12/17 08:31:43
Nice simplification.
| |
2375 reinterpret_cast<HeapObject*>(this), | |
2376 OffsetOfElementAt(ToKeyIndex(descriptor_number))); | |
2377 } | 2375 } |
2378 | 2376 |
2379 | 2377 |
2380 Object** DescriptorArray::GetDescriptorStartSlot(int descriptor_number) { | 2378 Object** DescriptorArray::GetDescriptorStartSlot(int descriptor_number) { |
2381 return GetKeySlot(descriptor_number); | 2379 return GetKeySlot(descriptor_number); |
2382 } | 2380 } |
2383 | 2381 |
2384 | 2382 |
2385 Object** DescriptorArray::GetDescriptorEndSlot(int descriptor_number) { | 2383 Object** DescriptorArray::GetDescriptorEndSlot(int descriptor_number) { |
2386 return GetValueSlot(descriptor_number - 1) + 1; | 2384 return GetValueSlot(descriptor_number - 1) + 1; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2421 void DescriptorArray::InitializeRepresentations(Representation representation) { | 2419 void DescriptorArray::InitializeRepresentations(Representation representation) { |
2422 int length = number_of_descriptors(); | 2420 int length = number_of_descriptors(); |
2423 for (int i = 0; i < length; i++) { | 2421 for (int i = 0; i < length; i++) { |
2424 SetRepresentation(i, representation); | 2422 SetRepresentation(i, representation); |
2425 } | 2423 } |
2426 } | 2424 } |
2427 | 2425 |
2428 | 2426 |
2429 Object** DescriptorArray::GetValueSlot(int descriptor_number) { | 2427 Object** DescriptorArray::GetValueSlot(int descriptor_number) { |
2430 ASSERT(descriptor_number < number_of_descriptors()); | 2428 ASSERT(descriptor_number < number_of_descriptors()); |
2431 return HeapObject::RawField( | 2429 return RawFieldOfElementAt(ToValueIndex(descriptor_number)); |
2432 reinterpret_cast<HeapObject*>(this), | |
2433 OffsetOfElementAt(ToValueIndex(descriptor_number))); | |
2434 } | 2430 } |
2435 | 2431 |
2436 | 2432 |
2437 Object* DescriptorArray::GetValue(int descriptor_number) { | 2433 Object* DescriptorArray::GetValue(int descriptor_number) { |
2438 ASSERT(descriptor_number < number_of_descriptors()); | 2434 ASSERT(descriptor_number < number_of_descriptors()); |
2439 return get(ToValueIndex(descriptor_number)); | 2435 return get(ToValueIndex(descriptor_number)); |
2440 } | 2436 } |
2441 | 2437 |
2442 | 2438 |
2443 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { | 2439 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3224 | 3220 |
3225 | 3221 |
3226 void JSFunctionResultCache::MakeZeroSize() { | 3222 void JSFunctionResultCache::MakeZeroSize() { |
3227 set_finger_index(kEntriesIndex); | 3223 set_finger_index(kEntriesIndex); |
3228 set_size(kEntriesIndex); | 3224 set_size(kEntriesIndex); |
3229 } | 3225 } |
3230 | 3226 |
3231 | 3227 |
3232 void JSFunctionResultCache::Clear() { | 3228 void JSFunctionResultCache::Clear() { |
3233 int cache_size = size(); | 3229 int cache_size = size(); |
3234 Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex)); | 3230 Object** entries_start = RawFieldOfElementAt(kEntriesIndex); |
3235 MemsetPointer(entries_start, | 3231 MemsetPointer(entries_start, |
3236 GetHeap()->the_hole_value(), | 3232 GetHeap()->the_hole_value(), |
3237 cache_size - kEntriesIndex); | 3233 cache_size - kEntriesIndex); |
3238 MakeZeroSize(); | 3234 MakeZeroSize(); |
3239 } | 3235 } |
3240 | 3236 |
3241 | 3237 |
3242 int JSFunctionResultCache::size() { | 3238 int JSFunctionResultCache::size() { |
3243 return Smi::cast(get(kCacheSizeIndex))->value(); | 3239 return Smi::cast(get(kCacheSizeIndex))->value(); |
3244 } | 3240 } |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3830 set(kCodesStartIndex + i, object); | 3826 set(kCodesStartIndex + i, object); |
3831 } | 3827 } |
3832 | 3828 |
3833 | 3829 |
3834 Object* DependentCode::object_at(int i) { | 3830 Object* DependentCode::object_at(int i) { |
3835 return get(kCodesStartIndex + i); | 3831 return get(kCodesStartIndex + i); |
3836 } | 3832 } |
3837 | 3833 |
3838 | 3834 |
3839 Object** DependentCode::slot_at(int i) { | 3835 Object** DependentCode::slot_at(int i) { |
3840 return HeapObject::RawField( | 3836 return RawFieldOfElementAt(kCodesStartIndex + i); |
3841 this, FixedArray::OffsetOfElementAt(kCodesStartIndex + i)); | |
3842 } | 3837 } |
3843 | 3838 |
3844 | 3839 |
3845 void DependentCode::clear_at(int i) { | 3840 void DependentCode::clear_at(int i) { |
3846 set_undefined(kCodesStartIndex + i); | 3841 set_undefined(kCodesStartIndex + i); |
3847 } | 3842 } |
3848 | 3843 |
3849 | 3844 |
3850 void DependentCode::copy(int from, int to) { | 3845 void DependentCode::copy(int from, int to) { |
3851 set(kCodesStartIndex + to, get(kCodesStartIndex + from)); | 3846 set(kCodesStartIndex + to, get(kCodesStartIndex + from)); |
(...skipping 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6473 #undef WRITE_UINT32_FIELD | 6468 #undef WRITE_UINT32_FIELD |
6474 #undef READ_SHORT_FIELD | 6469 #undef READ_SHORT_FIELD |
6475 #undef WRITE_SHORT_FIELD | 6470 #undef WRITE_SHORT_FIELD |
6476 #undef READ_BYTE_FIELD | 6471 #undef READ_BYTE_FIELD |
6477 #undef WRITE_BYTE_FIELD | 6472 #undef WRITE_BYTE_FIELD |
6478 | 6473 |
6479 | 6474 |
6480 } } // namespace v8::internal | 6475 } } // namespace v8::internal |
6481 | 6476 |
6482 #endif // V8_OBJECTS_INL_H_ | 6477 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |