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

Unified Diff: src/compiler/instruction-selector-impl.h

Issue 415403005: [turbofan] Support for combining branches with <Operation>WithOverflow. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/machine-node-factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction-selector-impl.h
diff --git a/src/compiler/instruction-selector-impl.h b/src/compiler/instruction-selector-impl.h
index 31031d8410aa5029287fea421feae98bd1d672a0..5b1dfac4aba399c9e010f69208e3899a458a27e8 100644
--- a/src/compiler/instruction-selector-impl.h
+++ b/src/compiler/instruction-selector-impl.h
@@ -48,6 +48,7 @@ class OperandGenerator {
}
InstructionOperand* DefineAsConstant(Node* node) {
+ selector()->MarkAsDefined(node);
sequence()->AddConstant(node->id(), ToConstant(node));
return ConstantOperand::Create(node->id(), zone());
}
@@ -179,12 +180,16 @@ class OperandGenerator {
ASSERT_NOT_NULL(node);
ASSERT_NOT_NULL(operand);
operand->set_virtual_register(node->id());
+ selector()->MarkAsDefined(node);
return operand;
}
UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) {
- selector_->MarkAsUsed(node);
- return Define(node, operand);
+ ASSERT_NOT_NULL(node);
+ ASSERT_NOT_NULL(operand);
+ operand->set_virtual_register(node->id());
+ selector()->MarkAsUsed(node);
+ return operand;
}
UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location) {
@@ -215,6 +220,8 @@ class OperandGenerator {
// instruction and the branch or set it should be combined with.
class FlagsContinuation V8_FINAL {
public:
+ FlagsContinuation() : mode_(kFlags_none) {}
+
// Creates a new flags continuation from the given condition and true/false
// blocks.
FlagsContinuation(FlagsCondition condition, BasicBlock* true_block,
@@ -236,7 +243,10 @@ class FlagsContinuation V8_FINAL {
bool IsNone() const { return mode_ == kFlags_none; }
bool IsBranch() const { return mode_ == kFlags_branch; }
bool IsSet() const { return mode_ == kFlags_set; }
- FlagsCondition condition() const { return condition_; }
+ FlagsCondition condition() const {
+ ASSERT(!IsNone());
+ return condition_;
+ }
Node* result() const {
ASSERT(IsSet());
return result_;
@@ -250,9 +260,13 @@ class FlagsContinuation V8_FINAL {
return false_block_;
}
- void Negate() { condition_ = static_cast<FlagsCondition>(condition_ ^ 1); }
+ void Negate() {
+ ASSERT(!IsNone());
+ condition_ = static_cast<FlagsCondition>(condition_ ^ 1);
+ }
void Commute() {
+ ASSERT(!IsNone());
switch (condition_) {
case kEqual:
case kNotEqual:
@@ -312,8 +326,11 @@ class FlagsContinuation V8_FINAL {
// Encodes this flags continuation into the given opcode.
InstructionCode Encode(InstructionCode opcode) {
- return opcode | FlagsModeField::encode(mode_) |
- FlagsConditionField::encode(condition_);
+ opcode |= FlagsModeField::encode(mode_);
+ if (mode_ != kFlags_none) {
+ opcode |= FlagsConditionField::encode(condition_);
+ }
+ return opcode;
}
private:
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/machine-node-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698