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

Side by Side Diff: src/hydrogen.cc

Issue 24095002: ShiftAmountsAllowReplaceByRotate Extension (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: add test case Created 7 years, 3 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/compiler/rotate.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 7590 matching lines...) Expand 10 before | Expand all | Expand 10 after
7601 BuildCheckHeapObject(string); 7601 BuildCheckHeapObject(string);
7602 HValue* checkstring = 7602 HValue* checkstring =
7603 AddInstruction(HCheckInstanceType::NewIsString(string, zone())); 7603 AddInstruction(HCheckInstanceType::NewIsString(string, zone()));
7604 HInstruction* length = BuildLoadStringLength(string, checkstring); 7604 HInstruction* length = BuildLoadStringLength(string, checkstring);
7605 AddInstruction(length); 7605 AddInstruction(length);
7606 HInstruction* checked_index = Add<HBoundsCheck>(index, length); 7606 HInstruction* checked_index = Add<HBoundsCheck>(index, length);
7607 return New<HStringCharCodeAt>(string, checked_index); 7607 return New<HStringCharCodeAt>(string, checked_index);
7608 } 7608 }
7609 7609
7610 7610
7611 // Checks if the given shift amounts have form: (sa) and (32 - sa). 7611 // Checks if the given shift amounts have following forms:
7612 // (N1) and (N2) with N1 + N2 = 32; (sa) and (32 - sa).
7612 static bool ShiftAmountsAllowReplaceByRotate(HValue* sa, 7613 static bool ShiftAmountsAllowReplaceByRotate(HValue* sa,
7613 HValue* const32_minus_sa) { 7614 HValue* const32_minus_sa) {
7615 if (sa->IsConstant() && const32_minus_sa->IsConstant()) {
7616 const HConstant* c1 = HConstant::cast(sa);
7617 const HConstant* c2 = HConstant::cast(const32_minus_sa);
7618 return c1->HasInteger32Value() && c2->HasInteger32Value() &&
7619 (c1->Integer32Value() + c2->Integer32Value() == 32);
7620 }
7614 if (!const32_minus_sa->IsSub()) return false; 7621 if (!const32_minus_sa->IsSub()) return false;
7615 HSub* sub = HSub::cast(const32_minus_sa); 7622 HSub* sub = HSub::cast(const32_minus_sa);
7616 if (sa != sub->right()) return false; 7623 if (sa != sub->right()) return false;
7617 HValue* const32 = sub->left(); 7624 HValue* const32 = sub->left();
7618 if (!const32->IsConstant() || 7625 if (!const32->IsConstant() ||
7619 HConstant::cast(const32)->Integer32Value() != 32) { 7626 HConstant::cast(const32)->Integer32Value() != 32) {
7620 return false; 7627 return false;
7621 } 7628 }
7622 return (sub->right() == sa); 7629 return (sub->right() == sa);
7623 } 7630 }
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after
9679 if (ShouldProduceTraceOutput()) { 9686 if (ShouldProduceTraceOutput()) {
9680 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9687 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9681 } 9688 }
9682 9689
9683 #ifdef DEBUG 9690 #ifdef DEBUG
9684 graph_->Verify(false); // No full verify. 9691 graph_->Verify(false); // No full verify.
9685 #endif 9692 #endif
9686 } 9693 }
9687 9694
9688 } } // namespace v8::internal 9695 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/compiler/rotate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698