OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 struct Value { | 214 struct Value { |
215 Value(Variable::Mode mode, int index) { | 215 Value(Variable::Mode mode, int index) { |
216 ASSERT(ModeField::is_valid(mode)); | 216 ASSERT(ModeField::is_valid(mode)); |
217 ASSERT(IndexField::is_valid(index)); | 217 ASSERT(IndexField::is_valid(index)); |
218 value_ = ModeField::encode(mode) | IndexField::encode(index); | 218 value_ = ModeField::encode(mode) | IndexField::encode(index); |
219 ASSERT(mode == this->mode()); | 219 ASSERT(mode == this->mode()); |
220 ASSERT(index == this->index()); | 220 ASSERT(index == this->index()); |
221 } | 221 } |
222 | 222 |
223 inline Value(uint32_t value) : value_(value) {} | 223 explicit inline Value(uint32_t value) : value_(value) {} |
224 | 224 |
225 uint32_t raw() { return value_; } | 225 uint32_t raw() { return value_; } |
226 | 226 |
227 Variable::Mode mode() { return ModeField::decode(value_); } | 227 Variable::Mode mode() { return ModeField::decode(value_); } |
228 | 228 |
229 int index() { return IndexField::decode(value_); } | 229 int index() { return IndexField::decode(value_); } |
230 | 230 |
231 // Bit fields in value_ (type, shift, size). Must be public so the | 231 // Bit fields in value_ (type, shift, size). Must be public so the |
232 // constants can be embedded in generated code. | 232 // constants can be embedded in generated code. |
233 class ModeField: public BitField<Variable::Mode, 0, 3> {}; | 233 class ModeField: public BitField<Variable::Mode, 0, 3> {}; |
234 class IndexField: public BitField<int, 3, 32-3> {}; | 234 class IndexField: public BitField<int, 3, 32-3> {}; |
235 private: | 235 private: |
236 uint32_t value_; | 236 uint32_t value_; |
237 }; | 237 }; |
238 | 238 |
239 Key keys_[kLength]; | 239 Key keys_[kLength]; |
240 uint32_t values_[kLength]; | 240 uint32_t values_[kLength]; |
241 | 241 |
242 friend class Isolate; | 242 friend class Isolate; |
243 DISALLOW_COPY_AND_ASSIGN(ContextSlotCache); | 243 DISALLOW_COPY_AND_ASSIGN(ContextSlotCache); |
244 }; | 244 }; |
245 | 245 |
246 | 246 |
247 } } // namespace v8::internal | 247 } } // namespace v8::internal |
248 | 248 |
249 #endif // V8_SCOPEINFO_H_ | 249 #endif // V8_SCOPEINFO_H_ |
OLD | NEW |