diff options
Diffstat (limited to 'deps/v8/src/messages.h')
-rw-r--r-- | deps/v8/src/messages.h | 88 |
1 files changed, 57 insertions, 31 deletions
diff --git a/deps/v8/src/messages.h b/deps/v8/src/messages.h index 5c3e867933..779e60e57f 100644 --- a/deps/v8/src/messages.h +++ b/deps/v8/src/messages.h @@ -10,33 +10,15 @@ #ifndef V8_MESSAGES_H_ #define V8_MESSAGES_H_ -// Forward declaration of MessageLocation. -namespace v8 { -namespace internal { -class MessageLocation; -} } // namespace v8::internal - - -class V8Message { - public: - V8Message(char* type, - v8::internal::Handle<v8::internal::JSArray> args, - const v8::internal::MessageLocation* loc) : - type_(type), args_(args), loc_(loc) { } - char* type() const { return type_; } - v8::internal::Handle<v8::internal::JSArray> args() const { return args_; } - const v8::internal::MessageLocation* loc() const { return loc_; } - private: - char* type_; - v8::internal::Handle<v8::internal::JSArray> const args_; - const v8::internal::MessageLocation* loc_; -}; - +#include "src/base/smart-pointers.h" +#include "src/list.h" namespace v8 { namespace internal { -struct Language; +// Forward declarations. +class JSMessageObject; +class LookupIterator; class SourceInfo; class MessageLocation { @@ -91,6 +73,7 @@ class CallSite { /* Error */ \ T(None, "") \ T(CyclicProto, "Cyclic __proto__ value") \ + T(Debugger, "Debugger: %") \ T(DebuggerLoading, "Error loading debugger") \ T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \ T(UncaughtException, "Uncaught %") \ @@ -119,6 +102,8 @@ class CallSite { T(DataViewNotArrayBuffer, \ "First argument to DataView constructor must be an ArrayBuffer") \ T(DateType, "this is not a Date object.") \ + T(DebuggerFrame, "Debugger: Invalid frame index.") \ + T(DebuggerType, "Debugger: Parameters have wrong types.") \ T(DefineDisallowed, "Cannot define property:%, object is not extensible.") \ T(DuplicateTemplateProperty, "Object template has duplicate property '%'") \ T(ExtendsValueGenerator, \ @@ -163,6 +148,7 @@ class CallSite { T(NotTypedArray, "this is not a typed array.") \ T(NotSharedTypedArray, "% is not a shared typed array.") \ T(NotIntegerSharedTypedArray, "% is not an integer shared typed array.") \ + T(NotInt32SharedTypedArray, "% is not an int32 shared typed array.") \ T(ObjectGetterExpectingFunction, \ "Object.prototype.__defineGetter__: Expecting function") \ T(ObjectGetterCallable, "Getter must be a function: %") \ @@ -231,6 +217,7 @@ class CallSite { "In strong mode, calling a function with too few arguments is deprecated") \ T(StrongDeleteProperty, \ "Deleting property '%' of strong object '%' is deprecated") \ + T(StrongExtendNull, "In strong mode, classes extending null are deprecated") \ T(StrongImplicitConversion, \ "In strong mode, implicit conversions are deprecated") \ T(StrongRedefineDisallowed, \ @@ -239,10 +226,9 @@ class CallSite { T(StrongSetProto, \ "On strong object %, redefining the internal prototype is deprecated") \ T(SymbolKeyFor, "% is not a symbol") \ - T(SymbolToPrimitive, \ - "Cannot convert a Symbol wrapper object to a primitive value") \ T(SymbolToNumber, "Cannot convert a Symbol value to a number") \ T(SymbolToString, "Cannot convert a Symbol value to a string") \ + T(SimdToNumber, "Cannot convert a SIMD value to a number") \ T(UndefinedOrNullToObject, "Cannot convert undefined or null to object") \ T(ValueAndAccessor, \ "Invalid property. A property cannot both have accessors and be " \ @@ -297,8 +283,6 @@ class CallSite { T(ConstructorIsGenerator, "Class constructor may not be a generator") \ T(DerivedConstructorReturn, \ "Derived constructors may only return object or undefined") \ - T(DuplicateArrawFunFormalParam, \ - "Arrow function may not have duplicate parameter names") \ T(DuplicateConstructor, "A class may only have one constructor") \ T(DuplicateExport, "Duplicate export of '%'") \ T(DuplicateProto, \ @@ -335,6 +319,7 @@ class CallSite { T(ParamAfterRest, "Rest parameter must be last formal parameter") \ T(BadSetterRestParameter, \ "Setter function argument must not be a rest parameter") \ + T(ParamDupe, "Duplicate parameter name not allowed in this context") \ T(ParenthesisInArgString, "Function arg string contains parenthesis") \ T(SingleFunctionLiteral, "Single function literal required") \ T(SloppyLexical, \ @@ -346,8 +331,6 @@ class CallSite { "In strict mode code, functions can only be declared at top level or " \ "immediately within another function.") \ T(StrictOctalLiteral, "Octal literals are not allowed in strict mode.") \ - T(StrictParamDupe, \ - "Strict mode function may not have duplicate parameter names") \ T(StrictWith, "Strict mode code may not include a with statement") \ T(StrongArguments, \ "In strong mode, 'arguments' is deprecated, use '...args' instead") \ @@ -411,6 +394,7 @@ class CallSite { T(UnexpectedTokenIdentifier, "Unexpected identifier") \ T(UnexpectedTokenNumber, "Unexpected number") \ T(UnexpectedTokenString, "Unexpected string") \ + T(UnexpectedTokenRegExp, "Unexpected regular expression") \ T(UnknownLabel, "Undefined label '%'") \ T(UnterminatedArgList, "missing ) after argument list") \ T(UnterminatedRegExp, "Invalid regular expression: missing /") \ @@ -430,6 +414,8 @@ class MessageTemplate { kLastMessage }; + static const char* TemplateString(int template_index); + static MaybeHandle<String> FormatMessage(int template_index, Handle<String> arg0, Handle<String> arg1, @@ -456,8 +442,48 @@ class MessageHandler { static void DefaultMessageReport(Isolate* isolate, const MessageLocation* loc, Handle<Object> message_obj); static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); - static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, - Handle<Object> data); + static base::SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, + Handle<Object> data); +}; + + +class ErrorToStringHelper { + public: + ErrorToStringHelper() : visited_(0) {} + + MUST_USE_RESULT MaybeHandle<String> Stringify(Isolate* isolate, + Handle<JSObject> error); + + private: + class VisitedScope { + public: + VisitedScope(ErrorToStringHelper* helper, Handle<JSObject> error) + : helper_(helper), has_visited_(false) { + for (const Handle<JSObject>& visited : helper->visited_) { + if (visited.is_identical_to(error)) { + has_visited_ = true; + break; + } + } + helper->visited_.Add(error); + } + ~VisitedScope() { helper_->visited_.RemoveLast(); } + bool has_visited() { return has_visited_; } + + private: + ErrorToStringHelper* helper_; + bool has_visited_; + }; + + static bool ShadowsInternalError(Isolate* isolate, + LookupIterator* property_lookup, + LookupIterator* internal_error_lookup); + + static MUST_USE_RESULT MaybeHandle<String> GetStringifiedProperty( + Isolate* isolate, LookupIterator* property_lookup, + Handle<String> default_value); + + List<Handle<JSObject> > visited_; }; } } // namespace v8::internal |