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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 10382033: x86/x64 port of Math.floor(x/y) to use integer division for specific divisor (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 6 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-instructions.h ('k') | src/ia32/disasm-ia32.cc » ('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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 } 934 }
935 935
936 936
937 HValue* HUnaryMathOperation::Canonicalize() { 937 HValue* HUnaryMathOperation::Canonicalize() {
938 if (op() == kMathFloor) { 938 if (op() == kMathFloor) {
939 // If the input is integer32 then we replace the floor instruction 939 // If the input is integer32 then we replace the floor instruction
940 // with its input. This happens before the representation changes are 940 // with its input. This happens before the representation changes are
941 // introduced. 941 // introduced.
942 if (value()->representation().IsInteger32()) return value(); 942 if (value()->representation().IsInteger32()) return value();
943 943
944 #ifdef V8_TARGET_ARCH_ARM 944 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_IA32) || \
945 defined(V8_TARGET_ARCH_X64)
945 if (value()->IsDiv() && (value()->UseCount() == 1)) { 946 if (value()->IsDiv() && (value()->UseCount() == 1)) {
946 // TODO(2038): Implement this optimization for non ARM architectures. 947 // TODO(2038): Implement this optimization for non ARM architectures.
947 HDiv* hdiv = HDiv::cast(value()); 948 HDiv* hdiv = HDiv::cast(value());
948 HValue* left = hdiv->left(); 949 HValue* left = hdiv->left();
949 HValue* right = hdiv->right(); 950 HValue* right = hdiv->right();
950 // Try to simplify left and right values of the division. 951 // Try to simplify left and right values of the division.
951 HValue* new_left = 952 HValue* new_left =
952 LChunkBuilder::SimplifiedDividendForMathFloorOfDiv(left); 953 LChunkBuilder::SimplifiedDividendForMathFloorOfDiv(left);
953 HValue* new_right = 954 HValue* new_right =
954 LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(right); 955 LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(right);
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2216 2217
2217 HValue* HDiv::EnsureAndPropagateNotMinusZero(BitVector* visited) { 2218 HValue* HDiv::EnsureAndPropagateNotMinusZero(BitVector* visited) {
2218 visited->Add(id()); 2219 visited->Add(id());
2219 if (range() == NULL || range()->CanBeMinusZero()) { 2220 if (range() == NULL || range()->CanBeMinusZero()) {
2220 SetFlag(kBailoutOnMinusZero); 2221 SetFlag(kBailoutOnMinusZero);
2221 } 2222 }
2222 return NULL; 2223 return NULL;
2223 } 2224 }
2224 2225
2225 2226
2227 HValue* HMathFloorOfDiv::EnsureAndPropagateNotMinusZero(BitVector* visited) {
2228 visited->Add(id());
2229 SetFlag(kBailoutOnMinusZero);
2230 return NULL;
2231 }
2232
2233
2226 HValue* HMul::EnsureAndPropagateNotMinusZero(BitVector* visited) { 2234 HValue* HMul::EnsureAndPropagateNotMinusZero(BitVector* visited) {
2227 visited->Add(id()); 2235 visited->Add(id());
2228 if (range() == NULL || range()->CanBeMinusZero()) { 2236 if (range() == NULL || range()->CanBeMinusZero()) {
2229 SetFlag(kBailoutOnMinusZero); 2237 SetFlag(kBailoutOnMinusZero);
2230 } 2238 }
2231 return NULL; 2239 return NULL;
2232 } 2240 }
2233 2241
2234 2242
2235 HValue* HSub::EnsureAndPropagateNotMinusZero(BitVector* visited) { 2243 HValue* HSub::EnsureAndPropagateNotMinusZero(BitVector* visited) {
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2520 2528
2521 2529
2522 void HCheckPrototypeMaps::Verify() { 2530 void HCheckPrototypeMaps::Verify() {
2523 HInstruction::Verify(); 2531 HInstruction::Verify();
2524 ASSERT(HasNoUses()); 2532 ASSERT(HasNoUses());
2525 } 2533 }
2526 2534
2527 #endif 2535 #endif
2528 2536
2529 } } // namespace v8::internal 2537 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/disasm-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698