Chromium Code Reviews| Index: src/hydrogen.h |
| diff --git a/src/hydrogen.h b/src/hydrogen.h |
| index bd51dd15651cc10fb53e2454fca2cfe1c6ea1451..876b1cf4f26cee9e0246e8096ad55208749cbe11 100644 |
| --- a/src/hydrogen.h |
| +++ b/src/hydrogen.h |
| @@ -322,6 +322,7 @@ class HEnvironment: public ZoneObject { |
| return &assigned_variables_; |
| } |
| int parameter_count() const { return parameter_count_; } |
| + int specials_count() const { return specials_count_; } |
| int local_count() const { return local_count_; } |
| HEnvironment* outer() const { return outer_; } |
| int pop_count() const { return pop_count_; } |
| @@ -331,6 +332,9 @@ class HEnvironment: public ZoneObject { |
| void set_ast_id(int id) { ast_id_ = id; } |
| int length() const { return values_.length(); } |
| + bool is_special_index(int i) const { |
| + return i >= parameter_count() && i < parameter_count() + specials_count(); |
| + } |
| void Bind(Variable* variable, HValue* value) { |
| Bind(IndexFor(variable), value); |
| @@ -348,6 +352,11 @@ class HEnvironment: public ZoneObject { |
| return result; |
| } |
| + HValue* LookupContext() const { |
|
Kevin Millikin (Chromium)
2011/05/06 12:29:45
Probably should have a BindContext function too, s
|
| + // Return first special. |
| + return Lookup(parameter_count()); |
| + } |
| + |
| void Push(HValue* value) { |
| ASSERT(value != NULL); |
| ++push_count_; |
| @@ -423,15 +432,18 @@ class HEnvironment: public ZoneObject { |
| int IndexFor(Variable* variable) const { |
| Slot* slot = variable->AsSlot(); |
| ASSERT(slot != NULL && slot->IsStackAllocated()); |
| - int shift = (slot->type() == Slot::PARAMETER) ? 1 : parameter_count_; |
| + int shift = (slot->type() == Slot::PARAMETER) |
| + ? 1 |
| + : parameter_count_ + specials_count_; |
| return slot->index() + shift; |
| } |
| Handle<JSFunction> closure_; |
| - // Value array [parameters] [locals] [temporaries]. |
| + // Value array [parameters] [specials] [locals] [temporaries]. |
| ZoneList<HValue*> values_; |
| ZoneList<int> assigned_variables_; |
| int parameter_count_; |
| + int specials_count_; |
| int local_count_; |
| HEnvironment* outer_; |
| int pop_count_; |