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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index dd7bbfdb28460f825e7982f69aad9f618073bbfe..7a42356c04d91099574617779c075441eb83a3a5 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -6050,6 +6050,8 @@ class HObjectAccess FINAL {
return ExistingInobjectPropertyField::decode(value_);
}
+ inline bool read_barrier() const { return ReadBarrierField::decode(value_); }
+
inline HObjectAccess WithRepresentation(Representation representation) {
return HObjectAccess(portion(), offset(), representation, name(),
immutable(), existing_inobject_property());
@@ -6216,22 +6218,28 @@ class HObjectAccess FINAL {
Representation::UInteger16());
}
- static HObjectAccess ForPropertyCellValue() {
- return HObjectAccess(kInobject, PropertyCell::kValueOffset);
- }
-
- static HObjectAccess ForCellValue() {
- return HObjectAccess(kInobject, Cell::kValueOffset);
- }
-
static HObjectAccess ForWeakCellValue() {
- return HObjectAccess(kInobject, WeakCell::kValueOffset);
+ return HObjectAccess(
+ kInobject, WeakCell::kValueOffsetDontForgetTheReadBarrier,
+ Representation::Tagged(), Handle<String>::null(), false, true, true);
}
static HObjectAccess ForWeakCellNext() {
return HObjectAccess(kInobject, WeakCell::kNextOffset);
}
+ // This version of the weak cell value does not trigger the read barrier.
+ // This means that for correctness you can only use the value for an
+ // immediate equality comparison, typically a map check. The GC is not
+ // allowed to see the value eg through a spill to the stack.
+ // TODO(erikcorry): When the SATB collector is actually running these
+ // need to be marked as untagged data when they are spilled to the stack.
+ static HObjectAccess ForWeakCellValueComparison() {
+ return HObjectAccess(
+ kInobject, WeakCell::kValueOffsetDontForgetTheReadBarrier,
+ Representation::Tagged(), Handle<String>::null(), false, true, false);
+ }
+
static HObjectAccess ForAllocationMementoSite() {
return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset);
}
@@ -6403,15 +6411,16 @@ class HObjectAccess FINAL {
HObjectAccess(Portion portion, int offset,
Representation representation = Representation::Tagged(),
Handle<String> name = Handle<String>::null(),
- bool immutable = false,
- bool existing_inobject_property = true)
- : value_(PortionField::encode(portion) |
- RepresentationField::encode(representation.kind()) |
- ImmutableField::encode(immutable ? 1 : 0) |
- ExistingInobjectPropertyField::encode(
- existing_inobject_property ? 1 : 0) |
- OffsetField::encode(offset)),
- name_(name) {
+ bool immutable = false, bool existing_inobject_property = true,
+ bool read_barrier = false)
+ : value_(PortionField::encode(portion) |
+ RepresentationField::encode(representation.kind()) |
+ ImmutableField::encode(immutable ? 1 : 0) |
+ ExistingInobjectPropertyField::encode(
+ existing_inobject_property ? 1 : 0) |
+ ReadBarrierField::encode(read_barrier ? 1 : 0) |
+ OffsetField::encode(offset)),
+ name_(name) {
// assert that the fields decode correctly
DCHECK(this->offset() == offset);
DCHECK(this->portion() == portion);
@@ -6425,7 +6434,8 @@ class HObjectAccess FINAL {
class RepresentationField : public BitField<Representation::Kind, 3, 4> {};
class ImmutableField : public BitField<bool, 7, 1> {};
class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {};
- class OffsetField : public BitField<int, 9, 23> {};
+ class ReadBarrierField : public BitField<bool, 9, 1> {};
+ class OffsetField : public BitField<int, 10, 22> {};
uint32_t value_; // encodes portion, representation, immutable, and offset
Handle<String> name_;
« 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