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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 | 162 |
163 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { | 163 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
164 Handle<Object> value = GetInfo(expr->CallFeedbackId()); | 164 Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
165 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); | 165 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { | 169 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { |
170 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); | 170 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
171 if (info->IsSmi()) { | 171 return info->IsSmi() || info->IsJSFunction(); |
172 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= | |
173 LAST_FAST_ELEMENTS_KIND); | |
174 return isolate_->global_context()->array_function(); | |
175 } | |
176 return info->IsJSFunction(); | |
177 } | 172 } |
178 | 173 |
179 | 174 |
180 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( | 175 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( |
181 ObjectLiteral::Property* prop) { | 176 ObjectLiteral::Property* prop) { |
182 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); | 177 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); |
183 return map_or_code->IsMap(); | 178 return map_or_code->IsMap(); |
184 } | 179 } |
185 | 180 |
186 | 181 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { | 286 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { |
292 Handle<Object> value = GetInfo(expr->CallFeedbackId()); | 287 Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
293 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; | 288 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; |
294 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); | 289 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); |
295 ASSERT(check != RECEIVER_MAP_CHECK); | 290 ASSERT(check != RECEIVER_MAP_CHECK); |
296 return check; | 291 return check; |
297 } | 292 } |
298 | 293 |
299 | 294 |
300 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { | 295 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { |
301 return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId())); | 296 Handle<Object> info = GetInfo(expr->CallFeedbackId()); |
| 297 if (info->IsSmi()) { |
| 298 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= |
| 299 LAST_FAST_ELEMENTS_KIND); |
| 300 return Handle<JSFunction>(isolate_->global_context()->array_function()); |
| 301 } else { |
| 302 return Handle<JSFunction>::cast(info); |
| 303 } |
302 } | 304 } |
303 | 305 |
304 | 306 |
305 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { | 307 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { |
306 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); | 308 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
307 if (info->IsSmi()) { | 309 if (info->IsSmi()) { |
308 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= | 310 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= |
309 LAST_FAST_ELEMENTS_KIND); | 311 LAST_FAST_ELEMENTS_KIND); |
310 return Handle<JSFunction>(isolate_->global_context()->array_function()); | 312 return Handle<JSFunction>(isolate_->global_context()->array_function()); |
311 } else { | 313 } else { |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 USE(maybe_result); | 760 USE(maybe_result); |
759 #ifdef DEBUG | 761 #ifdef DEBUG |
760 Object* result = NULL; | 762 Object* result = NULL; |
761 // Dictionary has been allocated with sufficient size for all elements. | 763 // Dictionary has been allocated with sufficient size for all elements. |
762 ASSERT(maybe_result->ToObject(&result)); | 764 ASSERT(maybe_result->ToObject(&result)); |
763 ASSERT(*dictionary_ == result); | 765 ASSERT(*dictionary_ == result); |
764 #endif | 766 #endif |
765 } | 767 } |
766 | 768 |
767 } } // namespace v8::internal | 769 } } // namespace v8::internal |
OLD | NEW |