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

Side by Side Diff: src/scopes.cc

Issue 1290053002: Revert of Group lexical context variables for faster look up. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « src/scopeinfo.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/messages.h" 9 #include "src/messages.h"
10 #include "src/parser.h" 10 #include "src/parser.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 return NULL; 586 return NULL;
587 } 587 }
588 588
589 589
590 class VarAndOrder { 590 class VarAndOrder {
591 public: 591 public:
592 VarAndOrder(Variable* var, int order) : var_(var), order_(order) { } 592 VarAndOrder(Variable* var, int order) : var_(var), order_(order) { }
593 Variable* var() const { return var_; } 593 Variable* var() const { return var_; }
594 int order() const { return order_; } 594 int order() const { return order_; }
595 static int Compare(const VarAndOrder* a, const VarAndOrder* b) { 595 static int Compare(const VarAndOrder* a, const VarAndOrder* b) {
596 // Sort lexical variables to the end of the list. 596 return a->order_ - b->order_;
597 bool a_is_lexical = IsLexicalVariableMode(a->var()->mode());
598 bool b_is_lexical = IsLexicalVariableMode(b->var()->mode());
599 if (a_is_lexical == b_is_lexical) return a->order_ - b->order_;
600 return a_is_lexical ? 1 : -1;
601 } 597 }
602 598
603 private: 599 private:
604 Variable* var_; 600 Variable* var_;
605 int order_; 601 int order_;
606 }; 602 };
607 603
608 604
609 void Scope::CollectStackAndContextLocals( 605 void Scope::CollectStackAndContextLocals(
610 ZoneList<Variable*>* stack_locals, ZoneList<Variable*>* context_locals, 606 ZoneList<Variable*>* stack_locals, ZoneList<Variable*>* context_locals,
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 function_ != NULL && function_->proxy()->var()->IsContextSlot(); 1606 function_ != NULL && function_->proxy()->var()->IsContextSlot();
1611 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - 1607 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
1612 (is_function_var_in_context ? 1 : 0); 1608 (is_function_var_in_context ? 1 : 0);
1613 } 1609 }
1614 1610
1615 1611
1616 int Scope::ContextGlobalCount() const { return num_global_slots(); } 1612 int Scope::ContextGlobalCount() const { return num_global_slots(); }
1617 1613
1618 } // namespace internal 1614 } // namespace internal
1619 } // namespace v8 1615 } // namespace v8
OLDNEW
« 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