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

Unified Diff: src/typing.h

Issue 112933002: Fix off-by-one error in AstTyper, part 2. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 | « no previous file | test/mjsunit/regress/regress-param-local-type.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/typing.h
diff --git a/src/typing.h b/src/typing.h
index 6298e5a41b3d6824f45cc6879e408f48014ce9b0..a111ae5fd1594d14868ba2db80df27a34e2caf1e 100644
--- a/src/typing.h
+++ b/src/typing.h
@@ -83,8 +83,11 @@ class AstTyper: public AstVisitor {
void ExitEffects() { store_ = store_.Pop(); }
int variable_index(Variable* var) {
+ // Stack locals have the range [0 .. l]
+ // Parameters have the range [-1 .. p]
+ // We map this to [-p-2 .. -1, 0 .. l]
return var->IsStackLocal() ? var->index() :
- var->IsParameter() ? -var->index() - 1 : kNoVar;
+ var->IsParameter() ? -var->index() - 2 : kNoVar;
}
void VisitDeclarations(ZoneList<Declaration*>* declarations);
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-param-local-type.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698