Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: src/objects-inl.h

Issue 376973002: [Arm]: Optimize ConstantPoolBuilder::Populate code by minimizing calls to OffsetOfElementAt (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after
2455 offset += kExtendedInt32CountOffset; 2455 offset += kExtendedInt32CountOffset;
2456 break; 2456 break;
2457 default: 2457 default:
2458 UNREACHABLE(); 2458 UNREACHABLE();
2459 } 2459 }
2460 return READ_INT_FIELD(this, offset); 2460 return READ_INT_FIELD(this, offset);
2461 } 2461 }
2462 } 2462 }
2463 2463
2464 2464
2465 bool ConstantPoolArray::offset_is_type(int offset, Type type) {
2466 return (offset >= OffsetOfElementAt(first_index(type, SMALL_SECTION)) &&
2467 offset <= OffsetOfElementAt(last_index(type, SMALL_SECTION))) ||
2468 (is_extended_layout() &&
2469 offset >= OffsetOfElementAt(first_index(type, EXTENDED_SECTION)) &&
2470 offset <= OffsetOfElementAt(last_index(type, EXTENDED_SECTION)));
2471 }
2472
2473
2465 ConstantPoolArray::Type ConstantPoolArray::get_type(int index) { 2474 ConstantPoolArray::Type ConstantPoolArray::get_type(int index) {
2466 LayoutSection section; 2475 LayoutSection section;
2467 if (is_extended_layout() && index >= first_extended_section_index()) { 2476 if (is_extended_layout() && index >= first_extended_section_index()) {
2468 section = EXTENDED_SECTION; 2477 section = EXTENDED_SECTION;
2469 } else { 2478 } else {
2470 section = SMALL_SECTION; 2479 section = SMALL_SECTION;
2471 } 2480 }
2472 2481
2473 Type type = FIRST_TYPE; 2482 Type type = FIRST_TYPE;
2474 while (index > last_index(type, section)) { 2483 while (index > last_index(type, section)) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2545 } 2554 }
2546 2555
2547 2556
2548 void ConstantPoolArray::set(int index, int32_t value) { 2557 void ConstantPoolArray::set(int index, int32_t value) {
2549 ASSERT(map() == GetHeap()->constant_pool_array_map()); 2558 ASSERT(map() == GetHeap()->constant_pool_array_map());
2550 ASSERT(get_type(index) == INT32); 2559 ASSERT(get_type(index) == INT32);
2551 WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value); 2560 WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value);
2552 } 2561 }
2553 2562
2554 2563
2564 void ConstantPoolArray::set_at_offset(int offset, int32_t value) {
2565 ASSERT(map() == GetHeap()->constant_pool_array_map());
2566 ASSERT(offset_is_type(offset, INT32));
2567 WRITE_INT32_FIELD(this, offset, value);
2568 }
2569
2570
2571 void ConstantPoolArray::set_at_offset(int offset, int64_t value) {
2572 ASSERT(map() == GetHeap()->constant_pool_array_map());
2573 ASSERT(offset_is_type(offset, INT64));
2574 WRITE_INT64_FIELD(this, offset, value);
2575 }
2576
2577
2578 void ConstantPoolArray::set_at_offset(int offset, double value) {
2579 ASSERT(map() == GetHeap()->constant_pool_array_map());
2580 ASSERT(offset_is_type(offset, INT64));
2581 WRITE_DOUBLE_FIELD(this, offset, value);
2582 }
2583
2584
2585 void ConstantPoolArray::set_at_offset(int offset, Address value) {
2586 ASSERT(map() == GetHeap()->constant_pool_array_map());
2587 ASSERT(offset_is_type(offset, CODE_PTR));
2588 WRITE_FIELD(this, offset, reinterpret_cast<Object*>(value));
2589 WRITE_BARRIER(GetHeap(), this, offset, reinterpret_cast<Object*>(value));
2590 }
2591
2592
2593 void ConstantPoolArray::set_at_offset(int offset, Object* value) {
2594 ASSERT(map() == GetHeap()->constant_pool_array_map());
2595 ASSERT(offset_is_type(offset, HEAP_PTR));
2596 WRITE_FIELD(this, offset, value);
2597 WRITE_BARRIER(GetHeap(), this, offset, value);
2598 }
2599
2600
2555 void ConstantPoolArray::Init(const NumberOfEntries& small) { 2601 void ConstantPoolArray::Init(const NumberOfEntries& small) {
2556 uint32_t small_layout_1 = 2602 uint32_t small_layout_1 =
2557 Int64CountField::encode(small.count_of(INT64)) | 2603 Int64CountField::encode(small.count_of(INT64)) |
2558 CodePtrCountField::encode(small.count_of(CODE_PTR)) | 2604 CodePtrCountField::encode(small.count_of(CODE_PTR)) |
2559 HeapPtrCountField::encode(small.count_of(HEAP_PTR)) | 2605 HeapPtrCountField::encode(small.count_of(HEAP_PTR)) |
2560 IsExtendedField::encode(false); 2606 IsExtendedField::encode(false);
2561 uint32_t small_layout_2 = 2607 uint32_t small_layout_2 =
2562 Int32CountField::encode(small.count_of(INT32)) | 2608 Int32CountField::encode(small.count_of(INT32)) |
2563 TotalCountField::encode(small.total_count()) | 2609 TotalCountField::encode(small.total_count()) |
2564 WeakObjectStateField::encode(NO_WEAK_OBJECTS); 2610 WeakObjectStateField::encode(NO_WEAK_OBJECTS);
(...skipping 4576 matching lines...) Expand 10 before | Expand all | Expand 10 after
7141 #undef READ_SHORT_FIELD 7187 #undef READ_SHORT_FIELD
7142 #undef WRITE_SHORT_FIELD 7188 #undef WRITE_SHORT_FIELD
7143 #undef READ_BYTE_FIELD 7189 #undef READ_BYTE_FIELD
7144 #undef WRITE_BYTE_FIELD 7190 #undef WRITE_BYTE_FIELD
7145 #undef NOBARRIER_READ_BYTE_FIELD 7191 #undef NOBARRIER_READ_BYTE_FIELD
7146 #undef NOBARRIER_WRITE_BYTE_FIELD 7192 #undef NOBARRIER_WRITE_BYTE_FIELD
7147 7193
7148 } } // namespace v8::internal 7194 } } // namespace v8::internal
7149 7195
7150 #endif // V8_OBJECTS_INL_H_ 7196 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698