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

Unified Diff: src/hydrogen-instructions.h

Issue 6366002: Begin changing Hydrogen branch instructions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build/ia32
Patch Set: Rebase to HEAD> Created 9 years, 11 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/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index d8d3f6fdf1a7a4dd1370543672eb7154a6da0318..ab5005b9fcfae0564b1ef427dca2f00337db1078 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -99,9 +99,9 @@ class LChunkBuilder;
// HDeoptimize
// HGoto
// HUnaryControlInstruction
-// HBranch
-// HCompareMapAndBranch
+// HCompareMap
// HReturn
+// HTest
// HThrow
// HEnterInlined
// HFunctionLiteral
@@ -183,7 +183,6 @@ class LChunkBuilder;
V(BitXor) \
V(BlockEntry) \
V(BoundsCheck) \
- V(Branch) \
V(CallConstantFunction) \
V(CallFunction) \
V(CallGlobal) \
@@ -202,7 +201,7 @@ class LChunkBuilder;
V(CheckSmi) \
V(Compare) \
V(CompareJSObjectEq) \
- V(CompareMapAndBranch) \
+ V(CompareMap) \
V(Constant) \
V(DeleteProperty) \
V(Deoptimize) \
@@ -253,6 +252,7 @@ class LChunkBuilder;
V(StringCharCodeAt) \
V(StringLength) \
V(Sub) \
+ V(Test) \
V(Throw) \
V(Typeof) \
V(TypeofIs) \
@@ -815,44 +815,55 @@ class HBlockEntry: public HInstruction {
class HControlInstruction: public HInstruction {
public:
- virtual HBasicBlock* FirstSuccessor() const { return NULL; }
- virtual HBasicBlock* SecondSuccessor() const { return NULL; }
+ HControlInstruction(HBasicBlock* first, HBasicBlock* second)
+ : first_successor_(first), second_successor_(second) {
+ }
+
+ HBasicBlock* FirstSuccessor() const { return first_successor_; }
+ HBasicBlock* SecondSuccessor() const { return second_successor_; }
+
+ virtual void PrintDataTo(StringStream* stream) const;
DECLARE_INSTRUCTION(ControlInstruction)
+
+ private:
+ HBasicBlock* first_successor_;
+ HBasicBlock* second_successor_;
};
class HDeoptimize: public HControlInstruction {
public:
+ HDeoptimize() : HControlInstruction(NULL, NULL) { }
+
DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
};
class HGoto: public HControlInstruction {
public:
- explicit HGoto(HBasicBlock* destination)
- : destination_(destination),
- include_stack_check_(false) {}
+ explicit HGoto(HBasicBlock* target)
+ : HControlInstruction(target, NULL), include_stack_check_(false) {
+ }
- virtual HBasicBlock* FirstSuccessor() const { return destination_; }
void set_include_stack_check(bool include_stack_check) {
include_stack_check_ = include_stack_check;
}
bool include_stack_check() const { return include_stack_check_; }
- virtual void PrintDataTo(StringStream* stream) const;
-
DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
private:
- HBasicBlock* destination_;
bool include_stack_check_;
};
class HUnaryControlInstruction: public HControlInstruction {
public:
- explicit HUnaryControlInstruction(HValue* value) {
+ explicit HUnaryControlInstruction(HValue* value,
+ HBasicBlock* true_target,
+ HBasicBlock* false_target)
+ : HControlInstruction(true_target, false_target) {
SetOperandAt(0, value);
}
@@ -860,6 +871,8 @@ class HUnaryControlInstruction: public HControlInstruction {
return Representation::Tagged();
}
+ virtual void PrintDataTo(StringStream* stream) const;
+
HValue* value() const { return OperandAt(0); }
virtual int OperandCount() const { return 1; }
virtual HValue* OperandAt(int index) const { return operands_[index]; }
@@ -876,73 +889,50 @@ class HUnaryControlInstruction: public HControlInstruction {
};
-class HBranch: public HUnaryControlInstruction {
+class HTest: public HUnaryControlInstruction {
public:
- HBranch(HBasicBlock* true_destination,
- HBasicBlock* false_destination,
- HValue* boolean_value)
- : HUnaryControlInstruction(boolean_value),
- true_destination_(true_destination),
- false_destination_(false_destination) {
- ASSERT(true_destination != NULL && false_destination != NULL);
+ HTest(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target)
+ : HUnaryControlInstruction(value, true_target, false_target) {
+ ASSERT(true_target != NULL && false_target != NULL);
}
virtual Representation RequiredInputRepresentation(int index) const {
return Representation::None();
}
- virtual HBasicBlock* FirstSuccessor() const { return true_destination_; }
- virtual HBasicBlock* SecondSuccessor() const { return false_destination_; }
-
- virtual void PrintDataTo(StringStream* stream) const;
-
- DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
-
- private:
- HBasicBlock* true_destination_;
- HBasicBlock* false_destination_;
+ DECLARE_CONCRETE_INSTRUCTION(Test, "test")
};
-class HCompareMapAndBranch: public HUnaryControlInstruction {
+class HCompareMap: public HUnaryControlInstruction {
public:
- HCompareMapAndBranch(HValue* result,
- Handle<Map> map,
- HBasicBlock* true_destination,
- HBasicBlock* false_destination)
- : HUnaryControlInstruction(result),
- map_(map),
- true_destination_(true_destination),
- false_destination_(false_destination) {
- ASSERT(true_destination != NULL);
- ASSERT(false_destination != NULL);
+ HCompareMap(HValue* value,
+ Handle<Map> map,
+ HBasicBlock* true_target,
+ HBasicBlock* false_target)
+ : HUnaryControlInstruction(value, true_target, false_target),
+ map_(map) {
+ ASSERT(true_target != NULL);
+ ASSERT(false_target != NULL);
ASSERT(!map.is_null());
}
- virtual HBasicBlock* FirstSuccessor() const { return true_destination_; }
- virtual HBasicBlock* SecondSuccessor() const { return false_destination_; }
-
- HBasicBlock* true_destination() const { return true_destination_; }
- HBasicBlock* false_destination() const { return false_destination_; }
-
virtual void PrintDataTo(StringStream* stream) const;
Handle<Map> map() const { return map_; }
- DECLARE_CONCRETE_INSTRUCTION(CompareMapAndBranch, "compare_map_and_branch")
+ DECLARE_CONCRETE_INSTRUCTION(CompareMap, "compare_map")
private:
Handle<Map> map_;
- HBasicBlock* true_destination_;
- HBasicBlock* false_destination_;
};
class HReturn: public HUnaryControlInstruction {
public:
- explicit HReturn(HValue* result) : HUnaryControlInstruction(result) { }
-
- virtual void PrintDataTo(StringStream* stream) const;
+ explicit HReturn(HValue* value)
+ : HUnaryControlInstruction(value, NULL, NULL) {
+ }
DECLARE_CONCRETE_INSTRUCTION(Return, "return")
};
@@ -950,9 +940,8 @@ class HReturn: public HUnaryControlInstruction {
class HThrow: public HUnaryControlInstruction {
public:
- explicit HThrow(HValue* value) : HUnaryControlInstruction(value) { }
-
- virtual void PrintDataTo(StringStream* stream) const;
+ explicit HThrow(HValue* value)
+ : HUnaryControlInstruction(value, NULL, NULL) { }
DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
};
« 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