OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 void HGraphBuilder::IfBuilder::Then() { | 1080 void HGraphBuilder::IfBuilder::Then() { |
1081 DCHECK(!captured_); | 1081 DCHECK(!captured_); |
1082 DCHECK(!finished_); | 1082 DCHECK(!finished_); |
1083 did_then_ = true; | 1083 did_then_ = true; |
1084 if (needs_compare_) { | 1084 if (needs_compare_) { |
1085 // Handle if's without any expressions, they jump directly to the "else" | 1085 // Handle if's without any expressions, they jump directly to the "else" |
1086 // branch. However, we must pretend that the "then" branch is reachable, | 1086 // branch. However, we must pretend that the "then" branch is reachable, |
1087 // so that the graph builder visits it and sees any live range extending | 1087 // so that the graph builder visits it and sees any live range extending |
1088 // constructs within it. | 1088 // constructs within it. |
1089 HConstant* constant_false = builder()->graph()->GetConstantFalse(); | 1089 HConstant* constant_false = builder()->graph()->GetConstantFalse(); |
1090 ToBooleanICStub::Types boolean_type = ToBooleanICStub::Types(); | 1090 ToBooleanHints boolean_type = ToBooleanHint::kBoolean; |
1091 boolean_type.Add(ToBooleanICStub::BOOLEAN); | |
1092 HBranch* branch = builder()->New<HBranch>( | 1091 HBranch* branch = builder()->New<HBranch>( |
1093 constant_false, boolean_type, first_true_block_, first_false_block_); | 1092 constant_false, boolean_type, first_true_block_, first_false_block_); |
1094 builder()->FinishCurrentBlock(branch); | 1093 builder()->FinishCurrentBlock(branch); |
1095 } | 1094 } |
1096 builder()->set_current_block(first_true_block_); | 1095 builder()->set_current_block(first_true_block_); |
1097 pending_merge_block_ = true; | 1096 pending_merge_block_ = true; |
1098 } | 1097 } |
1099 | 1098 |
1100 | 1099 |
1101 void HGraphBuilder::IfBuilder::Else() { | 1100 void HGraphBuilder::IfBuilder::Else() { |
(...skipping 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3928 | 3927 |
3929 void TestContext::BuildBranch(HValue* value) { | 3928 void TestContext::BuildBranch(HValue* value) { |
3930 // We expect the graph to be in edge-split form: there is no edge that | 3929 // We expect the graph to be in edge-split form: there is no edge that |
3931 // connects a branch node to a join node. We conservatively ensure that | 3930 // connects a branch node to a join node. We conservatively ensure that |
3932 // property by always adding an empty block on the outgoing edges of this | 3931 // property by always adding an empty block on the outgoing edges of this |
3933 // branch. | 3932 // branch. |
3934 HOptimizedGraphBuilder* builder = owner(); | 3933 HOptimizedGraphBuilder* builder = owner(); |
3935 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) { | 3934 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) { |
3936 builder->Bailout(kArgumentsObjectValueInATestContext); | 3935 builder->Bailout(kArgumentsObjectValueInATestContext); |
3937 } | 3936 } |
3938 ToBooleanICStub::Types expected(condition()->to_boolean_types()); | 3937 ToBooleanHints expected(condition()->to_boolean_types()); |
3939 ReturnControl(owner()->New<HBranch>(value, expected), BailoutId::None()); | 3938 ReturnControl(owner()->New<HBranch>(value, expected), BailoutId::None()); |
3940 } | 3939 } |
3941 | 3940 |
3942 | 3941 |
3943 // HOptimizedGraphBuilder infrastructure for bailing out and checking bailouts. | 3942 // HOptimizedGraphBuilder infrastructure for bailing out and checking bailouts. |
3944 #define CHECK_BAILOUT(call) \ | 3943 #define CHECK_BAILOUT(call) \ |
3945 do { \ | 3944 do { \ |
3946 call; \ | 3945 call; \ |
3947 if (HasStackOverflow()) return; \ | 3946 if (HasStackOverflow()) return; \ |
3948 } while (false) | 3947 } while (false) |
(...skipping 7116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11065 if (is_logical_and == expr->left()->ToBooleanIsTrue()) { | 11064 if (is_logical_and == expr->left()->ToBooleanIsTrue()) { |
11066 Drop(1); | 11065 Drop(1); |
11067 CHECK_ALIVE(VisitForValue(expr->right())); | 11066 CHECK_ALIVE(VisitForValue(expr->right())); |
11068 } | 11067 } |
11069 return ast_context()->ReturnValue(Pop()); | 11068 return ast_context()->ReturnValue(Pop()); |
11070 } | 11069 } |
11071 | 11070 |
11072 // We need an extra block to maintain edge-split form. | 11071 // We need an extra block to maintain edge-split form. |
11073 HBasicBlock* empty_block = graph()->CreateBasicBlock(); | 11072 HBasicBlock* empty_block = graph()->CreateBasicBlock(); |
11074 HBasicBlock* eval_right = graph()->CreateBasicBlock(); | 11073 HBasicBlock* eval_right = graph()->CreateBasicBlock(); |
11075 ToBooleanICStub::Types expected(expr->left()->to_boolean_types()); | 11074 ToBooleanHints expected(expr->left()->to_boolean_types()); |
11076 HBranch* test = is_logical_and | 11075 HBranch* test = is_logical_and |
11077 ? New<HBranch>(left_value, expected, eval_right, empty_block) | 11076 ? New<HBranch>(left_value, expected, eval_right, empty_block) |
11078 : New<HBranch>(left_value, expected, empty_block, eval_right); | 11077 : New<HBranch>(left_value, expected, empty_block, eval_right); |
11079 FinishCurrentBlock(test); | 11078 FinishCurrentBlock(test); |
11080 | 11079 |
11081 set_current_block(eval_right); | 11080 set_current_block(eval_right); |
11082 Drop(1); // Value of the left subexpression. | 11081 Drop(1); // Value of the left subexpression. |
11083 CHECK_BAILOUT(VisitForValue(expr->right())); | 11082 CHECK_BAILOUT(VisitForValue(expr->right())); |
11084 | 11083 |
11085 HBasicBlock* join_block = | 11084 HBasicBlock* join_block = |
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13045 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13044 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13046 } | 13045 } |
13047 | 13046 |
13048 #ifdef DEBUG | 13047 #ifdef DEBUG |
13049 graph_->Verify(false); // No full verify. | 13048 graph_->Verify(false); // No full verify. |
13050 #endif | 13049 #endif |
13051 } | 13050 } |
13052 | 13051 |
13053 } // namespace internal | 13052 } // namespace internal |
13054 } // namespace v8 | 13053 } // namespace v8 |
OLD | NEW |