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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 | 45 |
46 class CallSite { | 46 class CallSite { |
47 public: | 47 public: |
48 CallSite(Isolate* isolate, Handle<JSObject> call_site_obj); | 48 CallSite(Isolate* isolate, Handle<JSObject> call_site_obj); |
49 | 49 |
50 Handle<Object> GetFileName(); | 50 Handle<Object> GetFileName(); |
51 Handle<Object> GetFunctionName(); | 51 Handle<Object> GetFunctionName(); |
52 Handle<Object> GetScriptNameOrSourceUrl(); | 52 Handle<Object> GetScriptNameOrSourceUrl(); |
53 Handle<Object> GetMethodName(); | 53 Handle<Object> GetMethodName(); |
| 54 Handle<Object> GetTypeName(); |
| 55 Handle<Object> GetEvalOrigin(); |
54 // Return 1-based line number, including line offset. | 56 // Return 1-based line number, including line offset. |
55 int GetLineNumber(); | 57 int GetLineNumber(); |
56 // Return 1-based column number, including column offset if first line. | 58 // Return 1-based column number, including column offset if first line. |
57 int GetColumnNumber(); | 59 int GetColumnNumber(); |
58 bool IsNative(); | 60 bool IsNative(); |
59 bool IsToplevel(); | 61 bool IsToplevel(); |
60 bool IsEval(); | 62 bool IsEval(); |
61 bool IsConstructor(); | 63 bool IsConstructor(); |
62 | 64 |
63 bool IsJavaScript() { return !fun_.is_null(); } | 65 bool IsJavaScript() { return !fun_.is_null(); } |
(...skipping 18 matching lines...) Expand all Loading... |
82 // Determines how stack trace collection skips frames. | 84 // Determines how stack trace collection skips frames. |
83 enum FrameSkipMode { | 85 enum FrameSkipMode { |
84 // Unconditionally skips the first frame. Used e.g. when the Error constructor | 86 // Unconditionally skips the first frame. Used e.g. when the Error constructor |
85 // is called, in which case the first frame is always a BUILTIN_EXIT frame. | 87 // is called, in which case the first frame is always a BUILTIN_EXIT frame. |
86 SKIP_FIRST, | 88 SKIP_FIRST, |
87 // Skip all frames until a specified caller function is seen. | 89 // Skip all frames until a specified caller function is seen. |
88 SKIP_UNTIL_SEEN, | 90 SKIP_UNTIL_SEEN, |
89 SKIP_NONE, | 91 SKIP_NONE, |
90 }; | 92 }; |
91 | 93 |
92 MaybeHandle<Object> ConstructError(Isolate* isolate, Handle<JSFunction> target, | 94 class ErrorUtils : public AllStatic { |
93 Handle<Object> new_target, | 95 public: |
94 Handle<Object> message, FrameSkipMode mode, | 96 static MaybeHandle<Object> Construct( |
95 bool suppress_detailed_trace); | 97 Isolate* isolate, Handle<JSFunction> target, Handle<Object> new_target, |
| 98 Handle<Object> message, FrameSkipMode mode, bool suppress_detailed_trace); |
| 99 |
| 100 static MaybeHandle<String> ToString(Isolate* isolate, Handle<Object> recv); |
| 101 }; |
| 102 |
| 103 class CallSiteUtils : public AllStatic { |
| 104 public: |
| 105 static MaybeHandle<Object> Construct(Isolate* isolate, |
| 106 Handle<JSFunction> target, |
| 107 Handle<Object> new_target, |
| 108 Handle<Object> receiver, |
| 109 Handle<Object> fun, Handle<Object> pos, |
| 110 Handle<Object> strict_mode); |
| 111 |
| 112 static MaybeHandle<String> ToString(Isolate* isolate, Handle<Object> recv); |
| 113 }; |
96 | 114 |
97 #define MESSAGE_TEMPLATES(T) \ | 115 #define MESSAGE_TEMPLATES(T) \ |
98 /* Error */ \ | 116 /* Error */ \ |
99 T(None, "") \ | 117 T(None, "") \ |
100 T(CyclicProto, "Cyclic __proto__ value") \ | 118 T(CyclicProto, "Cyclic __proto__ value") \ |
101 T(Debugger, "Debugger: %") \ | 119 T(Debugger, "Debugger: %") \ |
102 T(DebuggerLoading, "Error loading debugger") \ | 120 T(DebuggerLoading, "Error loading debugger") \ |
103 T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \ | 121 T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \ |
104 T(UncaughtException, "Uncaught %") \ | 122 T(UncaughtException, "Uncaught %") \ |
105 T(Unsupported, "Not supported") \ | 123 T(Unsupported, "Not supported") \ |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 576 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
559 static std::unique_ptr<char[]> GetLocalizedMessage(Isolate* isolate, | 577 static std::unique_ptr<char[]> GetLocalizedMessage(Isolate* isolate, |
560 Handle<Object> data); | 578 Handle<Object> data); |
561 }; | 579 }; |
562 | 580 |
563 | 581 |
564 } // namespace internal | 582 } // namespace internal |
565 } // namespace v8 | 583 } // namespace v8 |
566 | 584 |
567 #endif // V8_MESSAGES_H_ | 585 #endif // V8_MESSAGES_H_ |
OLD | NEW |