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

Side by Side Diff: src/isolate.cc

Issue 630373003: Add stack trace to the promise reject callback. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 2265
2266 void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { 2266 void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
2267 promise_reject_callback_ = callback; 2267 promise_reject_callback_ = callback;
2268 } 2268 }
2269 2269
2270 2270
2271 void Isolate::ReportPromiseReject(Handle<JSObject> promise, 2271 void Isolate::ReportPromiseReject(Handle<JSObject> promise,
2272 Handle<Object> value, 2272 Handle<Object> value,
2273 v8::PromiseRejectEvent event) { 2273 v8::PromiseRejectEvent event) {
2274 if (promise_reject_callback_ == NULL) return; 2274 if (promise_reject_callback_ == NULL) return;
2275 promise_reject_callback_(v8::Utils::PromiseToLocal(promise), 2275 Handle<JSArray> stack_trace;
2276 v8::Utils::ToLocal(value), event); 2276 if (event == v8::kPromiseRejectWithNoHandler && value->IsJSObject()) {
2277 Handle<JSObject> error_obj = Handle<JSObject>::cast(value);
2278 Handle<Name> key = factory()->detailed_stack_trace_symbol();
2279 Handle<Object> property = JSObject::GetDataProperty(error_obj, key);
2280 if (property->IsJSArray()) stack_trace = Handle<JSArray>::cast(property);
2281 }
2282 promise_reject_callback_(v8::PromiseRejectMessage(
2283 v8::Utils::PromiseToLocal(promise), event, v8::Utils::ToLocal(value),
2284 v8::Utils::StackTraceToLocal(stack_trace)));
2277 } 2285 }
2278 2286
2279 2287
2280 void Isolate::EnqueueMicrotask(Handle<Object> microtask) { 2288 void Isolate::EnqueueMicrotask(Handle<Object> microtask) {
2281 DCHECK(microtask->IsJSFunction() || microtask->IsCallHandlerInfo()); 2289 DCHECK(microtask->IsJSFunction() || microtask->IsCallHandlerInfo());
2282 Handle<FixedArray> queue(heap()->microtask_queue(), this); 2290 Handle<FixedArray> queue(heap()->microtask_queue(), this);
2283 int num_tasks = pending_microtask_count(); 2291 int num_tasks = pending_microtask_count();
2284 DCHECK(num_tasks <= queue->length()); 2292 DCHECK(num_tasks <= queue->length());
2285 if (num_tasks == 0) { 2293 if (num_tasks == 0) {
2286 queue = factory()->NewFixedArray(8); 2294 queue = factory()->NewFixedArray(8);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 if (prev_ && prev_->Intercept(flag)) return true; 2394 if (prev_ && prev_->Intercept(flag)) return true;
2387 // Then check whether this scope intercepts. 2395 // Then check whether this scope intercepts.
2388 if ((flag & intercept_mask_)) { 2396 if ((flag & intercept_mask_)) {
2389 intercepted_flags_ |= flag; 2397 intercepted_flags_ |= flag;
2390 return true; 2398 return true;
2391 } 2399 }
2392 return false; 2400 return false;
2393 } 2401 }
2394 2402
2395 } } // namespace v8::internal 2403 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698