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

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

Issue 396803009: Tests that the GC doesn't mistake non-pointer constant pool entries as poitners. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add isOldSpace checks Created 6 years, 4 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 | « no previous file | test/cctest/test-constantpool.cc » ('j') | 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 2521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2532 2532
2533 void ConstantPoolArray::set(int index, Address value) { 2533 void ConstantPoolArray::set(int index, Address value) {
2534 ASSERT(map() == GetHeap()->constant_pool_array_map()); 2534 ASSERT(map() == GetHeap()->constant_pool_array_map());
2535 ASSERT(get_type(index) == CODE_PTR); 2535 ASSERT(get_type(index) == CODE_PTR);
2536 WRITE_FIELD(this, OffsetOfElementAt(index), reinterpret_cast<Object*>(value)); 2536 WRITE_FIELD(this, OffsetOfElementAt(index), reinterpret_cast<Object*>(value));
2537 } 2537 }
2538 2538
2539 2539
2540 void ConstantPoolArray::set(int index, Object* value) { 2540 void ConstantPoolArray::set(int index, Object* value) {
2541 ASSERT(map() == GetHeap()->constant_pool_array_map()); 2541 ASSERT(map() == GetHeap()->constant_pool_array_map());
2542 ASSERT(!GetHeap()->InNewSpace(value));
2542 ASSERT(get_type(index) == HEAP_PTR); 2543 ASSERT(get_type(index) == HEAP_PTR);
2543 WRITE_FIELD(this, OffsetOfElementAt(index), value); 2544 WRITE_FIELD(this, OffsetOfElementAt(index), value);
2544 WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value); 2545 WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value);
2545 } 2546 }
2546 2547
2547 2548
2548 void ConstantPoolArray::set(int index, int32_t value) { 2549 void ConstantPoolArray::set(int index, int32_t value) {
2549 ASSERT(map() == GetHeap()->constant_pool_array_map()); 2550 ASSERT(map() == GetHeap()->constant_pool_array_map());
2550 ASSERT(get_type(index) == INT32); 2551 ASSERT(get_type(index) == INT32);
2551 WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value); 2552 WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value);
(...skipping 24 matching lines...) Expand all
2576 void ConstantPoolArray::set_at_offset(int offset, Address value) { 2577 void ConstantPoolArray::set_at_offset(int offset, Address value) {
2577 ASSERT(map() == GetHeap()->constant_pool_array_map()); 2578 ASSERT(map() == GetHeap()->constant_pool_array_map());
2578 ASSERT(offset_is_type(offset, CODE_PTR)); 2579 ASSERT(offset_is_type(offset, CODE_PTR));
2579 WRITE_FIELD(this, offset, reinterpret_cast<Object*>(value)); 2580 WRITE_FIELD(this, offset, reinterpret_cast<Object*>(value));
2580 WRITE_BARRIER(GetHeap(), this, offset, reinterpret_cast<Object*>(value)); 2581 WRITE_BARRIER(GetHeap(), this, offset, reinterpret_cast<Object*>(value));
2581 } 2582 }
2582 2583
2583 2584
2584 void ConstantPoolArray::set_at_offset(int offset, Object* value) { 2585 void ConstantPoolArray::set_at_offset(int offset, Object* value) {
2585 ASSERT(map() == GetHeap()->constant_pool_array_map()); 2586 ASSERT(map() == GetHeap()->constant_pool_array_map());
2587 ASSERT(!GetHeap()->InNewSpace(value));
2586 ASSERT(offset_is_type(offset, HEAP_PTR)); 2588 ASSERT(offset_is_type(offset, HEAP_PTR));
2587 WRITE_FIELD(this, offset, value); 2589 WRITE_FIELD(this, offset, value);
2588 WRITE_BARRIER(GetHeap(), this, offset, value); 2590 WRITE_BARRIER(GetHeap(), this, offset, value);
2589 } 2591 }
2590 2592
2591 2593
2592 void ConstantPoolArray::Init(const NumberOfEntries& small) { 2594 void ConstantPoolArray::Init(const NumberOfEntries& small) {
2593 uint32_t small_layout_1 = 2595 uint32_t small_layout_1 =
2594 Int64CountField::encode(small.count_of(INT64)) | 2596 Int64CountField::encode(small.count_of(INT64)) |
2595 CodePtrCountField::encode(small.count_of(CODE_PTR)) | 2597 CodePtrCountField::encode(small.count_of(CODE_PTR)) |
(...skipping 4618 matching lines...) Expand 10 before | Expand all | Expand 10 after
7214 #undef READ_SHORT_FIELD 7216 #undef READ_SHORT_FIELD
7215 #undef WRITE_SHORT_FIELD 7217 #undef WRITE_SHORT_FIELD
7216 #undef READ_BYTE_FIELD 7218 #undef READ_BYTE_FIELD
7217 #undef WRITE_BYTE_FIELD 7219 #undef WRITE_BYTE_FIELD
7218 #undef NOBARRIER_READ_BYTE_FIELD 7220 #undef NOBARRIER_READ_BYTE_FIELD
7219 #undef NOBARRIER_WRITE_BYTE_FIELD 7221 #undef NOBARRIER_WRITE_BYTE_FIELD
7220 7222
7221 } } // namespace v8::internal 7223 } } // namespace v8::internal
7222 7224
7223 #endif // V8_OBJECTS_INL_H_ 7225 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-constantpool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698