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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 *left_type = *right_type = stub.GetInputType(isolate_, map); | 401 *left_type = *right_type = stub.GetInputType(isolate_, map); |
402 } | 402 } |
403 } | 403 } |
404 | 404 |
405 | 405 |
406 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, | 406 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, |
407 Handle<Type>* left, | 407 Handle<Type>* left, |
408 Handle<Type>* right, | 408 Handle<Type>* right, |
409 Handle<Type>* result, | 409 Handle<Type>* result, |
410 Maybe<int>* fixed_right_arg, | 410 Maybe<int>* fixed_right_arg, |
| 411 Handle<AllocationSite>* allocation_site, |
411 Token::Value op) { | 412 Token::Value op) { |
412 Handle<Object> object = GetInfo(id); | 413 Handle<Object> object = GetInfo(id); |
413 if (!object->IsCode()) { | 414 if (!object->IsCode()) { |
414 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the | 415 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the |
415 // operations covered by the BinaryOpIC we should always have them. | 416 // operations covered by the BinaryOpIC we should always have them. |
416 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN || | 417 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN || |
417 op > BinaryOpIC::State::LAST_TOKEN); | 418 op > BinaryOpIC::State::LAST_TOKEN); |
418 *left = *right = *result = handle(Type::None(), isolate_); | 419 *left = *right = *result = handle(Type::None(), isolate_); |
419 *fixed_right_arg = Maybe<int>(); | 420 *fixed_right_arg = Maybe<int>(); |
| 421 *allocation_site = Handle<AllocationSite>::null(); |
420 return; | 422 return; |
421 } | 423 } |
422 Handle<Code> code = Handle<Code>::cast(object); | 424 Handle<Code> code = Handle<Code>::cast(object); |
423 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); | 425 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); |
424 BinaryOpIC::State state(code->extended_extra_ic_state()); | 426 BinaryOpIC::State state(code->extended_extra_ic_state()); |
425 ASSERT_EQ(op, state.op()); | 427 ASSERT_EQ(op, state.op()); |
426 | 428 |
427 *left = state.GetLeftType(isolate()); | 429 *left = state.GetLeftType(isolate()); |
428 *right = state.GetRightType(isolate()); | 430 *right = state.GetRightType(isolate()); |
429 *result = state.GetResultType(isolate()); | 431 *result = state.GetResultType(isolate()); |
430 *fixed_right_arg = state.fixed_right_arg(); | 432 *fixed_right_arg = state.fixed_right_arg(); |
| 433 |
| 434 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); |
| 435 if (first_allocation_site != NULL) { |
| 436 *allocation_site = handle(first_allocation_site); |
| 437 } else { |
| 438 *allocation_site = Handle<AllocationSite>::null(); |
| 439 } |
431 } | 440 } |
432 | 441 |
433 | 442 |
434 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) { | 443 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) { |
435 Handle<Object> info = GetInfo(id); | 444 Handle<Object> info = GetInfo(id); |
436 Handle<Type> result(Type::None(), isolate_); | 445 Handle<Type> result(Type::None(), isolate_); |
437 if (info->IsCode() && Handle<Code>::cast(info)->is_compare_ic_stub()) { | 446 if (info->IsCode() && Handle<Code>::cast(info)->is_compare_ic_stub()) { |
438 Handle<Code> code = Handle<Code>::cast(info); | 447 Handle<Code> code = Handle<Code>::cast(info); |
439 CompareIC::State state = ICCompareStub::CompareState(code->stub_info()); | 448 CompareIC::State state = ICCompareStub::CompareState(code->stub_info()); |
440 result = CompareIC::StateToType(isolate_, state); | 449 result = CompareIC::StateToType(isolate_, state); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 if (info.IsUninitialized()) return Representation::None(); | 765 if (info.IsUninitialized()) return Representation::None(); |
757 if (info.IsSmi()) return Representation::Smi(); | 766 if (info.IsSmi()) return Representation::Smi(); |
758 if (info.IsInteger32()) return Representation::Integer32(); | 767 if (info.IsInteger32()) return Representation::Integer32(); |
759 if (info.IsDouble()) return Representation::Double(); | 768 if (info.IsDouble()) return Representation::Double(); |
760 if (info.IsNumber()) return Representation::Double(); | 769 if (info.IsNumber()) return Representation::Double(); |
761 return Representation::Tagged(); | 770 return Representation::Tagged(); |
762 } | 771 } |
763 | 772 |
764 | 773 |
765 } } // namespace v8::internal | 774 } } // namespace v8::internal |
OLD | NEW |