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

Side by Side Diff: src/runtime/runtime-promise.cc

Issue 2752043002: [promises] Add %WaitForPromise runtime call to allow tests to reliably wait for promises to be fini… (Closed)
Patch Set: Strip it down to %IncrementWaitCount and %DecrementWaitCount Created 3 years, 9 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 #include "src/runtime/runtime-utils.h" 4 #include "src/runtime/runtime-utils.h"
5 5
6 #include "src/arguments.h" 6 #include "src/arguments.h"
7 #include "src/counters.h" 7 #include "src/counters.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/elements.h" 9 #include "src/elements.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 isolate->RunPromiseHook(PromiseHookType::kBefore, 155 isolate->RunPromiseHook(PromiseHookType::kBefore,
156 Handle<JSPromise>::cast(promise), 156 Handle<JSPromise>::cast(promise),
157 isolate->factory()->undefined_value()); 157 isolate->factory()->undefined_value());
158 } 158 }
159 return isolate->heap()->undefined_value(); 159 return isolate->heap()->undefined_value();
160 } 160 }
161 161
162 RUNTIME_FUNCTION(Runtime_PromiseHookAfter) { 162 RUNTIME_FUNCTION(Runtime_PromiseHookAfter) {
163 HandleScope scope(isolate); 163 HandleScope scope(isolate);
164 DCHECK_EQ(1, args.length()); 164 DCHECK_EQ(1, args.length());
165 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); 165 CONVERT_ARG_HANDLE_CHECKED(JSObject, arg, 0);
166 if (promise->IsJSPromise()) { 166 if (arg->IsJSPromise()) {
167 isolate->RunPromiseHook(PromiseHookType::kAfter, 167 isolate->RunPromiseHook(PromiseHookType::kAfter,
168 Handle<JSPromise>::cast(promise), 168 Handle<JSPromise>::cast(arg),
169 isolate->factory()->undefined_value()); 169 isolate->factory()->undefined_value());
170 } 170 }
171 return isolate->heap()->undefined_value(); 171 return isolate->heap()->undefined_value();
172 } 172 }
173 173
174 RUNTIME_FUNCTION(Runtime_IncrementWaitCount) {
175 isolate->IncrementWaitCount();
176 return isolate->heap()->undefined_value();
177 }
178
179 RUNTIME_FUNCTION(Runtime_DecrementWaitCount) {
180 isolate->DecrementWaitCount();
181 return isolate->heap()->undefined_value();
182 }
174 } // namespace internal 183 } // namespace internal
175 } // namespace v8 184 } // namespace v8
OLDNEW
« src/d8.cc ('K') | « src/runtime/runtime.h ('k') | test/mjsunit/basic-promise.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698