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

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: 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
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 6031 matching lines...) Expand 10 before | Expand all | Expand 10 after
6042 inline bool immutable() const { 6042 inline bool immutable() const {
6043 return ImmutableField::decode(value_); 6043 return ImmutableField::decode(value_);
6044 } 6044 }
6045 6045
6046 // Returns true if access is being made to an in-object property that 6046 // Returns true if access is being made to an in-object property that
6047 // was already added to the object. 6047 // was already added to the object.
6048 inline bool existing_inobject_property() const { 6048 inline bool existing_inobject_property() const {
6049 return ExistingInobjectPropertyField::decode(value_); 6049 return ExistingInobjectPropertyField::decode(value_);
6050 } 6050 }
6051 6051
6052 inline bool read_barrier() const { return ReadBarrierField::decode(value_); }
6053
6052 inline HObjectAccess WithRepresentation(Representation representation) { 6054 inline HObjectAccess WithRepresentation(Representation representation) {
6053 return HObjectAccess(portion(), offset(), representation, name(), 6055 return HObjectAccess(portion(), offset(), representation, name(),
6054 immutable(), existing_inobject_property()); 6056 immutable(), existing_inobject_property());
6055 } 6057 }
6056 6058
6057 static HObjectAccess ForHeapNumberValue() { 6059 static HObjectAccess ForHeapNumberValue() {
6058 return HObjectAccess( 6060 return HObjectAccess(
6059 kDouble, HeapNumber::kValueOffset, Representation::Double()); 6061 kDouble, HeapNumber::kValueOffset, Representation::Double());
6060 } 6062 }
6061 6063
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
6208 static HObjectAccess ForMapInstanceTypeAndBitField() { 6210 static HObjectAccess ForMapInstanceTypeAndBitField() {
6209 STATIC_ASSERT((Map::kInstanceTypeAndBitFieldOffset & 1) == 0); 6211 STATIC_ASSERT((Map::kInstanceTypeAndBitFieldOffset & 1) == 0);
6210 // Ensure the two fields share one 16-bit word, endian-independent. 6212 // Ensure the two fields share one 16-bit word, endian-independent.
6211 STATIC_ASSERT((Map::kBitFieldOffset & ~1) == 6213 STATIC_ASSERT((Map::kBitFieldOffset & ~1) ==
6212 (Map::kInstanceTypeOffset & ~1)); 6214 (Map::kInstanceTypeOffset & ~1));
6213 return HObjectAccess(kInobject, 6215 return HObjectAccess(kInobject,
6214 Map::kInstanceTypeAndBitFieldOffset, 6216 Map::kInstanceTypeAndBitFieldOffset,
6215 Representation::UInteger16()); 6217 Representation::UInteger16());
6216 } 6218 }
6217 6219
6218 static HObjectAccess ForPropertyCellValue() {
6219 return HObjectAccess(kInobject, PropertyCell::kValueOffset);
6220 }
6221
6222 static HObjectAccess ForCellValue() {
6223 return HObjectAccess(kInobject, Cell::kValueOffset);
6224 }
6225
6226 static HObjectAccess ForWeakCellValue() { 6220 static HObjectAccess ForWeakCellValue() {
Erik Corry Chromium.org 2015/02/03 17:42:53 I suspect some or perhaps all of the uses of this
ulan 2015/02/04 09:35:04 Yesterday I landed a change in StoreGlobal hydroge
Erik Corry 2015/02/04 10:49:42 OK, we probably need both.
6227 return HObjectAccess(kInobject, WeakCell::kValueOffset); 6221 return HObjectAccess(
6222 kInobject, WeakCell::kValueOffsetDontForgetTheReadBarrier,
6223 Representation::Tagged(), Handle<String>::null(), false, true, true);
6228 } 6224 }
6229 6225
6230 static HObjectAccess ForAllocationMementoSite() { 6226 static HObjectAccess ForAllocationMementoSite() {
6231 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); 6227 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset);
6232 } 6228 }
6233 6229
6234 static HObjectAccess ForCounter() { 6230 static HObjectAccess ForCounter() {
6235 return HObjectAccess(kExternalMemory, 0, Representation::Integer32(), 6231 return HObjectAccess(kExternalMemory, 0, Representation::Integer32(),
6236 Handle<String>::null(), false, false); 6232 Handle<String>::null(), false, false);
6237 } 6233 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
6391 kDouble, // some double field 6387 kDouble, // some double field
6392 kInobject, // some other in-object field 6388 kInobject, // some other in-object field
6393 kExternalMemory // some field in external memory 6389 kExternalMemory // some field in external memory
6394 }; 6390 };
6395 6391
6396 HObjectAccess() : value_(0) {} 6392 HObjectAccess() : value_(0) {}
6397 6393
6398 HObjectAccess(Portion portion, int offset, 6394 HObjectAccess(Portion portion, int offset,
6399 Representation representation = Representation::Tagged(), 6395 Representation representation = Representation::Tagged(),
6400 Handle<String> name = Handle<String>::null(), 6396 Handle<String> name = Handle<String>::null(),
6401 bool immutable = false, 6397 bool immutable = false, bool existing_inobject_property = true,
6402 bool existing_inobject_property = true) 6398 bool read_barrier = false)
6403 : value_(PortionField::encode(portion) | 6399 : value_(PortionField::encode(portion) |
6404 RepresentationField::encode(representation.kind()) | 6400 RepresentationField::encode(representation.kind()) |
6405 ImmutableField::encode(immutable ? 1 : 0) | 6401 ImmutableField::encode(immutable ? 1 : 0) |
6406 ExistingInobjectPropertyField::encode( 6402 ExistingInobjectPropertyField::encode(
6407 existing_inobject_property ? 1 : 0) | 6403 existing_inobject_property ? 1 : 0) |
6408 OffsetField::encode(offset)), 6404 ReadBarrierField::encode(read_barrier ? 1 : 0) |
Hannes Payer (out of office) 2015/02/04 12:45:59 I like that.
6409 name_(name) { 6405 OffsetField::encode(offset)),
6406 name_(name) {
6410 // assert that the fields decode correctly 6407 // assert that the fields decode correctly
6411 DCHECK(this->offset() == offset); 6408 DCHECK(this->offset() == offset);
6412 DCHECK(this->portion() == portion); 6409 DCHECK(this->portion() == portion);
6413 DCHECK(this->immutable() == immutable); 6410 DCHECK(this->immutable() == immutable);
6414 DCHECK(this->existing_inobject_property() == existing_inobject_property); 6411 DCHECK(this->existing_inobject_property() == existing_inobject_property);
6415 DCHECK(RepresentationField::decode(value_) == representation.kind()); 6412 DCHECK(RepresentationField::decode(value_) == representation.kind());
6416 DCHECK(!this->existing_inobject_property() || IsInobject()); 6413 DCHECK(!this->existing_inobject_property() || IsInobject());
6417 } 6414 }
6418 6415
6419 class PortionField : public BitField<Portion, 0, 3> {}; 6416 class PortionField : public BitField<Portion, 0, 3> {};
6420 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; 6417 class RepresentationField : public BitField<Representation::Kind, 3, 4> {};
6421 class ImmutableField : public BitField<bool, 7, 1> {}; 6418 class ImmutableField : public BitField<bool, 7, 1> {};
6422 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; 6419 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {};
6423 class OffsetField : public BitField<int, 9, 23> {}; 6420 class ReadBarrierField : public BitField<bool, 9, 1> {};
6421 class OffsetField : public BitField<int, 10, 22> {};
6424 6422
6425 uint32_t value_; // encodes portion, representation, immutable, and offset 6423 uint32_t value_; // encodes portion, representation, immutable, and offset
6426 Handle<String> name_; 6424 Handle<String> name_;
6427 6425
6428 friend class HLoadNamedField; 6426 friend class HLoadNamedField;
6429 friend class HStoreNamedField; 6427 friend class HStoreNamedField;
6430 friend class SideEffectsTracker; 6428 friend class SideEffectsTracker;
6431 friend std::ostream& operator<<(std::ostream& os, 6429 friend std::ostream& operator<<(std::ostream& os,
6432 const HObjectAccess& access); 6430 const HObjectAccess& access);
6433 6431
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
7999 }; 7997 };
8000 7998
8001 7999
8002 8000
8003 #undef DECLARE_INSTRUCTION 8001 #undef DECLARE_INSTRUCTION
8004 #undef DECLARE_CONCRETE_INSTRUCTION 8002 #undef DECLARE_CONCRETE_INSTRUCTION
8005 8003
8006 } } // namespace v8::internal 8004 } } // namespace v8::internal
8007 8005
8008 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 8006 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698