Chromium Code Reviews

Unified Diff: src/hydrogen-instructions.h

Issue 21055011: First implementation of allocation elimination in Hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ported to x64 and ARM architectures. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 08667c994197356d3080e5c99fd9ec7b83853be8..1735c4f0989be75845b4b84c71240a0e3fb8d601 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -87,6 +87,7 @@ class LChunkBuilder;
V(CallNewArray) \
V(CallRuntime) \
V(CallStub) \
+ V(CapturedObject) \
V(Change) \
V(CheckFunction) \
V(CheckHeapObject) \
@@ -2946,6 +2947,7 @@ class HCheckHeapObject: public HUnaryOperation {
set_type(HType::NonPrimitive());
}
+ virtual bool HasEscapingOperandAt(int index) { return false; }
virtual Representation RequiredInputRepresentation(int index) {
return Representation::Tagged();
}
@@ -3429,20 +3431,10 @@ class HInductionVariableAnnotation : public HUnaryOperation {
};
-class HArgumentsObject: public HTemplateInstruction<0> {
+// Common base class for HArgumentsObject and HCapturedObject.
+class HDematerializedObject: public HTemplateInstruction<0> {
public:
- HArgumentsObject(int count, Zone* zone) : values_(count, zone) {
- set_representation(Representation::Tagged());
- SetFlag(kIsArguments);
- }
-
- const ZoneList<HValue*>* arguments_values() const { return &values_; }
- int arguments_count() const { return values_.length(); }
-
- void AddArgument(HValue* argument, Zone* zone) {
- values_.Add(NULL, zone); // Resize list.
- SetOperandAt(values_.length() - 1, argument);
- }
+ HDematerializedObject(int count, Zone* zone) : values_(count, zone) {}
virtual int OperandCount() { return values_.length(); }
virtual HValue* OperandAt(int index) const { return values_[index]; }
@@ -3452,17 +3444,56 @@ class HArgumentsObject: public HTemplateInstruction<0> {
return Representation::None();
}
- DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject)
-
protected:
virtual void InternalSetOperandAt(int index, HValue* value) {
values_[index] = value;
}
+ // List of values tracked by this marker.
+ ZoneList<HValue*> values_;
+
private:
virtual bool IsDeletable() const { return true; }
+};
- ZoneList<HValue*> values_;
+
+class HArgumentsObject: public HDematerializedObject {
+ public:
+ HArgumentsObject(int count, Zone* zone)
+ : HDematerializedObject(count, zone) {
+ set_representation(Representation::Tagged());
+ SetFlag(kIsArguments);
+ }
+
+ // The values contain a list of all elements in the arguments object
+ // including the receiver object, which is skipped when materializing.
+ const ZoneList<HValue*>* arguments_values() const { return &values_; }
+ int arguments_count() const { return values_.length(); }
+
+ void AddArgument(HValue* argument, Zone* zone) {
+ values_.Add(NULL, zone); // Resize list.
+ SetOperandAt(values_.length() - 1, argument);
+ }
+
+ DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject)
+};
+
+
+class HCapturedObject: public HDematerializedObject {
+ public:
+ HCapturedObject(int length, Zone* zone)
+ : HDematerializedObject(length, zone) {
+ set_representation(Representation::Tagged());
+ values_.AddBlock(NULL, length, zone); // Resize list.
+ }
+
+ // The values contain a list of all in-object properties inside the
+ // captured object and is index by field index. Properties in the
+ // properties or elements backing store are not tracked here.
+ const ZoneList<HValue*>* values() const { return &values_; }
+ int length() const { return values_.length(); }
+
+ DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
};
@@ -6286,7 +6317,6 @@ class HStoreKeyed
}
}
- virtual bool HasEscapingOperandAt(int index) { return index != 0; }
virtual Representation RequiredInputRepresentation(int index) {
// kind_fast: tagged[int32] = tagged
// kind_double: tagged[int32] = double

Powered by Google App Engine