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/messages.h" | 8 #include "src/messages.h" |
9 #include "src/property-descriptor.h" | 9 #include "src/property-descriptor.h" |
10 #include "src/string-builder.h" | 10 #include "src/string-builder.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // static | 37 // static |
38 BUILTIN(ErrorCaptureStackTrace) { | 38 BUILTIN(ErrorCaptureStackTrace) { |
39 HandleScope scope(isolate); | 39 HandleScope scope(isolate); |
40 Handle<Object> object_obj = args.atOrUndefined(isolate, 1); | 40 Handle<Object> object_obj = args.atOrUndefined(isolate, 1); |
41 if (!object_obj->IsJSObject()) { | 41 if (!object_obj->IsJSObject()) { |
42 THROW_NEW_ERROR_RETURN_FAILURE( | 42 THROW_NEW_ERROR_RETURN_FAILURE( |
43 isolate, NewTypeError(MessageTemplate::kInvalidArgument, object_obj)); | 43 isolate, NewTypeError(MessageTemplate::kInvalidArgument, object_obj)); |
44 } | 44 } |
45 Handle<JSObject> object = Handle<JSObject>::cast(object_obj); | 45 Handle<JSObject> object = Handle<JSObject>::cast(object_obj); |
46 Handle<Object> caller = args.atOrUndefined(isolate, 2); | 46 Handle<Object> caller = args.atOrUndefined(isolate, 2); |
47 FrameSkipMode mode = caller->IsJSFunction() ? SKIP_UNTIL_SEEN : SKIP_NONE; | 47 FrameSkipMode mode = caller->IsJSFunction() ? SKIP_UNTIL_SEEN : SKIP_FIRST; |
48 | 48 |
49 // Collect the stack trace. | 49 // Collect the stack trace. |
50 | 50 |
51 RETURN_FAILURE_ON_EXCEPTION(isolate, | 51 RETURN_FAILURE_ON_EXCEPTION(isolate, |
52 isolate->CaptureAndSetDetailedStackTrace(object)); | 52 isolate->CaptureAndSetDetailedStackTrace(object)); |
53 | 53 |
54 // Eagerly format the stack trace and set the stack property. | 54 // Eagerly format the stack trace and set the stack property. |
55 | 55 |
56 Handle<Object> stack_trace = | 56 Handle<Object> stack_trace = |
57 isolate->CaptureSimpleStackTrace(object, mode, caller); | 57 isolate->CaptureSimpleStackTrace(object, mode, caller); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 Handle<Object> undefined = isolate->factory()->undefined_value(); | 126 Handle<Object> undefined = isolate->factory()->undefined_value(); |
127 const int template_index = MessageTemplate::kURIMalformed; | 127 const int template_index = MessageTemplate::kURIMalformed; |
128 RETURN_RESULT_OR_FAILURE( | 128 RETURN_RESULT_OR_FAILURE( |
129 isolate, | 129 isolate, |
130 ErrorUtils::MakeGenericError(isolate, constructor, template_index, | 130 ErrorUtils::MakeGenericError(isolate, constructor, template_index, |
131 undefined, undefined, undefined, SKIP_NONE)); | 131 undefined, undefined, undefined, SKIP_NONE)); |
132 } | 132 } |
133 | 133 |
134 } // namespace internal | 134 } // namespace internal |
135 } // namespace v8 | 135 } // namespace v8 |
OLD | NEW |