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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 | 174 |
175 | 175 |
176 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( | 176 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( |
177 ObjectLiteral::Property* prop) { | 177 ObjectLiteral::Property* prop) { |
178 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); | 178 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); |
179 return map_or_code->IsMap(); | 179 return map_or_code->IsMap(); |
180 } | 180 } |
181 | 181 |
182 | 182 |
183 bool TypeFeedbackOracle::IsForInFastCase(ForInStatement* stmt) { | 183 byte TypeFeedbackOracle::ForInType(ForInStatement* stmt) { |
184 Handle<Object> value = GetInfo(stmt->ForInFeedbackId()); | 184 Handle<Object> value = GetInfo(stmt->ForInFeedbackId()); |
185 return value->IsSmi() && | 185 return value->IsSmi() && |
186 Smi::cast(*value)->value() == TypeFeedbackCells::kForInFastCaseMarker; | 186 Smi::cast(*value)->value() == TypeFeedbackCells::kForInFastCaseMarker |
| 187 ? ForInStatement::FAST_FOR_IN : ForInStatement::SLOW_FOR_IN; |
187 } | 188 } |
188 | 189 |
189 | 190 |
190 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { | 191 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { |
191 ASSERT(LoadIsMonomorphicNormal(expr)); | 192 ASSERT(LoadIsMonomorphicNormal(expr)); |
192 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); | 193 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); |
193 if (map_or_code->IsCode()) { | 194 if (map_or_code->IsCode()) { |
194 Handle<Code> code = Handle<Code>::cast(map_or_code); | 195 Handle<Code> code = Handle<Code>::cast(map_or_code); |
195 Map* first_map = code->FindFirstMap(); | 196 Map* first_map = code->FindFirstMap(); |
196 ASSERT(first_map != NULL); | 197 ASSERT(first_map != NULL); |
(...skipping 15 matching lines...) Expand all Loading... |
212 ASSERT(first_map != NULL); | 213 ASSERT(first_map != NULL); |
213 return CanRetainOtherContext(first_map, *native_context_) | 214 return CanRetainOtherContext(first_map, *native_context_) |
214 ? Handle<Map>::null() | 215 ? Handle<Map>::null() |
215 : Handle<Map>(first_map); | 216 : Handle<Map>(first_map); |
216 } | 217 } |
217 return Handle<Map>::cast(map_or_code); | 218 return Handle<Map>::cast(map_or_code); |
218 } | 219 } |
219 | 220 |
220 | 221 |
221 Handle<Map> TypeFeedbackOracle::CompareNilMonomorphicReceiverType( | 222 Handle<Map> TypeFeedbackOracle::CompareNilMonomorphicReceiverType( |
222 TypeFeedbackId id) { | 223 CompareOperation* expr) { |
223 Handle<Object> maybe_code = GetInfo(id); | 224 Handle<Object> maybe_code = GetInfo(expr->CompareOperationFeedbackId()); |
224 if (maybe_code->IsCode()) { | 225 if (maybe_code->IsCode()) { |
225 Map* first_map = Handle<Code>::cast(maybe_code)->FindFirstMap(); | 226 Map* first_map = Handle<Code>::cast(maybe_code)->FindFirstMap(); |
226 if (first_map != NULL) return Handle<Map>(first_map); | 227 if (first_map != NULL) return Handle<Map>(first_map); |
227 } | 228 } |
228 return Handle<Map>(); | 229 return Handle<Map>(); |
229 } | 230 } |
230 | 231 |
231 | 232 |
232 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( | 233 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( |
233 TypeFeedbackId ast_id) { | 234 TypeFeedbackId ast_id) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 281 |
281 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { | 282 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { |
282 Handle<Object> value = GetInfo(expr->CallFeedbackId()); | 283 Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
283 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; | 284 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; |
284 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); | 285 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); |
285 ASSERT(check != RECEIVER_MAP_CHECK); | 286 ASSERT(check != RECEIVER_MAP_CHECK); |
286 return check; | 287 return check; |
287 } | 288 } |
288 | 289 |
289 | 290 |
290 Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck( | |
291 CheckType check) { | |
292 JSFunction* function = NULL; | |
293 switch (check) { | |
294 case RECEIVER_MAP_CHECK: | |
295 UNREACHABLE(); | |
296 break; | |
297 case STRING_CHECK: | |
298 function = native_context_->string_function(); | |
299 break; | |
300 case SYMBOL_CHECK: | |
301 function = native_context_->symbol_function(); | |
302 break; | |
303 case NUMBER_CHECK: | |
304 function = native_context_->number_function(); | |
305 break; | |
306 case BOOLEAN_CHECK: | |
307 function = native_context_->boolean_function(); | |
308 break; | |
309 } | |
310 ASSERT(function != NULL); | |
311 return Handle<JSObject>(JSObject::cast(function->instance_prototype())); | |
312 } | |
313 | |
314 | |
315 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { | 291 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { |
316 return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId())); | 292 return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId())); |
317 } | 293 } |
318 | 294 |
319 | 295 |
320 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { | 296 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { |
321 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); | 297 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
322 if (info->IsSmi()) { | 298 if (info->IsSmi()) { |
323 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= | 299 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= |
324 LAST_FAST_ELEMENTS_KIND); | 300 LAST_FAST_ELEMENTS_KIND); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 } | 602 } |
627 } | 603 } |
628 | 604 |
629 | 605 |
630 byte TypeFeedbackOracle::ToBooleanTypes(TypeFeedbackId id) { | 606 byte TypeFeedbackOracle::ToBooleanTypes(TypeFeedbackId id) { |
631 Handle<Object> object = GetInfo(id); | 607 Handle<Object> object = GetInfo(id); |
632 return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0; | 608 return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0; |
633 } | 609 } |
634 | 610 |
635 | 611 |
636 byte TypeFeedbackOracle::CompareNilTypes(TypeFeedbackId id) { | 612 byte TypeFeedbackOracle::CompareNilTypes(CompareOperation* expr) { |
637 Handle<Object> object = GetInfo(id); | 613 Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId()); |
638 if (object->IsCode() && | 614 if (object->IsCode() && |
639 Handle<Code>::cast(object)->is_compare_nil_ic_stub()) { | 615 Handle<Code>::cast(object)->is_compare_nil_ic_stub()) { |
640 return Handle<Code>::cast(object)->compare_nil_state(); | 616 return Handle<Code>::cast(object)->compare_nil_state(); |
641 } else { | 617 } else { |
642 return CompareNilICStub::kFullCompare; | 618 return CompareNilICStub::kFullCompare; |
643 } | 619 } |
644 } | 620 } |
645 | 621 |
646 | 622 |
647 // Things are a bit tricky here: The iterator for the RelocInfos and the infos | 623 // Things are a bit tricky here: The iterator for the RelocInfos and the infos |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 USE(maybe_result); | 749 USE(maybe_result); |
774 #ifdef DEBUG | 750 #ifdef DEBUG |
775 Object* result = NULL; | 751 Object* result = NULL; |
776 // Dictionary has been allocated with sufficient size for all elements. | 752 // Dictionary has been allocated with sufficient size for all elements. |
777 ASSERT(maybe_result->ToObject(&result)); | 753 ASSERT(maybe_result->ToObject(&result)); |
778 ASSERT(*dictionary_ == result); | 754 ASSERT(*dictionary_ == result); |
779 #endif | 755 #endif |
780 } | 756 } |
781 | 757 |
782 } } // namespace v8::internal | 758 } } // namespace v8::internal |
OLD | NEW |