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->IsSmi() || value->IsJSFunction(); | 189 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); |
190 } | 190 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 Code::Flags flags = Code::ComputeFlags( | 259 Code::Flags flags = Code::ComputeFlags( |
260 Code::STUB, MONOMORPHIC, Code::kNoExtraICState, | 260 Code::STUB, MONOMORPHIC, Code::kNoExtraICState, |
261 Code::NORMAL, Code::LOAD_IC); | 261 Code::NORMAL, Code::LOAD_IC); |
262 CollectReceiverTypes(expr->PropertyFeedbackId(), name, flags, types); | 262 CollectReceiverTypes(expr->PropertyFeedbackId(), name, flags, types); |
263 } | 263 } |
264 | 264 |
265 | 265 |
266 void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, | 266 void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, |
267 Handle<String> name, | 267 Handle<String> name, |
268 SmallMapList* types) { | 268 SmallMapList* types) { |
269 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC); | 269 Code::Flags flags = Code::ComputeFlags( |
| 270 Code::STUB, MONOMORPHIC, Code::kNoExtraICState, |
| 271 Code::NORMAL, Code::STORE_IC); |
270 CollectReceiverTypes(expr->AssignmentFeedbackId(), name, flags, types); | 272 CollectReceiverTypes(expr->AssignmentFeedbackId(), name, flags, types); |
271 } | 273 } |
272 | 274 |
273 | 275 |
274 void TypeFeedbackOracle::CallReceiverTypes(Call* expr, | 276 void TypeFeedbackOracle::CallReceiverTypes(Call* expr, |
275 Handle<String> name, | 277 Handle<String> name, |
276 CallKind call_kind, | 278 CallKind call_kind, |
277 SmallMapList* types) { | 279 SmallMapList* types) { |
278 int arity = expr->arguments()->length(); | 280 int arity = expr->arguments()->length(); |
279 | 281 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 Handle<Object> object = GetInfo(ast_id); | 549 Handle<Object> object = GetInfo(ast_id); |
548 if (!object->IsCode()) return; | 550 if (!object->IsCode()) return; |
549 Handle<Code> code = Handle<Code>::cast(object); | 551 Handle<Code> code = Handle<Code>::cast(object); |
550 if (code->kind() == Code::KEYED_LOAD_IC || | 552 if (code->kind() == Code::KEYED_LOAD_IC || |
551 code->kind() == Code::KEYED_STORE_IC) { | 553 code->kind() == Code::KEYED_STORE_IC) { |
552 CollectPolymorphicMaps(code, types); | 554 CollectPolymorphicMaps(code, types); |
553 } | 555 } |
554 } | 556 } |
555 | 557 |
556 | 558 |
| 559 void TypeFeedbackOracle::CollectPolymorphicStoreReceiverTypes( |
| 560 TypeFeedbackId ast_id, |
| 561 SmallMapList* types) { |
| 562 Handle<Object> object = GetInfo(ast_id); |
| 563 if (!object->IsCode()) return; |
| 564 Handle<Code> code = Handle<Code>::cast(object); |
| 565 if (code->kind() == Code::STORE_IC && code->ic_state() == POLYMORPHIC) { |
| 566 CollectPolymorphicMaps(code, types); |
| 567 } |
| 568 } |
| 569 |
| 570 |
557 byte TypeFeedbackOracle::ToBooleanTypes(TypeFeedbackId id) { | 571 byte TypeFeedbackOracle::ToBooleanTypes(TypeFeedbackId id) { |
558 Handle<Object> object = GetInfo(id); | 572 Handle<Object> object = GetInfo(id); |
559 return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0; | 573 return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0; |
560 } | 574 } |
561 | 575 |
562 | 576 |
563 // Things are a bit tricky here: The iterator for the RelocInfos and the infos | 577 // Things are a bit tricky here: The iterator for the RelocInfos and the infos |
564 // themselves are not GC-safe, so we first get all infos, then we create the | 578 // themselves are not GC-safe, so we first get all infos, then we create the |
565 // dictionary (possibly triggering GC), and finally we relocate the collected | 579 // dictionary (possibly triggering GC), and finally we relocate the collected |
566 // infos before we process them. | 580 // infos before we process them. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 // TODO(verwaest): Return Smi rather than Integer32. | 717 // TODO(verwaest): Return Smi rather than Integer32. |
704 if (info.IsSmi()) return Representation::Integer32(); | 718 if (info.IsSmi()) return Representation::Integer32(); |
705 if (info.IsInteger32()) return Representation::Integer32(); | 719 if (info.IsInteger32()) return Representation::Integer32(); |
706 if (info.IsDouble()) return Representation::Double(); | 720 if (info.IsDouble()) return Representation::Double(); |
707 if (info.IsNumber()) return Representation::Double(); | 721 if (info.IsNumber()) return Representation::Double(); |
708 return Representation::Tagged(); | 722 return Representation::Tagged(); |
709 } | 723 } |
710 | 724 |
711 | 725 |
712 } } // namespace v8::internal | 726 } } // namespace v8::internal |
OLD | NEW |