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

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 more bugs 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
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 2469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kReturn, 2480 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kReturn,
2481 "[Generator].prototype.return"); 2481 "[Generator].prototype.return");
2482 } 2482 }
2483 2483
2484 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception ) 2484 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception )
2485 void Builtins::Generate_GeneratorPrototypeThrow(CodeStubAssembler* assembler) { 2485 void Builtins::Generate_GeneratorPrototypeThrow(CodeStubAssembler* assembler) {
2486 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kThrow, 2486 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kThrow,
2487 "[Generator].prototype.throw"); 2487 "[Generator].prototype.throw");
2488 } 2488 }
2489 2489
2490 void Builtins::Generate_AsyncFunctionNext(CodeStubAssembler* assembler) {
2491 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kNext,
2492 "AsyncFunctionNext");
2493 }
2494
2495 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception )
2496 void Builtins::Generate_AsyncFunctionThrow(CodeStubAssembler* assembler) {
2497 Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kThrow,
2498 "AsyncFunctionThrow");
2499 }
2500
2490 // ----------------------------------------------------------------------------- 2501 // -----------------------------------------------------------------------------
2491 // ES6 section 26.1 The Reflect Object 2502 // ES6 section 26.1 The Reflect Object
2492 2503
2493 // ES6 section 26.1.3 Reflect.defineProperty 2504 // ES6 section 26.1.3 Reflect.defineProperty
2494 BUILTIN(ReflectDefineProperty) { 2505 BUILTIN(ReflectDefineProperty) {
2495 HandleScope scope(isolate); 2506 HandleScope scope(isolate);
2496 DCHECK_EQ(4, args.length()); 2507 DCHECK_EQ(4, args.length());
2497 Handle<Object> target = args.at<Object>(1); 2508 Handle<Object> target = args.at<Object>(1);
2498 Handle<Object> key = args.at<Object>(2); 2509 Handle<Object> key = args.at<Object>(2);
2499 Handle<Object> attributes = args.at<Object>(3); 2510 Handle<Object> attributes = args.at<Object>(3);
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
4205 4216
4206 // ES6 section 25.2.1.1 GeneratorFunction (p1, p2, ... , pn, body) 4217 // ES6 section 25.2.1.1 GeneratorFunction (p1, p2, ... , pn, body)
4207 BUILTIN(GeneratorFunctionConstructor) { 4218 BUILTIN(GeneratorFunctionConstructor) {
4208 HandleScope scope(isolate); 4219 HandleScope scope(isolate);
4209 Handle<JSFunction> result; 4220 Handle<JSFunction> result;
4210 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 4221 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
4211 isolate, result, CreateDynamicFunction(isolate, args, "function*")); 4222 isolate, result, CreateDynamicFunction(isolate, args, "function*"));
4212 return *result; 4223 return *result;
4213 } 4224 }
4214 4225
4226 BUILTIN(AsyncFunctionConstructor) {
4227 HandleScope scope(isolate);
4228 Handle<JSFunction> result;
4229 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
4230 isolate, result, CreateDynamicFunction(isolate, args, "async function"));
4231 return *result;
4232 }
4215 4233
4216 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case. 4234 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case.
4217 BUILTIN(SymbolConstructor) { 4235 BUILTIN(SymbolConstructor) {
4218 HandleScope scope(isolate); 4236 HandleScope scope(isolate);
4219 Handle<Symbol> result = isolate->factory()->NewSymbol(); 4237 Handle<Symbol> result = isolate->factory()->NewSymbol();
4220 Handle<Object> description = args.atOrUndefined(isolate, 1); 4238 Handle<Object> description = args.atOrUndefined(isolate, 1);
4221 if (!description->IsUndefined()) { 4239 if (!description->IsUndefined()) {
4222 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description, 4240 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description,
4223 Object::ToString(isolate, description)); 4241 Object::ToString(isolate, description));
4224 result->set_name(*description); 4242 result->set_name(*description);
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
5465 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 5483 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
5466 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 5484 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
5467 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 5485 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
5468 #undef DEFINE_BUILTIN_ACCESSOR_C 5486 #undef DEFINE_BUILTIN_ACCESSOR_C
5469 #undef DEFINE_BUILTIN_ACCESSOR_A 5487 #undef DEFINE_BUILTIN_ACCESSOR_A
5470 #undef DEFINE_BUILTIN_ACCESSOR_T 5488 #undef DEFINE_BUILTIN_ACCESSOR_T
5471 #undef DEFINE_BUILTIN_ACCESSOR_H 5489 #undef DEFINE_BUILTIN_ACCESSOR_H
5472 5490
5473 } // namespace internal 5491 } // namespace internal
5474 } // namespace v8 5492 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698