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

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

Issue 2575313002: [promisehook] Implement PromiseHook (Closed)
Patch Set: remove promise_hook_enabled_ Created 4 years 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/debug/debug.h" 6 #include "src/debug/debug.h"
7 #include "src/elements.h" 7 #include "src/elements.h"
8 #include "src/promise-utils.h" 8 #include "src/promise-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 RUNTIME_FUNCTION(Runtime_PromiseMarkAsHandled) { 278 RUNTIME_FUNCTION(Runtime_PromiseMarkAsHandled) {
279 HandleScope scope(isolate); 279 HandleScope scope(isolate);
280 DCHECK(args.length() == 1); 280 DCHECK(args.length() == 1);
281 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); 281 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
282 282
283 promise->set_has_handler(true); 283 promise->set_has_handler(true);
284 return isolate->heap()->undefined_value(); 284 return isolate->heap()->undefined_value();
285 } 285 }
286 286
287 RUNTIME_FUNCTION(Runtime_PromiseHookInit) {
288 DCHECK_EQ(2, args.length());
289 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
adamk 2016/12/15 15:43:58 You should have handle scopes here, since you're c
gsathya 2016/12/15 16:32:06 Done.
290 CONVERT_ARG_HANDLE_CHECKED(Object, parent, 1);
291 isolate->RunPromiseHook(PromiseHookType::kInit, promise, parent);
292 return isolate->heap()->undefined_value();
293 }
294
295 RUNTIME_FUNCTION(Runtime_PromiseHookResolve) {
296 DCHECK_EQ(1, args.length());
297 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
298 isolate->RunPromiseHook(PromiseHookType::kResolve, promise,
299 isolate->factory()->undefined_value());
300 return isolate->heap()->undefined_value();
301 }
302
303 RUNTIME_FUNCTION(Runtime_PromiseHookBefore) {
304 DCHECK_EQ(1, args.length());
305 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
306 isolate->RunPromiseHook(PromiseHookType::kBefore, promise,
307 isolate->factory()->undefined_value());
308 return isolate->heap()->undefined_value();
309 }
310
311 RUNTIME_FUNCTION(Runtime_PromiseHookAfter) {
312 DCHECK_EQ(1, args.length());
313 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
314 isolate->RunPromiseHook(PromiseHookType::kAfter, promise,
315 isolate->factory()->undefined_value());
316 return isolate->heap()->undefined_value();
317 }
318
287 } // namespace internal 319 } // namespace internal
288 } // namespace v8 320 } // namespace v8
OLDNEW
« src/isolate.cc ('K') | « src/runtime/runtime.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698