| OLD | NEW |
| 1 // Copyright 2011 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 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 VariableMode mode, | 59 VariableMode mode, |
| 60 bool is_valid_LHS, | 60 bool is_valid_LHS, |
| 61 Kind kind, | 61 Kind kind, |
| 62 InitializationFlag initialization_flag) | 62 InitializationFlag initialization_flag) |
| 63 : scope_(scope), | 63 : scope_(scope), |
| 64 name_(name), | 64 name_(name), |
| 65 mode_(mode), | 65 mode_(mode), |
| 66 kind_(kind), | 66 kind_(kind), |
| 67 location_(UNALLOCATED), | 67 location_(UNALLOCATED), |
| 68 index_(-1), | 68 index_(-1), |
| 69 initializer_position_(RelocInfo::kNoPosition), | |
| 70 local_if_not_shadowed_(NULL), | 69 local_if_not_shadowed_(NULL), |
| 71 is_valid_LHS_(is_valid_LHS), | 70 is_valid_LHS_(is_valid_LHS), |
| 72 force_context_allocation_(false), | 71 force_context_allocation_(false), |
| 73 is_used_(false), | 72 is_used_(false), |
| 74 initialization_flag_(initialization_flag) { | 73 initialization_flag_(initialization_flag) { |
| 75 // Names must be canonicalized for fast equality checks. | 74 // Names must be canonicalized for fast equality checks. |
| 76 ASSERT(name->IsSymbol()); | 75 ASSERT(name->IsSymbol()); |
| 77 // Var declared variables never need initialization. | 76 // Var declared variables never need initialization. |
| 78 ASSERT(!(mode == VAR && initialization_flag == kNeedsInitialization)); | 77 ASSERT(!(mode == VAR && initialization_flag == kNeedsInitialization)); |
| 79 } | 78 } |
| 80 | 79 |
| 81 | 80 |
| 82 bool Variable::is_global() const { | 81 bool Variable::is_global() const { |
| 83 // Temporaries are never global, they must always be allocated in the | 82 // Temporaries are never global, they must always be allocated in the |
| 84 // activation frame. | 83 // activation frame. |
| 85 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); | 84 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); |
| 86 } | 85 } |
| 87 | 86 |
| 88 | 87 |
| 89 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { | 88 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { |
| 90 int x = (*v)->index(); | 89 int x = (*v)->index(); |
| 91 int y = (*w)->index(); | 90 int y = (*w)->index(); |
| 92 // Consider sorting them according to type as well? | 91 // Consider sorting them according to type as well? |
| 93 return x - y; | 92 return x - y; |
| 94 } | 93 } |
| 95 | 94 |
| 96 } } // namespace v8::internal | 95 } } // namespace v8::internal |
| OLD | NEW |