Chromium Code Reviews| 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 2174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2185 } | 2185 } |
| 2186 | 2186 |
| 2187 | 2187 |
| 2188 void FixedDoubleArray::FillWithHoles(int from, int to) { | 2188 void FixedDoubleArray::FillWithHoles(int from, int to) { |
| 2189 for (int i = from; i < to; i++) { | 2189 for (int i = from; i < to; i++) { |
| 2190 set_the_hole(i); | 2190 set_the_hole(i); |
| 2191 } | 2191 } |
| 2192 } | 2192 } |
| 2193 | 2193 |
| 2194 | 2194 |
| 2195 bool ConstantPoolArray::is_extended_layout() { | |
| 2196 uint32_t small_layout_1 = READ_UINT32_FIELD(this, kSmallLayout1Offset); | |
| 2197 return IsExtendedField::decode(small_layout_1); | |
| 2198 } | |
| 2199 | |
| 2200 | |
| 2201 ConstantPoolArray::LayoutSection ConstantPoolArray::final_section() { | |
| 2202 return is_extended_layout() ? EXTENDED_SECTION : SMALL_SECTION; | |
| 2203 } | |
| 2204 | |
| 2205 | |
| 2206 int ConstantPoolArray::first_extended_section_index() { | |
| 2207 ASSERT(is_extended_layout()); | |
| 2208 uint32_t small_layout_2 = READ_UINT32_FIELD(this, kSmallLayout2Offset); | |
| 2209 return TotalCountField::decode(small_layout_2); | |
| 2210 } | |
| 2211 | |
| 2212 | |
| 2213 int ConstantPoolArray::get_extended_section_header_offset() { | |
| 2214 return RoundUp(SizeFor(number_of_entries(INT64, SMALL_SECTION), | |
| 2215 number_of_entries(CODE_PTR, SMALL_SECTION), | |
| 2216 number_of_entries(HEAP_PTR, SMALL_SECTION), | |
| 2217 number_of_entries(INT32, SMALL_SECTION)), | |
| 2218 kInt64Size); | |
| 2219 } | |
| 2220 | |
| 2221 | |
| 2222 ConstantPoolArray::WeakObjectState ConstantPoolArray::get_weak_object_state() { | |
| 2223 uint32_t small_layout_2 = READ_UINT32_FIELD(this, kSmallLayout2Offset); | |
| 2224 return WeakObjectStateField::decode(small_layout_2); | |
| 2225 } | |
| 2226 | |
| 2227 | |
| 2195 void ConstantPoolArray::set_weak_object_state( | 2228 void ConstantPoolArray::set_weak_object_state( |
| 2196 ConstantPoolArray::WeakObjectState state) { | 2229 ConstantPoolArray::WeakObjectState state) { |
| 2197 int old_layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); | 2230 uint32_t small_layout_2 = READ_UINT32_FIELD(this, kSmallLayout2Offset); |
| 2198 int new_layout_field = WeakObjectStateField::update(old_layout_field, state); | 2231 small_layout_2 = WeakObjectStateField::update(small_layout_2, state); |
| 2199 WRITE_INT_FIELD(this, kArrayLayoutOffset, new_layout_field); | 2232 WRITE_INT32_FIELD(this, kSmallLayout2Offset, small_layout_2); |
| 2200 } | 2233 } |
| 2201 | 2234 |
| 2202 | 2235 |
| 2203 ConstantPoolArray::WeakObjectState ConstantPoolArray::get_weak_object_state() { | 2236 int ConstantPoolArray::first_index(Type type, LayoutSection section) { |
| 2204 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); | 2237 int index = 0; |
|
ulan
2014/06/02 12:32:58
How about iterating over types and sections in thi
rmcilroy
2014/06/03 12:32:28
Done (but only iterating through types).
| |
| 2205 return WeakObjectStateField::decode(layout_field); | 2238 if (section == EXTENDED_SECTION) { |
| 2206 } | 2239 ASSERT(is_extended_layout()); |
| 2207 | 2240 index += first_extended_section_index(); |
| 2208 | 2241 } |
| 2209 int ConstantPoolArray::first_int64_index() { | 2242 |
| 2210 return 0; | 2243 switch (type) { |
| 2211 } | 2244 case INT32: |
| 2212 | 2245 index += number_of_entries(HEAP_PTR, section); |
| 2213 | 2246 // fall through. |
| 2214 int ConstantPoolArray::first_code_ptr_index() { | 2247 case HEAP_PTR: |
| 2215 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); | 2248 index += number_of_entries(CODE_PTR, section); |
| 2216 return first_int64_index() + | 2249 // fall through. |
| 2217 NumberOfInt64EntriesField::decode(layout_field); | 2250 case CODE_PTR: |
| 2218 } | 2251 index += number_of_entries(INT64, section); |
| 2219 | 2252 // fall through. |
| 2220 | 2253 case INT64: |
| 2221 int ConstantPoolArray::first_heap_ptr_index() { | 2254 break; |
| 2222 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); | 2255 default: |
| 2223 return first_code_ptr_index() + | 2256 UNREACHABLE(); |
| 2224 NumberOfCodePtrEntriesField::decode(layout_field); | 2257 } |
| 2225 } | 2258 |
| 2226 | 2259 return index; |
| 2227 | 2260 } |
| 2228 int ConstantPoolArray::first_int32_index() { | 2261 |
| 2229 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); | 2262 |
| 2230 return first_heap_ptr_index() + | 2263 int ConstantPoolArray::last_index(Type type, LayoutSection section) { |
| 2231 NumberOfHeapPtrEntriesField::decode(layout_field); | 2264 return first_index(type, section) + number_of_entries(type, section) - 1; |
| 2232 } | 2265 } |
| 2233 | 2266 |
| 2234 | 2267 |
| 2235 int ConstantPoolArray::count_of_int64_entries() { | 2268 int ConstantPoolArray::number_of_entries(Type type, LayoutSection section) { |
| 2236 return first_code_ptr_index(); | 2269 if (section == SMALL_SECTION) { |
| 2237 } | 2270 uint32_t small_layout_1 = READ_UINT32_FIELD(this, kSmallLayout1Offset); |
| 2238 | 2271 uint32_t small_layout_2 = READ_UINT32_FIELD(this, kSmallLayout2Offset); |
| 2239 | 2272 switch (type) { |
| 2240 int ConstantPoolArray::count_of_code_ptr_entries() { | 2273 case INT64: |
| 2241 return first_heap_ptr_index() - first_code_ptr_index(); | 2274 return Int64CountField::decode(small_layout_1); |
| 2242 } | 2275 case CODE_PTR: |
| 2243 | 2276 return CodePtrCountField::decode(small_layout_1); |
| 2244 | 2277 case HEAP_PTR: |
| 2245 int ConstantPoolArray::count_of_heap_ptr_entries() { | 2278 return HeapPtrCountField::decode(small_layout_1); |
| 2246 return first_int32_index() - first_heap_ptr_index(); | 2279 case INT32: |
| 2247 } | 2280 return Int32CountField::decode(small_layout_2); |
| 2248 | 2281 default: |
| 2249 | 2282 UNREACHABLE(); |
| 2250 int ConstantPoolArray::count_of_int32_entries() { | 2283 return 0; |
| 2251 return length() - first_int32_index(); | 2284 } |
| 2252 } | 2285 } else { |
| 2253 | 2286 ASSERT(section == EXTENDED_SECTION && is_extended_layout()); |
| 2254 | 2287 int offset = get_extended_section_header_offset(); |
| 2255 void ConstantPoolArray::Init(int number_of_int64_entries, | 2288 switch (type) { |
| 2256 int number_of_code_ptr_entries, | 2289 case INT64: |
| 2257 int number_of_heap_ptr_entries, | 2290 offset += kExtendedInt64CountOffset; |
| 2258 int number_of_int32_entries) { | 2291 break; |
| 2259 set_length(number_of_int64_entries + | 2292 case CODE_PTR: |
| 2260 number_of_code_ptr_entries + | 2293 offset += kExtendedCodePtrCountOffset; |
| 2261 number_of_heap_ptr_entries + | 2294 break; |
| 2262 number_of_int32_entries); | 2295 case HEAP_PTR: |
| 2263 int layout_field = | 2296 offset += kExtendedHeapPtrCountOffset; |
| 2264 NumberOfInt64EntriesField::encode(number_of_int64_entries) | | 2297 break; |
| 2265 NumberOfCodePtrEntriesField::encode(number_of_code_ptr_entries) | | 2298 case INT32: |
| 2266 NumberOfHeapPtrEntriesField::encode(number_of_heap_ptr_entries) | | 2299 offset += kExtendedInt32CountOffset; |
| 2267 WeakObjectStateField::encode(NO_WEAK_OBJECTS); | 2300 break; |
| 2268 WRITE_INT_FIELD(this, kArrayLayoutOffset, layout_field); | 2301 default: |
| 2302 UNREACHABLE(); | |
| 2303 } | |
| 2304 return READ_INT_FIELD(this, offset); | |
| 2305 } | |
| 2306 } | |
| 2307 | |
| 2308 | |
| 2309 ConstantPoolArray::Type ConstantPoolArray::get_type(int index) { | |
| 2310 LayoutSection section; | |
| 2311 if (is_extended_layout() && index >= first_extended_section_index()) { | |
| 2312 section = EXTENDED_SECTION; | |
| 2313 } else { | |
| 2314 section = SMALL_SECTION; | |
| 2315 } | |
| 2316 | |
| 2317 if (index >= first_index(INT64, section) && | |
|
ulan
2014/06/02 12:32:58
int t = 0;
while (last_index(t, section) < index)
rmcilroy
2014/06/03 12:32:28
Done.
| |
| 2318 index <= last_index(INT64, section)) { | |
| 2319 return INT64; | |
| 2320 } else if (index >= first_index(CODE_PTR, section) && | |
| 2321 index <= last_index(CODE_PTR, section)) { | |
| 2322 return CODE_PTR; | |
| 2323 } else if (index >= first_index(HEAP_PTR, section) && | |
| 2324 index <= last_index(HEAP_PTR, section)) { | |
| 2325 return HEAP_PTR; | |
| 2326 } else { | |
| 2327 ASSERT(index >= first_index(INT32, section) && | |
| 2328 index <= last_index(INT32, section)); | |
| 2329 return INT32; | |
| 2330 } | |
| 2269 } | 2331 } |
| 2270 | 2332 |
| 2271 | 2333 |
| 2272 int64_t ConstantPoolArray::get_int64_entry(int index) { | 2334 int64_t ConstantPoolArray::get_int64_entry(int index) { |
| 2273 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2335 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2274 ASSERT(index >= 0 && index < first_code_ptr_index()); | 2336 ASSERT(get_type(index) == INT64); |
| 2275 return READ_INT64_FIELD(this, OffsetOfElementAt(index)); | 2337 return READ_INT64_FIELD(this, OffsetOfElementAt(index)); |
| 2276 } | 2338 } |
| 2277 | 2339 |
| 2340 | |
| 2278 double ConstantPoolArray::get_int64_entry_as_double(int index) { | 2341 double ConstantPoolArray::get_int64_entry_as_double(int index) { |
| 2279 STATIC_ASSERT(kDoubleSize == kInt64Size); | 2342 STATIC_ASSERT(kDoubleSize == kInt64Size); |
| 2280 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2343 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2281 ASSERT(index >= 0 && index < first_code_ptr_index()); | 2344 ASSERT(get_type(index) == INT64); |
| 2282 return READ_DOUBLE_FIELD(this, OffsetOfElementAt(index)); | 2345 return READ_DOUBLE_FIELD(this, OffsetOfElementAt(index)); |
| 2283 } | 2346 } |
| 2284 | 2347 |
| 2285 | 2348 |
| 2286 Address ConstantPoolArray::get_code_ptr_entry(int index) { | 2349 Address ConstantPoolArray::get_code_ptr_entry(int index) { |
| 2287 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2350 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2288 ASSERT(index >= first_code_ptr_index() && index < first_heap_ptr_index()); | 2351 ASSERT(get_type(index) == CODE_PTR); |
| 2289 return reinterpret_cast<Address>(READ_FIELD(this, OffsetOfElementAt(index))); | 2352 return reinterpret_cast<Address>(READ_FIELD(this, OffsetOfElementAt(index))); |
| 2290 } | 2353 } |
| 2291 | 2354 |
| 2292 | 2355 |
| 2293 Object* ConstantPoolArray::get_heap_ptr_entry(int index) { | 2356 Object* ConstantPoolArray::get_heap_ptr_entry(int index) { |
| 2294 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2357 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2295 ASSERT(index >= first_heap_ptr_index() && index < first_int32_index()); | 2358 ASSERT(get_type(index) == HEAP_PTR); |
| 2296 return READ_FIELD(this, OffsetOfElementAt(index)); | 2359 return READ_FIELD(this, OffsetOfElementAt(index)); |
| 2297 } | 2360 } |
| 2298 | 2361 |
| 2299 | 2362 |
| 2300 int32_t ConstantPoolArray::get_int32_entry(int index) { | 2363 int32_t ConstantPoolArray::get_int32_entry(int index) { |
| 2301 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2364 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2302 ASSERT(index >= first_int32_index() && index < length()); | 2365 ASSERT(get_type(index) == INT32); |
| 2303 return READ_INT32_FIELD(this, OffsetOfElementAt(index)); | 2366 return READ_INT32_FIELD(this, OffsetOfElementAt(index)); |
| 2304 } | 2367 } |
| 2305 | 2368 |
| 2306 | 2369 |
| 2370 void ConstantPoolArray::set(int index, int64_t value) { | |
| 2371 ASSERT(map() == GetHeap()->constant_pool_array_map()); | |
| 2372 ASSERT(get_type(index) == INT64); | |
| 2373 WRITE_INT64_FIELD(this, OffsetOfElementAt(index), value); | |
| 2374 } | |
| 2375 | |
| 2376 | |
| 2377 void ConstantPoolArray::set(int index, double value) { | |
| 2378 STATIC_ASSERT(kDoubleSize == kInt64Size); | |
| 2379 ASSERT(map() == GetHeap()->constant_pool_array_map()); | |
| 2380 ASSERT(get_type(index) == INT64); | |
| 2381 WRITE_DOUBLE_FIELD(this, OffsetOfElementAt(index), value); | |
| 2382 } | |
| 2383 | |
| 2384 | |
| 2307 void ConstantPoolArray::set(int index, Address value) { | 2385 void ConstantPoolArray::set(int index, Address value) { |
| 2308 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2386 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2309 ASSERT(index >= first_code_ptr_index() && index < first_heap_ptr_index()); | 2387 ASSERT(get_type(index) == CODE_PTR); |
| 2310 WRITE_FIELD(this, OffsetOfElementAt(index), reinterpret_cast<Object*>(value)); | 2388 WRITE_FIELD(this, OffsetOfElementAt(index), reinterpret_cast<Object*>(value)); |
| 2311 } | 2389 } |
| 2312 | 2390 |
| 2313 | 2391 |
| 2314 void ConstantPoolArray::set(int index, Object* value) { | 2392 void ConstantPoolArray::set(int index, Object* value) { |
| 2315 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2393 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2316 ASSERT(index >= first_code_ptr_index() && index < first_int32_index()); | 2394 ASSERT(get_type(index) == HEAP_PTR); |
| 2317 WRITE_FIELD(this, OffsetOfElementAt(index), value); | 2395 WRITE_FIELD(this, OffsetOfElementAt(index), value); |
| 2318 WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value); | 2396 WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value); |
| 2319 } | 2397 } |
| 2320 | 2398 |
| 2321 | 2399 |
| 2322 void ConstantPoolArray::set(int index, int64_t value) { | |
| 2323 ASSERT(map() == GetHeap()->constant_pool_array_map()); | |
| 2324 ASSERT(index >= first_int64_index() && index < first_code_ptr_index()); | |
| 2325 WRITE_INT64_FIELD(this, OffsetOfElementAt(index), value); | |
| 2326 } | |
| 2327 | |
| 2328 | |
| 2329 void ConstantPoolArray::set(int index, double value) { | |
| 2330 STATIC_ASSERT(kDoubleSize == kInt64Size); | |
| 2331 ASSERT(map() == GetHeap()->constant_pool_array_map()); | |
| 2332 ASSERT(index >= first_int64_index() && index < first_code_ptr_index()); | |
| 2333 WRITE_DOUBLE_FIELD(this, OffsetOfElementAt(index), value); | |
| 2334 } | |
| 2335 | |
| 2336 | |
| 2337 void ConstantPoolArray::set(int index, int32_t value) { | 2400 void ConstantPoolArray::set(int index, int32_t value) { |
| 2338 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2401 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2339 ASSERT(index >= this->first_int32_index() && index < length()); | 2402 ASSERT(get_type(index) == INT32); |
| 2340 WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value); | 2403 WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value); |
| 2341 } | 2404 } |
| 2342 | 2405 |
| 2343 | 2406 |
| 2407 void ConstantPoolArray::Init(int int64_count, | |
| 2408 int code_ptr_count, | |
| 2409 int heap_ptr_count, | |
| 2410 int int32_count) { | |
| 2411 uint32_t small_layout_1 = | |
| 2412 Int64CountField::encode(int64_count) | | |
| 2413 CodePtrCountField::encode(code_ptr_count) | | |
| 2414 HeapPtrCountField::encode(heap_ptr_count) | | |
| 2415 IsExtendedField::encode(false); | |
| 2416 uint32_t small_layout_2 = | |
| 2417 Int32CountField::encode(int32_count) | | |
| 2418 TotalCountField::encode(int64_count + code_ptr_count + heap_ptr_count + | |
| 2419 int32_count) | | |
| 2420 WeakObjectStateField::encode(NO_WEAK_OBJECTS); | |
| 2421 WRITE_UINT32_FIELD(this, kSmallLayout1Offset, small_layout_1); | |
| 2422 WRITE_UINT32_FIELD(this, kSmallLayout2Offset, small_layout_2); | |
| 2423 if (kHeaderSize != kFirstEntryOffset) { | |
| 2424 ASSERT(kFirstEntryOffset - kHeaderSize == kInt32Size); | |
| 2425 WRITE_UINT32_FIELD(this, kHeaderSize, 0); // Zero out header padding. | |
| 2426 } | |
| 2427 } | |
| 2428 | |
| 2429 | |
| 2430 void ConstantPoolArray::InitExtended(int small_section_int64_count, | |
| 2431 int small_section_code_ptr_count, | |
| 2432 int small_section_heap_ptr_count, | |
| 2433 int small_section_int32_count, | |
| 2434 int extended_section_int64_count, | |
| 2435 int extended_section_code_ptr_count, | |
| 2436 int extended_section_heap_ptr_count, | |
| 2437 int extended_section_int32_count) { | |
| 2438 // Initialize small layout fields first. | |
| 2439 Init(small_section_int64_count, small_section_code_ptr_count, | |
| 2440 small_section_heap_ptr_count, small_section_int32_count); | |
| 2441 | |
| 2442 // Set is_extended_layout field. | |
| 2443 uint32_t small_layout_1 = READ_UINT32_FIELD(this, kSmallLayout1Offset); | |
| 2444 small_layout_1 = IsExtendedField::update(small_layout_1, true); | |
| 2445 WRITE_INT32_FIELD(this, kSmallLayout1Offset, small_layout_1); | |
| 2446 | |
| 2447 // Initialize the extended layout fields. | |
| 2448 int extended_header_offset = get_extended_section_header_offset(); | |
| 2449 WRITE_INT_FIELD(this, extended_header_offset + kExtendedInt64CountOffset, | |
| 2450 extended_section_int64_count); | |
| 2451 WRITE_INT_FIELD(this, extended_header_offset + kExtendedCodePtrCountOffset, | |
| 2452 extended_section_code_ptr_count); | |
| 2453 WRITE_INT_FIELD(this, extended_header_offset + kExtendedHeapPtrCountOffset, | |
| 2454 extended_section_heap_ptr_count); | |
| 2455 WRITE_INT_FIELD(this, extended_header_offset + kExtendedInt32CountOffset, | |
| 2456 extended_section_int32_count); | |
| 2457 } | |
| 2458 | |
| 2459 | |
| 2460 int ConstantPoolArray::size() { | |
| 2461 if (!is_extended_layout()) { | |
| 2462 return SizeFor(number_of_entries(INT64, SMALL_SECTION), | |
| 2463 number_of_entries(CODE_PTR, SMALL_SECTION), | |
| 2464 number_of_entries(HEAP_PTR, SMALL_SECTION), | |
| 2465 number_of_entries(INT32, SMALL_SECTION)); | |
| 2466 } else { | |
| 2467 return SizeForExtended(number_of_entries(INT64, SMALL_SECTION), | |
| 2468 number_of_entries(CODE_PTR, SMALL_SECTION), | |
| 2469 number_of_entries(HEAP_PTR, SMALL_SECTION), | |
| 2470 number_of_entries(INT32, SMALL_SECTION), | |
| 2471 number_of_entries(INT64, EXTENDED_SECTION), | |
| 2472 number_of_entries(CODE_PTR, EXTENDED_SECTION), | |
| 2473 number_of_entries(HEAP_PTR, EXTENDED_SECTION), | |
| 2474 number_of_entries(INT32, EXTENDED_SECTION)); | |
| 2475 } | |
| 2476 } | |
| 2477 | |
| 2478 | |
| 2479 int ConstantPoolArray::length() { | |
| 2480 uint32_t small_layout_2 = READ_UINT32_FIELD(this, kSmallLayout2Offset); | |
| 2481 int length = TotalCountField::decode(small_layout_2); | |
| 2482 if (is_extended_layout()) { | |
| 2483 length += number_of_entries(INT64, EXTENDED_SECTION) + | |
| 2484 number_of_entries(CODE_PTR, EXTENDED_SECTION) + | |
| 2485 number_of_entries(HEAP_PTR, EXTENDED_SECTION) + | |
| 2486 number_of_entries(INT32, EXTENDED_SECTION); | |
| 2487 } | |
| 2488 return length; | |
| 2489 } | |
| 2490 | |
| 2491 | |
| 2492 int ConstantPoolArray::Iterator::next_index() { | |
| 2493 ASSERT(!is_finished()); | |
| 2494 int ret = next_index_++; | |
| 2495 update_section(); | |
| 2496 return ret; | |
| 2497 } | |
| 2498 | |
| 2499 | |
| 2500 bool ConstantPoolArray::Iterator::is_finished() { | |
| 2501 return next_index_ > array_->last_index(type_, final_section_); | |
| 2502 } | |
| 2503 | |
| 2504 | |
| 2505 void ConstantPoolArray::Iterator::update_section() { | |
| 2506 if (next_index_ > array_->last_index(type_, current_section_) && | |
| 2507 current_section_ != final_section_) { | |
| 2508 ASSERT(final_section_ == EXTENDED_SECTION); | |
| 2509 current_section_ = EXTENDED_SECTION; | |
| 2510 next_index_ = array_->first_index(type_, EXTENDED_SECTION); | |
| 2511 } | |
| 2512 } | |
| 2513 | |
| 2514 | |
| 2344 WriteBarrierMode HeapObject::GetWriteBarrierMode( | 2515 WriteBarrierMode HeapObject::GetWriteBarrierMode( |
| 2345 const DisallowHeapAllocation& promise) { | 2516 const DisallowHeapAllocation& promise) { |
| 2346 Heap* heap = GetHeap(); | 2517 Heap* heap = GetHeap(); |
| 2347 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; | 2518 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; |
| 2348 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; | 2519 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; |
| 2349 return UPDATE_WRITE_BARRIER; | 2520 return UPDATE_WRITE_BARRIER; |
| 2350 } | 2521 } |
| 2351 | 2522 |
| 2352 | 2523 |
| 2353 void FixedArray::set(int index, | 2524 void FixedArray::set(int index, |
| (...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3936 if (instance_type == STRING_TYPE || | 4107 if (instance_type == STRING_TYPE || |
| 3937 instance_type == INTERNALIZED_STRING_TYPE) { | 4108 instance_type == INTERNALIZED_STRING_TYPE) { |
| 3938 return SeqTwoByteString::SizeFor( | 4109 return SeqTwoByteString::SizeFor( |
| 3939 reinterpret_cast<SeqTwoByteString*>(this)->length()); | 4110 reinterpret_cast<SeqTwoByteString*>(this)->length()); |
| 3940 } | 4111 } |
| 3941 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { | 4112 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { |
| 3942 return FixedDoubleArray::SizeFor( | 4113 return FixedDoubleArray::SizeFor( |
| 3943 reinterpret_cast<FixedDoubleArray*>(this)->length()); | 4114 reinterpret_cast<FixedDoubleArray*>(this)->length()); |
| 3944 } | 4115 } |
| 3945 if (instance_type == CONSTANT_POOL_ARRAY_TYPE) { | 4116 if (instance_type == CONSTANT_POOL_ARRAY_TYPE) { |
| 3946 return ConstantPoolArray::SizeFor( | 4117 return reinterpret_cast<ConstantPoolArray*>(this)->size(); |
| 3947 reinterpret_cast<ConstantPoolArray*>(this)->count_of_int64_entries(), | |
| 3948 reinterpret_cast<ConstantPoolArray*>(this)->count_of_code_ptr_entries(), | |
| 3949 reinterpret_cast<ConstantPoolArray*>(this)->count_of_heap_ptr_entries(), | |
| 3950 reinterpret_cast<ConstantPoolArray*>(this)->count_of_int32_entries()); | |
| 3951 } | 4118 } |
| 3952 if (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE && | 4119 if (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE && |
| 3953 instance_type <= LAST_FIXED_TYPED_ARRAY_TYPE) { | 4120 instance_type <= LAST_FIXED_TYPED_ARRAY_TYPE) { |
| 3954 return reinterpret_cast<FixedTypedArrayBase*>(this)->size(); | 4121 return reinterpret_cast<FixedTypedArrayBase*>(this)->size(); |
| 3955 } | 4122 } |
| 3956 ASSERT(instance_type == CODE_TYPE); | 4123 ASSERT(instance_type == CODE_TYPE); |
| 3957 return reinterpret_cast<Code*>(this)->CodeSize(); | 4124 return reinterpret_cast<Code*>(this)->CodeSize(); |
| 3958 } | 4125 } |
| 3959 | 4126 |
| 3960 | 4127 |
| (...skipping 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6845 #undef READ_SHORT_FIELD | 7012 #undef READ_SHORT_FIELD |
| 6846 #undef WRITE_SHORT_FIELD | 7013 #undef WRITE_SHORT_FIELD |
| 6847 #undef READ_BYTE_FIELD | 7014 #undef READ_BYTE_FIELD |
| 6848 #undef WRITE_BYTE_FIELD | 7015 #undef WRITE_BYTE_FIELD |
| 6849 #undef NOBARRIER_READ_BYTE_FIELD | 7016 #undef NOBARRIER_READ_BYTE_FIELD |
| 6850 #undef NOBARRIER_WRITE_BYTE_FIELD | 7017 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 6851 | 7018 |
| 6852 } } // namespace v8::internal | 7019 } } // namespace v8::internal |
| 6853 | 7020 |
| 6854 #endif // V8_OBJECTS_INL_H_ | 7021 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |