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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if (!preliminary_checks) return false; | 163 if (!preliminary_checks) return false; |
164 Map* map = code->FindFirstMap(); | 164 Map* map = code->FindFirstMap(); |
165 if (map == NULL) return false; | 165 if (map == NULL) return false; |
166 map = map->CurrentMapForDeprecated(); | 166 map = map->CurrentMapForDeprecated(); |
167 return map != NULL && !CanRetainOtherContext(map, *native_context_); | 167 return map != NULL && !CanRetainOtherContext(map, *native_context_); |
168 } | 168 } |
169 return false; | 169 return false; |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 bool TypeFeedbackOracle::StoreIsPolymorphic(TypeFeedbackId ast_id) { | 173 bool TypeFeedbackOracle::StoreIsKeyedPolymorphic(TypeFeedbackId ast_id) { |
174 Handle<Object> map_or_code = GetInfo(ast_id); | 174 Handle<Object> map_or_code = GetInfo(ast_id); |
175 if (map_or_code->IsCode()) { | 175 if (map_or_code->IsCode()) { |
176 Handle<Code> code = Handle<Code>::cast(map_or_code); | 176 Handle<Code> code = Handle<Code>::cast(map_or_code); |
177 bool standard_store = FLAG_compiled_keyed_stores || | 177 bool standard_store = FLAG_compiled_keyed_stores || |
178 (Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == | 178 (Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == |
179 STANDARD_STORE); | 179 STANDARD_STORE); |
180 return code->is_keyed_store_stub() && standard_store && | 180 return code->is_keyed_store_stub() && standard_store && |
181 code->ic_state() == POLYMORPHIC; | 181 code->ic_state() == POLYMORPHIC; |
182 } | 182 } |
183 return false; | 183 return false; |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { | 187 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
188 Handle<Object> value = GetInfo(expr->CallFeedbackId()); | 188 Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
189 return value->IsMap() || value->IsAllocationSite() || value->IsJSFunction() || | 189 return value->IsMap() || value->IsAllocationSite() || value->IsJSFunction() || |
190 value->IsSmi(); | 190 value->IsSmi(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 Code::Flags flags = Code::ComputeFlags( | 260 Code::Flags flags = Code::ComputeFlags( |
261 Code::STUB, MONOMORPHIC, Code::kNoExtraICState, | 261 Code::STUB, MONOMORPHIC, Code::kNoExtraICState, |
262 Code::NORMAL, Code::LOAD_IC); | 262 Code::NORMAL, Code::LOAD_IC); |
263 CollectReceiverTypes(expr->PropertyFeedbackId(), name, flags, types); | 263 CollectReceiverTypes(expr->PropertyFeedbackId(), name, flags, types); |
264 } | 264 } |
265 | 265 |
266 | 266 |
267 void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, | 267 void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, |
268 Handle<String> name, | 268 Handle<String> name, |
269 SmallMapList* types) { | 269 SmallMapList* types) { |
270 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC); | 270 Code::Flags flags = Code::ComputeFlags( |
| 271 Code::STUB, MONOMORPHIC, Code::kNoExtraICState, |
| 272 Code::NORMAL, Code::STORE_IC); |
271 CollectReceiverTypes(expr->AssignmentFeedbackId(), name, flags, types); | 273 CollectReceiverTypes(expr->AssignmentFeedbackId(), name, flags, types); |
272 } | 274 } |
273 | 275 |
274 | 276 |
275 void TypeFeedbackOracle::CallReceiverTypes(Call* expr, | 277 void TypeFeedbackOracle::CallReceiverTypes(Call* expr, |
276 Handle<String> name, | 278 Handle<String> name, |
277 CallKind call_kind, | 279 CallKind call_kind, |
278 SmallMapList* types) { | 280 SmallMapList* types) { |
279 int arity = expr->arguments()->length(); | 281 int arity = expr->arguments()->length(); |
280 | 282 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 Handle<Object> object = GetInfo(ast_id); | 546 Handle<Object> object = GetInfo(ast_id); |
545 if (!object->IsCode()) return; | 547 if (!object->IsCode()) return; |
546 Handle<Code> code = Handle<Code>::cast(object); | 548 Handle<Code> code = Handle<Code>::cast(object); |
547 if (code->kind() == Code::KEYED_LOAD_IC || | 549 if (code->kind() == Code::KEYED_LOAD_IC || |
548 code->kind() == Code::KEYED_STORE_IC) { | 550 code->kind() == Code::KEYED_STORE_IC) { |
549 CollectPolymorphicMaps(code, types); | 551 CollectPolymorphicMaps(code, types); |
550 } | 552 } |
551 } | 553 } |
552 | 554 |
553 | 555 |
| 556 void TypeFeedbackOracle::CollectPolymorphicStoreReceiverTypes( |
| 557 TypeFeedbackId ast_id, |
| 558 SmallMapList* types) { |
| 559 Handle<Object> object = GetInfo(ast_id); |
| 560 if (!object->IsCode()) return; |
| 561 Handle<Code> code = Handle<Code>::cast(object); |
| 562 if (code->kind() == Code::STORE_IC && code->ic_state() == POLYMORPHIC) { |
| 563 CollectPolymorphicMaps(code, types); |
| 564 } |
| 565 } |
| 566 |
| 567 |
554 byte TypeFeedbackOracle::ToBooleanTypes(TypeFeedbackId id) { | 568 byte TypeFeedbackOracle::ToBooleanTypes(TypeFeedbackId id) { |
555 Handle<Object> object = GetInfo(id); | 569 Handle<Object> object = GetInfo(id); |
556 return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0; | 570 return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0; |
557 } | 571 } |
558 | 572 |
559 | 573 |
560 // Things are a bit tricky here: The iterator for the RelocInfos and the infos | 574 // Things are a bit tricky here: The iterator for the RelocInfos and the infos |
561 // themselves are not GC-safe, so we first get all infos, then we create the | 575 // themselves are not GC-safe, so we first get all infos, then we create the |
562 // dictionary (possibly triggering GC), and finally we relocate the collected | 576 // dictionary (possibly triggering GC), and finally we relocate the collected |
563 // infos before we process them. | 577 // infos before we process them. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 // TODO(verwaest): Return Smi rather than Integer32. | 715 // TODO(verwaest): Return Smi rather than Integer32. |
702 if (info.IsSmi()) return Representation::Integer32(); | 716 if (info.IsSmi()) return Representation::Integer32(); |
703 if (info.IsInteger32()) return Representation::Integer32(); | 717 if (info.IsInteger32()) return Representation::Integer32(); |
704 if (info.IsDouble()) return Representation::Double(); | 718 if (info.IsDouble()) return Representation::Double(); |
705 if (info.IsNumber()) return Representation::Double(); | 719 if (info.IsNumber()) return Representation::Double(); |
706 return Representation::Tagged(); | 720 return Representation::Tagged(); |
707 } | 721 } |
708 | 722 |
709 | 723 |
710 } } // namespace v8::internal | 724 } } // namespace v8::internal |
OLD | NEW |