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/ast/variables.h" | 5 #include "src/ast/variables.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/globals.h" | 8 #include "src/globals.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 // ---------------------------------------------------------------------------- | 13 // ---------------------------------------------------------------------------- |
14 // Implementation Variable. | 14 // Implementation Variable. |
15 | 15 |
16 const char* Variable::Mode2String(VariableMode mode) { | 16 const char* Variable::Mode2String(VariableMode mode) { |
17 switch (mode) { | 17 switch (mode) { |
18 case VAR: return "VAR"; | 18 case VAR: return "VAR"; |
19 case CONST_LEGACY: return "CONST_LEGACY"; | |
20 case LET: return "LET"; | 19 case LET: return "LET"; |
21 case CONST: return "CONST"; | 20 case CONST: return "CONST"; |
22 case DYNAMIC: return "DYNAMIC"; | 21 case DYNAMIC: return "DYNAMIC"; |
23 case DYNAMIC_GLOBAL: return "DYNAMIC_GLOBAL"; | 22 case DYNAMIC_GLOBAL: return "DYNAMIC_GLOBAL"; |
24 case DYNAMIC_LOCAL: return "DYNAMIC_LOCAL"; | 23 case DYNAMIC_LOCAL: return "DYNAMIC_LOCAL"; |
25 case TEMPORARY: return "TEMPORARY"; | 24 case TEMPORARY: return "TEMPORARY"; |
26 } | 25 } |
27 UNREACHABLE(); | 26 UNREACHABLE(); |
28 return NULL; | 27 return NULL; |
29 } | 28 } |
(...skipping 29 matching lines...) Expand all Loading... |
59 bool Variable::IsStaticGlobalObjectProperty() const { | 58 bool Variable::IsStaticGlobalObjectProperty() const { |
60 // Temporaries are never global, they must always be allocated in the | 59 // Temporaries are never global, they must always be allocated in the |
61 // activation frame. | 60 // activation frame. |
62 return (IsDeclaredVariableMode(mode()) && !IsLexicalVariableMode(mode())) && | 61 return (IsDeclaredVariableMode(mode()) && !IsLexicalVariableMode(mode())) && |
63 scope_ != NULL && scope_->is_script_scope(); | 62 scope_ != NULL && scope_->is_script_scope(); |
64 } | 63 } |
65 | 64 |
66 | 65 |
67 } // namespace internal | 66 } // namespace internal |
68 } // namespace v8 | 67 } // namespace v8 |
OLD | NEW |