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

Side by Side Diff: src/builtins.cc

Issue 1895603002: [esnext] prototype runtime implementation for async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
Patch Set: fix test nits Created 4 years, 7 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.h ('k') | src/code-stubs.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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.h" 5 #include "src/builtins.h"
6 6
7 #include "src/api-arguments.h" 7 #include "src/api-arguments.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2491 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kReturn, 2491 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kReturn,
2492 "[Generator].prototype.return"); 2492 "[Generator].prototype.return");
2493 } 2493 }
2494 2494
2495 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception ) 2495 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception )
2496 void Builtins::Generate_GeneratorPrototypeThrow(CodeStubAssembler* assembler) { 2496 void Builtins::Generate_GeneratorPrototypeThrow(CodeStubAssembler* assembler) {
2497 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kThrow, 2497 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kThrow,
2498 "[Generator].prototype.throw"); 2498 "[Generator].prototype.throw");
2499 } 2499 }
2500 2500
2501 void Builtins::Generate_AsyncFunctionNext(CodeStubAssembler* assembler) {
2502 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kNext,
2503 "AsyncFunctionNext");
2504 }
2505
2506 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception )
neis 2016/05/12 16:34:22 wrong comment
caitp (gmail) 2016/05/12 16:38:39 Acknowledged.
2507 void Builtins::Generate_AsyncFunctionThrow(CodeStubAssembler* assembler) {
2508 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kThrow,
2509 "AsyncFunctionThrow");
2510 }
2511
neis 2016/05/12 16:34:22 Can we get rid of these functions and just use Gen
caitp (gmail) 2016/05/12 16:38:39 We mark these as native, which prevents them from
2501 // ----------------------------------------------------------------------------- 2512 // -----------------------------------------------------------------------------
2502 // ES6 section 26.1 The Reflect Object 2513 // ES6 section 26.1 The Reflect Object
2503 2514
2504 // ES6 section 26.1.3 Reflect.defineProperty 2515 // ES6 section 26.1.3 Reflect.defineProperty
2505 BUILTIN(ReflectDefineProperty) { 2516 BUILTIN(ReflectDefineProperty) {
2506 HandleScope scope(isolate); 2517 HandleScope scope(isolate);
2507 DCHECK_EQ(4, args.length()); 2518 DCHECK_EQ(4, args.length());
2508 Handle<Object> target = args.at<Object>(1); 2519 Handle<Object> target = args.at<Object>(1);
2509 Handle<Object> key = args.at<Object>(2); 2520 Handle<Object> key = args.at<Object>(2);
2510 Handle<Object> attributes = args.at<Object>(3); 2521 Handle<Object> attributes = args.at<Object>(3);
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
4216 4227
4217 // ES6 section 25.2.1.1 GeneratorFunction (p1, p2, ... , pn, body) 4228 // ES6 section 25.2.1.1 GeneratorFunction (p1, p2, ... , pn, body)
4218 BUILTIN(GeneratorFunctionConstructor) { 4229 BUILTIN(GeneratorFunctionConstructor) {
4219 HandleScope scope(isolate); 4230 HandleScope scope(isolate);
4220 Handle<JSFunction> result; 4231 Handle<JSFunction> result;
4221 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 4232 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
4222 isolate, result, CreateDynamicFunction(isolate, args, "function*")); 4233 isolate, result, CreateDynamicFunction(isolate, args, "function*"));
4223 return *result; 4234 return *result;
4224 } 4235 }
4225 4236
4237 BUILTIN(AsyncFunctionConstructor) {
4238 HandleScope scope(isolate);
4239 Handle<JSFunction> result;
4240 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
4241 isolate, result, CreateDynamicFunction(isolate, args, "async function"));
4242 return *result;
4243 }
4226 4244
4227 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case. 4245 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case.
4228 BUILTIN(SymbolConstructor) { 4246 BUILTIN(SymbolConstructor) {
4229 HandleScope scope(isolate); 4247 HandleScope scope(isolate);
4230 Handle<Symbol> result = isolate->factory()->NewSymbol(); 4248 Handle<Symbol> result = isolate->factory()->NewSymbol();
4231 Handle<Object> description = args.atOrUndefined(isolate, 1); 4249 Handle<Object> description = args.atOrUndefined(isolate, 1);
4232 if (!description->IsUndefined()) { 4250 if (!description->IsUndefined()) {
4233 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description, 4251 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description,
4234 Object::ToString(isolate, description)); 4252 Object::ToString(isolate, description));
4235 result->set_name(*description); 4253 result->set_name(*description);
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
5478 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 5496 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
5479 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 5497 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
5480 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 5498 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
5481 #undef DEFINE_BUILTIN_ACCESSOR_C 5499 #undef DEFINE_BUILTIN_ACCESSOR_C
5482 #undef DEFINE_BUILTIN_ACCESSOR_A 5500 #undef DEFINE_BUILTIN_ACCESSOR_A
5483 #undef DEFINE_BUILTIN_ACCESSOR_T 5501 #undef DEFINE_BUILTIN_ACCESSOR_T
5484 #undef DEFINE_BUILTIN_ACCESSOR_H 5502 #undef DEFINE_BUILTIN_ACCESSOR_H
5485 5503
5486 } // namespace internal 5504 } // namespace internal
5487 } // namespace v8 5505 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698