| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 | 68 |
| 69 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { | 69 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { |
| 70 int entry = dictionary_->FindEntry(ast_id); | 70 int entry = dictionary_->FindEntry(ast_id); |
| 71 return entry != NumberDictionary::kNotFound | 71 return entry != NumberDictionary::kNotFound |
| 72 ? Handle<Object>(dictionary_->ValueAt(entry)) | 72 ? Handle<Object>(dictionary_->ValueAt(entry)) |
| 73 : Isolate::Current()->factory()->undefined_value(); | 73 : Isolate::Current()->factory()->undefined_value(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 | 76 |
| 77 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { | 77 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) { |
| 78 Handle<Object> map_or_code(GetInfo(expr->id())); | 78 Handle<Object> map_or_code(GetInfo(expr->id())); |
| 79 if (map_or_code->IsMap()) return true; | 79 if (map_or_code->IsMap()) return true; |
| 80 if (map_or_code->IsCode()) { | 80 if (map_or_code->IsCode()) { |
| 81 Handle<Code> code = Handle<Code>::cast(map_or_code); | 81 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 82 return code->is_keyed_load_stub() && | 82 return code->is_keyed_load_stub() && |
| 83 code->ic_state() == MONOMORPHIC && | 83 code->ic_state() == MONOMORPHIC && |
| 84 Code::ExtractTypeFromFlags(code->flags()) == NORMAL && | |
| 85 code->FindFirstMap() != NULL; | 84 code->FindFirstMap() != NULL; |
| 86 } | 85 } |
| 87 return false; | 86 return false; |
| 88 } | 87 } |
| 89 | 88 |
| 90 | 89 |
| 91 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(Expression* expr) { | 90 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) { |
| 92 Handle<Object> map_or_code(GetInfo(expr->id())); | 91 Handle<Object> map_or_code(GetInfo(expr->id())); |
| 93 if (map_or_code->IsMap()) return true; | 92 if (map_or_code->IsMap()) return true; |
| 94 if (map_or_code->IsCode()) { | 93 if (map_or_code->IsCode()) { |
| 95 Handle<Code> code = Handle<Code>::cast(map_or_code); | 94 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 96 return code->is_keyed_store_stub() && | 95 return code->is_keyed_store_stub() && |
| 97 code->ic_state() == MONOMORPHIC && | 96 code->ic_state() == MONOMORPHIC; |
| 98 Code::ExtractTypeFromFlags(code->flags()) == NORMAL; | |
| 99 } | 97 } |
| 100 return false; | 98 return false; |
| 101 } | 99 } |
| 102 | 100 |
| 103 | 101 |
| 104 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { | 102 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
| 105 Handle<Object> value = GetInfo(expr->id()); | 103 Handle<Object> value = GetInfo(expr->id()); |
| 106 return value->IsMap() || value->IsSmi(); | 104 return value->IsMap() || value->IsSmi(); |
| 107 } | 105 } |
| 108 | 106 |
| 109 | 107 |
| 110 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { | 108 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { |
| 111 ASSERT(LoadIsMonomorphicNormal(expr)); | 109 ASSERT(LoadIsMonomorphic(expr)); |
| 112 Handle<Object> map_or_code(GetInfo(expr->id())); | 110 Handle<Object> map_or_code(GetInfo(expr->id())); |
| 113 if (map_or_code->IsCode()) { | 111 if (map_or_code->IsCode()) { |
| 114 Handle<Code> code = Handle<Code>::cast(map_or_code); | 112 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 115 Map* first_map = code->FindFirstMap(); | 113 Map* first_map = code->FindFirstMap(); |
| 116 ASSERT(first_map != NULL); | 114 ASSERT(first_map != NULL); |
| 117 return Handle<Map>(first_map); | 115 return Handle<Map>(first_map); |
| 118 } | 116 } |
| 119 return Handle<Map>::cast(map_or_code); | 117 return Handle<Map>::cast(map_or_code); |
| 120 } | 118 } |
| 121 | 119 |
| 122 | 120 |
| 123 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) { | 121 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) { |
| 124 ASSERT(StoreIsMonomorphicNormal(expr)); | 122 ASSERT(StoreIsMonomorphic(expr)); |
| 125 Handle<Object> map_or_code(GetInfo(expr->id())); | 123 Handle<Object> map_or_code(GetInfo(expr->id())); |
| 126 if (map_or_code->IsCode()) { | 124 if (map_or_code->IsCode()) { |
| 127 Handle<Code> code = Handle<Code>::cast(map_or_code); | 125 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 128 return Handle<Map>(code->FindFirstMap()); | 126 return Handle<Map>(code->FindFirstMap()); |
| 129 } | 127 } |
| 130 return Handle<Map>::cast(map_or_code); | 128 return Handle<Map>::cast(map_or_code); |
| 131 } | 129 } |
| 132 | 130 |
| 133 | 131 |
| 134 ZoneMapList* TypeFeedbackOracle::LoadReceiverTypes(Property* expr, | 132 ZoneMapList* TypeFeedbackOracle::LoadReceiverTypes(Property* expr, |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 static_cast<int>(info->pc() - code->instruction_start())); | 482 static_cast<int>(info->pc() - code->instruction_start())); |
| 485 ASSERT(ast_ids->length() == 0 || | 483 ASSERT(ast_ids->length() == 0 || |
| 486 (*ast_ids)[ast_ids->length()-1] != | 484 (*ast_ids)[ast_ids->length()-1] != |
| 487 static_cast<unsigned>(info->data())); | 485 static_cast<unsigned>(info->data())); |
| 488 ast_ids->Add(static_cast<unsigned>(info->data())); | 486 ast_ids->Add(static_cast<unsigned>(info->data())); |
| 489 } | 487 } |
| 490 } | 488 } |
| 491 } | 489 } |
| 492 | 490 |
| 493 } } // namespace v8::internal | 491 } } // namespace v8::internal |
| OLD | NEW |