| OLD | NEW | 
|     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  Loading... | 
|   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     return a->order_ - b->order_; |   596     // Sort lexical variables to the end of the list. | 
 |   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; | 
|   597   } |   601   } | 
|   598  |   602  | 
|   599  private: |   603  private: | 
|   600   Variable* var_; |   604   Variable* var_; | 
|   601   int order_; |   605   int order_; | 
|   602 }; |   606 }; | 
|   603  |   607  | 
|   604  |   608  | 
|   605 void Scope::CollectStackAndContextLocals( |   609 void Scope::CollectStackAndContextLocals( | 
|   606     ZoneList<Variable*>* stack_locals, ZoneList<Variable*>* context_locals, |   610     ZoneList<Variable*>* stack_locals, ZoneList<Variable*>* context_locals, | 
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1606       function_ != NULL && function_->proxy()->var()->IsContextSlot(); |  1610       function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 
|  1607   return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |  1611   return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 
|  1608          (is_function_var_in_context ? 1 : 0); |  1612          (is_function_var_in_context ? 1 : 0); | 
|  1609 } |  1613 } | 
|  1610  |  1614  | 
|  1611  |  1615  | 
|  1612 int Scope::ContextGlobalCount() const { return num_global_slots(); } |  1616 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 
|  1613  |  1617  | 
|  1614 }  // namespace internal |  1618 }  // namespace internal | 
|  1615 }  // namespace v8 |  1619 }  // namespace v8 | 
| OLD | NEW |