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