| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 Handle<Code> code = Handle<Code>::cast(map_or_code); | 134 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 135 return code->is_keyed_load_stub() && code->ic_state() == POLYMORPHIC; | 135 return code->is_keyed_load_stub() && code->ic_state() == POLYMORPHIC; |
| 136 } | 136 } |
| 137 return false; | 137 return false; |
| 138 } | 138 } |
| 139 | 139 |
| 140 | 140 |
| 141 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) { | 141 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) { |
| 142 Handle<Object> map_or_code = GetInfo(ast_id); | 142 Handle<Object> map_or_code = GetInfo(ast_id); |
| 143 if (map_or_code->IsMap()) return false; | 143 if (map_or_code->IsMap()) return false; |
| 144 if (!map_or_code->IsCode()) return true; | 144 if (!map_or_code->IsCode()) return false; |
| 145 Handle<Code> code = Handle<Code>::cast(map_or_code); | 145 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 146 return code->ic_state() == UNINITIALIZED; | 146 return code->ic_state() == UNINITIALIZED; |
| 147 } | 147 } |
| 148 | 148 |
| 149 | 149 |
| 150 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) { | 150 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) { |
| 151 Handle<Object> map_or_code = GetInfo(ast_id); | 151 Handle<Object> map_or_code = GetInfo(ast_id); |
| 152 if (map_or_code->IsMap()) return true; | 152 if (map_or_code->IsMap()) return true; |
| 153 if (map_or_code->IsCode()) { | 153 if (map_or_code->IsCode()) { |
| 154 Handle<Code> code = Handle<Code>::cast(map_or_code); | 154 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 if (raw_map != NULL && !CanRetainOtherContext(raw_map, *native_context_)) { | 370 if (raw_map != NULL && !CanRetainOtherContext(raw_map, *native_context_)) { |
| 371 map = handle(raw_map, isolate_); | 371 map = handle(raw_map, isolate_); |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 | 374 |
| 375 if (code->is_compare_ic_stub()) { | 375 if (code->is_compare_ic_stub()) { |
| 376 int stub_minor_key = code->stub_info(); | 376 int stub_minor_key = code->stub_info(); |
| 377 CompareIC::StubInfoToType( | 377 CompareIC::StubInfoToType( |
| 378 stub_minor_key, left_type, right_type, combined_type, map, isolate()); | 378 stub_minor_key, left_type, right_type, combined_type, map, isolate()); |
| 379 } else if (code->is_compare_nil_ic_stub()) { | 379 } else if (code->is_compare_nil_ic_stub()) { |
| 380 CompareNilICStub::State state(code->compare_nil_state()); | 380 CompareNilICStub stub(code->extended_extra_ic_state()); |
| 381 *combined_type = CompareNilICStub::StateToType(isolate_, state, map); | 381 *combined_type = stub.GetType(isolate_, map); |
| 382 Handle<Type> nil_type = handle(code->compare_nil_value() == kNullValue | 382 *left_type = *right_type = stub.GetInputType(isolate_, map); |
| 383 ? Type::Null() : Type::Undefined(), isolate_); | |
| 384 *left_type = *right_type = | |
| 385 handle(Type::Union(*combined_type, nil_type), isolate_); | |
| 386 } | 383 } |
| 387 } | 384 } |
| 388 | 385 |
| 389 | 386 |
| 390 Handle<Type> TypeFeedbackOracle::UnaryType(TypeFeedbackId id) { | 387 Handle<Type> TypeFeedbackOracle::UnaryType(TypeFeedbackId id) { |
| 391 Handle<Object> object = GetInfo(id); | 388 Handle<Object> object = GetInfo(id); |
| 392 if (!object->IsCode()) { | 389 if (!object->IsCode()) { |
| 393 return handle(Type::None(), isolate()); | 390 return handle(Type::None(), isolate()); |
| 394 } | 391 } |
| 395 Handle<Code> code = Handle<Code>::cast(object); | 392 Handle<Code> code = Handle<Code>::cast(object); |
| 396 ASSERT(code->is_unary_op_stub()); | 393 ASSERT(code->is_unary_op_stub()); |
| 397 return UnaryOpStub(code->extra_ic_state()).GetType(isolate()); | 394 return UnaryOpStub(code->extended_extra_ic_state()).GetType(isolate()); |
| 398 } | 395 } |
| 399 | 396 |
| 400 | 397 |
| 401 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, | 398 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, |
| 402 Handle<Type>* left, | 399 Handle<Type>* left, |
| 403 Handle<Type>* right, | 400 Handle<Type>* right, |
| 404 Handle<Type>* result, | 401 Handle<Type>* result, |
| 405 Maybe<int>* fixed_right_arg) { | 402 Maybe<int>* fixed_right_arg) { |
| 406 Handle<Object> object = GetInfo(id); | 403 Handle<Object> object = GetInfo(id); |
| 407 if (!object->IsCode()) { | 404 if (!object->IsCode()) { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 // TODO(verwaest): Return Smi rather than Integer32. | 712 // TODO(verwaest): Return Smi rather than Integer32. |
| 716 if (info.IsSmi()) return Representation::Integer32(); | 713 if (info.IsSmi()) return Representation::Integer32(); |
| 717 if (info.IsInteger32()) return Representation::Integer32(); | 714 if (info.IsInteger32()) return Representation::Integer32(); |
| 718 if (info.IsDouble()) return Representation::Double(); | 715 if (info.IsDouble()) return Representation::Double(); |
| 719 if (info.IsNumber()) return Representation::Double(); | 716 if (info.IsNumber()) return Representation::Double(); |
| 720 return Representation::Tagged(); | 717 return Representation::Tagged(); |
| 721 } | 718 } |
| 722 | 719 |
| 723 | 720 |
| 724 } } // namespace v8::internal | 721 } } // namespace v8::internal |
| OLD | NEW |