OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 164 return Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
165 } | 165 } |
166 | 166 |
167 | 167 |
168 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) { | 168 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) { |
169 Handle<Object> object = GetElement(map_, expr->position()); | 169 Handle<Object> object = GetElement(map_, expr->position()); |
170 return *object == Builtins::builtin(id); | 170 return *object == Builtins::builtin(id); |
171 } | 171 } |
172 | 172 |
173 | 173 |
174 TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr, Side side) { | 174 TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr) { |
175 Handle<Object> object = GetElement(map_, expr->position()); | 175 Handle<Object> object = GetElement(map_, expr->position()); |
176 TypeInfo unknown = TypeInfo::Unknown(); | 176 TypeInfo unknown = TypeInfo::Unknown(); |
177 if (!object->IsCode()) return unknown; | 177 if (!object->IsCode()) return unknown; |
178 Handle<Code> code = Handle<Code>::cast(object); | 178 Handle<Code> code = Handle<Code>::cast(object); |
179 if (!code->is_compare_ic_stub()) return unknown; | 179 if (!code->is_compare_ic_stub()) return unknown; |
180 | 180 |
181 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); | 181 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
182 switch (state) { | 182 switch (state) { |
183 case CompareIC::UNINITIALIZED: | 183 case CompareIC::UNINITIALIZED: |
184 // Uninitialized means never executed. | 184 // Uninitialized means never executed. |
185 // TODO(fschneider): Introduce a separate value for never-executed ICs. | 185 // TODO(fschneider): Introduce a separate value for never-executed ICs. |
186 return unknown; | 186 return unknown; |
187 case CompareIC::SMIS: | 187 case CompareIC::SMIS: |
188 return TypeInfo::Smi(); | 188 return TypeInfo::Smi(); |
189 case CompareIC::HEAP_NUMBERS: | 189 case CompareIC::HEAP_NUMBERS: |
190 return TypeInfo::Number(); | 190 return TypeInfo::Number(); |
191 case CompareIC::OBJECTS: | 191 case CompareIC::OBJECTS: |
192 // TODO(kasperl): We really need a type for JS objects here. | 192 // TODO(kasperl): We really need a type for JS objects here. |
193 return TypeInfo::NonPrimitive(); | 193 return TypeInfo::NonPrimitive(); |
194 case CompareIC::GENERIC: | 194 case CompareIC::GENERIC: |
195 default: | 195 default: |
196 return unknown; | 196 return unknown; |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 | 200 |
201 TypeInfo TypeFeedbackOracle::BinaryType(BinaryOperation* expr, Side side) { | 201 TypeInfo TypeFeedbackOracle::BinaryType(BinaryOperation* expr) { |
202 Handle<Object> object = GetElement(map_, expr->position()); | 202 Handle<Object> object = GetElement(map_, expr->position()); |
203 TypeInfo unknown = TypeInfo::Unknown(); | 203 TypeInfo unknown = TypeInfo::Unknown(); |
204 if (!object->IsCode()) return unknown; | 204 if (!object->IsCode()) return unknown; |
205 Handle<Code> code = Handle<Code>::cast(object); | 205 Handle<Code> code = Handle<Code>::cast(object); |
206 if (code->is_binary_op_stub()) { | 206 if (code->is_binary_op_stub()) { |
207 BinaryOpIC::TypeInfo type = static_cast<BinaryOpIC::TypeInfo>( | 207 BinaryOpIC::TypeInfo type = static_cast<BinaryOpIC::TypeInfo>( |
208 code->binary_op_type()); | 208 code->binary_op_type()); |
209 switch (type) { | 209 switch (type) { |
210 case BinaryOpIC::UNINIT_OR_SMI: | 210 case BinaryOpIC::UNINIT_OR_SMI: |
211 return TypeInfo::Smi(); | 211 return TypeInfo::Smi(); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 source_positions->Add(position); | 397 source_positions->Add(position); |
398 } | 398 } |
399 } else { | 399 } else { |
400 ASSERT(RelocInfo::IsPosition(mode)); | 400 ASSERT(RelocInfo::IsPosition(mode)); |
401 position = static_cast<int>(info->data()); | 401 position = static_cast<int>(info->data()); |
402 } | 402 } |
403 } | 403 } |
404 } | 404 } |
405 | 405 |
406 } } // namespace v8::internal | 406 } } // namespace v8::internal |
OLD | NEW |