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

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: 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(FACTORY->NewNumber(val, TENURED), \
Yang 2013/02/19 14:39:07 As discussed offline, there is no need to allocate
Jakob Kummerow 2013/02/21 08:46:26 Done.
2751 Representation::Double()) 2750 Representation::Double())
2752 2751
2753 #define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \ 2752 #define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \
2754 HInstruction* HInstr::New##HInstr(Zone* zone, \ 2753 HInstruction* HInstr::New##HInstr(Zone* zone, \
2755 HValue* context, \ 2754 HValue* context, \
2756 HValue* left, \ 2755 HValue* left, \
2757 HValue* right) { \ 2756 HValue* right) { \
2758 if (left->IsConstant() && right->IsConstant()) { \ 2757 if (left->IsConstant() && right->IsConstant()) { \
2759 HConstant* c_left = HConstant::cast(left); \ 2758 HConstant* c_left = HConstant::cast(left); \
2760 HConstant* c_right = HConstant::cast(right); \ 2759 HConstant* c_right = HConstant::cast(right); \
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2886 if (left->IsConstant() && right->IsConstant()) { 2885 if (left->IsConstant() && right->IsConstant()) {
2887 HConstant* c_left = HConstant::cast(left); 2886 HConstant* c_left = HConstant::cast(left);
2888 HConstant* c_right = HConstant::cast(right); 2887 HConstant* c_right = HConstant::cast(right);
2889 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { 2888 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) {
2890 int32_t left_val = c_left->NumberValueAsInteger32(); 2889 int32_t left_val = c_left->NumberValueAsInteger32();
2891 int32_t right_val = c_right->NumberValueAsInteger32() & 0x1f; 2890 int32_t right_val = c_right->NumberValueAsInteger32() & 0x1f;
2892 if ((right_val == 0) && (left_val < 0)) { 2891 if ((right_val == 0) && (left_val < 0)) {
2893 return H_CONSTANT_DOUBLE( 2892 return H_CONSTANT_DOUBLE(
2894 static_cast<double>(static_cast<uint32_t>(left_val))); 2893 static_cast<double>(static_cast<uint32_t>(left_val)));
2895 } 2894 }
2896 return H_CONSTANT_INT32(static_cast<uint32_t>(left_val) >> right_val); 2895 return H_CONSTANT_INT32(static_cast<int32_t>(
2896 static_cast<uint32_t>(left_val) >> right_val));
2897 } 2897 }
2898 } 2898 }
2899 return new(zone) HShr(context, left, right); 2899 return new(zone) HShr(context, left, right);
2900 } 2900 }
2901 2901
2902 2902
2903 #undef H_CONSTANT_INT32 2903 #undef H_CONSTANT_INT32
2904 #undef H_CONSTANT_DOUBLE 2904 #undef H_CONSTANT_DOUBLE
2905 2905
2906 2906
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
3060 3060
3061 3061
3062 void HCheckFunction::Verify() { 3062 void HCheckFunction::Verify() {
3063 HInstruction::Verify(); 3063 HInstruction::Verify();
3064 ASSERT(HasNoUses()); 3064 ASSERT(HasNoUses());
3065 } 3065 }
3066 3066
3067 #endif 3067 #endif
3068 3068
3069 } } // namespace v8::internal 3069 } } // 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