| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId())); | 305 return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId())); |
| 306 } | 306 } |
| 307 | 307 |
| 308 | 308 |
| 309 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) { | 309 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) { |
| 310 return *GetInfo(expr->PropertyFeedbackId()) == | 310 return *GetInfo(expr->PropertyFeedbackId()) == |
| 311 isolate_->builtins()->builtin(id); | 311 isolate_->builtins()->builtin(id); |
| 312 } | 312 } |
| 313 | 313 |
| 314 | 314 |
| 315 Code::ExtraICStateForeignCallback TypeFeedbackOracle::LoadForeignCallbackType( |
| 316 Property* expr) { |
| 317 Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId()); |
| 318 if (map_or_code->IsMap()) { |
| 319 // If the IC is monomorphic we get the Map and not the Code object so we |
| 320 // cannot access the extra_ic_state bits. |
| 321 // Anyway we check the map and return the proper flag if appropriate. |
| 322 Handle<Map> map = Handle<Map>::cast(map_or_code); |
| 323 if (map->instance_type() == JS_ARRAY_TYPE && |
| 324 IsFastElementsKind(map->elements_kind()) && |
| 325 expr->key()->IsPropertyName() && |
| 326 Handle<String>::cast(expr->key()->AsLiteral()->handle())-> |
| 327 Equals(Isolate::Current()->heap()->length_symbol())) { |
| 328 return Code::ExtraICStateForeignCallbackArrayLength; |
| 329 } |
| 330 } else if (map_or_code->IsCode()) { |
| 331 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 332 if (code->kind() == Code::LOAD_IC && code->type() == Code::CALLBACKS) { |
| 333 return Code::ExtraICStateForeignCallback(code->extra_ic_state()); |
| 334 } |
| 335 } |
| 336 return Code::ExtraICStateForeignCallbackNone; |
| 337 } |
| 338 |
| 339 |
| 315 TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr) { | 340 TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr) { |
| 316 Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId()); | 341 Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId()); |
| 317 TypeInfo unknown = TypeInfo::Unknown(); | 342 TypeInfo unknown = TypeInfo::Unknown(); |
| 318 if (!object->IsCode()) return unknown; | 343 if (!object->IsCode()) return unknown; |
| 319 Handle<Code> code = Handle<Code>::cast(object); | 344 Handle<Code> code = Handle<Code>::cast(object); |
| 320 if (!code->is_compare_ic_stub()) return unknown; | 345 if (!code->is_compare_ic_stub()) return unknown; |
| 321 | 346 |
| 322 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); | 347 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
| 323 switch (state) { | 348 switch (state) { |
| 324 case CompareIC::UNINITIALIZED: | 349 case CompareIC::UNINITIALIZED: |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 USE(maybe_result); | 753 USE(maybe_result); |
| 729 #ifdef DEBUG | 754 #ifdef DEBUG |
| 730 Object* result = NULL; | 755 Object* result = NULL; |
| 731 // Dictionary has been allocated with sufficient size for all elements. | 756 // Dictionary has been allocated with sufficient size for all elements. |
| 732 ASSERT(maybe_result->ToObject(&result)); | 757 ASSERT(maybe_result->ToObject(&result)); |
| 733 ASSERT(*dictionary_ == result); | 758 ASSERT(*dictionary_ == result); |
| 734 #endif | 759 #endif |
| 735 } | 760 } |
| 736 | 761 |
| 737 } } // namespace v8::internal | 762 } } // namespace v8::internal |
| OLD | NEW |