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 <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 void HGraphBuilder::IfBuilder::Then() { | 899 void HGraphBuilder::IfBuilder::Then() { |
900 DCHECK(!captured_); | 900 DCHECK(!captured_); |
901 DCHECK(!finished_); | 901 DCHECK(!finished_); |
902 did_then_ = true; | 902 did_then_ = true; |
903 if (needs_compare_) { | 903 if (needs_compare_) { |
904 // Handle if's without any expressions, they jump directly to the "else" | 904 // Handle if's without any expressions, they jump directly to the "else" |
905 // branch. However, we must pretend that the "then" branch is reachable, | 905 // branch. However, we must pretend that the "then" branch is reachable, |
906 // so that the graph builder visits it and sees any live range extending | 906 // so that the graph builder visits it and sees any live range extending |
907 // constructs within it. | 907 // constructs within it. |
908 HConstant* constant_false = builder()->graph()->GetConstantFalse(); | 908 HConstant* constant_false = builder()->graph()->GetConstantFalse(); |
909 ToBooleanStub::Types boolean_type = ToBooleanStub::Types(); | 909 ToBooleanICStub::Types boolean_type = ToBooleanICStub::Types(); |
910 boolean_type.Add(ToBooleanStub::BOOLEAN); | 910 boolean_type.Add(ToBooleanICStub::BOOLEAN); |
911 HBranch* branch = builder()->New<HBranch>( | 911 HBranch* branch = builder()->New<HBranch>( |
912 constant_false, boolean_type, first_true_block_, first_false_block_); | 912 constant_false, boolean_type, first_true_block_, first_false_block_); |
913 builder()->FinishCurrentBlock(branch); | 913 builder()->FinishCurrentBlock(branch); |
914 } | 914 } |
915 builder()->set_current_block(first_true_block_); | 915 builder()->set_current_block(first_true_block_); |
916 pending_merge_block_ = true; | 916 pending_merge_block_ = true; |
917 } | 917 } |
918 | 918 |
919 | 919 |
920 void HGraphBuilder::IfBuilder::Else() { | 920 void HGraphBuilder::IfBuilder::Else() { |
(...skipping 3370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4291 | 4291 |
4292 void TestContext::BuildBranch(HValue* value) { | 4292 void TestContext::BuildBranch(HValue* value) { |
4293 // We expect the graph to be in edge-split form: there is no edge that | 4293 // We expect the graph to be in edge-split form: there is no edge that |
4294 // connects a branch node to a join node. We conservatively ensure that | 4294 // connects a branch node to a join node. We conservatively ensure that |
4295 // property by always adding an empty block on the outgoing edges of this | 4295 // property by always adding an empty block on the outgoing edges of this |
4296 // branch. | 4296 // branch. |
4297 HOptimizedGraphBuilder* builder = owner(); | 4297 HOptimizedGraphBuilder* builder = owner(); |
4298 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) { | 4298 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) { |
4299 builder->Bailout(kArgumentsObjectValueInATestContext); | 4299 builder->Bailout(kArgumentsObjectValueInATestContext); |
4300 } | 4300 } |
4301 ToBooleanStub::Types expected(condition()->to_boolean_types()); | 4301 ToBooleanICStub::Types expected(condition()->to_boolean_types()); |
4302 ReturnControl(owner()->New<HBranch>(value, expected), BailoutId::None()); | 4302 ReturnControl(owner()->New<HBranch>(value, expected), BailoutId::None()); |
4303 } | 4303 } |
4304 | 4304 |
4305 | 4305 |
4306 // HOptimizedGraphBuilder infrastructure for bailing out and checking bailouts. | 4306 // HOptimizedGraphBuilder infrastructure for bailing out and checking bailouts. |
4307 #define CHECK_BAILOUT(call) \ | 4307 #define CHECK_BAILOUT(call) \ |
4308 do { \ | 4308 do { \ |
4309 call; \ | 4309 call; \ |
4310 if (HasStackOverflow()) return; \ | 4310 if (HasStackOverflow()) return; \ |
4311 } while (false) | 4311 } while (false) |
(...skipping 6974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11286 if (is_logical_and == expr->left()->ToBooleanIsTrue()) { | 11286 if (is_logical_and == expr->left()->ToBooleanIsTrue()) { |
11287 Drop(1); | 11287 Drop(1); |
11288 CHECK_ALIVE(VisitForValue(expr->right())); | 11288 CHECK_ALIVE(VisitForValue(expr->right())); |
11289 } | 11289 } |
11290 return ast_context()->ReturnValue(Pop()); | 11290 return ast_context()->ReturnValue(Pop()); |
11291 } | 11291 } |
11292 | 11292 |
11293 // We need an extra block to maintain edge-split form. | 11293 // We need an extra block to maintain edge-split form. |
11294 HBasicBlock* empty_block = graph()->CreateBasicBlock(); | 11294 HBasicBlock* empty_block = graph()->CreateBasicBlock(); |
11295 HBasicBlock* eval_right = graph()->CreateBasicBlock(); | 11295 HBasicBlock* eval_right = graph()->CreateBasicBlock(); |
11296 ToBooleanStub::Types expected(expr->left()->to_boolean_types()); | 11296 ToBooleanICStub::Types expected(expr->left()->to_boolean_types()); |
11297 HBranch* test = is_logical_and | 11297 HBranch* test = is_logical_and |
11298 ? New<HBranch>(left_value, expected, eval_right, empty_block) | 11298 ? New<HBranch>(left_value, expected, eval_right, empty_block) |
11299 : New<HBranch>(left_value, expected, empty_block, eval_right); | 11299 : New<HBranch>(left_value, expected, empty_block, eval_right); |
11300 FinishCurrentBlock(test); | 11300 FinishCurrentBlock(test); |
11301 | 11301 |
11302 set_current_block(eval_right); | 11302 set_current_block(eval_right); |
11303 Drop(1); // Value of the left subexpression. | 11303 Drop(1); // Value of the left subexpression. |
11304 CHECK_BAILOUT(VisitForValue(expr->right())); | 11304 CHECK_BAILOUT(VisitForValue(expr->right())); |
11305 | 11305 |
11306 HBasicBlock* join_block = | 11306 HBasicBlock* join_block = |
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13453 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13453 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13454 } | 13454 } |
13455 | 13455 |
13456 #ifdef DEBUG | 13456 #ifdef DEBUG |
13457 graph_->Verify(false); // No full verify. | 13457 graph_->Verify(false); // No full verify. |
13458 #endif | 13458 #endif |
13459 } | 13459 } |
13460 | 13460 |
13461 } // namespace internal | 13461 } // namespace internal |
13462 } // namespace v8 | 13462 } // namespace v8 |
OLD | NEW |