OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 bool Type::InUnion(Handle<Unioned> unioned, int current_size) { | 312 bool Type::InUnion(Handle<Unioned> unioned, int current_size) { |
313 ASSERT(!this->is_union()); | 313 ASSERT(!this->is_union()); |
314 for (int i = 0; i < current_size; ++i) { | 314 for (int i = 0; i < current_size; ++i) { |
315 Handle<Type> type = union_get(unioned, i); | 315 Handle<Type> type = union_get(unioned, i); |
316 if (this->Is(type)) return true; | 316 if (this->Is(type)) return true; |
317 } | 317 } |
318 return false; | 318 return false; |
319 } | 319 } |
320 | 320 |
| 321 |
321 // Get non-bitsets from this which are not subsumed by union, store at unioned, | 322 // Get non-bitsets from this which are not subsumed by union, store at unioned, |
322 // starting at index. Returns updated index. | 323 // starting at index. Returns updated index. |
323 int Type::ExtendUnion(Handle<Unioned> result, int current_size) { | 324 int Type::ExtendUnion(Handle<Unioned> result, int current_size) { |
324 int old_size = current_size; | 325 int old_size = current_size; |
325 if (this->is_class() || this->is_constant()) { | 326 if (this->is_class() || this->is_constant()) { |
326 if (!this->InUnion(result, old_size)) result->set(current_size++, this); | 327 if (!this->InUnion(result, old_size)) result->set(current_size++, this); |
327 } else if (this->is_union()) { | 328 } else if (this->is_union()) { |
328 Handle<Unioned> unioned = this->as_union(); | 329 Handle<Unioned> unioned = this->as_union(); |
329 for (int i = 0; i < unioned->length(); ++i) { | 330 for (int i = 0; i < unioned->length(); ++i) { |
330 Handle<Type> type = union_get(unioned, i); | 331 Handle<Type> type = union_get(unioned, i); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 471 } |
471 | 472 |
472 | 473 |
473 Type* Type::Optional(Handle<Type> type) { | 474 Type* Type::Optional(Handle<Type> type) { |
474 return type->is_bitset() | 475 return type->is_bitset() |
475 ? from_bitset(type->as_bitset() | kUndefined) | 476 ? from_bitset(type->as_bitset() | kUndefined) |
476 : Union(type, Undefined()->handle_via_isolate_of(*type)); | 477 : Union(type, Undefined()->handle_via_isolate_of(*type)); |
477 } | 478 } |
478 | 479 |
479 } } // namespace v8::internal | 480 } } // namespace v8::internal |
OLD | NEW |