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

Side by Side Diff: src/hydrogen.cc

Issue 197803005: Check that constant is an integer before getting its value in HGraphBuilder::MatchRotateRight. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: remove redundant check Created 6 years, 9 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 | « no previous file | test/mjsunit/regress/regress-351263.js » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 8914 matching lines...) Expand 10 before | Expand all | Expand 10 after
8925 static bool ShiftAmountsAllowReplaceByRotate(HValue* sa, 8925 static bool ShiftAmountsAllowReplaceByRotate(HValue* sa,
8926 HValue* const32_minus_sa) { 8926 HValue* const32_minus_sa) {
8927 if (sa->IsConstant() && const32_minus_sa->IsConstant()) { 8927 if (sa->IsConstant() && const32_minus_sa->IsConstant()) {
8928 const HConstant* c1 = HConstant::cast(sa); 8928 const HConstant* c1 = HConstant::cast(sa);
8929 const HConstant* c2 = HConstant::cast(const32_minus_sa); 8929 const HConstant* c2 = HConstant::cast(const32_minus_sa);
8930 return c1->HasInteger32Value() && c2->HasInteger32Value() && 8930 return c1->HasInteger32Value() && c2->HasInteger32Value() &&
8931 (c1->Integer32Value() + c2->Integer32Value() == 32); 8931 (c1->Integer32Value() + c2->Integer32Value() == 32);
8932 } 8932 }
8933 if (!const32_minus_sa->IsSub()) return false; 8933 if (!const32_minus_sa->IsSub()) return false;
8934 HSub* sub = HSub::cast(const32_minus_sa); 8934 HSub* sub = HSub::cast(const32_minus_sa);
8935 if (sa != sub->right()) return false; 8935 return sub->left()->EqualsInteger32Constant(32) && sub->right() == sa;
8936 HValue* const32 = sub->left();
8937 if (!const32->IsConstant() ||
8938 HConstant::cast(const32)->Integer32Value() != 32) {
8939 return false;
8940 }
8941 return (sub->right() == sa);
8942 } 8936 }
8943 8937
8944 8938
8945 // Checks if the left and the right are shift instructions with the oposite 8939 // Checks if the left and the right are shift instructions with the oposite
8946 // directions that can be replaced by one rotate right instruction or not. 8940 // directions that can be replaced by one rotate right instruction or not.
8947 // Returns the operand and the shift amount for the rotate instruction in the 8941 // Returns the operand and the shift amount for the rotate instruction in the
8948 // former case. 8942 // former case.
8949 bool HGraphBuilder::MatchRotateRight(HValue* left, 8943 bool HGraphBuilder::MatchRotateRight(HValue* left,
8950 HValue* right, 8944 HValue* right,
8951 HValue** operand, 8945 HValue** operand,
(...skipping 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after
11292 if (ShouldProduceTraceOutput()) { 11286 if (ShouldProduceTraceOutput()) {
11293 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11287 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11294 } 11288 }
11295 11289
11296 #ifdef DEBUG 11290 #ifdef DEBUG
11297 graph_->Verify(false); // No full verify. 11291 graph_->Verify(false); // No full verify.
11298 #endif 11292 #endif
11299 } 11293 }
11300 11294
11301 } } // namespace v8::internal 11295 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-351263.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698