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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 12281019: Avoid creating unnecessary branches in Hydrogen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed Yang's comment Created 7 years, 10 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.cc ('k') | no next file » | 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 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after
2737 } 2737 }
2738 if (HChange::cast(value())->value()->type().IsSmi()) { 2738 if (HChange::cast(value())->value()->type().IsSmi()) {
2739 return false; 2739 return false;
2740 } 2740 }
2741 } 2741 }
2742 return true; 2742 return true;
2743 } 2743 }
2744 2744
2745 2745
2746 #define H_CONSTANT_INT32(val) \ 2746 #define H_CONSTANT_INT32(val) \
2747 new(zone) HConstant(FACTORY->NewNumberFromInt(val, TENURED), \ 2747 new(zone) HConstant(val, Representation::Integer32())
2748 Representation::Integer32())
2749 #define H_CONSTANT_DOUBLE(val) \ 2748 #define H_CONSTANT_DOUBLE(val) \
2750 new(zone) HConstant(FACTORY->NewNumber(val, TENURED), \ 2749 new(zone) HConstant(val, Representation::Double())
2751 Representation::Double())
2752 2750
2753 #define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \ 2751 #define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \
2754 HInstruction* HInstr::New##HInstr(Zone* zone, \ 2752 HInstruction* HInstr::New##HInstr(Zone* zone, \
2755 HValue* context, \ 2753 HValue* context, \
2756 HValue* left, \ 2754 HValue* left, \
2757 HValue* right) { \ 2755 HValue* right) { \
2758 if (left->IsConstant() && right->IsConstant()) { \ 2756 if (left->IsConstant() && right->IsConstant()) { \
2759 HConstant* c_left = HConstant::cast(left); \ 2757 HConstant* c_left = HConstant::cast(left); \
2760 HConstant* c_right = HConstant::cast(right); \ 2758 HConstant* c_right = HConstant::cast(right); \
2761 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \ 2759 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2886 if (left->IsConstant() && right->IsConstant()) { 2884 if (left->IsConstant() && right->IsConstant()) {
2887 HConstant* c_left = HConstant::cast(left); 2885 HConstant* c_left = HConstant::cast(left);
2888 HConstant* c_right = HConstant::cast(right); 2886 HConstant* c_right = HConstant::cast(right);
2889 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { 2887 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) {
2890 int32_t left_val = c_left->NumberValueAsInteger32(); 2888 int32_t left_val = c_left->NumberValueAsInteger32();
2891 int32_t right_val = c_right->NumberValueAsInteger32() & 0x1f; 2889 int32_t right_val = c_right->NumberValueAsInteger32() & 0x1f;
2892 if ((right_val == 0) && (left_val < 0)) { 2890 if ((right_val == 0) && (left_val < 0)) {
2893 return H_CONSTANT_DOUBLE( 2891 return H_CONSTANT_DOUBLE(
2894 static_cast<double>(static_cast<uint32_t>(left_val))); 2892 static_cast<double>(static_cast<uint32_t>(left_val)));
2895 } 2893 }
2896 return H_CONSTANT_INT32(static_cast<uint32_t>(left_val) >> right_val); 2894 return H_CONSTANT_INT32(static_cast<int32_t>(
2895 static_cast<uint32_t>(left_val) >> right_val));
2897 } 2896 }
2898 } 2897 }
2899 return new(zone) HShr(context, left, right); 2898 return new(zone) HShr(context, left, right);
2900 } 2899 }
2901 2900
2902 2901
2903 #undef H_CONSTANT_INT32 2902 #undef H_CONSTANT_INT32
2904 #undef H_CONSTANT_DOUBLE 2903 #undef H_CONSTANT_DOUBLE
2905 2904
2906 2905
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
3060 3059
3061 3060
3062 void HCheckFunction::Verify() { 3061 void HCheckFunction::Verify() {
3063 HInstruction::Verify(); 3062 HInstruction::Verify();
3064 ASSERT(HasNoUses()); 3063 ASSERT(HasNoUses());
3065 } 3064 }
3066 3065
3067 #endif 3066 #endif
3068 3067
3069 } } // namespace v8::internal 3068 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698