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

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

Issue 6665006: Reduce strength of ModI for power-of-2 divisor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: port to arm and x64 Created 9 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2549 matching lines...) Expand 10 before | Expand all | Expand 10 after
2560 virtual Range* InferRange(); 2560 virtual Range* InferRange();
2561 }; 2561 };
2562 2562
2563 2563
2564 class HMod: public HArithmeticBinaryOperation { 2564 class HMod: public HArithmeticBinaryOperation {
2565 public: 2565 public:
2566 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2566 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2567 SetFlag(kCanBeDivByZero); 2567 SetFlag(kCanBeDivByZero);
2568 } 2568 }
2569 2569
2570 bool HasPowerOf2Divisor() {
2571 if (right()->IsConstant() &&
2572 HConstant::cast(right())->HasInteger32Value()) {
2573 int32_t value = HConstant::cast(right())->Integer32Value();
2574 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value));
2575 }
2576
2577 return false;
2578 }
2579
2570 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2580 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2571 2581
2572 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod") 2582 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod")
2573 2583
2574 protected: 2584 protected:
2575 virtual bool DataEquals(HValue* other) { return true; } 2585 virtual bool DataEquals(HValue* other) { return true; }
2576 2586
2577 virtual Range* InferRange(); 2587 virtual Range* InferRange();
2578 }; 2588 };
2579 2589
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
3451 HValue* object() { return left(); } 3461 HValue* object() { return left(); }
3452 HValue* key() { return right(); } 3462 HValue* key() { return right(); }
3453 }; 3463 };
3454 3464
3455 #undef DECLARE_INSTRUCTION 3465 #undef DECLARE_INSTRUCTION
3456 #undef DECLARE_CONCRETE_INSTRUCTION 3466 #undef DECLARE_CONCRETE_INSTRUCTION
3457 3467
3458 } } // namespace v8::internal 3468 } } // namespace v8::internal
3459 3469
3460 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3470 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698