Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(970)

Side by Side Diff: src/messages.h

Issue 2230953002: Use a custom Struct for stack trace storage (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweaks Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/isolate.cc ('k') | src/messages.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 int end_pos() const { return end_pos_; } 35 int end_pos() const { return end_pos_; }
36 Handle<JSFunction> function() const { return function_; } 36 Handle<JSFunction> function() const { return function_; }
37 37
38 private: 38 private:
39 Handle<Script> script_; 39 Handle<Script> script_;
40 int start_pos_; 40 int start_pos_;
41 int end_pos_; 41 int end_pos_;
42 Handle<JSFunction> function_; 42 Handle<JSFunction> function_;
43 }; 43 };
44 44
45
46 class CallSite {
47 public:
48 CallSite(Isolate* isolate, Handle<JSObject> call_site_obj);
49
50 Handle<Object> GetFileName();
51 Handle<Object> GetFunctionName();
52 Handle<Object> GetScriptNameOrSourceUrl();
53 Handle<Object> GetMethodName();
54 Handle<Object> GetTypeName();
55 Handle<Object> GetEvalOrigin();
56 // Return 1-based line number, including line offset.
57 int GetLineNumber();
58 // Return 1-based column number, including column offset if first line.
59 int GetColumnNumber();
60 bool IsNative();
61 bool IsToplevel();
62 bool IsEval();
63 bool IsConstructor();
64
65 bool IsJavaScript() { return !fun_.is_null(); }
66 bool IsWasm() { return !wasm_obj_.is_null(); }
67
68 int wasm_func_index() const { return wasm_func_index_; }
69
70 private:
71 Isolate* isolate_;
72 Handle<Object> receiver_;
73 Handle<JSFunction> fun_;
74 int32_t pos_ = -1;
75 Handle<JSObject> wasm_obj_;
76 uint32_t wasm_func_index_ = static_cast<uint32_t>(-1);
77 };
78
79 // Determines how stack trace collection skips frames. 45 // Determines how stack trace collection skips frames.
80 enum FrameSkipMode { 46 enum FrameSkipMode {
81 // Unconditionally skips the first frame. Used e.g. when the Error constructor 47 // Unconditionally skips the first frame. Used e.g. when the Error constructor
82 // is called, in which case the first frame is always a BUILTIN_EXIT frame. 48 // is called, in which case the first frame is always a BUILTIN_EXIT frame.
83 SKIP_FIRST, 49 SKIP_FIRST,
84 // Skip all frames until a specified caller function is seen. 50 // Skip all frames until a specified caller function is seen.
85 SKIP_UNTIL_SEEN, 51 SKIP_UNTIL_SEEN,
86 SKIP_NONE, 52 SKIP_NONE,
87 }; 53 };
88 54
(...skipping 11 matching lines...) Expand all
100 Handle<Object> arg0, Handle<Object> arg1, Handle<Object> arg2, 66 Handle<Object> arg0, Handle<Object> arg1, Handle<Object> arg2,
101 FrameSkipMode mode); 67 FrameSkipMode mode);
102 68
103 // Formats a textual stack trace from the given structured stack trace. 69 // Formats a textual stack trace from the given structured stack trace.
104 // Note that this can call arbitrary JS code through Error.prepareStackTrace. 70 // Note that this can call arbitrary JS code through Error.prepareStackTrace.
105 static MaybeHandle<Object> FormatStackTrace(Isolate* isolate, 71 static MaybeHandle<Object> FormatStackTrace(Isolate* isolate,
106 Handle<JSObject> error, 72 Handle<JSObject> error,
107 Handle<Object> stack_trace); 73 Handle<Object> stack_trace);
108 }; 74 };
109 75
110 class CallSiteUtils : public AllStatic {
111 public:
112 static MaybeHandle<Object> Construct(Isolate* isolate,
113 Handle<Object> receiver,
114 Handle<Object> fun, Handle<Object> pos,
115 Handle<Object> strict_mode);
116
117 static MaybeHandle<String> ToString(Isolate* isolate, Handle<Object> recv);
118 };
119
120 #define MESSAGE_TEMPLATES(T) \ 76 #define MESSAGE_TEMPLATES(T) \
121 /* Error */ \ 77 /* Error */ \
122 T(None, "") \ 78 T(None, "") \
123 T(CyclicProto, "Cyclic __proto__ value") \ 79 T(CyclicProto, "Cyclic __proto__ value") \
124 T(Debugger, "Debugger: %") \ 80 T(Debugger, "Debugger: %") \
125 T(DebuggerLoading, "Error loading debugger") \ 81 T(DebuggerLoading, "Error loading debugger") \
126 T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \ 82 T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \
127 T(UncaughtException, "Uncaught %") \ 83 T(UncaughtException, "Uncaught %") \
128 T(Unsupported, "Not supported") \ 84 T(Unsupported, "Not supported") \
129 T(WrongServiceType, "Internal error, wrong service type: %") \ 85 T(WrongServiceType, "Internal error, wrong service type: %") \
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); 537 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data);
582 static std::unique_ptr<char[]> GetLocalizedMessage(Isolate* isolate, 538 static std::unique_ptr<char[]> GetLocalizedMessage(Isolate* isolate,
583 Handle<Object> data); 539 Handle<Object> data);
584 }; 540 };
585 541
586 542
587 } // namespace internal 543 } // namespace internal
588 } // namespace v8 544 } // namespace v8
589 545
590 #endif // V8_MESSAGES_H_ 546 #endif // V8_MESSAGES_H_
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698