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/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/compiler-source-position-table.h" | 10 #include "src/compiler/compiler-source-position-table.h" |
(...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 | 1867 |
1868 Node** value_inputs = local_zone()->NewArray<Node*>(value_input_count); | 1868 Node** value_inputs = local_zone()->NewArray<Node*>(value_input_count); |
1869 value_inputs[0] = generator; | 1869 value_inputs[0] = generator; |
1870 value_inputs[1] = state; | 1870 value_inputs[1] = state; |
1871 value_inputs[2] = offset; | 1871 value_inputs[2] = offset; |
1872 for (int i = 0; i < register_count; ++i) { | 1872 for (int i = 0; i < register_count; ++i) { |
1873 value_inputs[3 + i] = | 1873 value_inputs[3 + i] = |
1874 environment()->LookupRegister(interpreter::Register(i)); | 1874 environment()->LookupRegister(interpreter::Register(i)); |
1875 } | 1875 } |
1876 | 1876 |
1877 MakeNode(javascript()->GeneratorStore(register_count), value_input_count, | 1877 MakeNode(javascript()->GeneratorStore(register_count, SuspendType::kYield), |
1878 value_inputs, false); | 1878 value_input_count, value_inputs, false); |
| 1879 } |
| 1880 |
| 1881 void BytecodeGraphBuilder::VisitAwaitGenerator() { |
| 1882 Node* state = environment()->LookupAccumulator(); |
| 1883 Node* generator = |
| 1884 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 1885 // The offsets used by the bytecode iterator are relative to a different base |
| 1886 // than what is used in the interpreter, hence the addition. |
| 1887 Node* offset = |
| 1888 jsgraph()->Constant(bytecode_iterator().current_offset() + |
| 1889 (BytecodeArray::kHeaderSize - kHeapObjectTag)); |
| 1890 |
| 1891 int register_count = environment()->register_count(); |
| 1892 int value_input_count = 3 + register_count; |
| 1893 |
| 1894 Node** value_inputs = local_zone()->NewArray<Node*>(value_input_count); |
| 1895 value_inputs[0] = generator; |
| 1896 value_inputs[1] = state; |
| 1897 value_inputs[2] = offset; |
| 1898 for (int i = 0; i < register_count; ++i) { |
| 1899 value_inputs[3 + i] = |
| 1900 environment()->LookupRegister(interpreter::Register(i)); |
| 1901 } |
| 1902 |
| 1903 MakeNode(javascript()->GeneratorStore(register_count, SuspendType::kAwait), |
| 1904 value_input_count, value_inputs, false); |
1879 } | 1905 } |
1880 | 1906 |
1881 void BytecodeGraphBuilder::VisitResumeGenerator() { | 1907 void BytecodeGraphBuilder::VisitResumeGenerator() { |
1882 PrepareEagerCheckpoint(); | 1908 PrepareEagerCheckpoint(); |
1883 | 1909 |
1884 Node* generator = environment()->LookupRegister( | 1910 Node* generator = environment()->LookupRegister( |
1885 bytecode_iterator().GetRegisterOperand(0)); | 1911 bytecode_iterator().GetRegisterOperand(0)); |
1886 | 1912 |
1887 // Bijection between registers and array indices must match that used in | 1913 // Bijection between registers and array indices must match that used in |
1888 // InterpreterAssembler::ExportRegisterFile. | 1914 // InterpreterAssembler::ExportRegisterFile. |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2298 it->source_position().ScriptOffset(), start_position_.InliningId())); |
2273 it->Advance(); | 2299 it->Advance(); |
2274 } else { | 2300 } else { |
2275 DCHECK_GT(it->code_offset(), offset); | 2301 DCHECK_GT(it->code_offset(), offset); |
2276 } | 2302 } |
2277 } | 2303 } |
2278 | 2304 |
2279 } // namespace compiler | 2305 } // namespace compiler |
2280 } // namespace internal | 2306 } // namespace internal |
2281 } // namespace v8 | 2307 } // namespace v8 |
OLD | NEW |