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

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

Issue 227133007: Allow race-full access of map instance size when sweeping concurrently. (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 | « no previous file | 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 // 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 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 1225
1226 #define READ_SHORT_FIELD(p, offset) \ 1226 #define READ_SHORT_FIELD(p, offset) \
1227 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset))) 1227 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)))
1228 1228
1229 #define WRITE_SHORT_FIELD(p, offset, value) \ 1229 #define WRITE_SHORT_FIELD(p, offset, value) \
1230 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value) 1230 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value)
1231 1231
1232 #define READ_BYTE_FIELD(p, offset) \ 1232 #define READ_BYTE_FIELD(p, offset) \
1233 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset))) 1233 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)))
1234 1234
1235 #define NOBARRIER_READ_BYTE_FIELD(p, offset) \
1236 static_cast<byte>(NoBarrier_Load( \
1237 reinterpret_cast<Atomic8*>(FIELD_ADDR(p, offset))) )
1238
1235 #define WRITE_BYTE_FIELD(p, offset, value) \ 1239 #define WRITE_BYTE_FIELD(p, offset, value) \
1236 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value) 1240 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value)
1237 1241
1242 #define NOBARRIER_WRITE_BYTE_FIELD(p, offset, value) \
1243 NoBarrier_Store(reinterpret_cast<Atomic8*>(FIELD_ADDR(p, offset)), \
1244 static_cast<Atomic8>(value));
1238 1245
1239 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) { 1246 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) {
1240 return &READ_FIELD(obj, byte_offset); 1247 return &READ_FIELD(obj, byte_offset);
1241 } 1248 }
1242 1249
1243 1250
1244 int Smi::value() { 1251 int Smi::value() {
1245 return Internals::SmiValue(this); 1252 return Internals::SmiValue(this);
1246 } 1253 }
1247 1254
(...skipping 2896 matching lines...) Expand 10 before | Expand all | Expand 10 after
4144 } 4151 }
4145 4152
4146 4153
4147 void Map::set_visitor_id(int id) { 4154 void Map::set_visitor_id(int id) {
4148 ASSERT(0 <= id && id < 256); 4155 ASSERT(0 <= id && id < 256);
4149 WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id)); 4156 WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id));
4150 } 4157 }
4151 4158
4152 4159
4153 int Map::instance_size() { 4160 int Map::instance_size() {
4154 return READ_BYTE_FIELD(this, kInstanceSizeOffset) << kPointerSizeLog2; 4161 return NOBARRIER_READ_BYTE_FIELD(
4162 this, kInstanceSizeOffset) << kPointerSizeLog2;
4155 } 4163 }
4156 4164
4157 4165
4158 int Map::inobject_properties() { 4166 int Map::inobject_properties() {
4159 return READ_BYTE_FIELD(this, kInObjectPropertiesOffset); 4167 return READ_BYTE_FIELD(this, kInObjectPropertiesOffset);
4160 } 4168 }
4161 4169
4162 4170
4163 int Map::pre_allocated_property_fields() { 4171 int Map::pre_allocated_property_fields() {
4164 return READ_BYTE_FIELD(this, kPreAllocatedPropertyFieldsOffset); 4172 return READ_BYTE_FIELD(this, kPreAllocatedPropertyFieldsOffset);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
4214 } 4222 }
4215 ASSERT(instance_type == CODE_TYPE); 4223 ASSERT(instance_type == CODE_TYPE);
4216 return reinterpret_cast<Code*>(this)->CodeSize(); 4224 return reinterpret_cast<Code*>(this)->CodeSize();
4217 } 4225 }
4218 4226
4219 4227
4220 void Map::set_instance_size(int value) { 4228 void Map::set_instance_size(int value) {
4221 ASSERT_EQ(0, value & (kPointerSize - 1)); 4229 ASSERT_EQ(0, value & (kPointerSize - 1));
4222 value >>= kPointerSizeLog2; 4230 value >>= kPointerSizeLog2;
4223 ASSERT(0 <= value && value < 256); 4231 ASSERT(0 <= value && value < 256);
4224 WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value)); 4232 NOBARRIER_WRITE_BYTE_FIELD(
4233 this, kInstanceSizeOffset, static_cast<byte>(value));
4225 } 4234 }
4226 4235
4227 4236
4228 void Map::set_inobject_properties(int value) { 4237 void Map::set_inobject_properties(int value) {
4229 ASSERT(0 <= value && value < 256); 4238 ASSERT(0 <= value && value < 256);
4230 WRITE_BYTE_FIELD(this, kInObjectPropertiesOffset, static_cast<byte>(value)); 4239 WRITE_BYTE_FIELD(this, kInObjectPropertiesOffset, static_cast<byte>(value));
4231 } 4240 }
4232 4241
4233 4242
4234 void Map::set_pre_allocated_property_fields(int value) { 4243 void Map::set_pre_allocated_property_fields(int value) {
(...skipping 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after
7068 HeapObject::RawField(obj, object_size)); 7077 HeapObject::RawField(obj, object_size));
7069 } 7078 }
7070 7079
7071 7080
7072 #undef TYPE_CHECKER 7081 #undef TYPE_CHECKER
7073 #undef CAST_ACCESSOR 7082 #undef CAST_ACCESSOR
7074 #undef INT_ACCESSORS 7083 #undef INT_ACCESSORS
7075 #undef ACCESSORS 7084 #undef ACCESSORS
7076 #undef ACCESSORS_TO_SMI 7085 #undef ACCESSORS_TO_SMI
7077 #undef SMI_ACCESSORS 7086 #undef SMI_ACCESSORS
7087 #undef SYNCHRONIZED_SMI_ACCESSORS
7088 #undef NOBARRIER_SMI_ACCESSORS
7078 #undef BOOL_GETTER 7089 #undef BOOL_GETTER
7079 #undef BOOL_ACCESSORS 7090 #undef BOOL_ACCESSORS
7080 #undef FIELD_ADDR 7091 #undef FIELD_ADDR
7081 #undef READ_FIELD 7092 #undef READ_FIELD
7093 #undef NOBARRIER_READ_FIELD
7082 #undef WRITE_FIELD 7094 #undef WRITE_FIELD
7095 #undef NOBARRIER_WRITE_FIELD
7083 #undef WRITE_BARRIER 7096 #undef WRITE_BARRIER
7084 #undef CONDITIONAL_WRITE_BARRIER 7097 #undef CONDITIONAL_WRITE_BARRIER
7085 #undef READ_DOUBLE_FIELD 7098 #undef READ_DOUBLE_FIELD
7086 #undef WRITE_DOUBLE_FIELD 7099 #undef WRITE_DOUBLE_FIELD
7087 #undef READ_INT_FIELD 7100 #undef READ_INT_FIELD
7088 #undef WRITE_INT_FIELD 7101 #undef WRITE_INT_FIELD
7089 #undef READ_INTPTR_FIELD 7102 #undef READ_INTPTR_FIELD
7090 #undef WRITE_INTPTR_FIELD 7103 #undef WRITE_INTPTR_FIELD
7091 #undef READ_UINT32_FIELD 7104 #undef READ_UINT32_FIELD
7092 #undef WRITE_UINT32_FIELD 7105 #undef WRITE_UINT32_FIELD
7093 #undef READ_SHORT_FIELD 7106 #undef READ_SHORT_FIELD
7094 #undef WRITE_SHORT_FIELD 7107 #undef WRITE_SHORT_FIELD
7095 #undef READ_BYTE_FIELD 7108 #undef READ_BYTE_FIELD
7096 #undef WRITE_BYTE_FIELD 7109 #undef WRITE_BYTE_FIELD
7110 #undef NOBARRIER_READ_BYTE_FIELD
7111 #undef NOBARRIER_WRITE_BYTE_FIELD
7097 7112
7098 } } // namespace v8::internal 7113 } } // namespace v8::internal
7099 7114
7100 #endif // V8_OBJECTS_INL_H_ 7115 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698