Skip to content

Commit

Permalink
Revert of Migrate error messages, part 2. (patchset #1 id:1 of https:…
Browse files Browse the repository at this point in the history
…//codereview.chromium.org/1086313003/)

Reason for revert:
[Sheriff]: This changes layout test expectations e.g.
http://build.chromium.org/p/client.v8/builders/V8-Blink%20Win/builds/2964

Original issue's description:
> Migrate error messages, part 2.
>
> Motivation for this is reducing the size of the native context.
>
> Committed: https://crrev.com/d3b788df0a4ccfedbe6e1df5e214cb6ba2792a65
> Cr-Commit-Position: refs/heads/master@{#27878}

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

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

Cr-Commit-Position: refs/heads/master@{#27889}
  • Loading branch information
mi-ac authored and Commit bot committed Apr 16, 2015
1 parent 2dc0f2e commit d881baa
Show file tree
Hide file tree
Showing 23 changed files with 212 additions and 250 deletions.
4 changes: 2 additions & 2 deletions src/array-iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ function ArrayIteratorNext() {
var iterator = ToObject(this);

if (!HAS_DEFINED_PRIVATE(iterator, arrayIteratorNextIndexSymbol)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Array Iterator.prototype.next', this);
throw MakeTypeError('incompatible_method_receiver',
['Array Iterator.prototype.next']);
}

var array = GET_PRIVATE(iterator, arrayIteratorObjectSymbol);
Expand Down
24 changes: 17 additions & 7 deletions src/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,9 @@ function ArrayFilter(f, receiver) {
var array = ToObject(this);
var length = ToUint32(array.length);

if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
if (!IS_SPEC_FUNCTION(f)) {
throw MakeTypeError('called_non_callable', [ f ]);
}
var needs_wrapper = false;
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
Expand Down Expand Up @@ -1179,7 +1181,9 @@ function ArrayForEach(f, receiver) {
var array = ToObject(this);
var length = TO_UINT32(array.length);

if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
if (!IS_SPEC_FUNCTION(f)) {
throw MakeTypeError('called_non_callable', [ f ]);
}
var needs_wrapper = false;
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
Expand Down Expand Up @@ -1211,7 +1215,9 @@ function ArraySome(f, receiver) {
var array = ToObject(this);
var length = TO_UINT32(array.length);

if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
if (!IS_SPEC_FUNCTION(f)) {
throw MakeTypeError('called_non_callable', [ f ]);
}
var needs_wrapper = false;
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
Expand Down Expand Up @@ -1242,7 +1248,9 @@ function ArrayEvery(f, receiver) {
var array = ToObject(this);
var length = TO_UINT32(array.length);

if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
if (!IS_SPEC_FUNCTION(f)) {
throw MakeTypeError('called_non_callable', [ f ]);
}
var needs_wrapper = false;
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
Expand Down Expand Up @@ -1272,7 +1280,9 @@ function ArrayMap(f, receiver) {
var array = ToObject(this);
var length = TO_UINT32(array.length);

if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
if (!IS_SPEC_FUNCTION(f)) {
throw MakeTypeError('called_non_callable', [ f ]);
}
var needs_wrapper = false;
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
Expand Down Expand Up @@ -1417,7 +1427,7 @@ function ArrayReduce(callback, current) {
var length = ToUint32(array.length);

if (!IS_SPEC_FUNCTION(callback)) {
throw MakeTypeError(kCalledNonCallable, callback);
throw MakeTypeError('called_non_callable', [callback]);
}

var is_array = IS_ARRAY(array);
Expand Down Expand Up @@ -1454,7 +1464,7 @@ function ArrayReduceRight(callback, current) {
var length = ToUint32(array.length);

if (!IS_SPEC_FUNCTION(callback)) {
throw MakeTypeError(kCalledNonCallable, callback);
throw MakeTypeError('called_non_callable', [callback]);
}

var is_array = IS_ARRAY(array);
Expand Down
8 changes: 4 additions & 4 deletions src/arraybuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ function ArrayBufferConstructor(length) { // length = 1

function ArrayBufferGetByteLen() {
if (!IS_ARRAYBUFFER(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'ArrayBuffer.prototype.byteLength', this);
throw MakeTypeError('incompatible_method_receiver',
['ArrayBuffer.prototype.byteLength', this]);
}
return %_ArrayBufferGetByteLength(this);
}

// ES6 Draft 15.13.5.5.3
function ArrayBufferSlice(start, end) {
if (!IS_ARRAYBUFFER(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'ArrayBuffer.prototype.slice', this);
throw MakeTypeError('incompatible_method_receiver',
['ArrayBuffer.prototype.slice', this]);
}

var relativeStart = TO_INTEGER(start);
Expand Down
28 changes: 14 additions & 14 deletions src/collection-iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function SetIteratorConstructor(set, kind) {

function SetIteratorNextJS() {
if (!IS_SET_ITERATOR(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Set Iterator.prototype.next', this);
throw MakeTypeError('incompatible_method_receiver',
['Set Iterator.prototype.next', this]);
}

var value_array = [UNDEFINED, UNDEFINED];
Expand Down Expand Up @@ -56,17 +56,17 @@ function SetIteratorSymbolIterator() {

function SetEntries() {
if (!IS_SET(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Set.prototype.entries', this);
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.entries', this]);
}
return new SetIterator(this, ITERATOR_KIND_ENTRIES);
}


function SetValues() {
if (!IS_SET(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Set.prototype.values', this);
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.values', this]);
}
return new SetIterator(this, ITERATOR_KIND_VALUES);
}
Expand Down Expand Up @@ -111,8 +111,8 @@ function MapIteratorSymbolIterator() {

function MapIteratorNextJS() {
if (!IS_MAP_ITERATOR(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map Iterator.prototype.next', this);
throw MakeTypeError('incompatible_method_receiver',
['Map Iterator.prototype.next', this]);
}

var value_array = [UNDEFINED, UNDEFINED];
Expand All @@ -137,26 +137,26 @@ function MapIteratorNextJS() {

function MapEntries() {
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.entries', this);
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.entries', this]);
}
return new MapIterator(this, ITERATOR_KIND_ENTRIES);
}


function MapKeys() {
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.keys', this);
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.keys', this]);
}
return new MapIterator(this, ITERATOR_KIND_KEYS);
}


function MapValues() {
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.values', this);
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.values', this]);
}
return new MapIterator(this, ITERATOR_KIND_VALUES);
}
Expand Down
62 changes: 34 additions & 28 deletions src/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function SetConstructor(iterable) {
if (!IS_NULL_OR_UNDEFINED(iterable)) {
var adder = this.add;
if (!IS_SPEC_FUNCTION(adder)) {
throw MakeTypeError(kPropertyNotFunction, 'add', this);
throw MakeTypeError(kPropertyNotFunction, ['add', this]);
}

for (var value of iterable) {
Expand All @@ -111,7 +111,8 @@ function SetConstructor(iterable) {

function SetAdd(key) {
if (!IS_SET(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver, 'Set.prototype.add', this);
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.add', this]);
}
// Normalize -0 to +0 as required by the spec.
// Even though we use SameValueZero as the comparison for the keys we don't
Expand Down Expand Up @@ -151,7 +152,8 @@ function SetAdd(key) {

function SetHas(key) {
if (!IS_SET(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver, 'Set.prototype.has', this);
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.has', this]);
}
var table = %_JSCollectionGetTable(this);
var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table);
Expand All @@ -162,8 +164,8 @@ function SetHas(key) {

function SetDelete(key) {
if (!IS_SET(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Set.prototype.delete', this);
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.delete', this]);
}
var table = %_JSCollectionGetTable(this);
var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table);
Expand All @@ -184,8 +186,8 @@ function SetDelete(key) {

function SetGetSize() {
if (!IS_SET(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Set.prototype.size', this);
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.size', this]);
}
var table = %_JSCollectionGetTable(this);
return ORDERED_HASH_TABLE_ELEMENT_COUNT(table);
Expand All @@ -194,20 +196,22 @@ function SetGetSize() {

function SetClearJS() {
if (!IS_SET(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Set.prototype.clear', this);
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.clear', this]);
}
%_SetClear(this);
}


function SetForEach(f, receiver) {
if (!IS_SET(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Set.prototype.forEach', this);
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.forEach', this]);
}

if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
if (!IS_SPEC_FUNCTION(f)) {
throw MakeTypeError('called_non_callable', [f]);
}
var needs_wrapper = false;
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
Expand Down Expand Up @@ -262,7 +266,7 @@ function MapConstructor(iterable) {
if (!IS_NULL_OR_UNDEFINED(iterable)) {
var adder = this.set;
if (!IS_SPEC_FUNCTION(adder)) {
throw MakeTypeError(kPropertyNotFunction, 'set', this);
throw MakeTypeError(kPropertyNotFunction, ['set', this]);
}

for (var nextItem of iterable) {
Expand All @@ -277,8 +281,8 @@ function MapConstructor(iterable) {

function MapGet(key) {
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.get', this);
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.get', this]);
}
var table = %_JSCollectionGetTable(this);
var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table);
Expand All @@ -291,8 +295,8 @@ function MapGet(key) {

function MapSet(key, value) {
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.set', this);
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.set', this]);
}
// Normalize -0 to +0 as required by the spec.
// Even though we use SameValueZero as the comparison for the keys we don't
Expand Down Expand Up @@ -339,8 +343,8 @@ function MapSet(key, value) {

function MapHas(key) {
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.has', this);
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.has', this]);
}
var table = %_JSCollectionGetTable(this);
var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table);
Expand All @@ -351,8 +355,8 @@ function MapHas(key) {

function MapDelete(key) {
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.delete', this);
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.delete', this]);
}
var table = %_JSCollectionGetTable(this);
var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table);
Expand All @@ -374,8 +378,8 @@ function MapDelete(key) {

function MapGetSize() {
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.size', this);
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.size', this]);
}
var table = %_JSCollectionGetTable(this);
return ORDERED_HASH_TABLE_ELEMENT_COUNT(table);
Expand All @@ -384,20 +388,22 @@ function MapGetSize() {

function MapClearJS() {
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.clear', this);
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.clear', this]);
}
%_MapClear(this);
}


function MapForEach(f, receiver) {
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.forEach', this);
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.forEach', this]);
}

if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
if (!IS_SPEC_FUNCTION(f)) {
throw MakeTypeError('called_non_callable', [f]);
}
var needs_wrapper = false;
if (IS_NULL_OR_UNDEFINED(receiver)) {
receiver = %GetDefaultReceiver(f) || receiver;
Expand Down
9 changes: 4 additions & 5 deletions src/execution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "src/codegen.h"
#include "src/deoptimizer.h"
#include "src/isolate-inl.h"
#include "src/messages.h"
#include "src/vm-state-inl.h"

namespace v8 {
Expand Down Expand Up @@ -280,8 +279,8 @@ MaybeHandle<Object> Execution::TryGetFunctionDelegate(Isolate* isolate,

// If the Object doesn't have an instance-call handler we should
// throw a non-callable exception.
THROW_NEW_ERROR(isolate,
NewTypeError(MessageTemplate::kCalledNonCallable, object),
THROW_NEW_ERROR(isolate, NewTypeError("called_non_callable",
i::HandleVector<i::Object>(&object, 1)),
Object);
}

Expand Down Expand Up @@ -336,8 +335,8 @@ MaybeHandle<Object> Execution::TryGetConstructorDelegate(

// If the Object doesn't have an instance-call handler we should
// throw a non-callable exception.
THROW_NEW_ERROR(isolate,
NewTypeError(MessageTemplate::kCalledNonCallable, object),
THROW_NEW_ERROR(isolate, NewTypeError("called_non_callable",
i::HandleVector<i::Object>(&object, 1)),
Object);
}

Expand Down
Loading

0 comments on commit d881baa

Please sign in to comment.