| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "ast.h" | 30 #include "ast.h" |
| 31 #include "scopes.h" | 31 #include "scopes.h" |
| 32 #include "variables.h" | 32 #include "variables.h" |
| 33 | 33 |
| 34 namespace v8 { | 34 namespace v8 { |
| 35 namespace internal { | 35 namespace internal { |
| 36 | 36 |
| 37 // ---------------------------------------------------------------------------- | 37 // ---------------------------------------------------------------------------- |
| 38 // Implementation StaticType. | |
| 39 | |
| 40 | |
| 41 const char* StaticType::Type2String(StaticType* type) { | |
| 42 switch (type->kind_) { | |
| 43 case UNKNOWN: | |
| 44 return "UNKNOWN"; | |
| 45 case LIKELY_SMI: | |
| 46 return "LIKELY_SMI"; | |
| 47 default: | |
| 48 UNREACHABLE(); | |
| 49 } | |
| 50 return "UNREACHABLE"; | |
| 51 } | |
| 52 | |
| 53 | |
| 54 // ---------------------------------------------------------------------------- | |
| 55 // Implementation Variable. | 38 // Implementation Variable. |
| 56 | 39 |
| 57 | |
| 58 const char* Variable::Mode2String(Mode mode) { | 40 const char* Variable::Mode2String(Mode mode) { |
| 59 switch (mode) { | 41 switch (mode) { |
| 60 case VAR: return "VAR"; | 42 case VAR: return "VAR"; |
| 61 case CONST: return "CONST"; | 43 case CONST: return "CONST"; |
| 62 case DYNAMIC: return "DYNAMIC"; | 44 case DYNAMIC: return "DYNAMIC"; |
| 63 case DYNAMIC_GLOBAL: return "DYNAMIC_GLOBAL"; | 45 case DYNAMIC_GLOBAL: return "DYNAMIC_GLOBAL"; |
| 64 case DYNAMIC_LOCAL: return "DYNAMIC_LOCAL"; | 46 case DYNAMIC_LOCAL: return "DYNAMIC_LOCAL"; |
| 65 case INTERNAL: return "INTERNAL"; | 47 case INTERNAL: return "INTERNAL"; |
| 66 case TEMPORARY: return "TEMPORARY"; | 48 case TEMPORARY: return "TEMPORARY"; |
| 67 } | 49 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 105 } |
| 124 | 106 |
| 125 | 107 |
| 126 bool Variable::is_global() const { | 108 bool Variable::is_global() const { |
| 127 // Temporaries are never global, they must always be allocated in the | 109 // Temporaries are never global, they must always be allocated in the |
| 128 // activation frame. | 110 // activation frame. |
| 129 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); | 111 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); |
| 130 } | 112 } |
| 131 | 113 |
| 132 } } // namespace v8::internal | 114 } } // namespace v8::internal |
| OLD | NEW |