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

Side by Side Diff: src/hydrogen.cc

Issue 14211009: Crankshaft: Recognize (i >>> 0) === i for integer32 inputs and replace (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 8 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.h ('k') | src/hydrogen-instructions.h » ('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 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 10023 matching lines...) Expand 10 before | Expand all | Expand 10 after
10034 Representation HOptimizedGraphBuilder::ToRepresentation(TypeInfo info) { 10034 Representation HOptimizedGraphBuilder::ToRepresentation(TypeInfo info) {
10035 if (info.IsUninitialized()) return Representation::None(); 10035 if (info.IsUninitialized()) return Representation::None();
10036 if (info.IsSmi()) return Representation::Integer32(); 10036 if (info.IsSmi()) return Representation::Integer32();
10037 if (info.IsInteger32()) return Representation::Integer32(); 10037 if (info.IsInteger32()) return Representation::Integer32();
10038 if (info.IsDouble()) return Representation::Double(); 10038 if (info.IsDouble()) return Representation::Double();
10039 if (info.IsNumber()) return Representation::Double(); 10039 if (info.IsNumber()) return Representation::Double();
10040 return Representation::Tagged(); 10040 return Representation::Tagged();
10041 } 10041 }
10042 10042
10043 10043
10044 void HOptimizedGraphBuilder::HandleTripleShiftZeroCompare(
10045 CompareOperation* expr,
10046 HValue* input) {
10047 // (i >>> 0) === i is transformed to i >= 0.
10048 // (i >>> 0) !== i is transformed to i < 0.
10049 Token::Value op = (expr->op() == Token::EQ_STRICT) ? Token::GTE : Token::LT;
10050 HCompareIDAndBranch* compare =
10051 new(zone()) HCompareIDAndBranch(input, graph()->GetConstant0(), op);
10052 compare->set_observed_input_representation(Representation::Integer32(),
10053 Representation::Integer32());
10054 compare->set_position(expr->position());
10055 return ast_context()->ReturnControl(compare, expr->id());
10056 }
10057
10058
10044 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, 10059 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr,
10045 HTypeof* typeof_expr, 10060 HTypeof* typeof_expr,
10046 Handle<String> check) { 10061 Handle<String> check) {
10047 // Note: The HTypeof itself is removed during canonicalization, if possible. 10062 // Note: The HTypeof itself is removed during canonicalization, if possible.
10048 HValue* value = typeof_expr->value(); 10063 HValue* value = typeof_expr->value();
10049 HTypeofIsAndBranch* instr = new(zone()) HTypeofIsAndBranch(value, check); 10064 HTypeofIsAndBranch* instr = new(zone()) HTypeofIsAndBranch(value, check);
10050 instr->set_position(expr->position()); 10065 instr->set_position(expr->position());
10051 return ast_context()->ReturnControl(instr, expr->id()); 10066 return ast_context()->ReturnControl(instr, expr->id());
10052 } 10067 }
10053 10068
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after
11872 } 11887 }
11873 } 11888 }
11874 11889
11875 #ifdef DEBUG 11890 #ifdef DEBUG
11876 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11891 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11877 if (allocator_ != NULL) allocator_->Verify(); 11892 if (allocator_ != NULL) allocator_->Verify();
11878 #endif 11893 #endif
11879 } 11894 }
11880 11895
11881 } } // namespace v8::internal 11896 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698