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

Side by Side Diff: src/isolate.cc

Issue 2581503003: [promisehook] Store promise in PromiseReactionJob (Closed)
Patch Set: rebase correctly 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 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 #include "src/isolate.h" 5 #include "src/isolate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <fstream> // NOLINT(readability/streams) 9 #include <fstream> // NOLINT(readability/streams)
10 #include <sstream> 10 #include <sstream>
(...skipping 3209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 Handle<Object> name_; 3220 Handle<Object> name_;
3221 bool is_debug_active_; 3221 bool is_debug_active_;
3222 }; 3222 };
3223 } // namespace 3223 } // namespace
3224 3224
3225 void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info, 3225 void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info,
3226 MaybeHandle<Object>* result, 3226 MaybeHandle<Object>* result,
3227 MaybeHandle<Object>* maybe_exception) { 3227 MaybeHandle<Object>* maybe_exception) {
3228 PromiseDebugEventScope helper(this, info->debug_id(), info->debug_name()); 3228 PromiseDebugEventScope helper(this, info->debug_id(), info->debug_name());
3229 3229
3230 Handle<JSPromise> promise(info->promise(), this);
3230 Handle<Object> value(info->value(), this); 3231 Handle<Object> value(info->value(), this);
3231 Handle<Object> tasks(info->tasks(), this); 3232 Handle<Object> tasks(info->tasks(), this);
3232 Handle<JSFunction> promise_handle_fn = promise_handle(); 3233 Handle<JSFunction> promise_handle_fn = promise_handle();
3233 Handle<Object> undefined = factory()->undefined_value(); 3234 Handle<Object> undefined = factory()->undefined_value();
3234 Handle<Object> deferred(info->deferred(), this); 3235 Handle<Object> deferred(info->deferred(), this);
3235 3236
3236 if (deferred->IsFixedArray()) { 3237 if (deferred->IsFixedArray()) {
3237 DCHECK(tasks->IsFixedArray()); 3238 DCHECK(tasks->IsFixedArray());
3238 Handle<FixedArray> deferred_arr = Handle<FixedArray>::cast(deferred); 3239 Handle<FixedArray> deferred_arr = Handle<FixedArray>::cast(deferred);
3239 Handle<FixedArray> tasks_arr = Handle<FixedArray>::cast(tasks); 3240 Handle<FixedArray> tasks_arr = Handle<FixedArray>::cast(tasks);
3240 for (int i = 0; i < deferred_arr->length(); i++) { 3241 for (int i = 0; i < deferred_arr->length(); i++) {
3241 Handle<Object> argv[] = {value, handle(tasks_arr->get(i), this), 3242 Handle<Object> argv[] = {promise, value, handle(tasks_arr->get(i), this),
3242 handle(deferred_arr->get(i), this)}; 3243 handle(deferred_arr->get(i), this)};
3243 *result = Execution::TryCall(this, promise_handle_fn, undefined, 3244 *result = Execution::TryCall(this, promise_handle_fn, undefined,
3244 arraysize(argv), argv, maybe_exception); 3245 arraysize(argv), argv, maybe_exception);
3245 // If execution is terminating, just bail out. 3246 // If execution is terminating, just bail out.
3246 if (result->is_null() && maybe_exception->is_null()) { 3247 if (result->is_null() && maybe_exception->is_null()) {
3247 return; 3248 return;
3248 } 3249 }
3249 } 3250 }
3250 } else { 3251 } else {
3251 Handle<Object> argv[] = {value, tasks, deferred}; 3252 Handle<Object> argv[] = {promise, value, tasks, deferred};
3252 *result = Execution::TryCall(this, promise_handle_fn, undefined, 3253 *result = Execution::TryCall(this, promise_handle_fn, undefined,
3253 arraysize(argv), argv, maybe_exception); 3254 arraysize(argv), argv, maybe_exception);
3254 } 3255 }
3255 } 3256 }
3256 3257
3257 void Isolate::PromiseResolveThenableJob( 3258 void Isolate::PromiseResolveThenableJob(
3258 Handle<PromiseResolveThenableJobInfo> info, MaybeHandle<Object>* result, 3259 Handle<PromiseResolveThenableJobInfo> info, MaybeHandle<Object>* result,
3259 MaybeHandle<Object>* maybe_exception) { 3260 MaybeHandle<Object>* maybe_exception) {
3260 PromiseDebugEventScope helper(this, info->debug_id(), info->debug_name()); 3261 PromiseDebugEventScope helper(this, info->debug_id(), info->debug_name());
3261 3262
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
3566 // Then check whether this scope intercepts. 3567 // Then check whether this scope intercepts.
3567 if ((flag & intercept_mask_)) { 3568 if ((flag & intercept_mask_)) {
3568 intercepted_flags_ |= flag; 3569 intercepted_flags_ |= flag;
3569 return true; 3570 return true;
3570 } 3571 }
3571 return false; 3572 return false;
3572 } 3573 }
3573 3574
3574 } // namespace internal 3575 } // namespace internal
3575 } // namespace v8 3576 } // namespace v8
OLDNEW
« src/builtins/builtins-promise.cc ('K') | « src/factory.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698