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

Side by Side Diff: src/hydrogen-instructions.h

Issue 893073006: Add map-based read barrier to WeakCell Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix merge Created 5 years, 10 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/code-stubs-ia32.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 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ 6 #define V8_HYDROGEN_INSTRUCTIONS_H_
7 7
8 #include <cstring> 8 #include <cstring>
9 #include <iosfwd> 9 #include <iosfwd>
10 10
(...skipping 6032 matching lines...) Expand 10 before | Expand all | Expand 10 after
6043 inline bool immutable() const { 6043 inline bool immutable() const {
6044 return ImmutableField::decode(value_); 6044 return ImmutableField::decode(value_);
6045 } 6045 }
6046 6046
6047 // Returns true if access is being made to an in-object property that 6047 // Returns true if access is being made to an in-object property that
6048 // was already added to the object. 6048 // was already added to the object.
6049 inline bool existing_inobject_property() const { 6049 inline bool existing_inobject_property() const {
6050 return ExistingInobjectPropertyField::decode(value_); 6050 return ExistingInobjectPropertyField::decode(value_);
6051 } 6051 }
6052 6052
6053 inline bool read_barrier() const { return ReadBarrierField::decode(value_); }
6054
6053 inline HObjectAccess WithRepresentation(Representation representation) { 6055 inline HObjectAccess WithRepresentation(Representation representation) {
6054 return HObjectAccess(portion(), offset(), representation, name(), 6056 return HObjectAccess(portion(), offset(), representation, name(),
6055 immutable(), existing_inobject_property()); 6057 immutable(), existing_inobject_property());
6056 } 6058 }
6057 6059
6058 static HObjectAccess ForHeapNumberValue() { 6060 static HObjectAccess ForHeapNumberValue() {
6059 return HObjectAccess( 6061 return HObjectAccess(
6060 kDouble, HeapNumber::kValueOffset, Representation::Double()); 6062 kDouble, HeapNumber::kValueOffset, Representation::Double());
6061 } 6063 }
6062 6064
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
6209 static HObjectAccess ForMapInstanceTypeAndBitField() { 6211 static HObjectAccess ForMapInstanceTypeAndBitField() {
6210 STATIC_ASSERT((Map::kInstanceTypeAndBitFieldOffset & 1) == 0); 6212 STATIC_ASSERT((Map::kInstanceTypeAndBitFieldOffset & 1) == 0);
6211 // Ensure the two fields share one 16-bit word, endian-independent. 6213 // Ensure the two fields share one 16-bit word, endian-independent.
6212 STATIC_ASSERT((Map::kBitFieldOffset & ~1) == 6214 STATIC_ASSERT((Map::kBitFieldOffset & ~1) ==
6213 (Map::kInstanceTypeOffset & ~1)); 6215 (Map::kInstanceTypeOffset & ~1));
6214 return HObjectAccess(kInobject, 6216 return HObjectAccess(kInobject,
6215 Map::kInstanceTypeAndBitFieldOffset, 6217 Map::kInstanceTypeAndBitFieldOffset,
6216 Representation::UInteger16()); 6218 Representation::UInteger16());
6217 } 6219 }
6218 6220
6219 static HObjectAccess ForPropertyCellValue() {
6220 return HObjectAccess(kInobject, PropertyCell::kValueOffset);
6221 }
6222
6223 static HObjectAccess ForCellValue() {
6224 return HObjectAccess(kInobject, Cell::kValueOffset);
6225 }
6226
6227 static HObjectAccess ForWeakCellValue() { 6221 static HObjectAccess ForWeakCellValue() {
6228 return HObjectAccess(kInobject, WeakCell::kValueOffset); 6222 return HObjectAccess(
6223 kInobject, WeakCell::kValueOffsetDontForgetTheReadBarrier,
6224 Representation::Tagged(), Handle<String>::null(), false, true, true);
6229 } 6225 }
6230 6226
6231 static HObjectAccess ForWeakCellNext() { 6227 static HObjectAccess ForWeakCellNext() {
6232 return HObjectAccess(kInobject, WeakCell::kNextOffset); 6228 return HObjectAccess(kInobject, WeakCell::kNextOffset);
6233 } 6229 }
6234 6230
6231 // This version of the weak cell value does not trigger the read barrier.
6232 // This means that for correctness you can only use the value for an
6233 // immediate equality comparison, typically a map check. The GC is not
6234 // allowed to see the value eg through a spill to the stack.
6235 // TODO(erikcorry): When the SATB collector is actually running these
6236 // need to be marked as untagged data when they are spilled to the stack.
6237 static HObjectAccess ForWeakCellValueComparison() {
6238 return HObjectAccess(
6239 kInobject, WeakCell::kValueOffsetDontForgetTheReadBarrier,
6240 Representation::Tagged(), Handle<String>::null(), false, true, false);
6241 }
6242
6235 static HObjectAccess ForAllocationMementoSite() { 6243 static HObjectAccess ForAllocationMementoSite() {
6236 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); 6244 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset);
6237 } 6245 }
6238 6246
6239 static HObjectAccess ForCounter() { 6247 static HObjectAccess ForCounter() {
6240 return HObjectAccess(kExternalMemory, 0, Representation::Integer32(), 6248 return HObjectAccess(kExternalMemory, 0, Representation::Integer32(),
6241 Handle<String>::null(), false, false); 6249 Handle<String>::null(), false, false);
6242 } 6250 }
6243 6251
6244 static HObjectAccess ForExternalUInteger8() { 6252 static HObjectAccess ForExternalUInteger8() {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
6396 kDouble, // some double field 6404 kDouble, // some double field
6397 kInobject, // some other in-object field 6405 kInobject, // some other in-object field
6398 kExternalMemory // some field in external memory 6406 kExternalMemory // some field in external memory
6399 }; 6407 };
6400 6408
6401 HObjectAccess() : value_(0) {} 6409 HObjectAccess() : value_(0) {}
6402 6410
6403 HObjectAccess(Portion portion, int offset, 6411 HObjectAccess(Portion portion, int offset,
6404 Representation representation = Representation::Tagged(), 6412 Representation representation = Representation::Tagged(),
6405 Handle<String> name = Handle<String>::null(), 6413 Handle<String> name = Handle<String>::null(),
6406 bool immutable = false, 6414 bool immutable = false, bool existing_inobject_property = true,
6407 bool existing_inobject_property = true) 6415 bool read_barrier = false)
6408 : value_(PortionField::encode(portion) | 6416 : value_(PortionField::encode(portion) |
6409 RepresentationField::encode(representation.kind()) | 6417 RepresentationField::encode(representation.kind()) |
6410 ImmutableField::encode(immutable ? 1 : 0) | 6418 ImmutableField::encode(immutable ? 1 : 0) |
6411 ExistingInobjectPropertyField::encode( 6419 ExistingInobjectPropertyField::encode(
6412 existing_inobject_property ? 1 : 0) | 6420 existing_inobject_property ? 1 : 0) |
6413 OffsetField::encode(offset)), 6421 ReadBarrierField::encode(read_barrier ? 1 : 0) |
6414 name_(name) { 6422 OffsetField::encode(offset)),
6423 name_(name) {
6415 // assert that the fields decode correctly 6424 // assert that the fields decode correctly
6416 DCHECK(this->offset() == offset); 6425 DCHECK(this->offset() == offset);
6417 DCHECK(this->portion() == portion); 6426 DCHECK(this->portion() == portion);
6418 DCHECK(this->immutable() == immutable); 6427 DCHECK(this->immutable() == immutable);
6419 DCHECK(this->existing_inobject_property() == existing_inobject_property); 6428 DCHECK(this->existing_inobject_property() == existing_inobject_property);
6420 DCHECK(RepresentationField::decode(value_) == representation.kind()); 6429 DCHECK(RepresentationField::decode(value_) == representation.kind());
6421 DCHECK(!this->existing_inobject_property() || IsInobject()); 6430 DCHECK(!this->existing_inobject_property() || IsInobject());
6422 } 6431 }
6423 6432
6424 class PortionField : public BitField<Portion, 0, 3> {}; 6433 class PortionField : public BitField<Portion, 0, 3> {};
6425 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; 6434 class RepresentationField : public BitField<Representation::Kind, 3, 4> {};
6426 class ImmutableField : public BitField<bool, 7, 1> {}; 6435 class ImmutableField : public BitField<bool, 7, 1> {};
6427 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; 6436 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {};
6428 class OffsetField : public BitField<int, 9, 23> {}; 6437 class ReadBarrierField : public BitField<bool, 9, 1> {};
6438 class OffsetField : public BitField<int, 10, 22> {};
6429 6439
6430 uint32_t value_; // encodes portion, representation, immutable, and offset 6440 uint32_t value_; // encodes portion, representation, immutable, and offset
6431 Handle<String> name_; 6441 Handle<String> name_;
6432 6442
6433 friend class HLoadNamedField; 6443 friend class HLoadNamedField;
6434 friend class HStoreNamedField; 6444 friend class HStoreNamedField;
6435 friend class SideEffectsTracker; 6445 friend class SideEffectsTracker;
6436 friend std::ostream& operator<<(std::ostream& os, 6446 friend std::ostream& operator<<(std::ostream& os,
6437 const HObjectAccess& access); 6447 const HObjectAccess& access);
6438 6448
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
8000 }; 8010 };
8001 8011
8002 8012
8003 8013
8004 #undef DECLARE_INSTRUCTION 8014 #undef DECLARE_INSTRUCTION
8005 #undef DECLARE_CONCRETE_INSTRUCTION 8015 #undef DECLARE_CONCRETE_INSTRUCTION
8006 8016
8007 } } // namespace v8::internal 8017 } } // namespace v8::internal
8008 8018
8009 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 8019 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698