| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/ast.h" | 7 #include "src/ast.h" |
| 8 #include "src/scopes.h" | 8 #include "src/scopes.h" |
| 9 #include "src/variables.h" | 9 #include "src/variables.h" |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 bool is_valid_ref, Kind kind, | 36 bool is_valid_ref, Kind kind, |
| 37 InitializationFlag initialization_flag, | 37 InitializationFlag initialization_flag, |
| 38 MaybeAssignedFlag maybe_assigned_flag) | 38 MaybeAssignedFlag maybe_assigned_flag) |
| 39 : scope_(scope), | 39 : scope_(scope), |
| 40 name_(name), | 40 name_(name), |
| 41 mode_(mode), | 41 mode_(mode), |
| 42 kind_(kind), | 42 kind_(kind), |
| 43 location_(UNALLOCATED), | 43 location_(UNALLOCATED), |
| 44 index_(-1), | 44 index_(-1), |
| 45 initializer_position_(RelocInfo::kNoPosition), | 45 initializer_position_(RelocInfo::kNoPosition), |
| 46 has_strong_mode_reference_(false), |
| 47 strong_mode_reference_start_position_(RelocInfo::kNoPosition), |
| 48 strong_mode_reference_end_position_(RelocInfo::kNoPosition), |
| 46 local_if_not_shadowed_(NULL), | 49 local_if_not_shadowed_(NULL), |
| 47 is_valid_ref_(is_valid_ref), | 50 is_valid_ref_(is_valid_ref), |
| 48 force_context_allocation_(false), | 51 force_context_allocation_(false), |
| 49 is_used_(false), | 52 is_used_(false), |
| 50 initialization_flag_(initialization_flag), | 53 initialization_flag_(initialization_flag), |
| 51 maybe_assigned_(maybe_assigned_flag) { | 54 maybe_assigned_(maybe_assigned_flag) { |
| 52 // Var declared variables never need initialization. | 55 // Var declared variables never need initialization. |
| 53 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization)); | 56 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization)); |
| 54 } | 57 } |
| 55 | 58 |
| 56 | 59 |
| 57 bool Variable::IsGlobalObjectProperty() const { | 60 bool Variable::IsGlobalObjectProperty() const { |
| 58 // Temporaries are never global, they must always be allocated in the | 61 // Temporaries are never global, they must always be allocated in the |
| 59 // activation frame. | 62 // activation frame. |
| 60 return (IsDynamicVariableMode(mode_) || | 63 return (IsDynamicVariableMode(mode_) || |
| 61 (IsDeclaredVariableMode(mode_) && !IsLexicalVariableMode(mode_))) | 64 (IsDeclaredVariableMode(mode_) && !IsLexicalVariableMode(mode_))) |
| 62 && scope_ != NULL && scope_->is_script_scope(); | 65 && scope_ != NULL && scope_->is_script_scope(); |
| 63 } | 66 } |
| 64 | 67 |
| 65 | 68 |
| 66 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { | 69 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { |
| 67 int x = (*v)->index(); | 70 int x = (*v)->index(); |
| 68 int y = (*w)->index(); | 71 int y = (*w)->index(); |
| 69 // Consider sorting them according to type as well? | 72 // Consider sorting them according to type as well? |
| 70 return x - y; | 73 return x - y; |
| 71 } | 74 } |
| 72 | 75 |
| 73 } } // namespace v8::internal | 76 } } // namespace v8::internal |
| OLD | NEW |