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 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2608 UnaryOpIC ic(isolate); | 2608 UnaryOpIC ic(isolate); |
2609 return ic.Transition(object); | 2609 return ic.Transition(object); |
2610 } | 2610 } |
2611 | 2611 |
2612 | 2612 |
2613 static BinaryOpIC::TypeInfo TypeInfoFromValue(Handle<Object> value, | 2613 static BinaryOpIC::TypeInfo TypeInfoFromValue(Handle<Object> value, |
2614 Token::Value op) { | 2614 Token::Value op) { |
2615 v8::internal::TypeInfo type = v8::internal::TypeInfo::FromValue(value); | 2615 v8::internal::TypeInfo type = v8::internal::TypeInfo::FromValue(value); |
2616 if (type.IsSmi()) return BinaryOpIC::SMI; | 2616 if (type.IsSmi()) return BinaryOpIC::SMI; |
2617 if (type.IsInteger32()) { | 2617 if (type.IsInteger32()) { |
2618 if (kSmiValueSize == 32) return BinaryOpIC::SMI; | 2618 if (SmiValuesAre32Bits()) return BinaryOpIC::SMI; |
2619 return BinaryOpIC::INT32; | 2619 return BinaryOpIC::INT32; |
2620 } | 2620 } |
2621 if (type.IsNumber()) return BinaryOpIC::NUMBER; | 2621 if (type.IsNumber()) return BinaryOpIC::NUMBER; |
2622 if (type.IsString()) return BinaryOpIC::STRING; | 2622 if (type.IsString()) return BinaryOpIC::STRING; |
2623 if (value->IsUndefined()) { | 2623 if (value->IsUndefined()) { |
2624 if (op == Token::BIT_AND || | 2624 if (op == Token::BIT_AND || |
2625 op == Token::BIT_OR || | 2625 op == Token::BIT_OR || |
2626 op == Token::BIT_XOR || | 2626 op == Token::BIT_XOR || |
2627 op == Token::SAR || | 2627 op == Token::SAR || |
2628 op == Token::SHL || | 2628 op == Token::SHL || |
2629 op == Token::SHR) { | 2629 op == Token::SHR) { |
2630 if (kSmiValueSize == 32) return BinaryOpIC::SMI; | 2630 if (SmiValuesAre32Bits()) return BinaryOpIC::SMI; |
2631 return BinaryOpIC::INT32; | 2631 return BinaryOpIC::INT32; |
2632 } | 2632 } |
2633 return BinaryOpIC::ODDBALL; | 2633 return BinaryOpIC::ODDBALL; |
2634 } | 2634 } |
2635 return BinaryOpIC::GENERIC; | 2635 return BinaryOpIC::GENERIC; |
2636 } | 2636 } |
2637 | 2637 |
2638 | 2638 |
2639 static BinaryOpIC::TypeInfo InputState(BinaryOpIC::TypeInfo old_type, | 2639 static BinaryOpIC::TypeInfo InputState(BinaryOpIC::TypeInfo old_type, |
2640 Handle<Object> value, | 2640 Handle<Object> value, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2698 (previous_fixed_right_arg.has_value && | 2698 (previous_fixed_right_arg.has_value && |
2699 previous_fixed_right_arg.value == value)); | 2699 previous_fixed_right_arg.value == value)); |
2700 Maybe<int32_t> new_fixed_right_arg( | 2700 Maybe<int32_t> new_fixed_right_arg( |
2701 new_has_fixed_right_arg, new_has_fixed_right_arg ? value : 1); | 2701 new_has_fixed_right_arg, new_has_fixed_right_arg ? value : 1); |
2702 | 2702 |
2703 if (previous_fixed_right_arg.has_value == new_fixed_right_arg.has_value) { | 2703 if (previous_fixed_right_arg.has_value == new_fixed_right_arg.has_value) { |
2704 if (new_overall == BinaryOpIC::SMI && previous_overall == BinaryOpIC::SMI) { | 2704 if (new_overall == BinaryOpIC::SMI && previous_overall == BinaryOpIC::SMI) { |
2705 if (op == Token::DIV || | 2705 if (op == Token::DIV || |
2706 op == Token::MUL || | 2706 op == Token::MUL || |
2707 op == Token::SHR || | 2707 op == Token::SHR || |
2708 kSmiValueSize == 32) { | 2708 SmiValuesAre32Bits()) { |
2709 // Arithmetic on two Smi inputs has yielded a heap number. | 2709 // Arithmetic on two Smi inputs has yielded a heap number. |
2710 // That is the only way to get here from the Smi stub. | 2710 // That is the only way to get here from the Smi stub. |
2711 // With 32-bit Smis, all overflows give heap numbers, but with | 2711 // With 32-bit Smis, all overflows give heap numbers, but with |
2712 // 31-bit Smis, most operations overflow to int32 results. | 2712 // 31-bit Smis, most operations overflow to int32 results. |
2713 result_type = BinaryOpIC::NUMBER; | 2713 result_type = BinaryOpIC::NUMBER; |
2714 } else { | 2714 } else { |
2715 // Other operations on SMIs that overflow yield int32s. | 2715 // Other operations on SMIs that overflow yield int32s. |
2716 result_type = BinaryOpIC::INT32; | 2716 result_type = BinaryOpIC::INT32; |
2717 } | 2717 } |
2718 } | 2718 } |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3128 #undef ADDR | 3128 #undef ADDR |
3129 }; | 3129 }; |
3130 | 3130 |
3131 | 3131 |
3132 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3132 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
3133 return IC_utilities[id]; | 3133 return IC_utilities[id]; |
3134 } | 3134 } |
3135 | 3135 |
3136 | 3136 |
3137 } } // namespace v8::internal | 3137 } } // namespace v8::internal |
OLD | NEW |