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

Side by Side Diff: src/hydrogen.cc

Issue 160543002: Merged r19031 into 3.22 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.22
Patch Set: Created 6 years, 10 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 | « no previous file | src/version.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 8032 matching lines...) Expand 10 before | Expand all | Expand 10 after
8043 eval_right->SetJoinId(expr->RightId()); 8043 eval_right->SetJoinId(expr->RightId());
8044 set_current_block(eval_right); 8044 set_current_block(eval_right);
8045 Visit(expr->right()); 8045 Visit(expr->right());
8046 } 8046 }
8047 8047
8048 } else if (ast_context()->IsValue()) { 8048 } else if (ast_context()->IsValue()) {
8049 CHECK_ALIVE(VisitForValue(expr->left())); 8049 CHECK_ALIVE(VisitForValue(expr->left()));
8050 ASSERT(current_block() != NULL); 8050 ASSERT(current_block() != NULL);
8051 HValue* left_value = Top(); 8051 HValue* left_value = Top();
8052 8052
8053 if (left_value->IsConstant()) { 8053 // Short-circuit left values that always evaluate to the same boolean value.
8054 HConstant* left_constant = HConstant::cast(left_value); 8054 if (expr->left()->ToBooleanIsTrue() || expr->left()->ToBooleanIsFalse()) {
8055 if ((is_logical_and && left_constant->BooleanValue()) || 8055 // l (evals true) && r -> r
8056 (!is_logical_and && !left_constant->BooleanValue())) { 8056 // l (evals true) || r -> l
8057 Drop(1); // left_value. 8057 // l (evals false) && r -> l
8058 // l (evals false) || r -> r
8059 if (is_logical_and == expr->left()->ToBooleanIsTrue()) {
8060 Drop(1);
8058 CHECK_ALIVE(VisitForValue(expr->right())); 8061 CHECK_ALIVE(VisitForValue(expr->right()));
8059 } 8062 }
8060 return ast_context()->ReturnValue(Pop()); 8063 return ast_context()->ReturnValue(Pop());
8061 } 8064 }
8062 8065
8063 // We need an extra block to maintain edge-split form. 8066 // We need an extra block to maintain edge-split form.
8064 HBasicBlock* empty_block = graph()->CreateBasicBlock(); 8067 HBasicBlock* empty_block = graph()->CreateBasicBlock();
8065 HBasicBlock* eval_right = graph()->CreateBasicBlock(); 8068 HBasicBlock* eval_right = graph()->CreateBasicBlock();
8066 ToBooleanStub::Types expected(expr->left()->to_boolean_types()); 8069 ToBooleanStub::Types expected(expr->left()->to_boolean_types());
8067 HBranch* test = is_logical_and 8070 HBranch* test = is_logical_and
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after
9850 if (ShouldProduceTraceOutput()) { 9853 if (ShouldProduceTraceOutput()) {
9851 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9854 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9852 } 9855 }
9853 9856
9854 #ifdef DEBUG 9857 #ifdef DEBUG
9855 graph_->Verify(false); // No full verify. 9858 graph_->Verify(false); // No full verify.
9856 #endif 9859 #endif
9857 } 9860 }
9858 9861
9859 } } // namespace v8::internal 9862 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698