Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/ic.cc

Issue 22350005: Introduce SmiValuesAre31Bits and SmiValuesAre32Bits global predicate functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after
2586 *right = TypeInfoToType(right_typeinfo, isolate); 2586 *right = TypeInfoToType(right_typeinfo, isolate);
2587 *result = TypeInfoToType(result_typeinfo, isolate); 2587 *result = TypeInfoToType(result_typeinfo, isolate);
2588 } 2588 }
2589 2589
2590 2590
2591 static BinaryOpIC::TypeInfo TypeInfoFromValue(Handle<Object> value, 2591 static BinaryOpIC::TypeInfo TypeInfoFromValue(Handle<Object> value,
2592 Token::Value op) { 2592 Token::Value op) {
2593 v8::internal::TypeInfo type = v8::internal::TypeInfo::FromValue(value); 2593 v8::internal::TypeInfo type = v8::internal::TypeInfo::FromValue(value);
2594 if (type.IsSmi()) return BinaryOpIC::SMI; 2594 if (type.IsSmi()) return BinaryOpIC::SMI;
2595 if (type.IsInteger32()) { 2595 if (type.IsInteger32()) {
2596 if (kSmiValueSize == 32) return BinaryOpIC::SMI; 2596 if (SmiValuesAre32Bits()) return BinaryOpIC::SMI;
2597 return BinaryOpIC::INT32; 2597 return BinaryOpIC::INT32;
2598 } 2598 }
2599 if (type.IsNumber()) return BinaryOpIC::NUMBER; 2599 if (type.IsNumber()) return BinaryOpIC::NUMBER;
2600 if (type.IsString()) return BinaryOpIC::STRING; 2600 if (type.IsString()) return BinaryOpIC::STRING;
2601 if (value->IsUndefined()) { 2601 if (value->IsUndefined()) {
2602 if (op == Token::BIT_AND || 2602 if (op == Token::BIT_AND ||
2603 op == Token::BIT_OR || 2603 op == Token::BIT_OR ||
2604 op == Token::BIT_XOR || 2604 op == Token::BIT_XOR ||
2605 op == Token::SAR || 2605 op == Token::SAR ||
2606 op == Token::SHL || 2606 op == Token::SHL ||
2607 op == Token::SHR) { 2607 op == Token::SHR) {
2608 if (kSmiValueSize == 32) return BinaryOpIC::SMI; 2608 if (SmiValuesAre32Bits()) return BinaryOpIC::SMI;
2609 return BinaryOpIC::INT32; 2609 return BinaryOpIC::INT32;
2610 } 2610 }
2611 return BinaryOpIC::ODDBALL; 2611 return BinaryOpIC::ODDBALL;
2612 } 2612 }
2613 return BinaryOpIC::GENERIC; 2613 return BinaryOpIC::GENERIC;
2614 } 2614 }
2615 2615
2616 2616
2617 static BinaryOpIC::TypeInfo InputState(BinaryOpIC::TypeInfo old_type, 2617 static BinaryOpIC::TypeInfo InputState(BinaryOpIC::TypeInfo old_type,
2618 Handle<Object> value, 2618 Handle<Object> value,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 (previous_fixed_right_arg.has_value && 2676 (previous_fixed_right_arg.has_value &&
2677 previous_fixed_right_arg.value == value)); 2677 previous_fixed_right_arg.value == value));
2678 Maybe<int32_t> new_fixed_right_arg( 2678 Maybe<int32_t> new_fixed_right_arg(
2679 new_has_fixed_right_arg, new_has_fixed_right_arg ? value : 1); 2679 new_has_fixed_right_arg, new_has_fixed_right_arg ? value : 1);
2680 2680
2681 if (previous_fixed_right_arg.has_value == new_fixed_right_arg.has_value) { 2681 if (previous_fixed_right_arg.has_value == new_fixed_right_arg.has_value) {
2682 if (new_overall == BinaryOpIC::SMI && previous_overall == BinaryOpIC::SMI) { 2682 if (new_overall == BinaryOpIC::SMI && previous_overall == BinaryOpIC::SMI) {
2683 if (op == Token::DIV || 2683 if (op == Token::DIV ||
2684 op == Token::MUL || 2684 op == Token::MUL ||
2685 op == Token::SHR || 2685 op == Token::SHR ||
2686 kSmiValueSize == 32) { 2686 SmiValuesAre32Bits()) {
2687 // Arithmetic on two Smi inputs has yielded a heap number. 2687 // Arithmetic on two Smi inputs has yielded a heap number.
2688 // That is the only way to get here from the Smi stub. 2688 // That is the only way to get here from the Smi stub.
2689 // With 32-bit Smis, all overflows give heap numbers, but with 2689 // With 32-bit Smis, all overflows give heap numbers, but with
2690 // 31-bit Smis, most operations overflow to int32 results. 2690 // 31-bit Smis, most operations overflow to int32 results.
2691 result_type = BinaryOpIC::NUMBER; 2691 result_type = BinaryOpIC::NUMBER;
2692 } else { 2692 } else {
2693 // Other operations on SMIs that overflow yield int32s. 2693 // Other operations on SMIs that overflow yield int32s.
2694 result_type = BinaryOpIC::INT32; 2694 result_type = BinaryOpIC::INT32;
2695 } 2695 }
2696 } 2696 }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
3106 #undef ADDR 3106 #undef ADDR
3107 }; 3107 };
3108 3108
3109 3109
3110 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3110 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3111 return IC_utilities[id]; 3111 return IC_utilities[id];
3112 } 3112 }
3113 3113
3114 3114
3115 } } // namespace v8::internal 3115 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698