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

Side by Side Diff: src/builtins/builtins-function.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/builtins/builtins-async-iterator.cc ('k') | src/builtins/builtins-promise.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins/builtins-utils.h" 5 #include "src/builtins/builtins-utils.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stub-assembler.h" 8 #include "src/code-stub-assembler.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/string-builder.h" 10 #include "src/string-builder.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Do not lazily compute eval position for AsyncFunction, as they may not be 156 // Do not lazily compute eval position for AsyncFunction, as they may not be
157 // determined after the function is resumed. 157 // determined after the function is resumed.
158 Handle<JSFunction> func = Handle<JSFunction>::cast(maybe_func); 158 Handle<JSFunction> func = Handle<JSFunction>::cast(maybe_func);
159 Handle<Script> script = handle(Script::cast(func->shared()->script())); 159 Handle<Script> script = handle(Script::cast(func->shared()->script()));
160 int position = script->GetEvalPosition(); 160 int position = script->GetEvalPosition();
161 USE(position); 161 USE(position);
162 162
163 return *func; 163 return *func;
164 } 164 }
165 165
166 BUILTIN(AsyncGeneratorFunctionConstructor) {
167 HandleScope scope(isolate);
168 Handle<Object> maybe_func;
169 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
170 isolate, maybe_func,
171 CreateDynamicFunction(isolate, args, "async function*"));
172 if (!maybe_func->IsJSFunction()) return *maybe_func;
173
174 // Do not lazily compute eval position for AsyncFunction, as they may not be
175 // determined after the function is resumed.
176 Handle<JSFunction> func = Handle<JSFunction>::cast(maybe_func);
177 Handle<Script> script = handle(Script::cast(func->shared()->script()));
178 int position = script->GetEvalPosition();
179 USE(position);
180
181 return *func;
182 }
183
166 namespace { 184 namespace {
167 185
168 Object* DoFunctionBind(Isolate* isolate, BuiltinArguments args) { 186 Object* DoFunctionBind(Isolate* isolate, BuiltinArguments args) {
169 HandleScope scope(isolate); 187 HandleScope scope(isolate);
170 DCHECK_LE(1, args.length()); 188 DCHECK_LE(1, args.length());
171 if (!args.receiver()->IsCallable()) { 189 if (!args.receiver()->IsCallable()) {
172 THROW_NEW_ERROR_RETURN_FAILURE( 190 THROW_NEW_ERROR_RETURN_FAILURE(
173 isolate, NewTypeError(MessageTemplate::kFunctionBind)); 191 isolate, NewTypeError(MessageTemplate::kFunctionBind));
174 } 192 }
175 193
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 484
467 Node* f = assembler.Parameter(0); 485 Node* f = assembler.Parameter(0);
468 Node* v = assembler.Parameter(1); 486 Node* v = assembler.Parameter(1);
469 Node* context = assembler.Parameter(4); 487 Node* context = assembler.Parameter(4);
470 Node* result = assembler.OrdinaryHasInstance(context, f, v); 488 Node* result = assembler.OrdinaryHasInstance(context, f, v);
471 assembler.Return(result); 489 assembler.Return(result);
472 } 490 }
473 491
474 } // namespace internal 492 } // namespace internal
475 } // namespace v8 493 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-async-iterator.cc ('k') | src/builtins/builtins-promise.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698