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

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

Issue 175143002: Consistenly handle power-of-2 divisors in division-like operations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 6 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
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/ia32/lithium-codegen-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 3695 matching lines...) Expand 10 before | Expand all | Expand 10 after
3706 return representation(); 3706 return representation();
3707 } 3707 }
3708 3708
3709 void SetOperandPositions(Zone* zone, 3709 void SetOperandPositions(Zone* zone,
3710 HSourcePosition left_pos, 3710 HSourcePosition left_pos,
3711 HSourcePosition right_pos) { 3711 HSourcePosition right_pos) {
3712 set_operand_position(zone, 1, left_pos); 3712 set_operand_position(zone, 1, left_pos);
3713 set_operand_position(zone, 2, right_pos); 3713 set_operand_position(zone, 2, right_pos);
3714 } 3714 }
3715 3715
3716 bool RightIsPowerOf2() {
3717 if (!right()->IsInteger32Constant()) return false;
3718 int32_t value = right()->GetInteger32Constant();
3719 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value));
3720 }
3721
3716 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) 3722 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation)
3717 3723
3718 private: 3724 private:
3719 bool IgnoreObservedOutputRepresentation(Representation current_rep); 3725 bool IgnoreObservedOutputRepresentation(Representation current_rep);
3720 3726
3721 Representation observed_input_representation_[2]; 3727 Representation observed_input_representation_[2];
3722 Representation observed_output_representation_; 3728 Representation observed_output_representation_;
3723 }; 3729 };
3724 3730
3725 3731
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
4082 if (to.IsTagged() && 4088 if (to.IsTagged() &&
4083 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { 4089 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
4084 SetAllSideEffects(); 4090 SetAllSideEffects();
4085 ClearFlag(kUseGVN); 4091 ClearFlag(kUseGVN);
4086 } else { 4092 } else {
4087 ClearAllSideEffects(); 4093 ClearAllSideEffects();
4088 SetFlag(kUseGVN); 4094 SetFlag(kUseGVN);
4089 } 4095 }
4090 } 4096 }
4091 4097
4092 bool RightIsPowerOf2() {
4093 if (!right()->IsInteger32Constant()) return false;
4094 int32_t value = right()->GetInteger32Constant();
4095 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value));
4096 }
4097
4098 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) 4098 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation)
4099 4099
4100 private: 4100 private:
4101 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4101 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
4102 }; 4102 };
4103 4103
4104 4104
4105 class HCompareGeneric V8_FINAL : public HBinaryOperation { 4105 class HCompareGeneric V8_FINAL : public HBinaryOperation {
4106 public: 4106 public:
4107 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*, 4107 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*,
(...skipping 3377 matching lines...) Expand 10 before | Expand all | Expand 10 after
7485 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7485 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7486 }; 7486 };
7487 7487
7488 7488
7489 #undef DECLARE_INSTRUCTION 7489 #undef DECLARE_INSTRUCTION
7490 #undef DECLARE_CONCRETE_INSTRUCTION 7490 #undef DECLARE_CONCRETE_INSTRUCTION
7491 7491
7492 } } // namespace v8::internal 7492 } } // namespace v8::internal
7493 7493
7494 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7494 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698