OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 SmallMapList() {} | 270 SmallMapList() {} |
271 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} | 271 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} |
272 | 272 |
273 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } | 273 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } |
274 void Clear() { list_.Clear(); } | 274 void Clear() { list_.Clear(); } |
275 void Sort() { list_.Sort(); } | 275 void Sort() { list_.Sort(); } |
276 | 276 |
277 bool is_empty() const { return list_.is_empty(); } | 277 bool is_empty() const { return list_.is_empty(); } |
278 int length() const { return list_.length(); } | 278 int length() const { return list_.length(); } |
279 | 279 |
| 280 void AddMapIfMissing(Handle<Map> map, Zone* zone) { |
| 281 map = Map::CurrentMapForDeprecated(map); |
| 282 for (int i = 0; i < length(); ++i) { |
| 283 if (at(i).is_identical_to(map)) return; |
| 284 } |
| 285 Add(map, zone); |
| 286 } |
| 287 |
280 void Add(Handle<Map> handle, Zone* zone) { | 288 void Add(Handle<Map> handle, Zone* zone) { |
281 list_.Add(handle.location(), zone); | 289 list_.Add(handle.location(), zone); |
282 } | 290 } |
283 | 291 |
284 Handle<Map> at(int i) const { | 292 Handle<Map> at(int i) const { |
285 return Handle<Map>(list_.at(i)); | 293 return Handle<Map>(list_.at(i)); |
286 } | 294 } |
287 | 295 |
288 Handle<Map> first() const { return at(0); } | 296 Handle<Map> first() const { return at(0); } |
289 Handle<Map> last() const { return at(length() - 1); } | 297 Handle<Map> last() const { return at(length() - 1); } |
(...skipping 2748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3038 private: | 3046 private: |
3039 Isolate* isolate_; | 3047 Isolate* isolate_; |
3040 Zone* zone_; | 3048 Zone* zone_; |
3041 Visitor visitor_; | 3049 Visitor visitor_; |
3042 }; | 3050 }; |
3043 | 3051 |
3044 | 3052 |
3045 } } // namespace v8::internal | 3053 } } // namespace v8::internal |
3046 | 3054 |
3047 #endif // V8_AST_H_ | 3055 #endif // V8_AST_H_ |
OLD | NEW |