Index: src/compiler/ast-graph-builder.h |
diff --git a/src/compiler/ast-graph-builder.h b/src/compiler/ast-graph-builder.h |
index aa874be5bdff7122b26fb78568d49b8536d6eaf3..4862525301d73a17c63c56852dfd9885ae33448b 100644 |
--- a/src/compiler/ast-graph-builder.h |
+++ b/src/compiler/ast-graph-builder.h |
@@ -348,21 +348,29 @@ class AstGraphBuilder::Environment : public ZoneObject { |
// Operations on parameter or local variables. The parameter indices are |
// shifted by 1 (receiver is parameter index -1 but environment index 0). |
void Bind(Variable* variable, Node* node) { |
- DCHECK(variable->IsStackAllocated()); |
- if (variable->IsParameter()) { |
- values()->at(variable->index() + 1) = node; |
+ if (variable->is_this()) { |
+ values()->at(0) = node; |
} else { |
- DCHECK(variable->IsStackLocal()); |
- values()->at(variable->index() + parameters_count_) = node; |
+ DCHECK(variable->IsStackAllocated()); |
+ if (variable->IsParameter()) { |
+ values()->at(variable->index() + 1) = node; |
+ } else { |
+ DCHECK(variable->IsStackLocal()); |
+ values()->at(variable->index() + parameters_count_) = node; |
+ } |
} |
} |
Node* Lookup(Variable* variable) { |
- DCHECK(variable->IsStackAllocated()); |
- if (variable->IsParameter()) { |
- return values()->at(variable->index() + 1); |
+ if (variable->is_this()) { |
+ return values()->at(0); |
} else { |
- DCHECK(variable->IsStackLocal()); |
- return values()->at(variable->index() + parameters_count_); |
+ DCHECK(variable->IsStackAllocated()); |
+ if (variable->IsParameter()) { |
+ return values()->at(variable->index() + 1); |
+ } else { |
+ DCHECK(variable->IsStackLocal()); |
+ return values()->at(variable->index() + parameters_count_); |
+ } |
} |
} |