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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 int GetColumnNumber() override { return -1; } | 141 int GetColumnNumber() override { return -1; } |
142 | 142 |
143 bool IsNative() override { return false; } | 143 bool IsNative() override { return false; } |
144 bool IsToplevel() override { return false; } | 144 bool IsToplevel() override { return false; } |
145 bool IsEval() override { return false; } | 145 bool IsEval() override { return false; } |
146 bool IsConstructor() override { return false; } | 146 bool IsConstructor() override { return false; } |
147 bool IsStrict() const override { return false; } | 147 bool IsStrict() const override { return false; } |
148 | 148 |
149 MaybeHandle<String> ToString() override; | 149 MaybeHandle<String> ToString() override; |
150 | 150 |
151 private: | 151 protected: |
152 void FromFrameArray(Isolate* isolate, Handle<FrameArray> array, int frame_ix); | |
153 Handle<Object> Null() const; | 152 Handle<Object> Null() const; |
154 | 153 |
155 Isolate* isolate_; | 154 Isolate* isolate_; |
156 | 155 |
157 Handle<Object> wasm_obj_; | 156 Handle<Object> wasm_obj_; |
158 uint32_t wasm_func_index_; | 157 uint32_t wasm_func_index_; |
159 Handle<AbstractCode> code_; | 158 Handle<AbstractCode> code_; |
160 int offset_; | 159 int offset_; |
161 | 160 |
| 161 private: |
| 162 void FromFrameArray(Isolate* isolate, Handle<FrameArray> array, int frame_ix); |
| 163 |
162 friend class FrameArrayIterator; | 164 friend class FrameArrayIterator; |
163 }; | 165 }; |
164 | 166 |
| 167 class AsmJsWasmStackFrame : public WasmStackFrame { |
| 168 public: |
| 169 virtual ~AsmJsWasmStackFrame() {} |
| 170 |
| 171 Handle<Object> GetReceiver() const override; |
| 172 Handle<Object> GetFunction() const override; |
| 173 |
| 174 Handle<Object> GetFileName() override; |
| 175 Handle<Object> GetFunctionName() override; |
| 176 Handle<Object> GetScriptNameOrSourceUrl() override; |
| 177 |
| 178 int GetPosition() const override; |
| 179 int GetLineNumber() override; |
| 180 int GetColumnNumber() override; |
| 181 |
| 182 MaybeHandle<String> ToString() override; |
| 183 }; |
| 184 |
165 class FrameArrayIterator { | 185 class FrameArrayIterator { |
166 public: | 186 public: |
167 FrameArrayIterator(Isolate* isolate, Handle<FrameArray> array, | 187 FrameArrayIterator(Isolate* isolate, Handle<FrameArray> array, |
168 int frame_ix = 0); | 188 int frame_ix = 0); |
169 | 189 |
170 StackFrameBase* Frame(); | 190 StackFrameBase* Frame(); |
171 | 191 |
172 bool HasNext() const; | 192 bool HasNext() const; |
173 void Next(); | 193 void Next(); |
174 | 194 |
175 private: | 195 private: |
176 Isolate* isolate_; | 196 Isolate* isolate_; |
177 | 197 |
178 Handle<FrameArray> array_; | 198 Handle<FrameArray> array_; |
179 int next_frame_ix_; | 199 int next_frame_ix_; |
180 | 200 |
181 WasmStackFrame wasm_frame_; | 201 WasmStackFrame wasm_frame_; |
| 202 AsmJsWasmStackFrame asm_wasm_frame_; |
182 JSStackFrame js_frame_; | 203 JSStackFrame js_frame_; |
183 }; | 204 }; |
184 | 205 |
185 // Determines how stack trace collection skips frames. | 206 // Determines how stack trace collection skips frames. |
186 enum FrameSkipMode { | 207 enum FrameSkipMode { |
187 // Unconditionally skips the first frame. Used e.g. when the Error constructor | 208 // Unconditionally skips the first frame. Used e.g. when the Error constructor |
188 // is called, in which case the first frame is always a BUILTIN_EXIT frame. | 209 // is called, in which case the first frame is always a BUILTIN_EXIT frame. |
189 SKIP_FIRST, | 210 SKIP_FIRST, |
190 // Skip all frames until a specified caller function is seen. | 211 // Skip all frames until a specified caller function is seen. |
191 SKIP_UNTIL_SEEN, | 212 SKIP_UNTIL_SEEN, |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 702 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
682 static std::unique_ptr<char[]> GetLocalizedMessage(Isolate* isolate, | 703 static std::unique_ptr<char[]> GetLocalizedMessage(Isolate* isolate, |
683 Handle<Object> data); | 704 Handle<Object> data); |
684 }; | 705 }; |
685 | 706 |
686 | 707 |
687 } // namespace internal | 708 } // namespace internal |
688 } // namespace v8 | 709 } // namespace v8 |
689 | 710 |
690 #endif // V8_MESSAGES_H_ | 711 #endif // V8_MESSAGES_H_ |
OLD | NEW |