OLD | NEW |
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 <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 frames_seen++; | 407 frames_seen++; |
408 } | 408 } |
409 } | 409 } |
410 elements->set(0, Smi::FromInt(sloppy_frames)); | 410 elements->set(0, Smi::FromInt(sloppy_frames)); |
411 Handle<JSArray> result = factory()->NewJSArrayWithElements(elements); | 411 Handle<JSArray> result = factory()->NewJSArrayWithElements(elements); |
412 result->set_length(Smi::FromInt(cursor)); | 412 result->set_length(Smi::FromInt(cursor)); |
413 return result; | 413 return result; |
414 } | 414 } |
415 | 415 |
416 | 416 |
417 void Isolate::CaptureAndSetDetailedStackTrace(Handle<JSObject> error_object) { | 417 MaybeHandle<JSObject> Isolate::CaptureAndSetDetailedStackTrace( |
| 418 Handle<JSObject> error_object) { |
418 if (capture_stack_trace_for_uncaught_exceptions_) { | 419 if (capture_stack_trace_for_uncaught_exceptions_) { |
419 // Capture stack trace for a detailed exception message. | 420 // Capture stack trace for a detailed exception message. |
420 Handle<Name> key = factory()->detailed_stack_trace_symbol(); | 421 Handle<Name> key = factory()->detailed_stack_trace_symbol(); |
421 Handle<JSArray> stack_trace = CaptureCurrentStackTrace( | 422 Handle<JSArray> stack_trace = CaptureCurrentStackTrace( |
422 stack_trace_for_uncaught_exceptions_frame_limit_, | 423 stack_trace_for_uncaught_exceptions_frame_limit_, |
423 stack_trace_for_uncaught_exceptions_options_); | 424 stack_trace_for_uncaught_exceptions_options_); |
424 JSObject::SetProperty(error_object, key, stack_trace, STRICT).Assert(); | 425 RETURN_ON_EXCEPTION( |
| 426 this, JSObject::SetProperty(error_object, key, stack_trace, STRICT), |
| 427 JSObject); |
425 } | 428 } |
| 429 return error_object; |
426 } | 430 } |
427 | 431 |
428 | 432 |
429 void Isolate::CaptureAndSetSimpleStackTrace(Handle<JSObject> error_object, | 433 MaybeHandle<JSObject> Isolate::CaptureAndSetSimpleStackTrace( |
430 Handle<Object> caller) { | 434 Handle<JSObject> error_object, Handle<Object> caller) { |
431 // Capture stack trace for simple stack trace string formatting. | 435 // Capture stack trace for simple stack trace string formatting. |
432 Handle<Name> key = factory()->stack_trace_symbol(); | 436 Handle<Name> key = factory()->stack_trace_symbol(); |
433 Handle<Object> stack_trace = CaptureSimpleStackTrace(error_object, caller); | 437 Handle<Object> stack_trace = CaptureSimpleStackTrace(error_object, caller); |
434 JSObject::SetProperty(error_object, key, stack_trace, STRICT).Assert(); | 438 RETURN_ON_EXCEPTION( |
| 439 this, JSObject::SetProperty(error_object, key, stack_trace, STRICT), |
| 440 JSObject); |
| 441 return error_object; |
435 } | 442 } |
436 | 443 |
437 | 444 |
438 Handle<JSArray> Isolate::GetDetailedStackTrace(Handle<JSObject> error_object) { | 445 Handle<JSArray> Isolate::GetDetailedStackTrace(Handle<JSObject> error_object) { |
439 Handle<Name> key_detailed = factory()->detailed_stack_trace_symbol(); | 446 Handle<Name> key_detailed = factory()->detailed_stack_trace_symbol(); |
440 Handle<Object> stack_trace = | 447 Handle<Object> stack_trace = |
441 JSObject::GetDataProperty(error_object, key_detailed); | 448 JSObject::GetDataProperty(error_object, key_detailed); |
442 if (stack_trace->IsJSArray()) return Handle<JSArray>::cast(stack_trace); | 449 if (stack_trace->IsJSArray()) return Handle<JSArray>::cast(stack_trace); |
443 | 450 |
444 if (!capture_stack_trace_for_uncaught_exceptions_) return Handle<JSArray>(); | 451 if (!capture_stack_trace_for_uncaught_exceptions_) return Handle<JSArray>(); |
(...skipping 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2659 if (prev_ && prev_->Intercept(flag)) return true; | 2666 if (prev_ && prev_->Intercept(flag)) return true; |
2660 // Then check whether this scope intercepts. | 2667 // Then check whether this scope intercepts. |
2661 if ((flag & intercept_mask_)) { | 2668 if ((flag & intercept_mask_)) { |
2662 intercepted_flags_ |= flag; | 2669 intercepted_flags_ |= flag; |
2663 return true; | 2670 return true; |
2664 } | 2671 } |
2665 return false; | 2672 return false; |
2666 } | 2673 } |
2667 | 2674 |
2668 } } // namespace v8::internal | 2675 } } // namespace v8::internal |
OLD | NEW |