| 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 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2262 } | 2262 } |
| 2263 | 2263 |
| 2264 | 2264 |
| 2265 void FixedDoubleArray::FillWithHoles(int from, int to) { | 2265 void FixedDoubleArray::FillWithHoles(int from, int to) { |
| 2266 for (int i = from; i < to; i++) { | 2266 for (int i = from; i < to; i++) { |
| 2267 set_the_hole(i); | 2267 set_the_hole(i); |
| 2268 } | 2268 } |
| 2269 } | 2269 } |
| 2270 | 2270 |
| 2271 | 2271 |
| 2272 void ConstantPoolArray::NumberOfEntries::increment(Type type) { |
| 2273 ASSERT(type < NUMBER_OF_TYPES); |
| 2274 element_counts_[type]++; |
| 2275 } |
| 2276 |
| 2277 |
| 2278 int ConstantPoolArray::NumberOfEntries::equals( |
| 2279 const ConstantPoolArray::NumberOfEntries& other) const { |
| 2280 for (int i = 0; i < NUMBER_OF_TYPES; i++) { |
| 2281 if (element_counts_[i] != other.element_counts_[i]) return false; |
| 2282 } |
| 2283 return true; |
| 2284 } |
| 2285 |
| 2286 |
| 2287 bool ConstantPoolArray::NumberOfEntries::is_empty() const { |
| 2288 return total_count() == 0; |
| 2289 } |
| 2290 |
| 2291 |
| 2292 int ConstantPoolArray::NumberOfEntries::count_of(Type type) const { |
| 2293 ASSERT(type < NUMBER_OF_TYPES); |
| 2294 return element_counts_[type]; |
| 2295 } |
| 2296 |
| 2297 |
| 2298 int ConstantPoolArray::NumberOfEntries::base_of(Type type) const { |
| 2299 int base = 0; |
| 2300 ASSERT(type < NUMBER_OF_TYPES); |
| 2301 for (int i = 0; i < type; i++) { |
| 2302 base += element_counts_[i]; |
| 2303 } |
| 2304 return base; |
| 2305 } |
| 2306 |
| 2307 |
| 2308 int ConstantPoolArray::NumberOfEntries::total_count() const { |
| 2309 int count = 0; |
| 2310 for (int i = 0; i < NUMBER_OF_TYPES; i++) { |
| 2311 count += element_counts_[i]; |
| 2312 } |
| 2313 return count; |
| 2314 } |
| 2315 |
| 2316 |
| 2317 int ConstantPoolArray::NumberOfEntries::are_in_range(int min, int max) const { |
| 2318 for (int i = FIRST_TYPE; i < NUMBER_OF_TYPES; i++) { |
| 2319 if (element_counts_[i] < min || element_counts_[i] > max) { |
| 2320 return false; |
| 2321 } |
| 2322 } |
| 2323 return true; |
| 2324 } |
| 2325 |
| 2326 |
| 2327 int ConstantPoolArray::Iterator::next_index() { |
| 2328 ASSERT(!is_finished()); |
| 2329 int ret = next_index_++; |
| 2330 update_section(); |
| 2331 return ret; |
| 2332 } |
| 2333 |
| 2334 |
| 2335 bool ConstantPoolArray::Iterator::is_finished() { |
| 2336 return next_index_ > array_->last_index(type_, final_section_); |
| 2337 } |
| 2338 |
| 2339 |
| 2340 void ConstantPoolArray::Iterator::update_section() { |
| 2341 if (next_index_ > array_->last_index(type_, current_section_) && |
| 2342 current_section_ != final_section_) { |
| 2343 ASSERT(final_section_ == EXTENDED_SECTION); |
| 2344 current_section_ = EXTENDED_SECTION; |
| 2345 next_index_ = array_->first_index(type_, EXTENDED_SECTION); |
| 2346 } |
| 2347 } |
| 2348 |
| 2349 |
| 2272 bool ConstantPoolArray::is_extended_layout() { | 2350 bool ConstantPoolArray::is_extended_layout() { |
| 2273 uint32_t small_layout_1 = READ_UINT32_FIELD(this, kSmallLayout1Offset); | 2351 uint32_t small_layout_1 = READ_UINT32_FIELD(this, kSmallLayout1Offset); |
| 2274 return IsExtendedField::decode(small_layout_1); | 2352 return IsExtendedField::decode(small_layout_1); |
| 2275 } | 2353 } |
| 2276 | 2354 |
| 2277 | 2355 |
| 2278 ConstantPoolArray::LayoutSection ConstantPoolArray::final_section() { | 2356 ConstantPoolArray::LayoutSection ConstantPoolArray::final_section() { |
| 2279 return is_extended_layout() ? EXTENDED_SECTION : SMALL_SECTION; | 2357 return is_extended_layout() ? EXTENDED_SECTION : SMALL_SECTION; |
| 2280 } | 2358 } |
| 2281 | 2359 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2517 if (is_extended_layout()) { | 2595 if (is_extended_layout()) { |
| 2518 length += number_of_entries(INT64, EXTENDED_SECTION) + | 2596 length += number_of_entries(INT64, EXTENDED_SECTION) + |
| 2519 number_of_entries(CODE_PTR, EXTENDED_SECTION) + | 2597 number_of_entries(CODE_PTR, EXTENDED_SECTION) + |
| 2520 number_of_entries(HEAP_PTR, EXTENDED_SECTION) + | 2598 number_of_entries(HEAP_PTR, EXTENDED_SECTION) + |
| 2521 number_of_entries(INT32, EXTENDED_SECTION); | 2599 number_of_entries(INT32, EXTENDED_SECTION); |
| 2522 } | 2600 } |
| 2523 return length; | 2601 return length; |
| 2524 } | 2602 } |
| 2525 | 2603 |
| 2526 | 2604 |
| 2527 int ConstantPoolArray::Iterator::next_index() { | |
| 2528 ASSERT(!is_finished()); | |
| 2529 int ret = next_index_++; | |
| 2530 update_section(); | |
| 2531 return ret; | |
| 2532 } | |
| 2533 | |
| 2534 | |
| 2535 bool ConstantPoolArray::Iterator::is_finished() { | |
| 2536 return next_index_ > array_->last_index(type_, final_section_); | |
| 2537 } | |
| 2538 | |
| 2539 | |
| 2540 void ConstantPoolArray::Iterator::update_section() { | |
| 2541 if (next_index_ > array_->last_index(type_, current_section_) && | |
| 2542 current_section_ != final_section_) { | |
| 2543 ASSERT(final_section_ == EXTENDED_SECTION); | |
| 2544 current_section_ = EXTENDED_SECTION; | |
| 2545 next_index_ = array_->first_index(type_, EXTENDED_SECTION); | |
| 2546 } | |
| 2547 } | |
| 2548 | |
| 2549 | |
| 2550 WriteBarrierMode HeapObject::GetWriteBarrierMode( | 2605 WriteBarrierMode HeapObject::GetWriteBarrierMode( |
| 2551 const DisallowHeapAllocation& promise) { | 2606 const DisallowHeapAllocation& promise) { |
| 2552 Heap* heap = GetHeap(); | 2607 Heap* heap = GetHeap(); |
| 2553 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; | 2608 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; |
| 2554 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; | 2609 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; |
| 2555 return UPDATE_WRITE_BARRIER; | 2610 return UPDATE_WRITE_BARRIER; |
| 2556 } | 2611 } |
| 2557 | 2612 |
| 2558 | 2613 |
| 2559 void FixedArray::set(int index, | 2614 void FixedArray::set(int index, |
| (...skipping 4510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7070 #undef READ_SHORT_FIELD | 7125 #undef READ_SHORT_FIELD |
| 7071 #undef WRITE_SHORT_FIELD | 7126 #undef WRITE_SHORT_FIELD |
| 7072 #undef READ_BYTE_FIELD | 7127 #undef READ_BYTE_FIELD |
| 7073 #undef WRITE_BYTE_FIELD | 7128 #undef WRITE_BYTE_FIELD |
| 7074 #undef NOBARRIER_READ_BYTE_FIELD | 7129 #undef NOBARRIER_READ_BYTE_FIELD |
| 7075 #undef NOBARRIER_WRITE_BYTE_FIELD | 7130 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7076 | 7131 |
| 7077 } } // namespace v8::internal | 7132 } } // namespace v8::internal |
| 7078 | 7133 |
| 7079 #endif // V8_OBJECTS_INL_H_ | 7134 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |