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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 687103004: Minor cleanup using BooleanConstant in graph builder. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/compiler/ast-graph-builder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 CaseClause* clause = clauses->at(i); 581 CaseClause* clause = clauses->at(i);
582 compare_switch.BeginCase(i); 582 compare_switch.BeginCase(i);
583 VisitStatements(clause->statements()); 583 VisitStatements(clause->statements());
584 compare_switch.EndCase(); 584 compare_switch.EndCase();
585 } 585 }
586 586
587 compare_switch.EndSwitch(); 587 compare_switch.EndSwitch();
588 } 588 }
589 589
590 590
591 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop(
592 IterationStatement* stmt) {
593 if (loop_assignment_analysis_ == NULL) return NULL;
594 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt);
595 }
596
597
598 void AstGraphBuilder::VisitDoWhileStatement(DoWhileStatement* stmt) { 591 void AstGraphBuilder::VisitDoWhileStatement(DoWhileStatement* stmt) {
599 LoopBuilder while_loop(this); 592 LoopBuilder while_loop(this);
600 while_loop.BeginLoop(GetVariablesAssignedInLoop(stmt)); 593 while_loop.BeginLoop(GetVariablesAssignedInLoop(stmt));
601 VisitIterationBody(stmt, &while_loop, 0); 594 VisitIterationBody(stmt, &while_loop, 0);
602 while_loop.EndBody(); 595 while_loop.EndBody();
603 VisitForTest(stmt->cond()); 596 VisitForTest(stmt->cond());
604 Node* condition = environment()->Pop(); 597 Node* condition = environment()->Pop();
605 while_loop.BreakUnless(condition); 598 while_loop.BreakUnless(condition);
606 while_loop.EndLoop(); 599 while_loop.EndLoop();
607 } 600 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 // code. We also have a stack overflow if the recursive compilation did. 812 // code. We also have a stack overflow if the recursive compilation did.
820 Handle<SharedFunctionInfo> shared_info = 813 Handle<SharedFunctionInfo> shared_info =
821 SearchSharedFunctionInfo(info()->shared_info()->code(), expr); 814 SearchSharedFunctionInfo(info()->shared_info()->code(), expr);
822 if (shared_info.is_null()) { 815 if (shared_info.is_null()) {
823 shared_info = Compiler::BuildFunctionInfo(expr, info()->script(), info()); 816 shared_info = Compiler::BuildFunctionInfo(expr, info()->script(), info());
824 CHECK(!shared_info.is_null()); // TODO(mstarzinger): Set stack overflow? 817 CHECK(!shared_info.is_null()); // TODO(mstarzinger): Set stack overflow?
825 } 818 }
826 819
827 // Create node to instantiate a new closure. 820 // Create node to instantiate a new closure.
828 Node* info = jsgraph()->Constant(shared_info); 821 Node* info = jsgraph()->Constant(shared_info);
829 Node* pretenure = expr->pretenure() ? jsgraph()->TrueConstant() 822 Node* pretenure = jsgraph()->BooleanConstant(expr->pretenure());
830 : jsgraph()->FalseConstant();
831 const Operator* op = javascript()->CallRuntime(Runtime::kNewClosure, 3); 823 const Operator* op = javascript()->CallRuntime(Runtime::kNewClosure, 3);
832 Node* value = NewNode(op, context, info, pretenure); 824 Node* value = NewNode(op, context, info, pretenure);
833 ast_context()->ProduceValue(value); 825 ast_context()->ProduceValue(value);
834 } 826 }
835 827
836 828
837 void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) { 829 void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) {
838 UNREACHABLE(); 830 UNREACHABLE();
839 } 831 }
840 832
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 Node* name = jsgraph()->Constant(variable->name()); 1918 Node* name = jsgraph()->Constant(variable->name());
1927 const Operator* op = javascript()->DeleteProperty(strict_mode()); 1919 const Operator* op = javascript()->DeleteProperty(strict_mode());
1928 Node* result = NewNode(op, global, name); 1920 Node* result = NewNode(op, global, name);
1929 PrepareFrameState(result, bailout_id, state_combine); 1921 PrepareFrameState(result, bailout_id, state_combine);
1930 return result; 1922 return result;
1931 } 1923 }
1932 case Variable::PARAMETER: 1924 case Variable::PARAMETER:
1933 case Variable::LOCAL: 1925 case Variable::LOCAL:
1934 case Variable::CONTEXT: 1926 case Variable::CONTEXT:
1935 // Local var, const, or let variable or context variable. 1927 // Local var, const, or let variable or context variable.
1936 return variable->is_this() ? jsgraph()->TrueConstant() 1928 return jsgraph()->BooleanConstant(variable->is_this());
1937 : jsgraph()->FalseConstant();
1938 case Variable::LOOKUP: { 1929 case Variable::LOOKUP: {
1939 // Dynamic lookup of context variable (anywhere in the chain). 1930 // Dynamic lookup of context variable (anywhere in the chain).
1940 Node* name = jsgraph()->Constant(variable->name()); 1931 Node* name = jsgraph()->Constant(variable->name());
1941 const Operator* op = 1932 const Operator* op =
1942 javascript()->CallRuntime(Runtime::kDeleteLookupSlot, 2); 1933 javascript()->CallRuntime(Runtime::kDeleteLookupSlot, 2);
1943 Node* result = NewNode(op, current_context(), name); 1934 Node* result = NewNode(op, current_context(), name);
1944 PrepareFrameState(result, bailout_id, state_combine); 1935 PrepareFrameState(result, bailout_id, state_combine);
1945 return result; 1936 return result;
1946 } 1937 }
1947 } 1938 }
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 void AstGraphBuilder::PrepareFrameState(Node* node, BailoutId ast_id, 2156 void AstGraphBuilder::PrepareFrameState(Node* node, BailoutId ast_id,
2166 OutputFrameStateCombine combine) { 2157 OutputFrameStateCombine combine) {
2167 if (OperatorProperties::HasFrameStateInput(node->op())) { 2158 if (OperatorProperties::HasFrameStateInput(node->op())) {
2168 DCHECK(NodeProperties::GetFrameStateInput(node)->opcode() == 2159 DCHECK(NodeProperties::GetFrameStateInput(node)->opcode() ==
2169 IrOpcode::kDead); 2160 IrOpcode::kDead);
2170 NodeProperties::ReplaceFrameStateInput( 2161 NodeProperties::ReplaceFrameStateInput(
2171 node, environment()->Checkpoint(ast_id, combine)); 2162 node, environment()->Checkpoint(ast_id, combine));
2172 } 2163 }
2173 } 2164 }
2174 2165
2166
2167 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop(
2168 IterationStatement* stmt) {
2169 if (loop_assignment_analysis_ == NULL) return NULL;
2170 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt);
2175 } 2171 }
2176 } 2172
2177 } // namespace v8::internal::compiler 2173 } // namespace compiler
2174 } // namespace internal
2175 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698