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

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

Issue 17468003: Use AST's type field and merge types for unary, binary & compare ICs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 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.cc ('k') | src/hydrogen-instructions.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 4444 matching lines...) Expand 10 before | Expand all | Expand 10 after
4455 } 4455 }
4456 }; 4456 };
4457 4457
4458 4458
4459 class HMod: public HArithmeticBinaryOperation { 4459 class HMod: public HArithmeticBinaryOperation {
4460 public: 4460 public:
4461 static HInstruction* New(Zone* zone, 4461 static HInstruction* New(Zone* zone,
4462 HValue* context, 4462 HValue* context,
4463 HValue* left, 4463 HValue* left,
4464 HValue* right, 4464 HValue* right,
4465 bool has_fixed_right_arg, 4465 Maybe<int> fixed_right_arg);
4466 int fixed_right_arg_value);
4467 4466
4468 bool has_fixed_right_arg() const { return has_fixed_right_arg_; } 4467 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
4469 int fixed_right_arg_value() const { return fixed_right_arg_value_; }
4470 4468
4471 bool HasPowerOf2Divisor() { 4469 bool HasPowerOf2Divisor() {
4472 if (right()->IsConstant() && 4470 if (right()->IsConstant() &&
4473 HConstant::cast(right())->HasInteger32Value()) { 4471 HConstant::cast(right())->HasInteger32Value()) {
4474 int32_t value = HConstant::cast(right())->Integer32Value(); 4472 int32_t value = HConstant::cast(right())->Integer32Value();
4475 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); 4473 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value));
4476 } 4474 }
4477 4475
4478 return false; 4476 return false;
4479 } 4477 }
4480 4478
4481 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 4479 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
4482 4480
4483 virtual HValue* Canonicalize(); 4481 virtual HValue* Canonicalize();
4484 4482
4485 DECLARE_CONCRETE_INSTRUCTION(Mod) 4483 DECLARE_CONCRETE_INSTRUCTION(Mod)
4486 4484
4487 protected: 4485 protected:
4488 virtual bool DataEquals(HValue* other) { return true; } 4486 virtual bool DataEquals(HValue* other) { return true; }
4489 4487
4490 virtual Range* InferRange(Zone* zone); 4488 virtual Range* InferRange(Zone* zone);
4491 4489
4492 private: 4490 private:
4493 HMod(HValue* context, 4491 HMod(HValue* context,
4494 HValue* left, 4492 HValue* left,
4495 HValue* right, 4493 HValue* right,
4496 bool has_fixed_right_arg, 4494 Maybe<int> fixed_right_arg)
4497 int fixed_right_arg_value)
4498 : HArithmeticBinaryOperation(context, left, right), 4495 : HArithmeticBinaryOperation(context, left, right),
4499 has_fixed_right_arg_(has_fixed_right_arg), 4496 fixed_right_arg_(fixed_right_arg) {
4500 fixed_right_arg_value_(fixed_right_arg_value) {
4501 SetFlag(kCanBeDivByZero); 4497 SetFlag(kCanBeDivByZero);
4502 SetFlag(kCanOverflow); 4498 SetFlag(kCanOverflow);
4503 } 4499 }
4504 4500
4505 const bool has_fixed_right_arg_; 4501 const Maybe<int> fixed_right_arg_;
4506 const int fixed_right_arg_value_;
4507 }; 4502 };
4508 4503
4509 4504
4510 class HDiv: public HArithmeticBinaryOperation { 4505 class HDiv: public HArithmeticBinaryOperation {
4511 public: 4506 public:
4512 static HInstruction* New(Zone* zone, 4507 static HInstruction* New(Zone* zone,
4513 HValue* context, 4508 HValue* context,
4514 HValue* left, 4509 HValue* left,
4515 HValue* right); 4510 HValue* right);
4516 4511
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after
6640 virtual bool IsDeletable() const { return true; } 6635 virtual bool IsDeletable() const { return true; }
6641 }; 6636 };
6642 6637
6643 6638
6644 #undef DECLARE_INSTRUCTION 6639 #undef DECLARE_INSTRUCTION
6645 #undef DECLARE_CONCRETE_INSTRUCTION 6640 #undef DECLARE_CONCRETE_INSTRUCTION
6646 6641
6647 } } // namespace v8::internal 6642 } } // namespace v8::internal
6648 6643
6649 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6644 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698