Commit d62337e1 authored by danno@chromium.org's avatar danno@chromium.org

Add ability to do "else-if" clauses in IfBuilder

- In an Else block it's possible to add more If<>'s in the same builder that are
  treated as an else if.
- Simplified and cleaned-up some of the IfBuilder's internals.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/66983002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17780 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a6ba455b
This diff is collapsed.
......@@ -953,7 +953,10 @@ class FunctionState V8_FINAL {
class HIfContinuation V8_FINAL {
public:
HIfContinuation() : continuation_captured_(false) {}
HIfContinuation()
: continuation_captured_(false),
true_branch_(NULL),
false_branch_(NULL) {}
HIfContinuation(HBasicBlock* true_branch,
HBasicBlock* false_branch)
: continuation_captured_(true), true_branch_(true_branch),
......@@ -1493,6 +1496,10 @@ class HGraphBuilder {
void End();
void Deopt(const char* reason);
void ThenDeopt(const char* reason) {
Then();
Deopt(reason);
}
void ElseDeopt(const char* reason) {
Else();
Deopt(reason);
......@@ -1505,21 +1512,41 @@ class HGraphBuilder {
HGraphBuilder* builder() const { return builder_; }
void AddMergeAtJoinBlock(bool deopt);
void Finish();
void Finish(HBasicBlock** then_continuation,
HBasicBlock** else_continuation);
class MergeAtJoinBlock : public ZoneObject {
public:
MergeAtJoinBlock(HBasicBlock* block,
bool deopt,
MergeAtJoinBlock* next)
: block_(block),
deopt_(deopt),
next_(next) {}
HBasicBlock* block_;
bool deopt_;
MergeAtJoinBlock* next_;
};
HGraphBuilder* builder_;
bool finished_ : 1;
bool deopt_then_ : 1;
bool deopt_else_ : 1;
bool did_then_ : 1;
bool did_else_ : 1;
bool did_else_if_ : 1;
bool did_and_ : 1;
bool did_or_ : 1;
bool captured_ : 1;
bool needs_compare_ : 1;
bool pending_merge_block_ : 1;
HBasicBlock* first_true_block_;
HBasicBlock* last_true_block_;
HBasicBlock* first_false_block_;
HBasicBlock* split_edge_merge_block_;
HBasicBlock* merge_block_;
MergeAtJoinBlock* merge_at_join_blocks_;
int normal_merge_at_join_block_count_;
int deopt_merge_at_join_block_count_;
};
class LoopBuilder V8_FINAL {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment