| 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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 T(WasmTrapUnreachable, "unreachable") \ | 662 T(WasmTrapUnreachable, "unreachable") \ |
| 663 T(WasmTrapMemOutOfBounds, "memory access out of bounds") \ | 663 T(WasmTrapMemOutOfBounds, "memory access out of bounds") \ |
| 664 T(WasmTrapDivByZero, "divide by zero") \ | 664 T(WasmTrapDivByZero, "divide by zero") \ |
| 665 T(WasmTrapDivUnrepresentable, "divide result unrepresentable") \ | 665 T(WasmTrapDivUnrepresentable, "divide result unrepresentable") \ |
| 666 T(WasmTrapRemByZero, "remainder by zero") \ | 666 T(WasmTrapRemByZero, "remainder by zero") \ |
| 667 T(WasmTrapFloatUnrepresentable, "integer result unrepresentable") \ | 667 T(WasmTrapFloatUnrepresentable, "integer result unrepresentable") \ |
| 668 T(WasmTrapFuncInvalid, "invalid function") \ | 668 T(WasmTrapFuncInvalid, "invalid function") \ |
| 669 T(WasmTrapFuncSigMismatch, "function signature mismatch") \ | 669 T(WasmTrapFuncSigMismatch, "function signature mismatch") \ |
| 670 T(WasmTrapInvalidIndex, "invalid index into function table") \ | 670 T(WasmTrapInvalidIndex, "invalid index into function table") \ |
| 671 T(WasmTrapTypeError, "invalid type") \ | 671 T(WasmTrapTypeError, "invalid type") \ |
| 672 /* Asm.js validation warnings */ \ |
| 673 T(AsmJsInvalid, "Invalid asm.js: %") \ |
| 672 /* DataCloneError messages */ \ | 674 /* DataCloneError messages */ \ |
| 673 T(DataCloneError, "% could not be cloned.") \ | 675 T(DataCloneError, "% could not be cloned.") \ |
| 674 T(DataCloneErrorNeuteredArrayBuffer, \ | 676 T(DataCloneErrorNeuteredArrayBuffer, \ |
| 675 "An ArrayBuffer is neutered and could not be cloned.") \ | 677 "An ArrayBuffer is neutered and could not be cloned.") \ |
| 676 T(DataCloneErrorSharedArrayBufferNotTransferred, \ | 678 T(DataCloneErrorSharedArrayBufferNotTransferred, \ |
| 677 "A SharedArrayBuffer could not be cloned. SharedArrayBuffer must be " \ | 679 "A SharedArrayBuffer could not be cloned. SharedArrayBuffer must be " \ |
| 678 "transferred.") \ | 680 "transferred.") \ |
| 679 T(DataCloneDeserializationError, "Unable to deserialize cloned data.") \ | 681 T(DataCloneDeserializationError, "Unable to deserialize cloned data.") \ |
| 680 T(DataCloneDeserializationVersionError, \ | 682 T(DataCloneDeserializationVersionError, \ |
| 681 "Unable to deserialize cloned data due to invalid or unsupported " \ | 683 "Unable to deserialize cloned data due to invalid or unsupported " \ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 702 }; | 704 }; |
| 703 | 705 |
| 704 | 706 |
| 705 // A message handler is a convenience interface for accessing the list | 707 // A message handler is a convenience interface for accessing the list |
| 706 // of message listeners registered in an environment | 708 // of message listeners registered in an environment |
| 707 class MessageHandler { | 709 class MessageHandler { |
| 708 public: | 710 public: |
| 709 // Returns a message object for the API to use. | 711 // Returns a message object for the API to use. |
| 710 static Handle<JSMessageObject> MakeMessageObject( | 712 static Handle<JSMessageObject> MakeMessageObject( |
| 711 Isolate* isolate, MessageTemplate::Template type, | 713 Isolate* isolate, MessageTemplate::Template type, |
| 712 MessageLocation* location, Handle<Object> argument, | 714 const MessageLocation* location, Handle<Object> argument, |
| 713 Handle<JSArray> stack_frames); | 715 Handle<JSArray> stack_frames); |
| 714 | 716 |
| 715 // Report a formatted message (needs JS allocation). | 717 // Report a formatted message (needs JS allocation). |
| 716 static void ReportMessage(Isolate* isolate, MessageLocation* loc, | 718 static void ReportMessage(Isolate* isolate, const MessageLocation* loc, |
| 717 Handle<JSMessageObject> message); | 719 Handle<JSMessageObject> message); |
| 718 | 720 |
| 719 static void DefaultMessageReport(Isolate* isolate, const MessageLocation* loc, | 721 static void DefaultMessageReport(Isolate* isolate, const MessageLocation* loc, |
| 720 Handle<Object> message_obj); | 722 Handle<Object> message_obj); |
| 721 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 723 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
| 722 static std::unique_ptr<char[]> GetLocalizedMessage(Isolate* isolate, | 724 static std::unique_ptr<char[]> GetLocalizedMessage(Isolate* isolate, |
| 723 Handle<Object> data); | 725 Handle<Object> data); |
| 726 |
| 727 private: |
| 728 static void ReportMessageNoExceptions(Isolate* isolate, |
| 729 const MessageLocation* loc, |
| 730 Handle<Object> message_obj, |
| 731 v8::Local<v8::Value> api_exception_obj); |
| 724 }; | 732 }; |
| 725 | 733 |
| 726 | 734 |
| 727 } // namespace internal | 735 } // namespace internal |
| 728 } // namespace v8 | 736 } // namespace v8 |
| 729 | 737 |
| 730 #endif // V8_MESSAGES_H_ | 738 #endif // V8_MESSAGES_H_ |
| OLD | NEW |