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