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

Unified Diff: src/hydrogen.cc

Issue 22876009: Improve and simplify removal of unreachable code (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix ia32 Created 7 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
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index ba1de7aa2258a308927c90f937d5d1e6beccd841..0206584404ff477b1bb7c28d9c6b7b0ab9c539e2 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -93,6 +93,7 @@ HBasicBlock::HBasicBlock(HGraph* graph)
deleted_phis_(4, graph->zone()),
parent_loop_header_(NULL),
inlined_entry_block_(NULL),
+ is_reachable_(true),
is_inline_return_target_(false),
is_deoptimizing_(false),
dominates_loop_successors_(false),
@@ -104,6 +105,20 @@ Isolate* HBasicBlock::isolate() const {
}
+void HBasicBlock::MarkUnreachable() {
+ if (!is_osr_entry()) {
+ is_reachable_ = false;
+ graph()->MarkHasUnreachableCode();
+ }
+}
+
+
+void HBasicBlock::MarkAsDeoptimizing() {
+ is_deoptimizing_ = true;
+ graph()->MarkHasUnreachableCode();
+}
+
+
void HBasicBlock::AttachLoopInformation() {
ASSERT(!IsLoopHeader());
loop_information_ = new(zone()) HLoopInformation(this, zone());
@@ -2066,6 +2081,7 @@ HGraph::HGraph(CompilationInfo* info)
osr_(NULL),
info_(info),
zone_(info->zone()),
+ has_unreachable_code_(false),
is_recursive_(false),
use_optimistic_licm_(false),
has_soft_deoptimize_(false),
@@ -2729,16 +2745,6 @@ void TestContext::BuildBranch(HValue* value) {
if (value != NULL && value->CheckFlag(HValue::kIsArguments)) {
builder->Bailout(kArgumentsObjectValueInATestContext);
}
- if (value->IsConstant()) {
- HConstant* constant_value = HConstant::cast(value);
- if (constant_value->BooleanValue()) {
- builder->current_block()->Goto(if_true(), builder->function_state());
- } else {
- builder->current_block()->Goto(if_false(), builder->function_state());
- }
- builder->set_current_block(NULL);
- return;
- }
HBasicBlock* empty_true = builder->graph()->CreateBasicBlock();
HBasicBlock* empty_false = builder->graph()->CreateBasicBlock();
ToBooleanStub::Types expected(condition()->to_boolean_types());
@@ -8017,9 +8023,16 @@ void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr,
static bool IsLiteralCompareBool(HValue* left,
Token::Value op,
HValue* right) {
- return op == Token::EQ_STRICT &&
- ((left->IsConstant() && HConstant::cast(left)->handle()->IsBoolean()) ||
- (right->IsConstant() && HConstant::cast(right)->handle()->IsBoolean()));
+ if (op != Token::EQ_STRICT) return false;
+ if (left->IsConstant() && HConstant::cast(left)->handle()->IsBoolean()) {
+ return !right->IsConstant() ||
Michael Starzinger 2013/08/16 15:02:20 nit: Should fit into one line.
danno 2013/10/01 10:43:18 Done.
+ !HConstant::cast(right)->handle()->IsSmi();
+ }
+ if (right->IsConstant() && HConstant::cast(right)->handle()->IsBoolean()) {
+ return !left->IsConstant() ||
Michael Starzinger 2013/08/16 15:02:20 nit: Should fit into one line.
danno 2013/10/01 10:43:18 Done.
+ !HConstant::cast(left)->handle()->IsSmi();
+ }
+ return false;
}
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698