OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 // The infrastructure used for (localized) message reporting in V8. | 5 // The infrastructure used for (localized) message reporting in V8. |
6 // | 6 // |
7 // Note: there's a big unresolved issue about ownership of the data | 7 // Note: there's a big unresolved issue about ownership of the data |
8 // structures used by this framework. | 8 // structures used by this framework. |
9 | 9 |
10 #ifndef V8_MESSAGES_H_ | 10 #ifndef V8_MESSAGES_H_ |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 private: | 70 private: |
71 Isolate* isolate_; | 71 Isolate* isolate_; |
72 Handle<Object> receiver_; | 72 Handle<Object> receiver_; |
73 Handle<JSFunction> fun_; | 73 Handle<JSFunction> fun_; |
74 int32_t pos_ = -1; | 74 int32_t pos_ = -1; |
75 Handle<JSObject> wasm_obj_; | 75 Handle<JSObject> wasm_obj_; |
76 uint32_t wasm_func_index_ = static_cast<uint32_t>(-1); | 76 uint32_t wasm_func_index_ = static_cast<uint32_t>(-1); |
77 }; | 77 }; |
78 | 78 |
79 // Formats a textual stack trace from the given structured stack trace. | |
80 // Note that this can call arbitrary JS code through Error.prepareStackTrace. | |
81 MaybeHandle<Object> FormatStackTrace(Isolate* isolate, Handle<JSObject> error, | |
82 Handle<Object> stack_trace); | |
83 | |
84 // Determines how stack trace collection skips frames. | 79 // Determines how stack trace collection skips frames. |
85 enum FrameSkipMode { | 80 enum FrameSkipMode { |
86 // Unconditionally skips the first frame. Used e.g. when the Error constructor | 81 // Unconditionally skips the first frame. Used e.g. when the Error constructor |
87 // is called, in which case the first frame is always a BUILTIN_EXIT frame. | 82 // is called, in which case the first frame is always a BUILTIN_EXIT frame. |
88 SKIP_FIRST, | 83 SKIP_FIRST, |
89 // Skip all frames until a specified caller function is seen. | 84 // Skip all frames until a specified caller function is seen. |
90 SKIP_UNTIL_SEEN, | 85 SKIP_UNTIL_SEEN, |
91 SKIP_NONE, | 86 SKIP_NONE, |
92 }; | 87 }; |
93 | 88 |
94 class ErrorUtils : public AllStatic { | 89 class ErrorUtils : public AllStatic { |
95 public: | 90 public: |
96 static MaybeHandle<Object> Construct( | 91 static MaybeHandle<Object> Construct( |
97 Isolate* isolate, Handle<JSFunction> target, Handle<Object> new_target, | 92 Isolate* isolate, Handle<JSFunction> target, Handle<Object> new_target, |
98 Handle<Object> message, FrameSkipMode mode, Handle<Object> caller, | 93 Handle<Object> message, FrameSkipMode mode, Handle<Object> caller, |
99 bool suppress_detailed_trace); | 94 bool suppress_detailed_trace); |
100 | 95 |
101 static MaybeHandle<String> ToString(Isolate* isolate, Handle<Object> recv); | 96 static MaybeHandle<String> ToString(Isolate* isolate, Handle<Object> recv); |
102 | 97 |
103 static MaybeHandle<Object> MakeGenericError( | 98 static MaybeHandle<Object> MakeGenericError( |
104 Isolate* isolate, Handle<JSFunction> constructor, int template_index, | 99 Isolate* isolate, Handle<JSFunction> constructor, int template_index, |
105 Handle<Object> arg0, Handle<Object> arg1, Handle<Object> arg2, | 100 Handle<Object> arg0, Handle<Object> arg1, Handle<Object> arg2, |
106 FrameSkipMode mode); | 101 FrameSkipMode mode); |
| 102 |
| 103 // Formats a textual stack trace from the given structured stack trace. |
| 104 // Note that this can call arbitrary JS code through Error.prepareStackTrace. |
| 105 static MaybeHandle<Object> FormatStackTrace(Isolate* isolate, |
| 106 Handle<JSObject> error, |
| 107 Handle<Object> stack_trace); |
107 }; | 108 }; |
108 | 109 |
109 class CallSiteUtils : public AllStatic { | 110 class CallSiteUtils : public AllStatic { |
110 public: | 111 public: |
111 static MaybeHandle<Object> Construct(Isolate* isolate, | 112 static MaybeHandle<Object> Construct(Isolate* isolate, |
112 Handle<Object> receiver, | 113 Handle<Object> receiver, |
113 Handle<Object> fun, Handle<Object> pos, | 114 Handle<Object> fun, Handle<Object> pos, |
114 Handle<Object> strict_mode); | 115 Handle<Object> strict_mode); |
115 | 116 |
116 static MaybeHandle<String> ToString(Isolate* isolate, Handle<Object> recv); | 117 static MaybeHandle<String> ToString(Isolate* isolate, Handle<Object> recv); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 581 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
581 static std::unique_ptr<char[]> GetLocalizedMessage(Isolate* isolate, | 582 static std::unique_ptr<char[]> GetLocalizedMessage(Isolate* isolate, |
582 Handle<Object> data); | 583 Handle<Object> data); |
583 }; | 584 }; |
584 | 585 |
585 | 586 |
586 } // namespace internal | 587 } // namespace internal |
587 } // namespace v8 | 588 } // namespace v8 |
588 | 589 |
589 #endif // V8_MESSAGES_H_ | 590 #endif // V8_MESSAGES_H_ |
OLD | NEW |