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

Unified Diff: src/scopes.cc

Issue 1281883002: Group lexical context variables for faster look up. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: added comments and TODOs Created 5 years, 4 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/scopeinfo.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index 319aca518ed69187dc29cc817c58f9266b2a8700..ce06976c4c9d2369d208d41ccc53a9431f9cba8e 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -593,7 +593,11 @@ class VarAndOrder {
Variable* var() const { return var_; }
int order() const { return order_; }
static int Compare(const VarAndOrder* a, const VarAndOrder* b) {
- return a->order_ - b->order_;
+ // Sort lexical variables to the end of the list.
+ bool a_is_lexical = IsLexicalVariableMode(a->var()->mode());
+ bool b_is_lexical = IsLexicalVariableMode(b->var()->mode());
+ if (a_is_lexical == b_is_lexical) return a->order_ - b->order_;
+ return a_is_lexical ? 1 : -1;
}
private:
« no previous file with comments | « src/scopeinfo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698