Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index f8661566e041714a46ea5543405dca69507a4e66..74947f88bffb71d29d5925aa86d69d81de4b98c5 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -160,10 +160,12 @@ bool CodeStubGraphBuilderBase::BuildGraph() { |
stack_pop_count->ClearFlag(HValue::kCanOverflow); |
} |
- HReturn* hreturn_instruction = new(zone) HReturn(return_value, |
- context_, |
- stack_pop_count); |
- current_block()->Finish(hreturn_instruction); |
+ if (!current_block()->IsFinished()) { |
+ HReturn* hreturn_instruction = new(zone) HReturn(return_value, |
+ context_, |
+ stack_pop_count); |
+ current_block()->Finish(hreturn_instruction); |
+ } |
return true; |
} |
@@ -509,4 +511,30 @@ Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { |
return DoGenerateCode(this); |
} |
+ |
+template <> |
+HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeUninitializedStub() { |
+ CompareNilICStub* stub = casted_stub(); |
+ HIfContinuation continuation; |
+ Handle<Map> sentinel_map(graph()->isolate()->heap()->meta_map()); |
+ BuildCompareNil(GetParameter(0), stub->GetKind(), |
+ stub->GetTypes(), sentinel_map, |
+ RelocInfo::kNoPosition, &continuation); |
+ IfBuilder if_nil(this, &continuation); |
+ if_nil.Then(); |
+ if (continuation.IsFalseReachable()) { |
+ if_nil.Else(); |
+ if_nil.Return(graph()->GetConstantSmi0()); |
+ } |
+ if_nil.End(); |
+ return continuation.IsTrueReachable() |
+ ? graph()->GetConstantSmi1() |
+ : graph()->GetConstantUndefined(); |
+} |
+ |
+ |
+Handle<Code> CompareNilICStub::GenerateCode() { |
+ return DoGenerateCode(this); |
+} |
+ |
} } // namespace v8::internal |