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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 static void DefaultMessageReport(Isolate* isolate, | 82 static void DefaultMessageReport(Isolate* isolate, |
83 const MessageLocation* loc, | 83 const MessageLocation* loc, |
84 Handle<Object> message_obj); | 84 Handle<Object> message_obj); |
85 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 85 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
86 static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, | 86 static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, |
87 Handle<Object> data); | 87 Handle<Object> data); |
88 }; | 88 }; |
89 | 89 |
90 | 90 |
| 91 class CallSite { |
| 92 public: |
| 93 CallSite(Handle<Object> receiver, Handle<JSFunction> fun, int pos) |
| 94 : receiver_(receiver), fun_(fun), pos_(pos) {} |
| 95 |
| 96 Handle<Object> GetFileName(Isolate* isolate); |
| 97 Handle<Object> GetFunctionName(Isolate* isolate); |
| 98 Handle<Object> GetScriptNameOrSourceUrl(Isolate* isolate); |
| 99 // Return 1-based line number, including line offset. |
| 100 int GetLineNumber(Isolate* isolate); |
| 101 // Return 1-based column number, including column offset if first line. |
| 102 int GetColumnNumber(Isolate* isolate); |
| 103 bool IsNative(Isolate* isolate); |
| 104 bool IsToplevel(Isolate* isolate); |
| 105 bool IsEval(Isolate* isolate); |
| 106 |
| 107 private: |
| 108 Handle<Object> receiver_; |
| 109 Handle<JSFunction> fun_; |
| 110 int pos_; |
| 111 }; |
| 112 |
| 113 |
91 #define MESSAGE_TEMPLATES(T) \ | 114 #define MESSAGE_TEMPLATES(T) \ |
92 /* Error */ \ | 115 /* Error */ \ |
93 T(CyclicProto, "Cyclic __proto__ value") \ | 116 T(CyclicProto, "Cyclic __proto__ value") \ |
94 T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \ | 117 T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \ |
95 T(Unsupported, "Not supported") \ | 118 T(Unsupported, "Not supported") \ |
96 T(WrongServiceType, "Internal error, wrong service type: %") \ | 119 T(WrongServiceType, "Internal error, wrong service type: %") \ |
97 T(WrongValueType, "Internal error. Wrong value type.") \ | 120 T(WrongValueType, "Internal error. Wrong value type.") \ |
98 /* TypeError */ \ | 121 /* TypeError */ \ |
99 T(ApplyNonFunction, \ | 122 T(ApplyNonFunction, \ |
100 "Function.prototype.apply was called on %, which is a % and not a " \ | 123 "Function.prototype.apply was called on %, which is a % and not a " \ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 }; | 217 }; |
195 | 218 |
196 static MaybeHandle<String> FormatMessage(int template_index, | 219 static MaybeHandle<String> FormatMessage(int template_index, |
197 Handle<String> arg0, | 220 Handle<String> arg0, |
198 Handle<String> arg1, | 221 Handle<String> arg1, |
199 Handle<String> arg2); | 222 Handle<String> arg2); |
200 }; | 223 }; |
201 } } // namespace v8::internal | 224 } } // namespace v8::internal |
202 | 225 |
203 #endif // V8_MESSAGES_H_ | 226 #endif // V8_MESSAGES_H_ |
OLD | NEW |