| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 class BufferedZoneList { | 185 class BufferedZoneList { |
| 186 public: | 186 public: |
| 187 BufferedZoneList() : list_(NULL), last_(NULL) {} | 187 BufferedZoneList() : list_(NULL), last_(NULL) {} |
| 188 | 188 |
| 189 // Adds element at end of list. This element is buffered and can | 189 // Adds element at end of list. This element is buffered and can |
| 190 // be read using last() or removed using RemoveLast until a new Add or until | 190 // be read using last() or removed using RemoveLast until a new Add or until |
| 191 // RemoveLast or GetList has been called. | 191 // RemoveLast or GetList has been called. |
| 192 void Add(T* value) { | 192 void Add(T* value) { |
| 193 if (last_ != NULL) { | 193 if (last_ != NULL) { |
| 194 if (list_ == NULL) { | 194 if (list_ == NULL) { |
| 195 list_ = new ZoneList<T*>(initial_size); | 195 list_ = ZoneList<T*>::New(ZONE, initial_size); |
| 196 } | 196 } |
| 197 list_->Add(last_); | 197 list_->Add(last_); |
| 198 } | 198 } |
| 199 last_ = value; | 199 last_ = value; |
| 200 } | 200 } |
| 201 | 201 |
| 202 T* last() { | 202 T* last() { |
| 203 ASSERT(last_ != NULL); | 203 ASSERT(last_ != NULL); |
| 204 return last_; | 204 return last_; |
| 205 } | 205 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 234 last_ = NULL; | 234 last_ = NULL; |
| 235 } | 235 } |
| 236 | 236 |
| 237 int length() { | 237 int length() { |
| 238 int length = (list_ == NULL) ? 0 : list_->length(); | 238 int length = (list_ == NULL) ? 0 : list_->length(); |
| 239 return length + ((last_ == NULL) ? 0 : 1); | 239 return length + ((last_ == NULL) ? 0 : 1); |
| 240 } | 240 } |
| 241 | 241 |
| 242 ZoneList<T*>* GetList() { | 242 ZoneList<T*>* GetList() { |
| 243 if (list_ == NULL) { | 243 if (list_ == NULL) { |
| 244 list_ = new ZoneList<T*>(initial_size); | 244 list_ = ZoneList<T*>::New(ZONE, initial_size); |
| 245 } | 245 } |
| 246 if (last_ != NULL) { | 246 if (last_ != NULL) { |
| 247 list_->Add(last_); | 247 list_->Add(last_); |
| 248 last_ = NULL; | 248 last_ = NULL; |
| 249 } | 249 } |
| 250 return list_; | 250 return list_; |
| 251 } | 251 } |
| 252 | 252 |
| 253 private: | 253 private: |
| 254 ZoneList<T*>* list_; | 254 ZoneList<T*>* list_; |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 private: | 749 private: |
| 750 static const int kTypeSlot = 0; | 750 static const int kTypeSlot = 0; |
| 751 static const int kElementsSlot = 1; | 751 static const int kElementsSlot = 1; |
| 752 | 752 |
| 753 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 753 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 754 }; | 754 }; |
| 755 | 755 |
| 756 } } // namespace v8::internal | 756 } } // namespace v8::internal |
| 757 | 757 |
| 758 #endif // V8_PARSER_H_ | 758 #endif // V8_PARSER_H_ |
| OLD | NEW |