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

Side by Side Diff: src/bootstrapper.cc

Issue 1895603002: [esnext] prototype runtime implementation for async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
Patch Set: properly rebase 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 } 2402 }
2403 2403
2404 Handle<AccessorInfo> script_is_embedder_debug_script = 2404 Handle<AccessorInfo> script_is_embedder_debug_script =
2405 Accessors::ScriptIsEmbedderDebugScriptInfo(isolate, attribs); 2405 Accessors::ScriptIsEmbedderDebugScriptInfo(isolate, attribs);
2406 { 2406 {
2407 AccessorConstantDescriptor d( 2407 AccessorConstantDescriptor d(
2408 Handle<Name>(Name::cast(script_is_embedder_debug_script->name())), 2408 Handle<Name>(Name::cast(script_is_embedder_debug_script->name())),
2409 script_is_embedder_debug_script, attribs); 2409 script_is_embedder_debug_script, attribs);
2410 script_map->AppendDescriptor(&d); 2410 script_map->AppendDescriptor(&d);
2411 } 2411 }
2412
2413 {
2414 Handle<JSFunction> async_function_next =
2415 SimpleInstallFunction(container, "AsyncFunctionNext",
2416 Builtins::kAsyncFunctionNext, 2, false);
2417 Handle<JSFunction> async_function_throw =
2418 SimpleInstallFunction(container, "AsyncFunctionThrow",
2419 Builtins::kAsyncFunctionThrow, 2, false);
2420 async_function_next->shared()->set_native(true);
2421 async_function_throw->shared()->set_native(true);
2422 }
2412 } 2423 }
2413 } 2424 }
2414 2425
2415 2426
2416 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate, 2427 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate,
2417 Handle<JSObject> container) { 2428 Handle<JSObject> container) {
2418 HandleScope scope(isolate); 2429 HandleScope scope(isolate);
2419 2430
2420 #define INITIALIZE_FLAG(FLAG) \ 2431 #define INITIALIZE_FLAG(FLAG) \
2421 { \ 2432 { \
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 Handle<JSFunction> cons = factory->NewFunction(name); 2505 Handle<JSFunction> cons = factory->NewFunction(name);
2495 JSFunction::SetInstancePrototype( 2506 JSFunction::SetInstancePrototype(
2496 cons, 2507 cons,
2497 Handle<Object>(native_context()->initial_object_prototype(), isolate)); 2508 Handle<Object>(native_context()->initial_object_prototype(), isolate));
2498 Handle<JSObject> atomics_object = factory->NewJSObject(cons, TENURED); 2509 Handle<JSObject> atomics_object = factory->NewJSObject(cons, TENURED);
2499 DCHECK(atomics_object->IsJSObject()); 2510 DCHECK(atomics_object->IsJSObject());
2500 JSObject::AddProperty(global, name, atomics_object, DONT_ENUM); 2511 JSObject::AddProperty(global, name, atomics_object, DONT_ENUM);
2501 2512
2502 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("load"), 2513 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("load"),
2503 Builtins::kAtomicsLoad, 2, true); 2514 Builtins::kAtomicsLoad, 2, true);
2504 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("store"),
2505 Builtins::kAtomicsStore, 3, true);
2506 } 2515 }
2507 2516
2508 2517
2509 void Genesis::InitializeGlobal_harmony_simd() { 2518 void Genesis::InitializeGlobal_harmony_simd() {
2510 if (!FLAG_harmony_simd) return; 2519 if (!FLAG_harmony_simd) return;
2511 2520
2512 Handle<JSGlobalObject> global( 2521 Handle<JSGlobalObject> global(
2513 JSGlobalObject::cast(native_context()->global_object())); 2522 JSGlobalObject::cast(native_context()->global_object()));
2514 Isolate* isolate = global->GetIsolate(); 2523 Isolate* isolate = global->GetIsolate();
2515 Factory* factory = isolate->factory(); 2524 Factory* factory = isolate->factory();
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
3012 static const char* harmony_function_sent_natives[] = {nullptr}; 3021 static const char* harmony_function_sent_natives[] = {nullptr};
3013 static const char* promise_extra_natives[] = {"native promise-extra.js", 3022 static const char* promise_extra_natives[] = {"native promise-extra.js",
3014 nullptr}; 3023 nullptr};
3015 static const char* harmony_object_values_entries_natives[] = {nullptr}; 3024 static const char* harmony_object_values_entries_natives[] = {nullptr};
3016 static const char* harmony_object_own_property_descriptors_natives[] = { 3025 static const char* harmony_object_own_property_descriptors_natives[] = {
3017 nullptr}; 3026 nullptr};
3018 static const char* harmony_array_prototype_values_natives[] = {nullptr}; 3027 static const char* harmony_array_prototype_values_natives[] = {nullptr};
3019 static const char* harmony_exponentiation_operator_natives[] = {nullptr}; 3028 static const char* harmony_exponentiation_operator_natives[] = {nullptr};
3020 static const char* harmony_string_padding_natives[] = { 3029 static const char* harmony_string_padding_natives[] = {
3021 "native harmony-string-padding.js", nullptr}; 3030 "native harmony-string-padding.js", nullptr};
3022 static const char* harmony_async_await_natives[] = {nullptr}; 3031 static const char* harmony_async_await_natives[] = {
3032 "native harmony-async-await.js", nullptr};
3023 3033
3024 for (int i = ExperimentalNatives::GetDebuggerCount(); 3034 for (int i = ExperimentalNatives::GetDebuggerCount();
3025 i < ExperimentalNatives::GetBuiltinsCount(); i++) { 3035 i < ExperimentalNatives::GetBuiltinsCount(); i++) {
3026 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ 3036 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \
3027 if (FLAG_##id) { \ 3037 if (FLAG_##id) { \
3028 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ 3038 for (size_t j = 0; id##_natives[j] != NULL; j++) { \
3029 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ 3039 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \
3030 if (strncmp(script_name.start(), id##_natives[j], \ 3040 if (strncmp(script_name.start(), id##_natives[j], \
3031 script_name.length()) == 0) { \ 3041 script_name.length()) == 0) { \
3032 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ 3042 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
3689 } 3699 }
3690 3700
3691 3701
3692 // Called when the top-level V8 mutex is destroyed. 3702 // Called when the top-level V8 mutex is destroyed.
3693 void Bootstrapper::FreeThreadResources() { 3703 void Bootstrapper::FreeThreadResources() {
3694 DCHECK(!IsActive()); 3704 DCHECK(!IsActive());
3695 } 3705 }
3696 3706
3697 } // namespace internal 3707 } // namespace internal
3698 } // namespace v8 3708 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698