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

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

Issue 227533006: Synchronize store buffer processing and concurrent sweeping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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') | src/spaces.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 #define SYNCHRONIZED_SMI_ACCESSORS(holder, name, offset) \ 128 #define SYNCHRONIZED_SMI_ACCESSORS(holder, name, offset) \
129 int holder::synchronized_##name() { \ 129 int holder::synchronized_##name() { \
130 Object* value = ACQUIRE_READ_FIELD(this, offset); \ 130 Object* value = ACQUIRE_READ_FIELD(this, offset); \
131 return Smi::cast(value)->value(); \ 131 return Smi::cast(value)->value(); \
132 } \ 132 } \
133 void holder::synchronized_set_##name(int value) { \ 133 void holder::synchronized_set_##name(int value) { \
134 RELEASE_WRITE_FIELD(this, offset, Smi::FromInt(value)); \ 134 RELEASE_WRITE_FIELD(this, offset, Smi::FromInt(value)); \
135 } 135 }
136 136
137 #define NOBARRIER_SMI_ACCESSORS(holder, name, offset) \
138 int holder::nobarrier_##name() { \
139 Object* value = NOBARRIER_READ_FIELD(this, offset); \
140 return Smi::cast(value)->value(); \
141 } \
142 void holder::nobarrier_set_##name(int value) { \
143 NOBARRIER_WRITE_FIELD(this, offset, Smi::FromInt(value)); \
144 }
137 145
138 #define BOOL_GETTER(holder, field, name, offset) \ 146 #define BOOL_GETTER(holder, field, name, offset) \
139 bool holder::name() { \ 147 bool holder::name() { \
140 return BooleanBit::get(field(), offset); \ 148 return BooleanBit::get(field(), offset); \
141 } \ 149 } \
142 150
143 151
144 #define BOOL_ACCESSORS(holder, field, name, offset) \ 152 #define BOOL_ACCESSORS(holder, field, name, offset) \
145 bool holder::name() { \ 153 bool holder::name() { \
146 return BooleanBit::get(field(), offset); \ 154 return BooleanBit::get(field(), offset); \
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 #define FIELD_ADDR(p, offset) \ 1109 #define FIELD_ADDR(p, offset) \
1102 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) 1110 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag)
1103 1111
1104 #define READ_FIELD(p, offset) \ 1112 #define READ_FIELD(p, offset) \
1105 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) 1113 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)))
1106 1114
1107 #define ACQUIRE_READ_FIELD(p, offset) \ 1115 #define ACQUIRE_READ_FIELD(p, offset) \
1108 reinterpret_cast<Object*>( \ 1116 reinterpret_cast<Object*>( \
1109 Acquire_Load(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)))) 1117 Acquire_Load(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset))))
1110 1118
1111 #define NO_BARRIER_READ_FIELD(p, offset) \ 1119 #define NOBARRIER_READ_FIELD(p, offset) \
1112 reinterpret_cast<Object*>( \ 1120 reinterpret_cast<Object*>( \
1113 NoBarrier_Load(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)))) 1121 NoBarrier_Load(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset))))
1114 1122
1115 #define WRITE_FIELD(p, offset, value) \ 1123 #define WRITE_FIELD(p, offset, value) \
1116 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) 1124 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value)
1117 1125
1118 #define RELEASE_WRITE_FIELD(p, offset, value) \ 1126 #define RELEASE_WRITE_FIELD(p, offset, value) \
1119 Release_Store(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)), \ 1127 Release_Store(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)), \
1120 reinterpret_cast<AtomicWord>(value)); 1128 reinterpret_cast<AtomicWord>(value));
1121 1129
1122 #define NO_BARRIER_WRITE_FIELD(p, offset, value) \ 1130 #define NOBARRIER_WRITE_FIELD(p, offset, value) \
1123 NoBarrier_Store(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)), \ 1131 NoBarrier_Store(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)), \
1124 reinterpret_cast<AtomicWord>(value)); 1132 reinterpret_cast<AtomicWord>(value));
1125 1133
1126 #define WRITE_BARRIER(heap, object, offset, value) \ 1134 #define WRITE_BARRIER(heap, object, offset, value) \
1127 heap->incremental_marking()->RecordWrite( \ 1135 heap->incremental_marking()->RecordWrite( \
1128 object, HeapObject::RawField(object, offset), value); \ 1136 object, HeapObject::RawField(object, offset), value); \
1129 if (heap->InNewSpace(value)) { \ 1137 if (heap->InNewSpace(value)) { \
1130 heap->RecordWrite(object->address(), offset); \ 1138 heap->RecordWrite(object->address(), offset); \
1131 } 1139 }
1132 1140
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 void HeapObject::synchronized_set_map(Map* value) { 1389 void HeapObject::synchronized_set_map(Map* value) {
1382 synchronized_set_map_word(MapWord::FromMap(value)); 1390 synchronized_set_map_word(MapWord::FromMap(value));
1383 if (value != NULL) { 1391 if (value != NULL) {
1384 // TODO(1600) We are passing NULL as a slot because maps can never be on 1392 // TODO(1600) We are passing NULL as a slot because maps can never be on
1385 // evacuation candidate. 1393 // evacuation candidate.
1386 value->GetHeap()->incremental_marking()->RecordWrite(this, NULL, value); 1394 value->GetHeap()->incremental_marking()->RecordWrite(this, NULL, value);
1387 } 1395 }
1388 } 1396 }
1389 1397
1390 1398
1399 void HeapObject::synchronized_set_map_no_write_barrier(Map* value) {
1400 synchronized_set_map_word(MapWord::FromMap(value));
1401 }
1402
1403
1391 // Unsafe accessor omitting write barrier. 1404 // Unsafe accessor omitting write barrier.
1392 void HeapObject::set_map_no_write_barrier(Map* value) { 1405 void HeapObject::set_map_no_write_barrier(Map* value) {
1393 set_map_word(MapWord::FromMap(value)); 1406 set_map_word(MapWord::FromMap(value));
1394 } 1407 }
1395 1408
1396 1409
1397 MapWord HeapObject::map_word() { 1410 MapWord HeapObject::map_word() {
1398 return MapWord( 1411 return MapWord(
1399 reinterpret_cast<uintptr_t>(NO_BARRIER_READ_FIELD(this, kMapOffset))); 1412 reinterpret_cast<uintptr_t>(NOBARRIER_READ_FIELD(this, kMapOffset)));
1400 } 1413 }
1401 1414
1402 1415
1403 void HeapObject::set_map_word(MapWord map_word) { 1416 void HeapObject::set_map_word(MapWord map_word) {
1404 NO_BARRIER_WRITE_FIELD( 1417 NOBARRIER_WRITE_FIELD(
1405 this, kMapOffset, reinterpret_cast<Object*>(map_word.value_)); 1418 this, kMapOffset, reinterpret_cast<Object*>(map_word.value_));
1406 } 1419 }
1407 1420
1408 1421
1409 MapWord HeapObject::synchronized_map_word() { 1422 MapWord HeapObject::synchronized_map_word() {
1410 return MapWord( 1423 return MapWord(
1411 reinterpret_cast<uintptr_t>(ACQUIRE_READ_FIELD(this, kMapOffset))); 1424 reinterpret_cast<uintptr_t>(ACQUIRE_READ_FIELD(this, kMapOffset)));
1412 } 1425 }
1413 1426
1414 1427
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2982 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { 2995 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) {
2983 ASSERT(obj->IsHashTable()); 2996 ASSERT(obj->IsHashTable());
2984 return reinterpret_cast<HashTable*>(obj); 2997 return reinterpret_cast<HashTable*>(obj);
2985 } 2998 }
2986 2999
2987 3000
2988 SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset) 3001 SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
2989 SYNCHRONIZED_SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset) 3002 SYNCHRONIZED_SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
2990 3003
2991 SMI_ACCESSORS(FreeSpace, size, kSizeOffset) 3004 SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
3005 NOBARRIER_SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
2992 3006
2993 SMI_ACCESSORS(String, length, kLengthOffset) 3007 SMI_ACCESSORS(String, length, kLengthOffset)
2994 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) 3008 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset)
2995 3009
2996 3010
2997 uint32_t Name::hash_field() { 3011 uint32_t Name::hash_field() {
2998 return READ_UINT32_FIELD(this, kHashFieldOffset); 3012 return READ_UINT32_FIELD(this, kHashFieldOffset);
2999 } 3013 }
3000 3014
3001 3015
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
4009 } 4023 }
4010 if (instance_type == ASCII_STRING_TYPE || 4024 if (instance_type == ASCII_STRING_TYPE ||
4011 instance_type == ASCII_INTERNALIZED_STRING_TYPE) { 4025 instance_type == ASCII_INTERNALIZED_STRING_TYPE) {
4012 return SeqOneByteString::SizeFor( 4026 return SeqOneByteString::SizeFor(
4013 reinterpret_cast<SeqOneByteString*>(this)->length()); 4027 reinterpret_cast<SeqOneByteString*>(this)->length());
4014 } 4028 }
4015 if (instance_type == BYTE_ARRAY_TYPE) { 4029 if (instance_type == BYTE_ARRAY_TYPE) {
4016 return reinterpret_cast<ByteArray*>(this)->ByteArraySize(); 4030 return reinterpret_cast<ByteArray*>(this)->ByteArraySize();
4017 } 4031 }
4018 if (instance_type == FREE_SPACE_TYPE) { 4032 if (instance_type == FREE_SPACE_TYPE) {
4019 return reinterpret_cast<FreeSpace*>(this)->size(); 4033 return reinterpret_cast<FreeSpace*>(this)->nobarrier_size();
4020 } 4034 }
4021 if (instance_type == STRING_TYPE || 4035 if (instance_type == STRING_TYPE ||
4022 instance_type == INTERNALIZED_STRING_TYPE) { 4036 instance_type == INTERNALIZED_STRING_TYPE) {
4023 return SeqTwoByteString::SizeFor( 4037 return SeqTwoByteString::SizeFor(
4024 reinterpret_cast<SeqTwoByteString*>(this)->length()); 4038 reinterpret_cast<SeqTwoByteString*>(this)->length());
4025 } 4039 }
4026 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { 4040 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) {
4027 return FixedDoubleArray::SizeFor( 4041 return FixedDoubleArray::SizeFor(
4028 reinterpret_cast<FixedDoubleArray*>(this)->length()); 4042 reinterpret_cast<FixedDoubleArray*>(this)->length());
4029 } 4043 }
(...skipping 2894 matching lines...) Expand 10 before | Expand all | Expand 10 after
6924 #undef READ_UINT32_FIELD 6938 #undef READ_UINT32_FIELD
6925 #undef WRITE_UINT32_FIELD 6939 #undef WRITE_UINT32_FIELD
6926 #undef READ_SHORT_FIELD 6940 #undef READ_SHORT_FIELD
6927 #undef WRITE_SHORT_FIELD 6941 #undef WRITE_SHORT_FIELD
6928 #undef READ_BYTE_FIELD 6942 #undef READ_BYTE_FIELD
6929 #undef WRITE_BYTE_FIELD 6943 #undef WRITE_BYTE_FIELD
6930 6944
6931 } } // namespace v8::internal 6945 } } // namespace v8::internal
6932 6946
6933 #endif // V8_OBJECTS_INL_H_ 6947 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698