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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 Handle<Object> GetMethodName(); | 52 Handle<Object> GetMethodName(); |
53 // Return 1-based line number, including line offset. | 53 // Return 1-based line number, including line offset. |
54 int GetLineNumber(); | 54 int GetLineNumber(); |
55 // Return 1-based column number, including column offset if first line. | 55 // Return 1-based column number, including column offset if first line. |
56 int GetColumnNumber(); | 56 int GetColumnNumber(); |
57 bool IsNative(); | 57 bool IsNative(); |
58 bool IsToplevel(); | 58 bool IsToplevel(); |
59 bool IsEval(); | 59 bool IsEval(); |
60 bool IsConstructor(); | 60 bool IsConstructor(); |
61 | 61 |
62 bool IsValid() { return !fun_.is_null(); } | 62 bool IsJavaScript() { return !fun_.is_null(); } |
| 63 bool IsWasm() { return !wasm_obj_.is_null(); } |
63 | 64 |
64 private: | 65 private: |
65 Isolate* isolate_; | 66 Isolate* isolate_; |
66 Handle<Object> receiver_; | 67 Handle<Object> receiver_; |
67 Handle<JSFunction> fun_; | 68 Handle<JSFunction> fun_; |
68 int32_t pos_; | 69 int32_t pos_ = -1; |
| 70 Handle<JSObject> wasm_obj_; |
| 71 uint32_t wasm_func_index_ = static_cast<uint32_t>(-1); |
69 }; | 72 }; |
70 | 73 |
71 #define MESSAGE_TEMPLATES(T) \ | 74 #define MESSAGE_TEMPLATES(T) \ |
72 /* Error */ \ | 75 /* Error */ \ |
73 T(None, "") \ | 76 T(None, "") \ |
74 T(CyclicProto, "Cyclic __proto__ value") \ | 77 T(CyclicProto, "Cyclic __proto__ value") \ |
75 T(Debugger, "Debugger: %") \ | 78 T(Debugger, "Debugger: %") \ |
76 T(DebuggerLoading, "Error loading debugger") \ | 79 T(DebuggerLoading, "Error loading debugger") \ |
77 T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \ | 80 T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \ |
78 T(UncaughtException, "Uncaught %") \ | 81 T(UncaughtException, "Uncaught %") \ |
(...skipping 10 matching lines...) Expand all Loading... |
89 "ArrayBuffer subclass returned this from species constructor") \ | 92 "ArrayBuffer subclass returned this from species constructor") \ |
90 T(ArrayFunctionsOnFrozen, "Cannot modify frozen array elements") \ | 93 T(ArrayFunctionsOnFrozen, "Cannot modify frozen array elements") \ |
91 T(ArrayFunctionsOnSealed, "Cannot add/remove sealed array elements") \ | 94 T(ArrayFunctionsOnSealed, "Cannot add/remove sealed array elements") \ |
92 T(ArrayNotSubclassable, "Subclassing Arrays is not currently supported.") \ | 95 T(ArrayNotSubclassable, "Subclassing Arrays is not currently supported.") \ |
93 T(CalledNonCallable, "% is not a function") \ | 96 T(CalledNonCallable, "% is not a function") \ |
94 T(CalledNonCallableInstanceOf, \ | 97 T(CalledNonCallableInstanceOf, \ |
95 "Right-hand side of 'instanceof' is not callable") \ | 98 "Right-hand side of 'instanceof' is not callable") \ |
96 T(CalledOnNonObject, "% called on non-object") \ | 99 T(CalledOnNonObject, "% called on non-object") \ |
97 T(CalledOnNullOrUndefined, "% called on null or undefined") \ | 100 T(CalledOnNullOrUndefined, "% called on null or undefined") \ |
98 T(CallSiteExpectsFunction, \ | 101 T(CallSiteExpectsFunction, \ |
99 "CallSite expects function as second argument, got %") \ | 102 "CallSite expects function or number as second argument, got %") \ |
100 T(CallSiteMethod, "CallSite method % expects CallSite as receiver") \ | 103 T(CallSiteMethod, "CallSite method % expects CallSite as receiver") \ |
101 T(CannotConvertToPrimitive, "Cannot convert object to primitive value") \ | 104 T(CannotConvertToPrimitive, "Cannot convert object to primitive value") \ |
102 T(CannotPreventExt, "Cannot prevent extensions") \ | 105 T(CannotPreventExt, "Cannot prevent extensions") \ |
103 T(CannotFreezeArrayBufferView, \ | 106 T(CannotFreezeArrayBufferView, \ |
104 "Cannot freeze array buffer views with elements") \ | 107 "Cannot freeze array buffer views with elements") \ |
105 T(CircularStructure, "Converting circular structure to JSON") \ | 108 T(CircularStructure, "Converting circular structure to JSON") \ |
106 T(ConstructAbstractClass, "Abstract class % not directly constructable") \ | 109 T(ConstructAbstractClass, "Abstract class % not directly constructable") \ |
107 T(ConstAssign, "Assignment to constant variable.") \ | 110 T(ConstAssign, "Assignment to constant variable.") \ |
108 T(ConstructorNonCallable, \ | 111 T(ConstructorNonCallable, \ |
109 "Class constructor % cannot be invoked without 'new'") \ | 112 "Class constructor % cannot be invoked without 'new'") \ |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 522 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
520 static base::SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, | 523 static base::SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, |
521 Handle<Object> data); | 524 Handle<Object> data); |
522 }; | 525 }; |
523 | 526 |
524 | 527 |
525 } // namespace internal | 528 } // namespace internal |
526 } // namespace v8 | 529 } // namespace v8 |
527 | 530 |
528 #endif // V8_MESSAGES_H_ | 531 #endif // V8_MESSAGES_H_ |
OLD | NEW |