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

Unified Diff: src/hydrogen-uint32-analysis.cc

Issue 288383002: Allow comparison in UINT32 mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-uint32-analysis.cc
diff --git a/src/hydrogen-uint32-analysis.cc b/src/hydrogen-uint32-analysis.cc
index 21fbec9f3363bc4de1e7b0bee10cf6210811bfd7..24c256b503a6b8af464700e4a6fa23a4912a94ea 100644
--- a/src/hydrogen-uint32-analysis.cc
+++ b/src/hydrogen-uint32-analysis.cc
@@ -8,6 +8,30 @@ namespace v8 {
namespace internal {
+static bool IsUnsignedLoad(HLoadKeyed* instr) {
+ switch (instr->elements_kind()) {
+ case EXTERNAL_UINT8_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case UINT8_ELEMENTS:
+ case UINT16_ELEMENTS:
+ case UINT32_ELEMENTS:
+ case UINT8_CLAMPED_ELEMENTS:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
+static bool IsUint32Operation(HValue* instr) {
+ return instr->IsShr() ||
+ (instr->IsLoadKeyed() && IsUnsignedLoad(HLoadKeyed::cast(instr))) ||
+ (instr->IsInteger32Constant() && instr->GetInteger32Constant() >= 0);
+}
+
+
bool HUint32AnalysisPhase::IsSafeUint32Use(HValue* val, HValue* use) {
// Operations that operate on bits are safe.
if (use->IsBitwise() || use->IsShl() || use->IsSar() || use->IsShr()) {
@@ -37,6 +61,9 @@ bool HUint32AnalysisPhase::IsSafeUint32Use(HValue* val, HValue* use) {
return true;
}
}
+ } else if (use->IsCompareNumericAndBranch()) {
+ HCompareNumericAndBranch* c = HCompareNumericAndBranch::cast(use);
+ return IsUint32Operation(c->left()) && IsUint32Operation(c->right());
}
return false;
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698