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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->IsAllocationSite() || value->IsJSFunction() || |
| 190 value->IsSmi(); |
190 } | 191 } |
191 | 192 |
192 | 193 |
193 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { | 194 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { |
194 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); | 195 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
195 return info->IsSmi() || info->IsJSFunction(); | 196 return info->IsAllocationSite() || info->IsJSFunction(); |
196 } | 197 } |
197 | 198 |
198 | 199 |
199 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( | 200 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( |
200 ObjectLiteral::Property* prop) { | 201 ObjectLiteral::Property* prop) { |
201 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); | 202 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); |
202 return map_or_code->IsMap(); | 203 return map_or_code->IsMap(); |
203 } | 204 } |
204 | 205 |
205 | 206 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 Handle<Object> value = GetInfo(expr->CallFeedbackId()); | 296 Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
296 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; | 297 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; |
297 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); | 298 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); |
298 ASSERT(check != RECEIVER_MAP_CHECK); | 299 ASSERT(check != RECEIVER_MAP_CHECK); |
299 return check; | 300 return check; |
300 } | 301 } |
301 | 302 |
302 | 303 |
303 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { | 304 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { |
304 Handle<Object> info = GetInfo(expr->CallFeedbackId()); | 305 Handle<Object> info = GetInfo(expr->CallFeedbackId()); |
305 if (info->IsSmi()) { | 306 if (info->IsAllocationSite()) { |
306 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= | |
307 LAST_FAST_ELEMENTS_KIND); | |
308 return Handle<JSFunction>(isolate_->global_context()->array_function()); | 307 return Handle<JSFunction>(isolate_->global_context()->array_function()); |
309 } else { | 308 } else { |
310 return Handle<JSFunction>::cast(info); | 309 return Handle<JSFunction>::cast(info); |
311 } | 310 } |
312 } | 311 } |
313 | 312 |
314 | 313 |
315 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { | 314 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { |
316 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); | 315 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
317 if (info->IsSmi()) { | 316 if (info->IsAllocationSite()) { |
318 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= | |
319 LAST_FAST_ELEMENTS_KIND); | |
320 return Handle<JSFunction>(isolate_->global_context()->array_function()); | 317 return Handle<JSFunction>(isolate_->global_context()->array_function()); |
321 } else { | 318 } else { |
322 return Handle<JSFunction>::cast(info); | 319 return Handle<JSFunction>::cast(info); |
323 } | 320 } |
324 } | 321 } |
325 | 322 |
326 | 323 |
327 Handle<Cell> TypeFeedbackOracle::GetCallNewAllocationInfoCell(CallNew* expr) { | 324 Handle<Cell> TypeFeedbackOracle::GetCallNewAllocationInfoCell(CallNew* expr) { |
328 return GetInfoCell(expr->CallNewFeedbackId()); | 325 return GetInfoCell(expr->CallNewFeedbackId()); |
329 } | 326 } |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 void TypeFeedbackOracle::ProcessTypeFeedbackCells(Handle<Code> code) { | 665 void TypeFeedbackOracle::ProcessTypeFeedbackCells(Handle<Code> code) { |
669 Object* raw_info = code->type_feedback_info(); | 666 Object* raw_info = code->type_feedback_info(); |
670 if (!raw_info->IsTypeFeedbackInfo()) return; | 667 if (!raw_info->IsTypeFeedbackInfo()) return; |
671 Handle<TypeFeedbackCells> cache( | 668 Handle<TypeFeedbackCells> cache( |
672 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells()); | 669 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells()); |
673 for (int i = 0; i < cache->CellCount(); i++) { | 670 for (int i = 0; i < cache->CellCount(); i++) { |
674 TypeFeedbackId ast_id = cache->AstId(i); | 671 TypeFeedbackId ast_id = cache->AstId(i); |
675 Cell* cell = cache->GetCell(i); | 672 Cell* cell = cache->GetCell(i); |
676 Object* value = cell->value(); | 673 Object* value = cell->value(); |
677 if (value->IsSmi() || | 674 if (value->IsSmi() || |
| 675 value->IsAllocationSite() || |
678 (value->IsJSFunction() && | 676 (value->IsJSFunction() && |
679 !CanRetainOtherContext(JSFunction::cast(value), | 677 !CanRetainOtherContext(JSFunction::cast(value), |
680 *native_context_))) { | 678 *native_context_))) { |
681 SetInfo(ast_id, cell); | 679 SetInfo(ast_id, cell); |
682 } | 680 } |
683 } | 681 } |
684 } | 682 } |
685 | 683 |
686 | 684 |
687 void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) { | 685 void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) { |
(...skipping 15 matching lines...) Expand all Loading... |
703 // TODO(verwaest): Return Smi rather than Integer32. | 701 // TODO(verwaest): Return Smi rather than Integer32. |
704 if (info.IsSmi()) return Representation::Integer32(); | 702 if (info.IsSmi()) return Representation::Integer32(); |
705 if (info.IsInteger32()) return Representation::Integer32(); | 703 if (info.IsInteger32()) return Representation::Integer32(); |
706 if (info.IsDouble()) return Representation::Double(); | 704 if (info.IsDouble()) return Representation::Double(); |
707 if (info.IsNumber()) return Representation::Double(); | 705 if (info.IsNumber()) return Representation::Double(); |
708 return Representation::Tagged(); | 706 return Representation::Tagged(); |
709 } | 707 } |
710 | 708 |
711 | 709 |
712 } } // namespace v8::internal | 710 } } // namespace v8::internal |
OLD | NEW |