OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
6 | 6 |
7 #include "src/compiler/bytecode-branch-analysis.h" | 7 #include "src/compiler/bytecode-branch-analysis.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/operator-properties.h" | 9 #include "src/compiler/operator-properties.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 Node* end = graph()->NewNode(common()->End(input_count), input_count, inputs); | 501 Node* end = graph()->NewNode(common()->End(input_count), input_count, inputs); |
502 graph()->SetEnd(end); | 502 graph()->SetEnd(end); |
503 | 503 |
504 return true; | 504 return true; |
505 } | 505 } |
506 | 506 |
507 | 507 |
508 void BytecodeGraphBuilder::CreateGraphBody(bool stack_check) { | 508 void BytecodeGraphBuilder::CreateGraphBody(bool stack_check) { |
509 // TODO(oth): Review ast-graph-builder equivalent, i.e. arguments | 509 // TODO(oth): Review ast-graph-builder equivalent, i.e. arguments |
510 // object setup, this function variable if used, tracing hooks. | 510 // object setup, this function variable if used, tracing hooks. |
| 511 |
| 512 if (stack_check) { |
| 513 Node* node = NewNode(javascript()->StackCheck()); |
| 514 PrepareEntryFrameState(node); |
| 515 } |
| 516 |
511 VisitBytecodes(); | 517 VisitBytecodes(); |
512 } | 518 } |
513 | 519 |
514 | 520 |
515 void BytecodeGraphBuilder::VisitBytecodes() { | 521 void BytecodeGraphBuilder::VisitBytecodes() { |
516 BytecodeBranchAnalysis analysis(bytecode_array(), local_zone()); | 522 BytecodeBranchAnalysis analysis(bytecode_array(), local_zone()); |
517 analysis.Analyze(); | 523 analysis.Analyze(); |
518 set_branch_analysis(&analysis); | 524 set_branch_analysis(&analysis); |
519 interpreter::BytecodeArrayIterator iterator(bytecode_array()); | 525 interpreter::BytecodeArrayIterator iterator(bytecode_array()); |
520 set_bytecode_iterator(&iterator); | 526 set_bytecode_iterator(&iterator); |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 Node** BytecodeGraphBuilder::EnsureInputBufferSize(int size) { | 1862 Node** BytecodeGraphBuilder::EnsureInputBufferSize(int size) { |
1857 if (size > input_buffer_size_) { | 1863 if (size > input_buffer_size_) { |
1858 size = size + kInputBufferSizeIncrement + input_buffer_size_; | 1864 size = size + kInputBufferSizeIncrement + input_buffer_size_; |
1859 input_buffer_ = local_zone()->NewArray<Node*>(size); | 1865 input_buffer_ = local_zone()->NewArray<Node*>(size); |
1860 input_buffer_size_ = size; | 1866 input_buffer_size_ = size; |
1861 } | 1867 } |
1862 return input_buffer_; | 1868 return input_buffer_; |
1863 } | 1869 } |
1864 | 1870 |
1865 | 1871 |
| 1872 void BytecodeGraphBuilder::PrepareEntryFrameState(Node* node) { |
| 1873 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); |
| 1874 DCHECK_EQ(IrOpcode::kDead, |
| 1875 NodeProperties::GetFrameStateInput(node, 0)->opcode()); |
| 1876 NodeProperties::ReplaceFrameStateInput( |
| 1877 node, 0, environment()->Checkpoint(BailoutId(0), |
| 1878 OutputFrameStateCombine::Ignore())); |
| 1879 } |
| 1880 |
| 1881 |
1866 Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, | 1882 Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, |
1867 Node** value_inputs, bool incomplete) { | 1883 Node** value_inputs, bool incomplete) { |
1868 DCHECK_EQ(op->ValueInputCount(), value_input_count); | 1884 DCHECK_EQ(op->ValueInputCount(), value_input_count); |
1869 | 1885 |
1870 bool has_context = OperatorProperties::HasContextInput(op); | 1886 bool has_context = OperatorProperties::HasContextInput(op); |
1871 int frame_state_count = OperatorProperties::GetFrameStateInputCount(op); | 1887 int frame_state_count = OperatorProperties::GetFrameStateInputCount(op); |
1872 bool has_control = op->ControlInputCount() == 1; | 1888 bool has_control = op->ControlInputCount() == 1; |
1873 bool has_effect = op->EffectInputCount() == 1; | 1889 bool has_effect = op->EffectInputCount() == 1; |
1874 | 1890 |
1875 DCHECK_LT(op->ControlInputCount(), 2); | 1891 DCHECK_LT(op->ControlInputCount(), 2); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2003 | 2019 |
2004 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { | 2020 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { |
2005 if (environment()->IsMarkedAsUnreachable()) return; | 2021 if (environment()->IsMarkedAsUnreachable()) return; |
2006 environment()->MarkAsUnreachable(); | 2022 environment()->MarkAsUnreachable(); |
2007 exit_controls_.push_back(exit); | 2023 exit_controls_.push_back(exit); |
2008 } | 2024 } |
2009 | 2025 |
2010 } // namespace compiler | 2026 } // namespace compiler |
2011 } // namespace internal | 2027 } // namespace internal |
2012 } // namespace v8 | 2028 } // namespace v8 |
OLD | NEW |