Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Unified Diff: src/objects.cc

Issue 1130073005: Revert of Migrate error messages, part 10. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/runtime.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 431e46e5f3271852b47146c843b61986419e4cde..c982dd29614ac1eb06495a93e93591c04cc35933 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -145,15 +145,15 @@
}
-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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
// 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 @@
// 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 @@
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);
}
@@ -12586,8 +12596,9 @@
// 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);
}
@@ -12617,9 +12628,11 @@
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);
}
}
}
@@ -12799,10 +12812,11 @@
} 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);
}
}
@@ -13041,9 +13055,11 @@
} 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);
}
}
@@ -13260,8 +13276,11 @@
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.
@@ -13704,10 +13723,10 @@
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);
}
« no previous file with comments | « src/objects.h ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698