| 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 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 } | 2244 } |
| 2245 | 2245 |
| 2246 | 2246 |
| 2247 void FixedDoubleArray::FillWithHoles(int from, int to) { | 2247 void FixedDoubleArray::FillWithHoles(int from, int to) { |
| 2248 for (int i = from; i < to; i++) { | 2248 for (int i = from; i < to; i++) { |
| 2249 set_the_hole(i); | 2249 set_the_hole(i); |
| 2250 } | 2250 } |
| 2251 } | 2251 } |
| 2252 | 2252 |
| 2253 | 2253 |
| 2254 void ConstantPoolArray::NumberOfEntries::increment(Type type) { |
| 2255 ASSERT(type < NUMBER_OF_TYPES); |
| 2256 element_counts_[type]++; |
| 2257 } |
| 2258 |
| 2259 |
| 2260 int ConstantPoolArray::NumberOfEntries::equals( |
| 2261 const ConstantPoolArray::NumberOfEntries& other) const { |
| 2262 for (int i = 0; i < NUMBER_OF_TYPES; i++) { |
| 2263 if (element_counts_[i] != other.element_counts_[i]) return false; |
| 2264 } |
| 2265 return true; |
| 2266 } |
| 2267 |
| 2268 |
| 2269 bool ConstantPoolArray::NumberOfEntries::is_empty() const { |
| 2270 return total_count() == 0; |
| 2271 } |
| 2272 |
| 2273 |
| 2274 int ConstantPoolArray::NumberOfEntries::count_of(Type type) const { |
| 2275 ASSERT(type < NUMBER_OF_TYPES); |
| 2276 return element_counts_[type]; |
| 2277 } |
| 2278 |
| 2279 |
| 2280 int ConstantPoolArray::NumberOfEntries::base_of(Type type) const { |
| 2281 int base = 0; |
| 2282 ASSERT(type < NUMBER_OF_TYPES); |
| 2283 for (int i = 0; i < type; i++) { |
| 2284 base += element_counts_[i]; |
| 2285 } |
| 2286 return base; |
| 2287 } |
| 2288 |
| 2289 |
| 2290 int ConstantPoolArray::NumberOfEntries::total_count() const { |
| 2291 int count = 0; |
| 2292 for (int i = 0; i < NUMBER_OF_TYPES; i++) { |
| 2293 count += element_counts_[i]; |
| 2294 } |
| 2295 return count; |
| 2296 } |
| 2297 |
| 2298 |
| 2299 int ConstantPoolArray::NumberOfEntries::are_in_range(int min, int max) const { |
| 2300 for (int i = FIRST_TYPE; i < NUMBER_OF_TYPES; i++) { |
| 2301 if (element_counts_[i] < min || element_counts_[i] > max) { |
| 2302 return false; |
| 2303 } |
| 2304 } |
| 2305 return true; |
| 2306 } |
| 2307 |
| 2308 |
| 2309 int ConstantPoolArray::Iterator::next_index() { |
| 2310 ASSERT(!is_finished()); |
| 2311 int ret = next_index_++; |
| 2312 update_section(); |
| 2313 return ret; |
| 2314 } |
| 2315 |
| 2316 |
| 2317 bool ConstantPoolArray::Iterator::is_finished() { |
| 2318 return next_index_ > array_->last_index(type_, final_section_); |
| 2319 } |
| 2320 |
| 2321 |
| 2322 void ConstantPoolArray::Iterator::update_section() { |
| 2323 if (next_index_ > array_->last_index(type_, current_section_) && |
| 2324 current_section_ != final_section_) { |
| 2325 ASSERT(final_section_ == EXTENDED_SECTION); |
| 2326 current_section_ = EXTENDED_SECTION; |
| 2327 next_index_ = array_->first_index(type_, EXTENDED_SECTION); |
| 2328 } |
| 2329 } |
| 2330 |
| 2331 |
| 2254 bool ConstantPoolArray::is_extended_layout() { | 2332 bool ConstantPoolArray::is_extended_layout() { |
| 2255 uint32_t small_layout_1 = READ_UINT32_FIELD(this, kSmallLayout1Offset); | 2333 uint32_t small_layout_1 = READ_UINT32_FIELD(this, kSmallLayout1Offset); |
| 2256 return IsExtendedField::decode(small_layout_1); | 2334 return IsExtendedField::decode(small_layout_1); |
| 2257 } | 2335 } |
| 2258 | 2336 |
| 2259 | 2337 |
| 2260 ConstantPoolArray::LayoutSection ConstantPoolArray::final_section() { | 2338 ConstantPoolArray::LayoutSection ConstantPoolArray::final_section() { |
| 2261 return is_extended_layout() ? EXTENDED_SECTION : SMALL_SECTION; | 2339 return is_extended_layout() ? EXTENDED_SECTION : SMALL_SECTION; |
| 2262 } | 2340 } |
| 2263 | 2341 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2499 if (is_extended_layout()) { | 2577 if (is_extended_layout()) { |
| 2500 length += number_of_entries(INT64, EXTENDED_SECTION) + | 2578 length += number_of_entries(INT64, EXTENDED_SECTION) + |
| 2501 number_of_entries(CODE_PTR, EXTENDED_SECTION) + | 2579 number_of_entries(CODE_PTR, EXTENDED_SECTION) + |
| 2502 number_of_entries(HEAP_PTR, EXTENDED_SECTION) + | 2580 number_of_entries(HEAP_PTR, EXTENDED_SECTION) + |
| 2503 number_of_entries(INT32, EXTENDED_SECTION); | 2581 number_of_entries(INT32, EXTENDED_SECTION); |
| 2504 } | 2582 } |
| 2505 return length; | 2583 return length; |
| 2506 } | 2584 } |
| 2507 | 2585 |
| 2508 | 2586 |
| 2509 int ConstantPoolArray::Iterator::next_index() { | |
| 2510 ASSERT(!is_finished()); | |
| 2511 int ret = next_index_++; | |
| 2512 update_section(); | |
| 2513 return ret; | |
| 2514 } | |
| 2515 | |
| 2516 | |
| 2517 bool ConstantPoolArray::Iterator::is_finished() { | |
| 2518 return next_index_ > array_->last_index(type_, final_section_); | |
| 2519 } | |
| 2520 | |
| 2521 | |
| 2522 void ConstantPoolArray::Iterator::update_section() { | |
| 2523 if (next_index_ > array_->last_index(type_, current_section_) && | |
| 2524 current_section_ != final_section_) { | |
| 2525 ASSERT(final_section_ == EXTENDED_SECTION); | |
| 2526 current_section_ = EXTENDED_SECTION; | |
| 2527 next_index_ = array_->first_index(type_, EXTENDED_SECTION); | |
| 2528 } | |
| 2529 } | |
| 2530 | |
| 2531 | |
| 2532 WriteBarrierMode HeapObject::GetWriteBarrierMode( | 2587 WriteBarrierMode HeapObject::GetWriteBarrierMode( |
| 2533 const DisallowHeapAllocation& promise) { | 2588 const DisallowHeapAllocation& promise) { |
| 2534 Heap* heap = GetHeap(); | 2589 Heap* heap = GetHeap(); |
| 2535 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; | 2590 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; |
| 2536 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; | 2591 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; |
| 2537 return UPDATE_WRITE_BARRIER; | 2592 return UPDATE_WRITE_BARRIER; |
| 2538 } | 2593 } |
| 2539 | 2594 |
| 2540 | 2595 |
| 2541 void FixedArray::set(int index, | 2596 void FixedArray::set(int index, |
| (...skipping 4480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7022 #undef READ_SHORT_FIELD | 7077 #undef READ_SHORT_FIELD |
| 7023 #undef WRITE_SHORT_FIELD | 7078 #undef WRITE_SHORT_FIELD |
| 7024 #undef READ_BYTE_FIELD | 7079 #undef READ_BYTE_FIELD |
| 7025 #undef WRITE_BYTE_FIELD | 7080 #undef WRITE_BYTE_FIELD |
| 7026 #undef NOBARRIER_READ_BYTE_FIELD | 7081 #undef NOBARRIER_READ_BYTE_FIELD |
| 7027 #undef NOBARRIER_WRITE_BYTE_FIELD | 7082 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7028 | 7083 |
| 7029 } } // namespace v8::internal | 7084 } } // namespace v8::internal |
| 7030 | 7085 |
| 7031 #endif // V8_OBJECTS_INL_H_ | 7086 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |