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

Unified Diff: src/hydrogen-instructions.h

Issue 15533004: Liveness analysis for environment slots in Hydrogen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 7 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-environment-liveness.cc ('k') | src/hydrogen-instructions.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 d06e3184f817f2849d6e53395e3bff72aa061621..395f0208f70603a05c7fb0c46e0acf16982a0e41 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -111,6 +111,7 @@ class LChunkBuilder;
V(DummyUse) \
V(ElementsKind) \
V(EnterInlined) \
+ V(EnvironmentMarker) \
V(FixedArrayBaseLength) \
V(ForceRepresentation) \
V(FunctionLiteral) \
@@ -812,7 +813,13 @@ class HValue: public ZoneObject {
kHasNoObservableSideEffects,
// Indicates the instruction is live during dead code elimination.
kIsLive,
- kLastFlag = kIDefsProcessingDone
+
+ // HEnvironmentMarkers are deleted before dead code
+ // elimination takes place, so they can repurpose the kIsLive flag:
+ kEndsLiveRange = kIsLive,
+
+ // TODO(everyone): Don't forget to update this!
+ kLastFlag = kIsLive
};
STATIC_ASSERT(kLastFlag < kBitsPerInt);
@@ -1477,8 +1484,13 @@ class HDebugBreak: public HTemplateInstruction<0> {
class HDeoptimize: public HControlInstruction {
public:
- HDeoptimize(int environment_length, Zone* zone)
- : values_(environment_length, zone) { }
+ HDeoptimize(int environment_length,
+ int first_local_index,
+ int first_expression_index,
+ Zone* zone)
+ : values_(environment_length, zone),
+ first_local_index_(first_local_index),
+ first_expression_index_(first_expression_index) { }
virtual Representation RequiredInputRepresentation(int index) {
return Representation::None();
@@ -1501,6 +1513,8 @@ class HDeoptimize: public HControlInstruction {
values_.Add(NULL, zone);
SetOperandAt(values_.length() - 1, value);
}
+ int first_local_index() { return first_local_index_; }
+ int first_expression_index() { return first_expression_index_; }
DECLARE_CONCRETE_INSTRUCTION(Deoptimize)
@@ -1516,6 +1530,8 @@ class HDeoptimize: public HControlInstruction {
private:
ZoneList<HValue*> values_;
+ int first_local_index_;
+ int first_expression_index_;
};
@@ -1827,6 +1843,12 @@ class HSimulate: public HInstruction {
void AddPushedValue(HValue* value) {
AddValue(kNoIndex, value);
}
+ int ToOperandIndex(int environment_index) {
+ for (int i = 0; i < assigned_indexes_.length(); ++i) {
+ if (assigned_indexes_[i] == environment_index) return i;
+ }
+ return -1;
+ }
virtual int OperandCount() { return values_.length(); }
virtual HValue* OperandAt(int index) const { return values_[index]; }
@@ -1841,6 +1863,8 @@ class HSimulate: public HInstruction {
#ifdef DEBUG
virtual void Verify();
+ void set_closure(Handle<JSFunction> closure) { closure_ = closure; }
+ Handle<JSFunction> closure() const { return closure_; }
#endif
protected:
@@ -1864,6 +1888,52 @@ class HSimulate: public HInstruction {
ZoneList<int> assigned_indexes_;
Zone* zone_;
RemovableSimulate removable_;
+
+#ifdef DEBUG
+ Handle<JSFunction> closure_;
+#endif
+};
+
+
+class HEnvironmentMarker: public HTemplateInstruction<1> {
+ public:
+ enum Kind { BIND, LOOKUP };
+
+ HEnvironmentMarker(Kind kind, int index)
+ : kind_(kind), index_(index), next_simulate_(NULL) { }
+
+ Kind kind() { return kind_; }
+ int index() { return index_; }
+ HSimulate* next_simulate() { return next_simulate_; }
+ void set_next_simulate(HSimulate* simulate) {
+ next_simulate_ = simulate;
+ }
+
+ virtual Representation RequiredInputRepresentation(int index) {
+ return Representation::None();
+ }
+
+ virtual void PrintDataTo(StringStream* stream);
+
+#ifdef DEBUG
+ void set_closure(Handle<JSFunction> closure) {
+ ASSERT(closure_.is_null());
+ ASSERT(!closure.is_null());
+ closure_ = closure;
+ }
+ Handle<JSFunction> closure() const { return closure_; }
+#endif
+
+ DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker);
+
+ private:
+ Kind kind_;
+ int index_;
+ HSimulate* next_simulate_;
+
+#ifdef DEBUG
+ Handle<JSFunction> closure_;
+#endif
};
@@ -1920,7 +1990,8 @@ class HEnterInlined: public HTemplateInstruction<0> {
InliningKind inlining_kind,
Variable* arguments_var,
ZoneList<HValue*>* arguments_values,
- bool undefined_receiver)
+ bool undefined_receiver,
+ Zone* zone)
: closure_(closure),
arguments_count_(arguments_count),
arguments_pushed_(false),
@@ -1928,9 +1999,13 @@ class HEnterInlined: public HTemplateInstruction<0> {
inlining_kind_(inlining_kind),
arguments_var_(arguments_var),
arguments_values_(arguments_values),
- undefined_receiver_(undefined_receiver) {
+ undefined_receiver_(undefined_receiver),
+ return_targets_(2, zone) {
}
+ void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone);
+ ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; }
+
virtual void PrintDataTo(StringStream* stream);
Handle<JSFunction> closure() const { return closure_; }
@@ -1959,6 +2034,7 @@ class HEnterInlined: public HTemplateInstruction<0> {
Variable* arguments_var_;
ZoneList<HValue*>* arguments_values_;
bool undefined_receiver_;
+ ZoneList<HBasicBlock*> return_targets_;
};
« no previous file with comments | « src/hydrogen-environment-liveness.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698