OLD | NEW |
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 | 4 |
5 #include "src/builtins/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/messages.h" | 9 #include "src/messages.h" |
10 #include "src/property-descriptor.h" | 10 #include "src/property-descriptor.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Collect the stack trace. | 38 // Collect the stack trace. |
39 | 39 |
40 RETURN_FAILURE_ON_EXCEPTION(isolate, | 40 RETURN_FAILURE_ON_EXCEPTION(isolate, |
41 isolate->CaptureAndSetDetailedStackTrace(object)); | 41 isolate->CaptureAndSetDetailedStackTrace(object)); |
42 | 42 |
43 // Eagerly format the stack trace and set the stack property. | 43 // Eagerly format the stack trace and set the stack property. |
44 | 44 |
45 Handle<Object> stack_trace = | 45 Handle<Object> stack_trace = |
46 isolate->CaptureSimpleStackTrace(object, mode, caller); | 46 isolate->CaptureSimpleStackTrace(object, mode, caller); |
| 47 if (!stack_trace->IsJSArray()) return *isolate->factory()->undefined_value(); |
47 | 48 |
48 Handle<Object> formatted_stack_trace; | 49 Handle<Object> formatted_stack_trace; |
49 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 50 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
50 isolate, formatted_stack_trace, | 51 isolate, formatted_stack_trace, |
51 FormatStackTrace(isolate, object, stack_trace)); | 52 FormatStackTrace(isolate, object, stack_trace)); |
52 | 53 |
53 RETURN_FAILURE_ON_EXCEPTION( | 54 RETURN_FAILURE_ON_EXCEPTION( |
54 isolate, JSObject::SetProperty(object, isolate->factory()->stack_string(), | 55 isolate, JSObject::SetProperty(object, isolate->factory()->stack_string(), |
55 formatted_stack_trace, STRICT)); | 56 formatted_stack_trace, STRICT)); |
56 | 57 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // the code unit 0x0020 (SPACE), and msg. | 118 // the code unit 0x0020 (SPACE), and msg. |
118 IncrementalStringBuilder builder(isolate); | 119 IncrementalStringBuilder builder(isolate); |
119 builder.AppendString(name); | 120 builder.AppendString(name); |
120 builder.AppendCString(": "); | 121 builder.AppendCString(": "); |
121 builder.AppendString(msg); | 122 builder.AppendString(msg); |
122 RETURN_RESULT_OR_FAILURE(isolate, builder.Finish()); | 123 RETURN_RESULT_OR_FAILURE(isolate, builder.Finish()); |
123 } | 124 } |
124 | 125 |
125 } // namespace internal | 126 } // namespace internal |
126 } // namespace v8 | 127 } // namespace v8 |
OLD | NEW |