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

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

Issue 2578173004: [promisehook] Fire init hook for promise subclass (Closed)
Patch Set: Fix test 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 DCHECK(args.length() == 1); 283 DCHECK(args.length() == 1);
284 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); 284 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
285 285
286 promise->set_has_handler(true); 286 promise->set_has_handler(true);
287 return isolate->heap()->undefined_value(); 287 return isolate->heap()->undefined_value();
288 } 288 }
289 289
290 RUNTIME_FUNCTION(Runtime_PromiseHookInit) { 290 RUNTIME_FUNCTION(Runtime_PromiseHookInit) {
291 HandleScope scope(isolate); 291 HandleScope scope(isolate);
292 DCHECK_EQ(2, args.length()); 292 DCHECK_EQ(2, args.length());
293 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); 293 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
294 CONVERT_ARG_HANDLE_CHECKED(Object, parent, 1); 294 CONVERT_ARG_HANDLE_CHECKED(Object, parent, 1);
295 isolate->RunPromiseHook(PromiseHookType::kInit, promise, parent); 295 isolate->RunPromiseHook(PromiseHookType::kInit, promise, parent);
296 return isolate->heap()->undefined_value(); 296 return isolate->heap()->undefined_value();
297 } 297 }
298 298
299 RUNTIME_FUNCTION(Runtime_PromiseHookResolve) { 299 RUNTIME_FUNCTION(Runtime_PromiseHookResolve) {
300 HandleScope scope(isolate); 300 HandleScope scope(isolate);
301 DCHECK_EQ(1, args.length()); 301 DCHECK_EQ(1, args.length());
302 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); 302 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
303 isolate->RunPromiseHook(PromiseHookType::kResolve, promise, 303 isolate->RunPromiseHook(PromiseHookType::kResolve, promise,
(...skipping 14 matching lines...) Expand all
318 HandleScope scope(isolate); 318 HandleScope scope(isolate);
319 DCHECK_EQ(1, args.length()); 319 DCHECK_EQ(1, args.length());
320 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); 320 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
321 isolate->RunPromiseHook(PromiseHookType::kAfter, promise, 321 isolate->RunPromiseHook(PromiseHookType::kAfter, promise,
322 isolate->factory()->undefined_value()); 322 isolate->factory()->undefined_value());
323 return isolate->heap()->undefined_value(); 323 return isolate->heap()->undefined_value();
324 } 324 }
325 325
326 } // namespace internal 326 } // namespace internal
327 } // namespace v8 327 } // namespace v8
OLDNEW
« src/isolate.h ('K') | « src/isolate.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698