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

Side by Side Diff: src/hydrogen.cc

Issue 7491043: Record ToBoolean's type information in Hydrogen's HBranch instruction, so we can use it in LCodeG... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2151 // We expect the graph to be in edge-split form: there is no edge that 2151 // We expect the graph to be in edge-split form: there is no edge that
2152 // connects a branch node to a join node. We conservatively ensure that 2152 // connects a branch node to a join node. We conservatively ensure that
2153 // property by always adding an empty block on the outgoing edges of this 2153 // property by always adding an empty block on the outgoing edges of this
2154 // branch. 2154 // branch.
2155 HGraphBuilder* builder = owner(); 2155 HGraphBuilder* builder = owner();
2156 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) { 2156 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) {
2157 builder->Bailout("arguments object value in a test context"); 2157 builder->Bailout("arguments object value in a test context");
2158 } 2158 }
2159 HBasicBlock* empty_true = builder->graph()->CreateBasicBlock(); 2159 HBasicBlock* empty_true = builder->graph()->CreateBasicBlock();
2160 HBasicBlock* empty_false = builder->graph()->CreateBasicBlock(); 2160 HBasicBlock* empty_false = builder->graph()->CreateBasicBlock();
2161 HBranch* test = new(zone()) HBranch(value, empty_true, empty_false); 2161 unsigned test_id = condition()->test_id();
2162 ToBooleanStub::Types expected(builder->oracle()->ToBooleanTypes(test_id));
2163 HBranch* test = new(zone()) HBranch(value, empty_true, empty_false, expected);
2162 builder->current_block()->Finish(test); 2164 builder->current_block()->Finish(test);
2163 2165
2164 empty_true->Goto(if_true()); 2166 empty_true->Goto(if_true());
2165 empty_false->Goto(if_false()); 2167 empty_false->Goto(if_false());
2166 builder->set_current_block(NULL); 2168 builder->set_current_block(NULL);
2167 } 2169 }
2168 2170
2169 2171
2170 // HGraphBuilder infrastructure for bailing out and checking bailouts. 2172 // HGraphBuilder infrastructure for bailing out and checking bailouts.
2171 #define CHECK_BAILOUT(call) \ 2173 #define CHECK_BAILOUT(call) \
(...skipping 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after
5497 Visit(expr->right()); 5499 Visit(expr->right());
5498 } 5500 }
5499 5501
5500 } else if (ast_context()->IsValue()) { 5502 } else if (ast_context()->IsValue()) {
5501 CHECK_ALIVE(VisitForValue(expr->left())); 5503 CHECK_ALIVE(VisitForValue(expr->left()));
5502 ASSERT(current_block() != NULL); 5504 ASSERT(current_block() != NULL);
5503 5505
5504 // We need an extra block to maintain edge-split form. 5506 // We need an extra block to maintain edge-split form.
5505 HBasicBlock* empty_block = graph()->CreateBasicBlock(); 5507 HBasicBlock* empty_block = graph()->CreateBasicBlock();
5506 HBasicBlock* eval_right = graph()->CreateBasicBlock(); 5508 HBasicBlock* eval_right = graph()->CreateBasicBlock();
5509 unsigned test_id = expr->left()->test_id();
5510 ToBooleanStub::Types expected(oracle()->ToBooleanTypes(test_id));
5507 HBranch* test = is_logical_and 5511 HBranch* test = is_logical_and
5508 ? new(zone()) HBranch(Top(), eval_right, empty_block) 5512 ? new(zone()) HBranch(Top(), eval_right, empty_block, expected)
5509 : new(zone()) HBranch(Top(), empty_block, eval_right); 5513 : new(zone()) HBranch(Top(), empty_block, eval_right, expected);
5510 current_block()->Finish(test); 5514 current_block()->Finish(test);
5511 5515
5512 set_current_block(eval_right); 5516 set_current_block(eval_right);
5513 Drop(1); // Value of the left subexpression. 5517 Drop(1); // Value of the left subexpression.
5514 CHECK_BAILOUT(VisitForValue(expr->right())); 5518 CHECK_BAILOUT(VisitForValue(expr->right()));
5515 5519
5516 HBasicBlock* join_block = 5520 HBasicBlock* join_block =
5517 CreateJoin(empty_block, current_block(), expr->id()); 5521 CreateJoin(empty_block, current_block(), expr->id());
5518 set_current_block(join_block); 5522 set_current_block(join_block);
5519 return ast_context()->ReturnValue(Pop()); 5523 return ast_context()->ReturnValue(Pop());
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
6722 } 6726 }
6723 } 6727 }
6724 6728
6725 #ifdef DEBUG 6729 #ifdef DEBUG
6726 if (graph_ != NULL) graph_->Verify(); 6730 if (graph_ != NULL) graph_->Verify();
6727 if (allocator_ != NULL) allocator_->Verify(); 6731 if (allocator_ != NULL) allocator_->Verify();
6728 #endif 6732 #endif
6729 } 6733 }
6730 6734
6731 } } // namespace v8::internal 6735 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698