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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 for (int i = 0; i < unioned->length(); ++i) { | 118 for (int i = 0; i < unioned->length(); ++i) { |
119 bitset |= union_get(unioned, i)->LubBitset(); | 119 bitset |= union_get(unioned, i)->LubBitset(); |
120 } | 120 } |
121 return bitset; | 121 return bitset; |
122 } else { | 122 } else { |
123 Map* map = NULL; | 123 Map* map = NULL; |
124 if (this->is_class()) { | 124 if (this->is_class()) { |
125 map = *this->as_class(); | 125 map = *this->as_class(); |
126 } else { | 126 } else { |
127 Handle<v8::internal::Object> value = this->as_constant(); | 127 Handle<v8::internal::Object> value = this->as_constant(); |
128 if (value->IsSmi()) return kInteger31; | 128 if (value->IsSmi()) return kSmi; |
129 map = HeapObject::cast(*value)->map(); | 129 map = HeapObject::cast(*value)->map(); |
130 if (map->instance_type() == ODDBALL_TYPE) { | 130 if (map->instance_type() == ODDBALL_TYPE) { |
131 if (value->IsUndefined()) return kUndefined; | 131 if (value->IsUndefined()) return kUndefined; |
132 if (value->IsNull()) return kNull; | 132 if (value->IsNull()) return kNull; |
133 if (value->IsTrue() || value->IsFalse()) return kBoolean; | 133 if (value->IsTrue() || value->IsFalse()) return kBoolean; |
134 } | 134 } |
135 } | 135 } |
136 switch (map->instance_type()) { | 136 switch (map->instance_type()) { |
137 case STRING_TYPE: | 137 case STRING_TYPE: |
138 case ASCII_STRING_TYPE: | 138 case ASCII_STRING_TYPE: |
(...skipping 29 matching lines...) Expand all Loading... |
168 case JS_OBJECT_TYPE: | 168 case JS_OBJECT_TYPE: |
169 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: | 169 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
170 case JS_GENERATOR_OBJECT_TYPE: | 170 case JS_GENERATOR_OBJECT_TYPE: |
171 case JS_MODULE_TYPE: | 171 case JS_MODULE_TYPE: |
172 case JS_GLOBAL_OBJECT_TYPE: | 172 case JS_GLOBAL_OBJECT_TYPE: |
173 case JS_BUILTINS_OBJECT_TYPE: | 173 case JS_BUILTINS_OBJECT_TYPE: |
174 case JS_GLOBAL_PROXY_TYPE: | 174 case JS_GLOBAL_PROXY_TYPE: |
175 case JS_ARRAY_BUFFER_TYPE: | 175 case JS_ARRAY_BUFFER_TYPE: |
176 case JS_TYPED_ARRAY_TYPE: | 176 case JS_TYPED_ARRAY_TYPE: |
177 case JS_DATA_VIEW_TYPE: | 177 case JS_DATA_VIEW_TYPE: |
| 178 case JS_SET_TYPE: |
| 179 case JS_MAP_TYPE: |
178 case JS_WEAK_MAP_TYPE: | 180 case JS_WEAK_MAP_TYPE: |
179 case JS_REGEXP_TYPE: | |
180 if (map->is_undetectable()) return kUndetectable; | 181 if (map->is_undetectable()) return kUndetectable; |
181 return kOtherObject; | 182 return kOtherObject; |
182 case JS_ARRAY_TYPE: | 183 case JS_ARRAY_TYPE: |
183 return kArray; | 184 return kArray; |
184 case JS_FUNCTION_TYPE: | 185 case JS_FUNCTION_TYPE: |
185 return kFunction; | 186 return kFunction; |
| 187 case JS_REGEXP_TYPE: |
| 188 return kRegExp; |
186 case JS_PROXY_TYPE: | 189 case JS_PROXY_TYPE: |
187 case JS_FUNCTION_PROXY_TYPE: | 190 case JS_FUNCTION_PROXY_TYPE: |
188 return kProxy; | 191 return kProxy; |
189 case MAP_TYPE: | 192 case MAP_TYPE: |
190 // When compiling stub templates, the meta map is used as a place holder | 193 // When compiling stub templates, the meta map is used as a place holder |
191 // for the actual map with which the template is later instantiated. | 194 // for the actual map with which the template is later instantiated. |
192 // We treat it as a kind of type variable whose upper bound is Any. | 195 // We treat it as a kind of type variable whose upper bound is Any. |
193 // TODO(rossberg): for caching of CompareNilIC stubs to work correctly, | 196 // TODO(rossberg): for caching of CompareNilIC stubs to work correctly, |
194 // we must exclude Undetectable here. This makes no sense, really, | 197 // we must exclude Undetectable here. This makes no sense, really, |
195 // because it means that the template isn't actually parametric. | 198 // because it means that the template isn't actually parametric. |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 465 } |
463 | 466 |
464 | 467 |
465 Type* Type::Optional(Handle<Type> type) { | 468 Type* Type::Optional(Handle<Type> type) { |
466 return type->is_bitset() | 469 return type->is_bitset() |
467 ? from_bitset(type->as_bitset() | kUndefined) | 470 ? from_bitset(type->as_bitset() | kUndefined) |
468 : Union(type, Undefined()->handle_via_isolate_of(*type)); | 471 : Union(type, Undefined()->handle_via_isolate_of(*type)); |
469 } | 472 } |
470 | 473 |
471 } } // namespace v8::internal | 474 } } // namespace v8::internal |
OLD | NEW |