Revert of Migrate error messages, part 10. (patchset #2 id:20001 of https://coderevie...
authoryangguo <yangguo@chromium.org>
Tue, 12 May 2015 08:33:27 +0000 (01:33 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 12 May 2015 08:33:28 +0000 (08:33 +0000)
Reason for revert:
patch didn't apply correctly.

Original issue's description:
> Migrate error messages, part 10.
>
> R=mvstanton@chromium.org
>
> Committed: https://crrev.com/8608e619afe2b4514b0577bfb73a153b1550d41f
> Cr-Commit-Position: refs/heads/master@{#28357}

TBR=mvstanton@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1130073005

Cr-Commit-Position: refs/heads/master@{#28358}

27 files changed:
src/api-natives.cc
src/api.cc
src/builtins.cc
src/debug.cc
src/elements.cc
src/factory.cc
src/factory.h
src/hydrogen.cc
src/ic/ic.cc
src/ic/ic.h
src/isolate.cc
src/json-stringifier.h
src/json.js
src/messages.cc
src/messages.h
src/messages.js
src/objects.cc
src/objects.h
src/runtime.js
src/runtime/runtime-classes.cc
src/runtime/runtime-date.cc
src/runtime/runtime-i18n.cc
src/runtime/runtime-internal.cc
src/runtime/runtime-object.cc
src/runtime/runtime-scopes.cc
test/cctest/test-serialize.cc
test/mjsunit/messages.js

index 71a039f..c95f2ce 100644 (file)
@@ -7,7 +7,6 @@
 #include "src/api.h"
 #include "src/isolate.h"
 #include "src/lookup.h"
-#include "src/messages.h"
 
 namespace v8 {
 namespace internal {
@@ -96,9 +95,10 @@ MaybeHandle<Object> DefineDataProperty(Isolate* isolate,
     duplicate = maybe.FromJust();
   }
   if (duplicate) {
-    THROW_NEW_ERROR(
-        isolate, NewTypeError(MessageTemplate::kDuplicateTemplateProperty, key),
-        Object);
+    Handle<Object> args[1] = {key};
+    THROW_NEW_ERROR(isolate, NewTypeError("duplicate_template_property",
+                                          HandleVector(args, 1)),
+                    Object);
   }
 #endif
 
index c147632..200dc5f 100644 (file)
@@ -4400,7 +4400,7 @@ Handle<Value> Function::GetDisplayName() const {
   i::Handle<i::String> property_name =
       isolate->factory()->NewStringFromStaticChars("displayName");
   i::Handle<i::Object> value =
-      i::JSReceiver::GetDataProperty(func, property_name);
+      i::JSObject::GetDataProperty(func, property_name);
   if (value->IsString()) {
     i::Handle<i::String> name = i::Handle<i::String>::cast(value);
     if (name->length() > 0) return Utils::ToLocal(name);
@@ -6239,7 +6239,7 @@ bool Promise::HasHandler() {
   LOG_API(isolate, "Promise::HasRejectHandler");
   ENTER_V8(isolate);
   i::Handle<i::Symbol> key = isolate->factory()->promise_has_handler_symbol();
-  return i::JSReceiver::GetDataProperty(promise, key)->IsTrue();
+  return i::JSObject::GetDataProperty(promise, key)->IsTrue();
 }
 
 
index 66d942c..5b1eeed 100644 (file)
@@ -16,7 +16,6 @@
 #include "src/heap-profiler.h"
 #include "src/ic/handler-compiler.h"
 #include "src/ic/ic.h"
-#include "src/messages.h"
 #include "src/prototype.h"
 #include "src/vm-state-inl.h"
 
@@ -1027,15 +1026,17 @@ BUILTIN(ArrayConcat) {
 
 BUILTIN(RestrictedFunctionPropertiesThrower) {
   HandleScope scope(isolate);
-  THROW_NEW_ERROR_RETURN_FAILURE(
-      isolate, NewTypeError(MessageTemplate::kRestrictedFunctionProperties));
+  THROW_NEW_ERROR_RETURN_FAILURE(isolate,
+                                 NewTypeError("restricted_function_properties",
+                                              HandleVector<Object>(NULL, 0)));
 }
 
 
 BUILTIN(RestrictedStrictArgumentsPropertiesThrower) {
   HandleScope scope(isolate);
   THROW_NEW_ERROR_RETURN_FAILURE(
-      isolate, NewTypeError(MessageTemplate::kStrictPoisonPill));
+      isolate,
+      NewTypeError("strict_poison_pill", HandleVector<Object>(NULL, 0)));
 }
 
 
@@ -1079,8 +1080,9 @@ MUST_USE_RESULT static MaybeHandle<Object> HandleApiCallHelper(
 
   if (raw_holder->IsNull()) {
     // This function cannot be called with the given receiver.  Abort!
-    THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIllegalInvocation),
-                    Object);
+    THROW_NEW_ERROR(
+        isolate, NewTypeError("illegal_invocation", HandleVector(&function, 1)),
+        Object);
   }
 
   Object* raw_call_data = fun_data->call_code();
index 82fab36..5c396cb 100644 (file)
@@ -2507,7 +2507,7 @@ void Debug::OnPromiseReject(Handle<JSObject> promise, Handle<Object> value) {
   HandleScope scope(isolate_);
   // Check whether the promise has been marked as having triggered a message.
   Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol();
-  if (JSReceiver::GetDataProperty(promise, key)->IsUndefined()) {
+  if (JSObject::GetDataProperty(promise, key)->IsUndefined()) {
     OnException(value, promise);
   }
 }
@@ -2516,9 +2516,9 @@ void Debug::OnPromiseReject(Handle<JSObject> promise, Handle<Object> value) {
 MaybeHandle<Object> Debug::PromiseHasUserDefinedRejectHandler(
     Handle<JSObject> promise) {
   Handle<JSFunction> fun = Handle<JSFunction>::cast(
-      JSReceiver::GetDataProperty(isolate_->js_builtins_object(),
-                                  isolate_->factory()->NewStringFromStaticChars(
-                                      "$promiseHasUserDefinedRejectHandler")));
+      JSObject::GetDataProperty(isolate_->js_builtins_object(),
+                                isolate_->factory()->NewStringFromStaticChars(
+                                    "$promiseHasUserDefinedRejectHandler")));
   return Execution::Call(isolate_, fun, promise, 0, NULL);
 }
 
index 7f9691b..ce32cb2 100644 (file)
@@ -1409,10 +1409,10 @@ class DictionaryElementsAccessor
         if (is_strict(language_mode)) {
           // Deleting a non-configurable property in strict mode.
           Handle<Object> name = isolate->factory()->NewNumberFromUint(key);
-          THROW_NEW_ERROR(
-              isolate,
-              NewTypeError(MessageTemplate::kStrictDeleteProperty, name, obj),
-              Object);
+          Handle<Object> args[2] = { name, obj };
+          THROW_NEW_ERROR(isolate, NewTypeError("strict_delete_property",
+                                                HandleVector(args, 2)),
+                          Object);
         }
         return isolate->factory()->false_value();
       }
index fca1e1c..0e66ec6 100644 (file)
@@ -1076,11 +1076,23 @@ Handle<HeapNumber> Factory::NewHeapNumber(double value,
 }
 
 
+Handle<Object> Factory::NewTypeError(const char* message,
+                                     Vector<Handle<Object> > args) {
+  return NewError("MakeTypeError", message, args);
+}
+
+
 Handle<Object> Factory::NewTypeError(Handle<String> message) {
   return NewError("$TypeError", message);
 }
 
 
+Handle<Object> Factory::NewRangeError(const char* message,
+                                      Vector<Handle<Object> > args) {
+  return NewError("MakeRangeError", message, args);
+}
+
+
 Handle<Object> Factory::NewRangeError(Handle<String> message) {
   return NewError("$RangeError", message);
 }
index 600f312..44aec28 100644 (file)
@@ -547,8 +547,12 @@ class Factory final {
   Handle<Object> NewError(Handle<String> message);
   Handle<Object> NewError(const char* constructor, Handle<String> message);
 
+  Handle<Object> NewTypeError(const char* message,
+                              Vector<Handle<Object> > args);
   Handle<Object> NewTypeError(Handle<String> message);
 
+  Handle<Object> NewRangeError(const char* message,
+                               Vector<Handle<Object> > args);
   Handle<Object> NewRangeError(Handle<String> message);
 
   Handle<Object> NewInvalidStringLengthError() {
index 3d314fb..ead064e 100644 (file)
@@ -5932,7 +5932,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField(
     if (object->IsJSObject()) {
       LookupIterator it(object, info->name(),
                         LookupIterator::OWN_SKIP_INTERCEPTOR);
-      Handle<Object> value = JSReceiver::GetDataProperty(&it);
+      Handle<Object> value = JSObject::GetDataProperty(&it);
       if (it.IsFound() && it.IsReadOnly() && !it.IsConfigurable()) {
         return New<HConstant>(value);
       }
index 628da7d..daf7704 100644 (file)
@@ -16,6 +16,7 @@
 #include "src/ic/ic-inl.h"
 #include "src/ic/ic-compiler.h"
 #include "src/ic/stub-cache.h"
+#include "src/messages.h"
 #include "src/prototype.h"
 #include "src/runtime/runtime.h"
 
@@ -361,10 +362,11 @@ void IC::UpdateState(Handle<Object> receiver, Handle<Object> name) {
 }
 
 
-MaybeHandle<Object> IC::TypeError(MessageTemplate::Template index,
-                                  Handle<Object> object, Handle<Object> key) {
+MaybeHandle<Object> IC::TypeError(const char* type, Handle<Object> object,
+                                  Handle<Object> key) {
   HandleScope scope(isolate());
-  THROW_NEW_ERROR(isolate(), NewTypeError(index, key, object), Object);
+  Handle<Object> args[2] = {key, object};
+  THROW_NEW_ERROR(isolate(), NewTypeError(type, HandleVector(args, 2)), Object);
 }
 
 
@@ -694,7 +696,7 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) {
   // If the object is undefined or null it's illegal to try to get any
   // of its properties; throw a TypeError in that case.
   if (object->IsUndefined() || object->IsNull()) {
-    return TypeError(MessageTemplate::kNonObjectPropertyLoad, object, name);
+    return TypeError("non_object_property_load", object, name);
   }
 
   // Check if the name is trivially convertible to an index and get
@@ -1556,7 +1558,7 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name,
       Handle<Context> script_context = ScriptContextTable::GetContext(
           script_contexts, lookup_result.context_index);
       if (lookup_result.mode == CONST) {
-        return TypeError(MessageTemplate::kConstAssign, object, name);
+        return TypeError("const_assign", object, name);
       }
 
       Handle<Object> previous_value =
@@ -1592,7 +1594,7 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name,
   // If the object is undefined or null it's illegal to try to set any
   // properties on it; throw a TypeError in that case.
   if (object->IsUndefined() || object->IsNull()) {
-    return TypeError(MessageTemplate::kNonObjectPropertyStore, object, name);
+    return TypeError("non_object_property_store", object, name);
   }
 
   // Check if the given name is an array index.
index 6f2a36b..d51309c 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "src/ic/ic-state.h"
 #include "src/macro-assembler.h"
-#include "src/messages.h"
 
 namespace v8 {
 namespace internal {
@@ -163,8 +162,8 @@ class IC {
   void TraceIC(const char* type, Handle<Object> name, State old_state,
                State new_state);
 
-  MaybeHandle<Object> TypeError(MessageTemplate::Template,
-                                Handle<Object> object, Handle<Object> key);
+  MaybeHandle<Object> TypeError(const char* type, Handle<Object> object,
+                                Handle<Object> key);
   MaybeHandle<Object> ReferenceError(Handle<Name> name);
 
   // Access the target code for the given IC address.
index f958da5..69a4f8d 100644 (file)
@@ -341,8 +341,9 @@ Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
   Handle<String> stackTraceLimit =
       factory()->InternalizeUtf8String("stackTraceLimit");
   DCHECK(!stackTraceLimit.is_null());
-  Handle<Object> stack_trace_limit = JSReceiver::GetDataProperty(
-      Handle<JSObject>::cast(error), stackTraceLimit);
+  Handle<Object> stack_trace_limit =
+      JSObject::GetDataProperty(Handle<JSObject>::cast(error),
+                                stackTraceLimit);
   if (!stack_trace_limit->IsNumber()) return factory()->undefined_value();
   int limit = FastD2IChecked(stack_trace_limit->Number());
   limit = Max(limit, 0);  // Ensure that limit is not negative.
@@ -445,7 +446,7 @@ MaybeHandle<JSObject> Isolate::CaptureAndSetSimpleStackTrace(
 Handle<JSArray> Isolate::GetDetailedStackTrace(Handle<JSObject> error_object) {
   Handle<Name> key_detailed = factory()->detailed_stack_trace_symbol();
   Handle<Object> stack_trace =
-      JSReceiver::GetDataProperty(error_object, key_detailed);
+      JSObject::GetDataProperty(error_object, key_detailed);
   if (stack_trace->IsJSArray()) return Handle<JSArray>::cast(stack_trace);
 
   if (!capture_stack_trace_for_uncaught_exceptions_) return Handle<JSArray>();
@@ -599,7 +600,7 @@ int PositionFromStackTrace(Handle<FixedArray> elements, int index) {
 Handle<JSArray> Isolate::GetDetailedFromSimpleStackTrace(
     Handle<JSObject> error_object) {
   Handle<Name> key = factory()->stack_trace_symbol();
-  Handle<Object> property = JSReceiver::GetDataProperty(error_object, key);
+  Handle<Object> property = JSObject::GetDataProperty(error_object, key);
   if (!property->IsJSArray()) return Handle<JSArray>();
   Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property);
 
@@ -1271,19 +1272,19 @@ bool Isolate::ComputeLocationFromException(MessageLocation* target,
   if (!exception->IsJSObject()) return false;
 
   Handle<Name> start_pos_symbol = factory()->error_start_pos_symbol();
-  Handle<Object> start_pos = JSReceiver::GetDataProperty(
+  Handle<Object> start_pos = JSObject::GetDataProperty(
       Handle<JSObject>::cast(exception), start_pos_symbol);
   if (!start_pos->IsSmi()) return false;
   int start_pos_value = Handle<Smi>::cast(start_pos)->value();
 
   Handle<Name> end_pos_symbol = factory()->error_end_pos_symbol();
-  Handle<Object> end_pos = JSReceiver::GetDataProperty(
+  Handle<Object> end_pos = JSObject::GetDataProperty(
       Handle<JSObject>::cast(exception), end_pos_symbol);
   if (!end_pos->IsSmi()) return false;
   int end_pos_value = Handle<Smi>::cast(end_pos)->value();
 
   Handle<Name> script_symbol = factory()->error_script_symbol();
-  Handle<Object> script = JSReceiver::GetDataProperty(
+  Handle<Object> script = JSObject::GetDataProperty(
       Handle<JSObject>::cast(exception), script_symbol);
   if (!script->IsScript()) return false;
 
@@ -1300,7 +1301,7 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
   if (!exception->IsJSObject()) return false;
   Handle<Name> key = factory()->stack_trace_symbol();
   Handle<Object> property =
-      JSReceiver::GetDataProperty(Handle<JSObject>::cast(exception), key);
+      JSObject::GetDataProperty(Handle<JSObject>::cast(exception), key);
   if (!property->IsJSArray()) return false;
   Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property);
 
index 9579c78..efb71e5 100644 (file)
@@ -8,7 +8,6 @@
 #include "src/v8.h"
 
 #include "src/conversions.h"
-#include "src/messages.h"
 #include "src/string-builder.h"
 #include "src/utils.h"
 
@@ -273,8 +272,8 @@ BasicJsonStringifier::Result BasicJsonStringifier::StackPush(
     for (int i = 0; i < length; i++) {
       if (elements->get(i) == *object) {
         AllowHeapAllocation allow_to_return_error;
-        Handle<Object> error =
-            factory()->NewTypeError(MessageTemplate::kCircularStructure);
+        Handle<Object> error = factory()->NewTypeError(
+            "circular_structure", HandleVector<Object>(NULL, 0));
         isolate_->Throw(*error);
         return EXCEPTION;
       }
index f093e5c..f5ac6cb 100644 (file)
@@ -51,7 +51,9 @@ function JSONParse(text, reviver) {
 
 
 function SerializeArray(value, replacer, stack, indent, gap) {
-  if (!%PushIfAbsent(stack, value)) throw MakeTypeError(kCircularStructure);
+  if (!%PushIfAbsent(stack, value)) {
+    throw MakeTypeError('circular_structure', []);
+  }
   var stepback = indent;
   indent += gap;
   var partial = new InternalArray();
@@ -80,7 +82,9 @@ function SerializeArray(value, replacer, stack, indent, gap) {
 
 
 function SerializeObject(value, replacer, stack, indent, gap) {
-  if (!%PushIfAbsent(stack, value)) throw MakeTypeError(kCircularStructure);
+  if (!%PushIfAbsent(stack, value)) {
+    throw MakeTypeError('circular_structure', []);
+  }
   var stepback = indent;
   indent += gap;
   var partial = new InternalArray();
index 62bcad1..81fcdec 100644 (file)
@@ -306,8 +306,8 @@ bool CallSite::IsEval(Isolate* isolate) {
 bool CallSite::IsConstructor(Isolate* isolate) {
   if (!receiver_->IsJSObject()) return false;
   Handle<Object> constructor =
-      JSReceiver::GetDataProperty(Handle<JSObject>::cast(receiver_),
-                                  isolate->factory()->constructor_string());
+      JSObject::GetDataProperty(Handle<JSObject>::cast(receiver_),
+                                isolate->factory()->constructor_string());
   return constructor.is_identical_to(fun_);
 }
 
index d3505d0..930ea92 100644 (file)
@@ -131,10 +131,6 @@ class CallSite {
   T(CalledOnNonObject, "% called on non-object")                               \
   T(CalledOnNullOrUndefined, "% called on null or undefined")                  \
   T(CannotConvertToPrimitive, "Cannot convert object to primitive value")      \
-  T(CannotPreventExtExternalArray,                                             \
-    "Cannot prevent extension of an object with external array elements")      \
-  T(CircularStructure, "Converting circular structure to JSON")                \
-  T(ConstAssign, "Assignment to constant variable.")                           \
   T(ConstructorNonCallable,                                                    \
     "Class constructors cannot be invoked without 'new'")                      \
   T(ConstructorNotFunction, "Constructor % requires 'new'")                    \
@@ -143,18 +139,12 @@ class CallSite {
     "First argument to DataView constructor must be an ArrayBuffer")           \
   T(DateType, "this is not a Date object.")                                    \
   T(DefineDisallowed, "Cannot define property:%, object is not extensible.")   \
-  T(DuplicateTemplateProperty, "Object template has duplicate property '%'")   \
-  T(ExtendsValueGenerator,                                                     \
-    "Class extends value % may not be a generator function")                   \
-  T(ExtendsValueNotFunction,                                                   \
-    "Class extends value % is not a function or null")                         \
   T(FirstArgumentNotRegExp,                                                    \
     "First argument to % must not be a regular expression")                    \
   T(FlagsGetterNonObject,                                                      \
     "RegExp.prototype.flags getter called on non-object %")                    \
   T(FunctionBind, "Bind must be called on a function")                         \
   T(GeneratorRunning, "Generator is already running")                          \
-  T(IllegalInvocation, "Illegal invocation")                                   \
   T(IncompatibleMethodReceiver, "Method % called on incompatible receiver %")  \
   T(InstanceofFunctionExpected,                                                \
     "Expecting a function in instanceof check, but got %")                     \
@@ -170,22 +160,15 @@ class CallSite {
   T(MethodInvokedOnNullOrUndefined,                                            \
     "Method invoked on undefined or null value.")                              \
   T(MethodInvokedOnWrongType, "Method invoked on an object that is not %.")    \
-  T(NonExtensibleProto, "% is not extensible")                                 \
-  T(NonObjectPropertyLoad, "Cannot read property '%' of %")                    \
-  T(NonObjectPropertyStore, "Cannot set property '%' of %")                    \
-  T(NoSetterInCallback, "Cannot set property % of % which has only a getter")  \
   T(NotAnIterator, "% is not an iterator")                                     \
   T(NotAPromise, "% is not a promise")                                         \
   T(NotConstructor, "% is not a constructor")                                  \
-  T(NotDateObject, "this is not a Date object.")                               \
-  T(NotIntlObject, "% is not an i18n object.")                                 \
   T(NotGeneric, "% is not generic")                                            \
   T(NotIterable, "% is not iterable")                                          \
   T(NotTypedArray, "this is not a typed array.")                               \
   T(ObjectGetterExpectingFunction,                                             \
     "Object.prototype.__defineGetter__: Expecting function")                   \
   T(ObjectGetterCallable, "Getter must be a function: %")                      \
-  T(ObjectNotExtensible, "Can't add property %, object is not extensible")     \
   T(ObjectSetterExpectingFunction,                                             \
     "Object.prototype.__defineSetter__: Expecting function")                   \
   T(ObjectSetterCallable, "Setter must be a function: %")                      \
@@ -207,10 +190,6 @@ class CallSite {
   T(PropertyDescObject, "Property description must be an object: %")           \
   T(PropertyNotFunction, "Property '%' of object % is not a function")         \
   T(ProtoObjectOrNull, "Object prototype may only be an Object or null: %")    \
-  T(PrototypeParentNotAnObject,                                                \
-    "Class extends value does not have valid prototype property %")            \
-  T(ProxyHandlerDeleteFailed,                                                  \
-    "Proxy handler % did not return a boolean value from 'delete' trap")       \
   T(ProxyHandlerNonObject, "Proxy.% called with non-object as handler")        \
   T(ProxyHandlerReturned, "Proxy handler % returned % from '%' trap")          \
   T(ProxyHandlerTrapMissing, "Proxy handler % has no '%' trap")                \
@@ -225,25 +204,12 @@ class CallSite {
   T(ProxyTrapFunctionExpected,                                                 \
     "Proxy.createFunction called with non-function for '%' trap")              \
   T(RedefineDisallowed, "Cannot redefine property: %")                         \
-  T(RedefineExternalArray,                                                     \
-    "Cannot redefine a property of an object with external array elements")    \
   T(ReduceNoInitial, "Reduce of empty array with no initial value")            \
   T(ReinitializeIntl, "Trying to re-initialize % object.")                     \
   T(ResolvedOptionsCalledOnNonObject,                                          \
     "resolvedOptions method called on a non-object or on a object that is "    \
     "not Intl.%.")                                                             \
   T(ResolverNotAFunction, "Promise resolver % is not a function")              \
-  T(RestrictedFunctionProperties,                                              \
-    "'caller' and 'arguments' are restricted function properties and cannot "  \
-    "be accessed in this context.")                                            \
-  T(StaticPrototype, "Classes may not have static property named prototype")   \
-  T(StrictCannotAssign, "Cannot assign to read only '% in strict mode")        \
-  T(StrictDeleteProperty, "Cannot delete property '%' of %")                   \
-  T(StrictPoisonPill,                                                          \
-    "'caller', 'callee', and 'arguments' properties may not be accessed on "   \
-    "strict mode functions or the arguments objects for calls to them")        \
-  T(StrictReadOnlyProperty, "Cannot assign to read only property '%' of %")    \
-  T(StrongImplicitCast, "In strong mode, implicit conversions are deprecated") \
   T(SymbolToPrimitive,                                                         \
     "Cannot convert a Symbol wrapper object to a primitive value")             \
   T(SymbolToNumber, "Cannot convert a Symbol value to a number")               \
@@ -252,7 +218,6 @@ class CallSite {
   T(ValueAndAccessor,                                                          \
     "Invalid property.  A property cannot both have accessors and be "         \
     "writable or have a value, %")                                             \
-  T(VarRedeclaration, "Identifier '%' has already been declared")              \
   T(WithExpression, "% has no properties")                                     \
   T(WrongArgs, "%: Arguments list has wrong type")                             \
   /* ReferenceError */                                                         \
index 6a1600c..b9503cf 100644 (file)
@@ -70,15 +70,21 @@ var kMessages = {
   newline_after_throw:           ["Illegal newline after throw"],
   label_redeclaration:           ["Label '", "%0", "' has already been declared"],
   var_redeclaration:             ["Identifier '", "%0", "' has already been declared"],
+  duplicate_template_property:   ["Object template has duplicate property '", "%0", "'"],
   no_catch_or_finally:           ["Missing catch or finally after try"],
   unknown_label:                 ["Undefined label '", "%0", "'"],
   uncaught_exception:            ["Uncaught ", "%0"],
   undefined_method:              ["Object ", "%1", " has no method '", "%0", "'"],
+  non_object_property_load:      ["Cannot read property '", "%0", "' of ", "%1"],
   non_object_property_store:     ["Cannot set property '", "%0", "' of ", "%1"],
+  illegal_invocation:            ["Illegal invocation"],
+  no_setter_in_callback:         ["Cannot set property ", "%0", " of ", "%1", " which has only a getter"],
   value_and_accessor:            ["Invalid property.  A property cannot both have accessors and be writable or have a value, ", "%0"],
   proto_object_or_null:          ["Object prototype may only be an Object or null: ", "%0"],
+  non_extensible_proto:          ["%0", " is not extensible"],
   invalid_weakmap_key:           ["Invalid value used as weak map key"],
   invalid_weakset_value:         ["Invalid value used in weak set"],
+  not_date_object:               ["this is not a Date object."],
   not_a_symbol:                  ["%0", " is not a symbol"],
   // ReferenceError
   invalid_lhs_in_assignment:     ["Invalid left-hand side in assignment"],
@@ -94,7 +100,9 @@ var kMessages = {
   illegal_continue:              ["Illegal continue statement"],
   illegal_return:                ["Illegal return statement"],
   error_loading_debugger:        ["Error loading debugger"],
+  circular_structure:            ["Converting circular structure to JSON"],
   array_indexof_not_defined:     ["Array.getIndexOf: Argument undefined"],
+  object_not_extensible:         ["Can't add property ", "%0", ", object is not extensible"],
   illegal_access:                ["Illegal access"],
   static_prototype:              ["Classes may not have static property named prototype"],
   strict_mode_with:              ["Strict mode code may not include a with statement"],
@@ -106,11 +114,17 @@ var kMessages = {
   strict_octal_literal:          ["Octal literals are not allowed in strict mode."],
   template_octal_literal:        ["Octal literals are not allowed in template strings."],
   strict_delete:                 ["Delete of an unqualified identifier in strict mode."],
+  strict_delete_property:        ["Cannot delete property '", "%0", "' of ", "%1"],
   strict_function:               ["In strict mode code, functions can only be declared at top level or immediately within another function." ],
+  strict_read_only_property:     ["Cannot assign to read only property '", "%0", "' of ", "%1"],
+  strict_cannot_assign:          ["Cannot assign to read only '", "%0", "' in strict mode"],
+  restricted_function_properties: ["'caller' and 'arguments' are restricted function properties and cannot be accessed in this context."],
+  strict_poison_pill:            ["'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them"],
   strict_caller:                 ["Illegal access to a strict mode caller function."],
   strong_ellision:               ["In strong mode, arrays with holes are deprecated, use maps instead"],
   strong_arguments:              ["In strong mode, 'arguments' is deprecated, use '...args' instead"],
   strong_undefined:              ["In strong mode, binding or assigning to 'undefined' is deprecated"],
+  strong_implicit_cast:          ["In strong mode, implicit conversions are deprecated"],
   strong_direct_eval:            ["In strong mode, direct calls to eval are deprecated"],
   strong_switch_fallthrough :    ["In strong mode, switch fall-through is deprecated, terminate each case with 'break', 'continue', 'return' or 'throw'"],
   strong_equal:                  ["In strong mode, '==' and '!=' are deprecated, use '===' and '!==' instead"],
@@ -130,9 +144,15 @@ var kMessages = {
   strong_arity:                  ["In strong mode, calling a function with too few arguments is deprecated"],
   sloppy_lexical:                ["Block-scoped declarations (let, const, function, class) not yet supported outside strict mode"],
   malformed_arrow_function_parameter_list: ["Malformed arrow function parameter list"],
+  cant_prevent_ext_external_array_elements: ["Cannot prevent extension of an object with external array elements"],
+  redef_external_array_element:  ["Cannot redefine a property of an object with external array elements"],
+  const_assign:                  ["Assignment to constant variable."],
   module_export_undefined:       ["Export '", "%0", "' is not defined in module"],
   duplicate_export:              ["Duplicate export of '", "%0", "'"],
   unexpected_super:              ["'super' keyword unexpected here"],
+  extends_value_not_a_function:  ["Class extends value ", "%0", " is not a function or null"],
+  extends_value_generator:       ["Class extends value ", "%0", " may not be a generator function"],
+  prototype_parent_not_an_object: ["Class extends value does not have valid prototype property ", "%0"],
   duplicate_constructor:         ["A class may only have one constructor"],
   super_constructor_call:        ["A 'super' constructor call may only appear as the first statement of a function, and its arguments may not access 'this'. Other forms are not yet supported."],
   duplicate_proto:               ["Duplicate __proto__ fields are not allowed in object literals"],
index 8d984e3..9a5353f 100644 (file)
@@ -145,15 +145,15 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it) {
 }
 
 
-Handle<Object> JSReceiver::GetDataProperty(Handle<JSReceiver> object,
-                                           Handle<Name> key) {
+Handle<Object> JSObject::GetDataProperty(Handle<JSObject> object,
+                                         Handle<Name> key) {
   LookupIterator it(object, key,
                     LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
   return GetDataProperty(&it);
 }
 
 
-Handle<Object> JSReceiver::GetDataProperty(LookupIterator* it) {
+Handle<Object> JSObject::GetDataProperty(LookupIterator* it) {
   for (; it->IsFound(); it->Next()) {
     switch (it->state()) {
       case LookupIterator::INTERCEPTOR:
@@ -389,10 +389,11 @@ MaybeHandle<Object> Object::SetPropertyWithAccessor(
           receiver, Handle<JSReceiver>::cast(setter), value);
     } else {
       if (is_sloppy(language_mode)) return value;
-      THROW_NEW_ERROR(
-          isolate,
-          NewTypeError(MessageTemplate::kNoSetterInCallback, name, holder),
-          Object);
+      Handle<Object> args[] = {name, holder};
+      THROW_NEW_ERROR(isolate,
+                      NewTypeError("no_setter_in_callback",
+                                   HandleVector(args, arraysize(args))),
+                      Object);
     }
   }
 
@@ -3321,10 +3322,10 @@ MaybeHandle<Object> Object::WriteToReadOnlyProperty(
     Isolate* isolate, Handle<Object> receiver, Handle<Object> name,
     Handle<Object> value, LanguageMode language_mode) {
   if (is_sloppy(language_mode)) return value;
-  THROW_NEW_ERROR(
-      isolate,
-      NewTypeError(MessageTemplate::kStrictReadOnlyProperty, name, receiver),
-      Object);
+  Handle<Object> args[] = {name, receiver};
+  THROW_NEW_ERROR(isolate, NewTypeError("strict_read_only_property",
+                                        HandleVector(args, arraysize(args))),
+                  Object);
 }
 
 
@@ -3409,10 +3410,12 @@ MaybeHandle<Object> Object::AddDataProperty(LookupIterator* it,
   it->PrepareTransitionToDataProperty(value, attributes, store_mode);
   if (it->state() != LookupIterator::TRANSITION) {
     if (is_sloppy(language_mode)) return value;
-    THROW_NEW_ERROR(
-        it->isolate(),
-        NewTypeError(MessageTemplate::kObjectNotExtensible, it->name()),
-        Object);
+
+    Handle<Object> args[] = {it->name()};
+    THROW_NEW_ERROR(it->isolate(),
+                    NewTypeError("object_not_extensible",
+                                 HandleVector(args, arraysize(args))),
+                    Object);
   }
   it->ApplyTransitionToDataProperty();
 
@@ -3966,9 +3969,10 @@ MaybeHandle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
   }
 
   if (is_sloppy(language_mode)) return value;
-  THROW_NEW_ERROR(
-      isolate, NewTypeError(MessageTemplate::kNoSetterInCallback, name, proxy),
-      Object);
+  Handle<Object> args2[] = { name, proxy };
+  THROW_NEW_ERROR(isolate, NewTypeError("no_setter_in_callback",
+                                        HandleVector(args2, arraysize(args2))),
+                  Object);
 }
 
 
@@ -3993,10 +3997,12 @@ MaybeHandle<Object> JSProxy::DeletePropertyWithHandler(
   bool result_bool = result->BooleanValue();
   if (is_strict(language_mode) && !result_bool) {
     Handle<Object> handler(proxy->handler(), isolate);
-    THROW_NEW_ERROR(
-        isolate,
-        NewTypeError(MessageTemplate::kProxyHandlerDeleteFailed, handler),
-        Object);
+    Handle<String> trap_name = isolate->factory()->InternalizeOneByteString(
+        STATIC_CHAR_VECTOR("delete"));
+    Handle<Object> args[] = { handler, trap_name };
+    THROW_NEW_ERROR(isolate, NewTypeError("handler_failed",
+                                          HandleVector(args, arraysize(args))),
+                    Object);
   }
   return isolate->factory()->ToBoolean(result_bool);
 }
@@ -5307,10 +5313,11 @@ MaybeHandle<Object> JSObject::DeleteElement(Handle<JSObject> object,
     if (is_strict(language_mode)) {
       // Deleting a non-configurable property in strict mode.
       Handle<Object> name = factory->NewNumberFromUint(index);
-      THROW_NEW_ERROR(
-          isolate,
-          NewTypeError(MessageTemplate::kStrictDeleteProperty, name, object),
-          Object);
+      Handle<Object> args[] = {name, object};
+      THROW_NEW_ERROR(isolate,
+                      NewTypeError("strict_delete_property",
+                                   HandleVector(args, arraysize(args))),
+                      Object);
     }
     return factory->false_value();
   }
@@ -5440,9 +5447,10 @@ MaybeHandle<Object> JSObject::DeleteProperty(Handle<JSObject> object,
         if (!it.IsConfigurable()) {
           // Fail if the property is not configurable.
           if (is_strict(language_mode)) {
+            Handle<Object> args[] = {name, object};
             THROW_NEW_ERROR(it.isolate(),
-                            NewTypeError(MessageTemplate::kStrictDeleteProperty,
-                                         name, object),
+                            NewTypeError("strict_delete_property",
+                                         HandleVector(args, arraysize(args))),
                             Object);
           }
           return it.isolate()->factory()->false_value();
@@ -5663,9 +5671,10 @@ MaybeHandle<Object> JSObject::PreventExtensions(Handle<JSObject> object) {
   // It's not possible to seal objects with external array elements
   if (object->HasExternalArrayElements() ||
       object->HasFixedTypedArrayElements()) {
-    THROW_NEW_ERROR(
-        isolate, NewTypeError(MessageTemplate::kCannotPreventExtExternalArray),
-        Object);
+    THROW_NEW_ERROR(isolate,
+                    NewTypeError("cant_prevent_ext_external_array_elements",
+                                 HandleVector(&object, 1)),
+                    Object);
   }
 
   // If there are fast elements we normalize.
@@ -5771,9 +5780,10 @@ MaybeHandle<Object> JSObject::PreventExtensionsWithTransition(
   // It's not possible to seal or freeze objects with external array elements
   if (object->HasExternalArrayElements() ||
       object->HasFixedTypedArrayElements()) {
-    THROW_NEW_ERROR(
-        isolate, NewTypeError(MessageTemplate::kCannotPreventExtExternalArray),
-        Object);
+    THROW_NEW_ERROR(isolate,
+                    NewTypeError("cant_prevent_ext_external_array_elements",
+                                 HandleVector(&object, 1)),
+                    Object);
   }
 
   Handle<SeededNumberDictionary> new_element_dictionary;
@@ -10512,7 +10522,7 @@ bool JSFunction::PassesFilter(const char* raw_filter) {
 Handle<String> JSFunction::GetDebugName(Handle<JSFunction> function) {
   Isolate* isolate = function->GetIsolate();
   Handle<Object> name =
-      JSReceiver::GetDataProperty(function, isolate->factory()->name_string());
+      JSObject::GetDataProperty(function, isolate->factory()->name_string());
   if (name->IsString()) return Handle<String>::cast(name);
   return handle(function->shared()->DebugName(), isolate);
 }
@@ -12587,8 +12597,9 @@ MaybeHandle<Object> JSObject::SetPrototype(Handle<JSObject> object,
   // or [[Extensible]] must not violate the invariants defined in the preceding
   // paragraph.
   if (!object->map()->is_extensible()) {
-    THROW_NEW_ERROR(isolate,
-                    NewTypeError(MessageTemplate::kNonExtensibleProto, object),
+    Handle<Object> args[] = { object };
+    THROW_NEW_ERROR(isolate, NewTypeError("non_extensible_proto",
+                                          HandleVector(args, arraysize(args))),
                     Object);
   }
 
@@ -12618,9 +12629,11 @@ MaybeHandle<Object> JSObject::SetPrototype(Handle<JSObject> object,
           Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter));
       iter.Advance();
       if (!real_receiver->map()->is_extensible()) {
-        THROW_NEW_ERROR(
-            isolate, NewTypeError(MessageTemplate::kNonExtensibleProto, object),
-            Object);
+        Handle<Object> args[] = {object};
+        THROW_NEW_ERROR(isolate,
+                        NewTypeError("non_extensible_proto",
+                                     HandleVector(args, arraysize(args))),
+                        Object);
       }
     }
   }
@@ -12800,10 +12813,11 @@ MaybeHandle<Object> JSObject::SetElementWithCallback(
     } else {
       if (is_sloppy(language_mode)) return value;
       Handle<Object> key(isolate->factory()->NewNumberFromUint(index));
-      THROW_NEW_ERROR(
-          isolate,
-          NewTypeError(MessageTemplate::kNoSetterInCallback, key, holder),
-          Object);
+      Handle<Object> args[] = {key, holder};
+      THROW_NEW_ERROR(isolate,
+                      NewTypeError("no_setter_in_callback",
+                                   HandleVector(args, arraysize(args))),
+                      Object);
     }
   }
 
@@ -13042,9 +13056,11 @@ MaybeHandle<Object> JSObject::SetDictionaryElement(
       } else {
         Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
         Handle<String> name = isolate->factory()->NumberToString(number);
-        THROW_NEW_ERROR(
-            isolate, NewTypeError(MessageTemplate::kObjectNotExtensible, name),
-            Object);
+        Handle<Object> args[] = {name};
+        THROW_NEW_ERROR(isolate,
+                        NewTypeError("object_not_extensible",
+                                     HandleVector(args, arraysize(args))),
+                        Object);
       }
     }
 
@@ -13261,8 +13277,11 @@ MaybeHandle<Object> JSObject::SetElement(Handle<JSObject> object,
   if ((object->HasExternalArrayElements() ||
           object->HasFixedTypedArrayElements()) &&
       set_mode == DEFINE_PROPERTY) {
-    THROW_NEW_ERROR(
-        isolate, NewTypeError(MessageTemplate::kRedefineExternalArray), Object);
+    Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
+    Handle<Object> args[] = { object, number };
+    THROW_NEW_ERROR(isolate, NewTypeError("redef_external_array_element",
+                                          HandleVector(args, arraysize(args))),
+                    Object);
   }
 
   // Normalize the elements to enable attributes on the property.
@@ -13705,10 +13724,10 @@ bool JSArray::WouldChangeReadOnlyLength(Handle<JSArray> array,
 MaybeHandle<Object> JSArray::ReadOnlyLengthError(Handle<JSArray> array) {
   Isolate* isolate = array->GetIsolate();
   Handle<Name> length = isolate->factory()->length_string();
-  THROW_NEW_ERROR(
-      isolate,
-      NewTypeError(MessageTemplate::kStrictReadOnlyProperty, length, array),
-      Object);
+  Handle<Object> args[] = {length, array};
+  THROW_NEW_ERROR(isolate, NewTypeError("strict_read_only_property",
+                                        HandleVector(args, arraysize(args))),
+                  Object);
 }
 
 
index f923310..2172695 100644 (file)
@@ -1670,11 +1670,6 @@ class JSReceiver: public HeapObject {
   MUST_USE_RESULT static inline Maybe<PropertyAttributes>
       GetOwnElementAttribute(Handle<JSReceiver> object, uint32_t index);
 
-  static Handle<Object> GetDataProperty(Handle<JSReceiver> object,
-                                        Handle<Name> key);
-  static Handle<Object> GetDataProperty(LookupIterator* it);
-
-
   // Retrieves a permanent object identity hash code. The undefined value might
   // be returned in case no hash was created yet.
   inline Object* GetIdentityHash();
@@ -2171,6 +2166,10 @@ class JSObject: public JSReceiver {
       Handle<JSObject> object,
       AllocationSiteCreationContext* site_context);
 
+  static Handle<Object> GetDataProperty(Handle<JSObject> object,
+                                        Handle<Name> key);
+  static Handle<Object> GetDataProperty(LookupIterator* it);
+
   DECLARE_CAST(JSObject)
 
   // Dispatched behavior.
index 0d40064..7fab3ca 100644 (file)
@@ -236,7 +236,7 @@ ADD_STRONG = function ADD_STRONG(x) {
   if (IS_NUMBER(this) && IS_NUMBER(x)) return %NumberAdd(this, x);
   if (IS_STRING(this) && IS_STRING(x)) return %_StringAdd(this, x);
 
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -260,7 +260,7 @@ STRING_ADD_LEFT_STRONG = function STRING_ADD_LEFT_STRONG(y) {
   if (IS_STRING(y)) {
     return %_StringAdd(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -285,7 +285,7 @@ STRING_ADD_RIGHT_STRONG = function STRING_ADD_RIGHT_STRONG(y) {
   if (IS_STRING(this)) {
     return %_StringAdd(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -302,7 +302,7 @@ SUB_STRONG = function SUB_STRONG(y) {
   if (IS_NUMBER(this) && IS_NUMBER(y)) {
     return %NumberSub(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -319,7 +319,7 @@ MUL_STRONG = function MUL_STRONG(y) {
   if (IS_NUMBER(this) && IS_NUMBER(y)) {
     return %NumberMul(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -336,7 +336,7 @@ DIV_STRONG = function DIV_STRONG(y) {
   if (IS_NUMBER(this) && IS_NUMBER(y)) {
     return %NumberDiv(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -353,7 +353,7 @@ MOD_STRONG = function MOD_STRONG(y) {
   if (IS_NUMBER(this) && IS_NUMBER(y)) {
     return %NumberMod(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -375,7 +375,7 @@ BIT_OR_STRONG = function BIT_OR_STRONG(y) {
   if (IS_NUMBER(this) && IS_NUMBER(y)) {
     return %NumberOr(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -406,7 +406,7 @@ BIT_AND_STRONG = function BIT_AND_STRONG(y) {
   if (IS_NUMBER(this) && IS_NUMBER(y)) {
     return %NumberAnd(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -423,7 +423,7 @@ BIT_XOR_STRONG = function BIT_XOR_STRONG(y) {
   if (IS_NUMBER(this) && IS_NUMBER(y)) {
     return %NumberXor(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -440,7 +440,7 @@ SHL_STRONG = function SHL_STRONG(y) {
   if (IS_NUMBER(this) && IS_NUMBER(y)) {
     return %NumberShl(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -471,7 +471,7 @@ SAR_STRONG = function SAR_STRONG(y) {
   if (IS_NUMBER(this) && IS_NUMBER(y)) {
     return %NumberSar(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
@@ -488,7 +488,7 @@ SHR_STRONG = function SHR_STRONG(y) {
   if (IS_NUMBER(this) && IS_NUMBER(y)) {
     return %NumberShr(this, y);
   }
-  throw %MakeTypeError(kStrongImplicitCast);
+  throw %MakeTypeError('strong_implicit_cast');
 }
 
 
index f084fd6..3dc3a24 100644 (file)
@@ -52,7 +52,7 @@ RUNTIME_FUNCTION(Runtime_ThrowArrayNotSubclassableError) {
 
 static Object* ThrowStaticPrototypeError(Isolate* isolate) {
   THROW_NEW_ERROR_RETURN_FAILURE(
-      isolate, NewTypeError(MessageTemplate::kStaticPrototype));
+      isolate, NewTypeError("static_prototype", HandleVector<Object>(NULL, 0)));
 }
 
 
@@ -113,25 +113,28 @@ RUNTIME_FUNCTION(Runtime_DefineClass) {
       prototype_parent = isolate->factory()->null_value();
     } else if (super_class->IsSpecFunction()) {
       if (Handle<JSFunction>::cast(super_class)->shared()->is_generator()) {
+        Handle<Object> args[1] = {super_class};
         THROW_NEW_ERROR_RETURN_FAILURE(
             isolate,
-            NewTypeError(MessageTemplate::kExtendsValueGenerator, super_class));
+            NewTypeError("extends_value_generator", HandleVector(args, 1)));
       }
       ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
           isolate, prototype_parent,
           Runtime::GetObjectProperty(isolate, super_class,
                                      isolate->factory()->prototype_string()));
       if (!prototype_parent->IsNull() && !prototype_parent->IsSpecObject()) {
+        Handle<Object> args[1] = {prototype_parent};
         THROW_NEW_ERROR_RETURN_FAILURE(
-            isolate, NewTypeError(MessageTemplate::kPrototypeParentNotAnObject,
-                                  prototype_parent));
+            isolate, NewTypeError("prototype_parent_not_an_object",
+                                  HandleVector(args, 1)));
       }
       constructor_parent = super_class;
     } else {
       // TODO(arv): Should be IsConstructor.
+      Handle<Object> args[1] = {super_class};
       THROW_NEW_ERROR_RETURN_FAILURE(
           isolate,
-          NewTypeError(MessageTemplate::kExtendsValueNotFunction, super_class));
+          NewTypeError("extends_value_not_a_function", HandleVector(args, 1)));
     }
   }
 
index 7c634c2..844ca25 100644 (file)
@@ -7,7 +7,6 @@
 #include "src/arguments.h"
 #include "src/date.h"
 #include "src/dateparser-inl.h"
-#include "src/messages.h"
 #include "src/runtime/runtime-utils.h"
 
 namespace v8 {
@@ -63,8 +62,8 @@ RUNTIME_FUNCTION(Runtime_DateSetValue) {
 RUNTIME_FUNCTION(Runtime_ThrowNotDateError) {
   HandleScope scope(isolate);
   DCHECK(args.length() == 0);
-  THROW_NEW_ERROR_RETURN_FAILURE(isolate,
-                                 NewTypeError(MessageTemplate::kNotDateObject));
+  THROW_NEW_ERROR_RETURN_FAILURE(
+      isolate, NewTypeError("not_date_object", HandleVector<Object>(NULL, 0)));
 }
 
 
@@ -180,7 +179,8 @@ RUNTIME_FUNCTION(Runtime_DateField) {
   if (!obj->IsJSDate()) {
     HandleScope scope(isolate);
     THROW_NEW_ERROR_RETURN_FAILURE(
-        isolate, NewTypeError(MessageTemplate::kNotDateObject));
+        isolate,
+        NewTypeError("not_date_object", HandleVector<Object>(NULL, 0)));
   }
   JSDate* date = JSDate::cast(obj);
   if (index == 0) return date->value();
index c39dbe3..5e01651 100644 (file)
@@ -9,7 +9,6 @@
 #include "src/api-natives.h"
 #include "src/arguments.h"
 #include "src/i18n.h"
-#include "src/messages.h"
 #include "src/runtime/runtime-utils.h"
 
 #include "unicode/brkiter.h"
@@ -235,7 +234,7 @@ RUNTIME_FUNCTION(Runtime_IsInitializedIntlObject) {
   Handle<JSObject> obj = Handle<JSObject>::cast(input);
 
   Handle<Symbol> marker = isolate->factory()->intl_initialized_marker_symbol();
-  Handle<Object> tag = JSReceiver::GetDataProperty(obj, marker);
+  Handle<Object> tag = JSObject::GetDataProperty(obj, marker);
   return isolate->heap()->ToBoolean(!tag->IsUndefined());
 }
 
@@ -252,7 +251,7 @@ RUNTIME_FUNCTION(Runtime_IsInitializedIntlObjectOfType) {
   Handle<JSObject> obj = Handle<JSObject>::cast(input);
 
   Handle<Symbol> marker = isolate->factory()->intl_initialized_marker_symbol();
-  Handle<Object> tag = JSReceiver::GetDataProperty(obj, marker);
+  Handle<Object> tag = JSObject::GetDataProperty(obj, marker);
   return isolate->heap()->ToBoolean(tag->IsString() &&
                                     String::cast(*tag)->Equals(*expected_type));
 }
@@ -282,21 +281,23 @@ RUNTIME_FUNCTION(Runtime_GetImplFromInitializedIntlObject) {
 
   DCHECK(args.length() == 1);
 
-  CONVERT_ARG_HANDLE_CHECKED(JSObject, input, 0);
+  CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
 
   if (!input->IsJSObject()) {
-    THROW_NEW_ERROR_RETURN_FAILURE(
-        isolate, NewTypeError(MessageTemplate::kNotIntlObject, input));
+    Vector<Handle<Object> > arguments = HandleVector(&input, 1);
+    THROW_NEW_ERROR_RETURN_FAILURE(isolate,
+                                   NewTypeError("not_intl_object", arguments));
   }
 
   Handle<JSObject> obj = Handle<JSObject>::cast(input);
 
   Handle<Symbol> marker = isolate->factory()->intl_impl_object_symbol();
 
-  Handle<Object> impl = JSReceiver::GetDataProperty(obj, marker);
+  Handle<Object> impl = JSObject::GetDataProperty(obj, marker);
   if (impl->IsTheHole()) {
-    THROW_NEW_ERROR_RETURN_FAILURE(
-        isolate, NewTypeError(MessageTemplate::kNotIntlObject, obj));
+    Vector<Handle<Object> > arguments = HandleVector(&obj, 1);
+    THROW_NEW_ERROR_RETURN_FAILURE(isolate,
+                                   NewTypeError("not_intl_object", arguments));
   }
   return *impl;
 }
index c7ce16e..b10350d 100644 (file)
@@ -79,7 +79,7 @@ RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) {
   if (debug_event) isolate->debug()->OnPromiseReject(promise, value);
   Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol();
   // Do not report if we actually have a handler.
-  if (JSReceiver::GetDataProperty(promise, key)->IsUndefined()) {
+  if (JSObject::GetDataProperty(promise, key)->IsUndefined()) {
     isolate->ReportPromiseReject(promise, value,
                                  v8::kPromiseRejectWithNoHandler);
   }
@@ -93,7 +93,7 @@ RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) {
   CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
   Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol();
   // At this point, no revocation has been issued before
-  RUNTIME_ASSERT(JSReceiver::GetDataProperty(promise, key)->IsUndefined());
+  RUNTIME_ASSERT(JSObject::GetDataProperty(promise, key)->IsUndefined());
   isolate->ReportPromiseReject(promise, Handle<Object>(),
                                v8::kPromiseHandlerAddedAfterReject);
   return isolate->heap()->undefined_value();
index ca35c10..79950c6 100644 (file)
@@ -70,10 +70,10 @@ MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate,
                                                Handle<Object> object,
                                                Handle<Object> key) {
   if (object->IsUndefined() || object->IsNull()) {
-    THROW_NEW_ERROR(
-        isolate,
-        NewTypeError(MessageTemplate::kNonObjectPropertyLoad, key, object),
-        Object);
+    Handle<Object> args[2] = {key, object};
+    THROW_NEW_ERROR(isolate, NewTypeError("non_object_property_load",
+                                          HandleVector(args, 2)),
+                    Object);
   }
 
   // Check if the given key is an array index.
@@ -102,10 +102,10 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
                                                Handle<Object> value,
                                                LanguageMode language_mode) {
   if (object->IsUndefined() || object->IsNull()) {
-    THROW_NEW_ERROR(
-        isolate,
-        NewTypeError(MessageTemplate::kNonObjectPropertyStore, key, object),
-        Object);
+    Handle<Object> args[2] = {key, object};
+    THROW_NEW_ERROR(isolate, NewTypeError("non_object_property_store",
+                                          HandleVector(args, 2)),
+                    Object);
   }
 
   if (object->IsJSProxy()) {
@@ -1419,9 +1419,9 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyUnchecked) {
 RUNTIME_FUNCTION(Runtime_GetDataProperty) {
   HandleScope scope(isolate);
   DCHECK(args.length() == 2);
-  CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
+  CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
   CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
-  return *JSReceiver::GetDataProperty(object, key);
+  return *JSObject::GetDataProperty(object, key);
 }
 
 
index b5c46bf..911958d 100644 (file)
@@ -17,15 +17,17 @@ namespace internal {
 
 static Object* ThrowRedeclarationError(Isolate* isolate, Handle<String> name) {
   HandleScope scope(isolate);
+  Handle<Object> args[1] = {name};
   THROW_NEW_ERROR_RETURN_FAILURE(
-      isolate, NewTypeError(MessageTemplate::kVarRedeclaration, name));
+      isolate, NewTypeError("var_redeclaration", HandleVector(args, 1)));
 }
 
 
 RUNTIME_FUNCTION(Runtime_ThrowConstAssignError) {
   HandleScope scope(isolate);
-  THROW_NEW_ERROR_RETURN_FAILURE(isolate,
-                                 NewTypeError(MessageTemplate::kConstAssign));
+  THROW_NEW_ERROR_RETURN_FAILURE(
+      isolate,
+      NewTypeError("const_assign", HandleVector<Object>(NULL, 0)));
 }
 
 
@@ -1017,7 +1019,8 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot) {
     } else if (is_strict(language_mode)) {
       // Setting read only property in strict mode.
       THROW_NEW_ERROR_RETURN_FAILURE(
-          isolate, NewTypeError(MessageTemplate::kStrictCannotAssign, name));
+          isolate,
+          NewTypeError("strict_cannot_assign", HandleVector(&name, 1)));
     }
     return *value;
   }
@@ -1108,7 +1111,8 @@ RUNTIME_FUNCTION(Runtime_GetArgumentsProperty) {
     JSFunction* function = frame->function();
     if (is_strict(function->shared()->language_mode())) {
       THROW_NEW_ERROR_RETURN_FAILURE(
-          isolate, NewTypeError(MessageTemplate::kStrictPoisonPill));
+          isolate, NewTypeError("strict_arguments_callee",
+                                HandleVector<Object>(NULL, 0)));
     }
     return function;
   }
index 7ec5e05..72eb194 100644 (file)
@@ -634,7 +634,7 @@ UNINITIALIZED_DEPENDENT_TEST(CustomContextDeserialization,
       CHECK(context->global_proxy() == *global_proxy);
       Handle<String> o = isolate->factory()->NewStringFromAsciiChecked("o");
       Handle<JSObject> global_object(context->global_object(), isolate);
-      Handle<Object> property = JSReceiver::GetDataProperty(global_object, o);
+      Handle<Object> property = JSObject::GetDataProperty(global_object, o);
       CHECK(property.is_identical_to(global_proxy));
 
       v8::Handle<v8::Context> v8_context = v8::Utils::ToLocal(context);
@@ -1009,11 +1009,11 @@ TEST(SerializeToplevelLargeStrings) {
       Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked();
 
   CHECK_EQ(6 * 1999999, Handle<String>::cast(copy_result)->length());
-  Handle<Object> property = JSReceiver::GetDataProperty(
+  Handle<Object> property = JSObject::GetDataProperty(
       isolate->global_object(), f->NewStringFromAsciiChecked("s"));
   CHECK(isolate->heap()->InSpace(HeapObject::cast(*property), LO_SPACE));
-  property = JSReceiver::GetDataProperty(isolate->global_object(),
-                                         f->NewStringFromAsciiChecked("t"));
+  property = JSObject::GetDataProperty(isolate->global_object(),
+                                       f->NewStringFromAsciiChecked("t"));
   CHECK(isolate->heap()->InSpace(HeapObject::cast(*property), LO_SPACE));
   // Make sure we do not serialize too much, e.g. include the source string.
   CHECK_LT(cache->length(), 13000000);
index 56470b1..73cc15a 100644 (file)
@@ -3,7 +3,7 @@
 // found in the LICENSE file.
 
 // Flags: --stack-size=100 --harmony --harmony-reflect --harmony-arrays
-// Flags: --harmony-regexps --strong-mode
+// Flags: --harmony-regexps
 
 function test(f, expected, type) {
   try {
@@ -62,30 +62,11 @@ test(function() {
   Array.prototype.shift.call(null);
 }, "Array.prototype.shift called on null or undefined", TypeError);
 
-// kCannotPreventExtExternalArray
-test(function() {
-  Object.preventExtensions(new Uint16Array(1));
-}, "Cannot prevent extension of an object with external array elements", TypeError);
-
-// kConstAssign
-test(function() {
-  "use strict";
-  const a = 1;
-  a = 2;
-}, "Assignment to constant variable.", TypeError);
-
 // kCannotConvertToPrimitive
 test(function() {
   [].join(Object(Symbol(1)));
 }, "Cannot convert object to primitive value", TypeError);
 
-// kCircularStructure
-test(function() {
-  var o = {};
-  o.o = o;
-  JSON.stringify(o);
-}, "Converting circular structure to JSON", TypeError);
-
 // kConstructorNotFunction
 test(function() {
   Uint16Array(1);
@@ -179,11 +160,6 @@ test(function() {
   new Symbol();
 }, "Symbol is not a constructor", TypeError);
 
-// kNotDateObject
-test(function() {
-  Date.prototype.setHours.call(1);
-}, "this is not a Date object.", TypeError);
-
 // kNotGeneric
 test(function() {
   String.prototype.toString.call(1);
@@ -228,14 +204,6 @@ test(function() {
   Object.defineProperty({}, "x", { get: 1 });
 }, "Getter must be a function: 1", TypeError);
 
-// kObjectNotExtensible
-test(function() {
-  "use strict";
-  var o = {};
-  Object.freeze(o);
-  o.a = 1;
-}, "Can't add property a, object is not extensible", TypeError);
-
 // kObjectSetterExpectingFunction
 test(function() {
   ({}).__defineSetter__("x", 0);
@@ -280,34 +248,6 @@ test(function() {
   new Promise(1);
 }, "Promise resolver 1 is not a function", TypeError);
 
-// kStrictDeleteProperty
-test(function() {
-  "use strict";
-  var o = {};
-  Object.defineProperty(o, "p", { value: 1, writable: false });
-  delete o.p;
-}, "Cannot delete property 'p' of #<Object>", TypeError);
-
-// kStrictPoisonPill
-test(function() {
-  "use strict";
-  arguments.callee;
-}, "'caller', 'callee', and 'arguments' properties may not be accessed on " +
-   "strict mode functions or the arguments objects for calls to them",
-   TypeError);
-
-// kStrictReadOnlyProperty
-test(function() {
-  "use strict";
-  (1).a = 1;
-}, "Cannot assign to read only property 'a' of 1", TypeError);
-
-// kStrongImplicitCast
-test(function() {
-  "use strong";
-  "a" + 1;
-}, "In strong mode, implicit conversions are deprecated", TypeError);
-
 // kSymbolToPrimitive
 test(function() {
   1 + Object(Symbol());