OLD | NEW |
1 // Copyright 2010 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if (map_or_code->IsMap()) return true; | 82 if (map_or_code->IsMap()) return true; |
83 if (map_or_code->IsCode()) { | 83 if (map_or_code->IsCode()) { |
84 Handle<Code> code(Code::cast(*map_or_code)); | 84 Handle<Code> code(Code::cast(*map_or_code)); |
85 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC && | 85 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC && |
86 code->FindFirstMap() != NULL; | 86 code->FindFirstMap() != NULL; |
87 } | 87 } |
88 return false; | 88 return false; |
89 } | 89 } |
90 | 90 |
91 | 91 |
92 bool TypeFeedbackOracle::StoreIsMonomorphic(Assignment* expr) { | 92 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) { |
93 Handle<Object> map_or_code(GetInfo(expr->position())); | 93 Handle<Object> map_or_code(GetInfo(expr->position())); |
94 if (map_or_code->IsMap()) return true; | 94 if (map_or_code->IsMap()) return true; |
95 if (map_or_code->IsCode()) { | 95 if (map_or_code->IsCode()) { |
96 Handle<Code> code(Code::cast(*map_or_code)); | 96 Handle<Code> code(Code::cast(*map_or_code)); |
97 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_STORE_IC && | 97 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_STORE_IC && |
98 code->FindFirstMap() != NULL; | 98 code->FindFirstMap() != NULL; |
99 } | 99 } |
100 return false; | 100 return false; |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { | 104 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
105 Handle<Object> value = GetInfo(expr->position()); | 105 Handle<Object> value = GetInfo(expr->position()); |
106 return value->IsMap() || value->IsSmi(); | 106 return value->IsMap() || value->IsSmi(); |
107 } | 107 } |
108 | 108 |
109 | 109 |
110 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { | 110 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { |
111 ASSERT(LoadIsMonomorphic(expr)); | 111 ASSERT(LoadIsMonomorphic(expr)); |
112 Handle<Object> map_or_code( | 112 Handle<Object> map_or_code( |
113 Handle<HeapObject>::cast(GetInfo(expr->position()))); | 113 Handle<HeapObject>::cast(GetInfo(expr->position()))); |
114 if (map_or_code->IsCode()) { | 114 if (map_or_code->IsCode()) { |
115 Handle<Code> code(Code::cast(*map_or_code)); | 115 Handle<Code> code(Code::cast(*map_or_code)); |
116 return Handle<Map>(code->FindFirstMap()); | 116 return Handle<Map>(code->FindFirstMap()); |
117 } | 117 } |
118 return Handle<Map>(Map::cast(*map_or_code)); | 118 return Handle<Map>(Map::cast(*map_or_code)); |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Assignment* expr) { | 122 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) { |
123 ASSERT(StoreIsMonomorphic(expr)); | 123 ASSERT(StoreIsMonomorphic(expr)); |
124 Handle<HeapObject> map_or_code( | 124 Handle<HeapObject> map_or_code( |
125 Handle<HeapObject>::cast(GetInfo(expr->position()))); | 125 Handle<HeapObject>::cast(GetInfo(expr->position()))); |
126 if (map_or_code->IsCode()) { | 126 if (map_or_code->IsCode()) { |
127 Handle<Code> code(Code::cast(*map_or_code)); | 127 Handle<Code> code(Code::cast(*map_or_code)); |
128 return Handle<Map>(code->FindFirstMap()); | 128 return Handle<Map>(code->FindFirstMap()); |
129 } | 129 } |
130 return Handle<Map>(Map::cast(*map_or_code)); | 130 return Handle<Map>(Map::cast(*map_or_code)); |
131 } | 131 } |
132 | 132 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 171 } |
172 | 172 |
173 ExternalArrayType TypeFeedbackOracle::GetKeyedLoadExternalArrayType( | 173 ExternalArrayType TypeFeedbackOracle::GetKeyedLoadExternalArrayType( |
174 Property* expr) { | 174 Property* expr) { |
175 Handle<Object> stub = GetInfo(expr->position()); | 175 Handle<Object> stub = GetInfo(expr->position()); |
176 ASSERT(stub->IsCode()); | 176 ASSERT(stub->IsCode()); |
177 return Code::cast(*stub)->external_array_type(); | 177 return Code::cast(*stub)->external_array_type(); |
178 } | 178 } |
179 | 179 |
180 ExternalArrayType TypeFeedbackOracle::GetKeyedStoreExternalArrayType( | 180 ExternalArrayType TypeFeedbackOracle::GetKeyedStoreExternalArrayType( |
181 Assignment* expr) { | 181 Expression* expr) { |
182 Handle<Object> stub = GetInfo(expr->position()); | 182 Handle<Object> stub = GetInfo(expr->position()); |
183 ASSERT(stub->IsCode()); | 183 ASSERT(stub->IsCode()); |
184 return Code::cast(*stub)->external_array_type(); | 184 return Code::cast(*stub)->external_array_type(); |
185 } | 185 } |
186 | 186 |
187 Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck( | 187 Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck( |
188 CheckType check) { | 188 CheckType check) { |
189 JSFunction* function = NULL; | 189 JSFunction* function = NULL; |
190 switch (check) { | 190 switch (check) { |
191 case RECEIVER_MAP_CHECK: | 191 case RECEIVER_MAP_CHECK: |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 source_positions->Add(position); | 463 source_positions->Add(position); |
464 } | 464 } |
465 } else { | 465 } else { |
466 ASSERT(RelocInfo::IsPosition(mode)); | 466 ASSERT(RelocInfo::IsPosition(mode)); |
467 position = static_cast<int>(info->data()); | 467 position = static_cast<int>(info->data()); |
468 } | 468 } |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 } } // namespace v8::internal | 472 } } // namespace v8::internal |
OLD | NEW |