| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 | 158 |
| 159 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { | 159 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
| 160 Handle<Object> value = GetInfo(expr->CallFeedbackId()); | 160 Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
| 161 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); | 161 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 | 164 |
| 165 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { | 165 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { |
| 166 Handle<Object> value = GetInfo(expr->CallNewFeedbackId()); | 166 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
| 167 return value->IsJSFunction(); | 167 if (info->IsSmi()) { |
| 168 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= |
| 169 LAST_FAST_ELEMENTS_KIND); |
| 170 return Isolate::Current()->global_context()->array_function(); |
| 171 } |
| 172 return info->IsJSFunction(); |
| 168 } | 173 } |
| 169 | 174 |
| 170 | 175 |
| 171 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( | 176 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( |
| 172 ObjectLiteral::Property* prop) { | 177 ObjectLiteral::Property* prop) { |
| 173 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); | 178 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); |
| 174 return map_or_code->IsMap(); | 179 return map_or_code->IsMap(); |
| 175 } | 180 } |
| 176 | 181 |
| 177 | 182 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 286 return Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
| 282 } | 287 } |
| 283 | 288 |
| 284 | 289 |
| 285 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { | 290 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { |
| 286 return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId())); | 291 return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId())); |
| 287 } | 292 } |
| 288 | 293 |
| 289 | 294 |
| 290 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { | 295 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { |
| 291 return Handle<JSFunction>::cast(GetInfo(expr->CallNewFeedbackId())); | 296 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
| 297 if (info->IsSmi()) { |
| 298 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= |
| 299 LAST_FAST_ELEMENTS_KIND); |
| 300 return Handle<JSFunction>(Isolate::Current()->global_context()-> |
| 301 array_function()); |
| 302 } else { |
| 303 return Handle<JSFunction>::cast(info); |
| 304 } |
| 292 } | 305 } |
| 293 | 306 |
| 294 | 307 |
| 308 ElementsKind TypeFeedbackOracle::GetCallNewElementsKind(CallNew* expr) { |
| 309 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
| 310 if (info->IsSmi()) { |
| 311 return static_cast<ElementsKind>(Smi::cast(*info)->value()); |
| 312 } else { |
| 313 return GetInitialFastElementsKind(); |
| 314 } |
| 315 } |
| 316 |
| 295 Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap( | 317 Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap( |
| 296 ObjectLiteral::Property* prop) { | 318 ObjectLiteral::Property* prop) { |
| 297 ASSERT(ObjectLiteralStoreIsMonomorphic(prop)); | 319 ASSERT(ObjectLiteralStoreIsMonomorphic(prop)); |
| 298 return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId())); | 320 return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId())); |
| 299 } | 321 } |
| 300 | 322 |
| 301 | 323 |
| 302 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) { | 324 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) { |
| 303 return *GetInfo(expr->PropertyFeedbackId()) == | 325 return *GetInfo(expr->PropertyFeedbackId()) == |
| 304 isolate_->builtins()->builtin(id); | 326 isolate_->builtins()->builtin(id); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 USE(maybe_result); | 734 USE(maybe_result); |
| 713 #ifdef DEBUG | 735 #ifdef DEBUG |
| 714 Object* result = NULL; | 736 Object* result = NULL; |
| 715 // Dictionary has been allocated with sufficient size for all elements. | 737 // Dictionary has been allocated with sufficient size for all elements. |
| 716 ASSERT(maybe_result->ToObject(&result)); | 738 ASSERT(maybe_result->ToObject(&result)); |
| 717 ASSERT(*dictionary_ == result); | 739 ASSERT(*dictionary_ == result); |
| 718 #endif | 740 #endif |
| 719 } | 741 } |
| 720 | 742 |
| 721 } } // namespace v8::internal | 743 } } // namespace v8::internal |
| OLD | NEW |