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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 245 } |
246 | 246 |
247 | 247 |
248 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, | 248 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, |
249 Handle<Type>* left_type, | 249 Handle<Type>* left_type, |
250 Handle<Type>* right_type, | 250 Handle<Type>* right_type, |
251 Handle<Type>* combined_type) { | 251 Handle<Type>* combined_type) { |
252 Handle<Object> info = GetInfo(id); | 252 Handle<Object> info = GetInfo(id); |
253 if (!info->IsCode()) { | 253 if (!info->IsCode()) { |
254 // For some comparisons we don't have ICs, e.g. LiteralCompareTypeof. | 254 // For some comparisons we don't have ICs, e.g. LiteralCompareTypeof. |
255 *left_type = *right_type = *combined_type = handle(Type::None(), isolate_); | 255 *left_type = *right_type = *combined_type = Type::None(isolate_); |
256 return; | 256 return; |
257 } | 257 } |
258 Handle<Code> code = Handle<Code>::cast(info); | 258 Handle<Code> code = Handle<Code>::cast(info); |
259 | 259 |
260 Handle<Map> map; | 260 Handle<Map> map; |
261 Map* raw_map = code->FindFirstMap(); | 261 Map* raw_map = code->FindFirstMap(); |
262 if (raw_map != NULL) { | 262 if (raw_map != NULL) { |
263 map = Map::CurrentMapForDeprecated(handle(raw_map)); | 263 map = Map::CurrentMapForDeprecated(handle(raw_map)); |
264 if (!map.is_null() && CanRetainOtherContext(*map, *native_context_)) { | 264 if (!map.is_null() && CanRetainOtherContext(*map, *native_context_)) { |
265 map = Handle<Map>::null(); | 265 map = Handle<Map>::null(); |
(...skipping 18 matching lines...) Expand all Loading... |
284 Handle<Type>* result, | 284 Handle<Type>* result, |
285 Maybe<int>* fixed_right_arg, | 285 Maybe<int>* fixed_right_arg, |
286 Handle<AllocationSite>* allocation_site, | 286 Handle<AllocationSite>* allocation_site, |
287 Token::Value op) { | 287 Token::Value op) { |
288 Handle<Object> object = GetInfo(id); | 288 Handle<Object> object = GetInfo(id); |
289 if (!object->IsCode()) { | 289 if (!object->IsCode()) { |
290 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the | 290 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the |
291 // operations covered by the BinaryOpIC we should always have them. | 291 // operations covered by the BinaryOpIC we should always have them. |
292 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN || | 292 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN || |
293 op > BinaryOpIC::State::LAST_TOKEN); | 293 op > BinaryOpIC::State::LAST_TOKEN); |
294 *left = *right = *result = handle(Type::None(), isolate_); | 294 *left = *right = *result = Type::None(isolate_); |
295 *fixed_right_arg = Maybe<int>(); | 295 *fixed_right_arg = Maybe<int>(); |
296 *allocation_site = Handle<AllocationSite>::null(); | 296 *allocation_site = Handle<AllocationSite>::null(); |
297 return; | 297 return; |
298 } | 298 } |
299 Handle<Code> code = Handle<Code>::cast(object); | 299 Handle<Code> code = Handle<Code>::cast(object); |
300 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); | 300 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); |
301 BinaryOpIC::State state(code->extended_extra_ic_state()); | 301 BinaryOpIC::State state(code->extended_extra_ic_state()); |
302 ASSERT_EQ(op, state.op()); | 302 ASSERT_EQ(op, state.op()); |
303 | 303 |
304 *left = state.GetLeftType(isolate()); | 304 *left = state.GetLeftType(isolate()); |
305 *right = state.GetRightType(isolate()); | 305 *right = state.GetRightType(isolate()); |
306 *result = state.GetResultType(isolate()); | 306 *result = state.GetResultType(isolate()); |
307 *fixed_right_arg = state.fixed_right_arg(); | 307 *fixed_right_arg = state.fixed_right_arg(); |
308 | 308 |
309 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); | 309 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); |
310 if (first_allocation_site != NULL) { | 310 if (first_allocation_site != NULL) { |
311 *allocation_site = handle(first_allocation_site); | 311 *allocation_site = handle(first_allocation_site); |
312 } else { | 312 } else { |
313 *allocation_site = Handle<AllocationSite>::null(); | 313 *allocation_site = Handle<AllocationSite>::null(); |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 | 317 |
318 Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) { | 318 Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) { |
319 Handle<Object> object = GetInfo(id); | 319 Handle<Object> object = GetInfo(id); |
320 if (!object->IsCode()) return handle(Type::None(), isolate_); | 320 if (!object->IsCode()) return Type::None(isolate_); |
321 Handle<Code> code = Handle<Code>::cast(object); | 321 Handle<Code> code = Handle<Code>::cast(object); |
322 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); | 322 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); |
323 BinaryOpIC::State state(code->extended_extra_ic_state()); | 323 BinaryOpIC::State state(code->extended_extra_ic_state()); |
324 return state.GetLeftType(isolate()); | 324 return state.GetLeftType(isolate()); |
325 } | 325 } |
326 | 326 |
327 | 327 |
328 void TypeFeedbackOracle::PropertyReceiverTypes( | 328 void TypeFeedbackOracle::PropertyReceiverTypes( |
329 TypeFeedbackId id, Handle<String> name, | 329 TypeFeedbackId id, Handle<String> name, |
330 SmallMapList* receiver_types, bool* is_prototype) { | 330 SmallMapList* receiver_types, bool* is_prototype) { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 #ifdef DEBUG | 575 #ifdef DEBUG |
576 Object* result = NULL; | 576 Object* result = NULL; |
577 // Dictionary has been allocated with sufficient size for all elements. | 577 // Dictionary has been allocated with sufficient size for all elements. |
578 ASSERT(maybe_result->ToObject(&result)); | 578 ASSERT(maybe_result->ToObject(&result)); |
579 ASSERT(*dictionary_ == result); | 579 ASSERT(*dictionary_ == result); |
580 #endif | 580 #endif |
581 } | 581 } |
582 | 582 |
583 | 583 |
584 } } // namespace v8::internal | 584 } } // namespace v8::internal |
OLD | NEW |