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

Unified Diff: src/crankshaft/typing.cc

Issue 2324783002: Include only stuff you need, part 9: variables.h (Closed)
Patch Set: rebased Created 4 years, 3 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/crankshaft/typing.h ('k') | src/globals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/typing.cc
diff --git a/src/crankshaft/typing.cc b/src/crankshaft/typing.cc
index 3b95841afde255b3b425c104a1ee5931e670e44a..bf2c8037ea5ed2e7521caf051da3540122989a62 100644
--- a/src/crankshaft/typing.cc
+++ b/src/crankshaft/typing.cc
@@ -6,6 +6,7 @@
#include "src/ast/compile-time-value.h"
#include "src/ast/scopes.h"
+#include "src/ast/variables.h"
#include "src/frames-inl.h"
#include "src/frames.h"
#include "src/ostreams.h"
@@ -771,6 +772,14 @@ void AstTyper::VisitRewritableExpression(RewritableExpression* expr) {
Visit(expr->expression());
}
+int AstTyper::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()
+ ? stack_local_index(var->index())
+ : var->IsParameter() ? parameter_index(var->index()) : kNoVar;
+}
void AstTyper::VisitDeclarations(ZoneList<Declaration*>* decls) {
for (int i = 0; i < decls->length(); ++i) {
« no previous file with comments | « src/crankshaft/typing.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698