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

Side by Side Diff: src/d8.cc

Issue 1895603002: [esnext] prototype runtime implementation for async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
Patch Set: remove weird arrow-generator thing 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 5
6 // Defined when linking against shared lib on Windows. 6 // Defined when linking against shared lib on Windows.
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED)
8 #define V8_SHARED 8 #define V8_SHARED
9 #endif 9 #endif
10 10
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 const_cast<v8::FunctionCallbackInfo<v8::Value>*>(&args)); 880 const_cast<v8::FunctionCallbackInfo<v8::Value>*>(&args));
881 } 881 }
882 882
883 883
884 void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) { 884 void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) {
885 args.GetReturnValue().Set( 885 args.GetReturnValue().Set(
886 String::NewFromUtf8(args.GetIsolate(), V8::GetVersion(), 886 String::NewFromUtf8(args.GetIsolate(), V8::GetVersion(),
887 NewStringType::kNormal).ToLocalChecked()); 887 NewStringType::kNormal).ToLocalChecked());
888 } 888 }
889 889
890 void Shell::FlushMicrotasks(const v8::FunctionCallbackInfo<v8::Value>& args) {
891 Isolate* isolate = args.GetIsolate();
892 isolate->RunMicrotasks();
893 }
890 894
891 void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) { 895 void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) {
892 HandleScope handle_scope(isolate); 896 HandleScope handle_scope(isolate);
893 #ifndef V8_SHARED 897 #ifndef V8_SHARED
894 Local<Context> context; 898 Local<Context> context;
895 bool enter_context = !isolate->InContext(); 899 bool enter_context = !isolate->InContext();
896 if (enter_context) { 900 if (enter_context) {
897 context = Local<Context>::New(isolate, evaluation_context_); 901 context = Local<Context>::New(isolate, evaluation_context_);
898 context->Enter(); 902 context->Enter();
899 } 903 }
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 worker_fun_template); 1201 worker_fun_template);
1198 #endif // !V8_SHARED 1202 #endif // !V8_SHARED
1199 1203
1200 Local<ObjectTemplate> os_templ = ObjectTemplate::New(isolate); 1204 Local<ObjectTemplate> os_templ = ObjectTemplate::New(isolate);
1201 AddOSMethods(isolate, os_templ); 1205 AddOSMethods(isolate, os_templ);
1202 global_template->Set( 1206 global_template->Set(
1203 String::NewFromUtf8(isolate, "os", NewStringType::kNormal) 1207 String::NewFromUtf8(isolate, "os", NewStringType::kNormal)
1204 .ToLocalChecked(), 1208 .ToLocalChecked(),
1205 os_templ); 1209 os_templ);
1206 1210
1211 global_template->Set(
1212 String::NewFromUtf8(isolate, "flushMicrotasks", NewStringType::kNormal)
1213 .ToLocalChecked(),
1214 FunctionTemplate::New(isolate, FlushMicrotasks));
1215
1207 return global_template; 1216 return global_template;
1208 } 1217 }
1209 1218
1210 static void EmptyMessageCallback(Local<Message> message, Local<Value> error) { 1219 static void EmptyMessageCallback(Local<Message> message, Local<Value> error) {
1211 // Nothing to be done here, exceptions thrown up to the shell will be reported 1220 // Nothing to be done here, exceptions thrown up to the shell will be reported
1212 // separately by {Shell::ReportException} after they are caught. 1221 // separately by {Shell::ReportException} after they are caught.
1213 } 1222 }
1214 1223
1215 void Shell::Initialize(Isolate* isolate) { 1224 void Shell::Initialize(Isolate* isolate) {
1216 #ifndef V8_SHARED 1225 #ifndef V8_SHARED
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 } 2535 }
2527 2536
2528 } // namespace v8 2537 } // namespace v8
2529 2538
2530 2539
2531 #ifndef GOOGLE3 2540 #ifndef GOOGLE3
2532 int main(int argc, char* argv[]) { 2541 int main(int argc, char* argv[]) {
2533 return v8::Shell::Main(argc, argv); 2542 return v8::Shell::Main(argc, argv);
2534 } 2543 }
2535 #endif 2544 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698