 Chromium Code Reviews
 Chromium Code Reviews Issue 1895603002:
  [esnext] prototype runtime implementation for async functions  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
    
  
    Issue 1895603002:
  [esnext] prototype runtime implementation for async functions  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction| OLD | NEW | 
|---|---|
| 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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 879 const_cast<v8::FunctionCallbackInfo<v8::Value>*>(&args)); | 879 const_cast<v8::FunctionCallbackInfo<v8::Value>*>(&args)); | 
| 880 } | 880 } | 
| 881 | 881 | 
| 882 | 882 | 
| 883 void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) { | 883 void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) { | 
| 884 args.GetReturnValue().Set( | 884 args.GetReturnValue().Set( | 
| 885 String::NewFromUtf8(args.GetIsolate(), V8::GetVersion(), | 885 String::NewFromUtf8(args.GetIsolate(), V8::GetVersion(), | 
| 886 NewStringType::kNormal).ToLocalChecked()); | 886 NewStringType::kNormal).ToLocalChecked()); | 
| 887 } | 887 } | 
| 888 | 888 | 
| 889 void Shell::FlushMicrotasks(const v8::FunctionCallbackInfo<v8::Value>& args) { | |
| 890 Isolate* isolate = args.GetIsolate(); | |
| 891 isolate->RunMicrotasks(); | |
| 
caitp (gmail)
2016/04/16 18:33:03
This is useful for testing the async-await-basic.j
 | |
| 892 } | |
| 889 | 893 | 
| 890 void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) { | 894 void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) { | 
| 891 HandleScope handle_scope(isolate); | 895 HandleScope handle_scope(isolate); | 
| 892 #ifndef V8_SHARED | 896 #ifndef V8_SHARED | 
| 893 Local<Context> context; | 897 Local<Context> context; | 
| 894 bool enter_context = !isolate->InContext(); | 898 bool enter_context = !isolate->InContext(); | 
| 895 if (enter_context) { | 899 if (enter_context) { | 
| 896 context = Local<Context>::New(isolate, evaluation_context_); | 900 context = Local<Context>::New(isolate, evaluation_context_); | 
| 897 context->Enter(); | 901 context->Enter(); | 
| 898 } | 902 } | 
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1196 worker_fun_template); | 1200 worker_fun_template); | 
| 1197 #endif // !V8_SHARED | 1201 #endif // !V8_SHARED | 
| 1198 | 1202 | 
| 1199 Local<ObjectTemplate> os_templ = ObjectTemplate::New(isolate); | 1203 Local<ObjectTemplate> os_templ = ObjectTemplate::New(isolate); | 
| 1200 AddOSMethods(isolate, os_templ); | 1204 AddOSMethods(isolate, os_templ); | 
| 1201 global_template->Set( | 1205 global_template->Set( | 
| 1202 String::NewFromUtf8(isolate, "os", NewStringType::kNormal) | 1206 String::NewFromUtf8(isolate, "os", NewStringType::kNormal) | 
| 1203 .ToLocalChecked(), | 1207 .ToLocalChecked(), | 
| 1204 os_templ); | 1208 os_templ); | 
| 1205 | 1209 | 
| 1210 global_template->Set( | |
| 1211 String::NewFromUtf8(isolate, "flushMicrotasks", NewStringType::kNormal) | |
| 1212 .ToLocalChecked(), | |
| 1213 FunctionTemplate::New(isolate, FlushMicrotasks)); | |
| 1214 | |
| 1206 return global_template; | 1215 return global_template; | 
| 1207 } | 1216 } | 
| 1208 | 1217 | 
| 1209 static void EmptyMessageCallback(Local<Message> message, Local<Value> error) { | 1218 static void EmptyMessageCallback(Local<Message> message, Local<Value> error) { | 
| 1210 // Nothing to be done here, exceptions thrown up to the shell will be reported | 1219 // Nothing to be done here, exceptions thrown up to the shell will be reported | 
| 1211 // separately by {Shell::ReportException} after they are caught. | 1220 // separately by {Shell::ReportException} after they are caught. | 
| 1212 } | 1221 } | 
| 1213 | 1222 | 
| 1214 void Shell::Initialize(Isolate* isolate) { | 1223 void Shell::Initialize(Isolate* isolate) { | 
| 1215 #ifndef V8_SHARED | 1224 #ifndef V8_SHARED | 
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2509 } | 2518 } | 
| 2510 | 2519 | 
| 2511 } // namespace v8 | 2520 } // namespace v8 | 
| 2512 | 2521 | 
| 2513 | 2522 | 
| 2514 #ifndef GOOGLE3 | 2523 #ifndef GOOGLE3 | 
| 2515 int main(int argc, char* argv[]) { | 2524 int main(int argc, char* argv[]) { | 
| 2516 return v8::Shell::Main(argc, argv); | 2525 return v8::Shell::Main(argc, argv); | 
| 2517 } | 2526 } | 
| 2518 #endif | 2527 #endif | 
| OLD | NEW |