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

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

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap Created 3 years, 11 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
« no previous file with comments | « src/compiler/access-builder.cc ('k') | src/compiler/js-intrinsic-lowering.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 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
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
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
OLDNEW
« no previous file with comments | « src/compiler/access-builder.cc ('k') | src/compiler/js-intrinsic-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698