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

Unified Diff: src/hydrogen-instructions.h

Issue 14146005: Track representations of fields (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make double support consistent. Now DOUBLE always contains smi or heapnumber Created 7 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 side-by-side diff with in-line comments
Download patch
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index bd1dd403a79cbd397b2a9c56a48a590c71443216..cf3efc68567ce34a235596a61d675ea166e9139f 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -5211,15 +5211,23 @@ class HStoreContextSlot: public HTemplateInstruction<2> {
class HLoadNamedField: public HTemplateInstruction<2> {
public:
- HLoadNamedField(HValue* object, bool is_in_object, int offset,
- HValue* typecheck = NULL)
+ HLoadNamedField(HValue* object, bool is_in_object, StorageType storage_type,
+ int offset, HValue* typecheck = NULL)
: is_in_object_(is_in_object),
+ storage_type_(storage_type),
offset_(offset) {
ASSERT(object != NULL);
SetOperandAt(0, object);
SetOperandAt(1, typecheck != NULL ? typecheck : object);
- set_representation(Representation::Tagged());
+ if (FLAG_track_fields && storage_type == SMI) {
+ set_type(HType::Smi());
+ set_representation(Representation::Tagged());
+ } else if (FLAG_track_double_fields && storage_type == DOUBLE) {
+ set_representation(Representation::Double());
+ } else {
+ set_representation(Representation::Tagged());
+ }
SetFlag(kUseGVN);
SetGVNFlag(kDependsOnMaps);
if (is_in_object) {
@@ -5232,8 +5240,9 @@ class HLoadNamedField: public HTemplateInstruction<2> {
static HLoadNamedField* NewArrayLength(Zone* zone, HValue* object,
HValue* typecheck,
HType type = HType::Tagged()) {
+ StorageType storage = type.IsSmi() ? SMI : TAGGED;
HLoadNamedField* result = new(zone) HLoadNamedField(
- object, true, JSArray::kLengthOffset, typecheck);
+ object, true, storage, JSArray::kLengthOffset, typecheck);
result->set_type(type);
result->SetGVNFlag(kDependsOnArrayLengths);
result->ClearGVNFlag(kDependsOnInobjectFields);
@@ -5248,6 +5257,7 @@ class HLoadNamedField: public HTemplateInstruction<2> {
bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); }
bool is_in_object() const { return is_in_object_; }
+ StorageType storage_type() const { return storage_type_; }
int offset() const { return offset_; }
virtual Representation RequiredInputRepresentation(int index) {
@@ -5267,6 +5277,7 @@ class HLoadNamedField: public HTemplateInstruction<2> {
virtual bool IsDeletable() const { return true; }
bool is_in_object_;
+ StorageType storage_type_;
int offset_;
};
@@ -5564,9 +5575,11 @@ class HStoreNamedField: public HTemplateInstruction<2> {
Handle<String> name,
HValue* val,
bool in_object,
+ StorageType storage,
int offset)
: name_(name),
is_in_object_(in_object),
+ storage_(storage),
offset_(offset),
transition_unique_id_(),
new_space_dominator_(NULL) {
@@ -5584,6 +5597,12 @@ class HStoreNamedField: public HTemplateInstruction<2> {
DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
virtual Representation RequiredInputRepresentation(int index) {
+ // if (FLAG_track_double_fields && index == 1 && storage_ == DOUBLE) {
+ // return Representation::Double();
+ // } else
+ if (FLAG_track_fields && index == 1 && storage_ == SMI) {
+ return Representation::Integer32();
+ }
return Representation::Tagged();
}
virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) {
@@ -5604,7 +5623,9 @@ class HStoreNamedField: public HTemplateInstruction<2> {
HValue* new_space_dominator() const { return new_space_dominator_; }
bool NeedsWriteBarrier() {
- return StoringValueNeedsWriteBarrier(value()) &&
+ return (storage_ != SMI || !FLAG_track_fields) &&
+ // (storage_ != DOUBLE || !FLAG_track_double_fields) &&
+ StoringValueNeedsWriteBarrier(value()) &&
ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator());
}
@@ -5616,9 +5637,14 @@ class HStoreNamedField: public HTemplateInstruction<2> {
transition_unique_id_ = UniqueValueId(transition_);
}
+ StorageType storage_type() const {
+ return storage_;
+ }
+
private:
Handle<String> name_;
bool is_in_object_;
+ StorageType storage_;
int offset_;
Handle<Map> transition_;
UniqueValueId transition_unique_id_;
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698