Commit 206cf398 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[runtime] Deprecate RUNTIME_ASSERT from object ops.

This removes explicit uses of the RUNTIME_ASSERT macro from some runtime
methods. The implicit ones in CONVERT_FOO_ARG_CHECKED will be addressed
in a separate CL for all runtime modules at once.

R=bmeurer@chromium.org
BUG=v8:5066

Review-Url: https://codereview.chromium.org/2045193002
Cr-Commit-Position: refs/heads/master@{#36852}
parent f4e4fd71
...@@ -31,7 +31,7 @@ RUNTIME_FUNCTION(Runtime_JSCollectionGetTable) { ...@@ -31,7 +31,7 @@ RUNTIME_FUNCTION(Runtime_JSCollectionGetTable) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK(args.length() == 1); DCHECK(args.length() == 1);
CONVERT_ARG_CHECKED(JSObject, object, 0); CONVERT_ARG_CHECKED(JSObject, object, 0);
RUNTIME_ASSERT(object->IsJSSet() || object->IsJSMap()); CHECK(object->IsJSSet() || object->IsJSMap());
return static_cast<JSCollection*>(object)->table(); return static_cast<JSCollection*>(object)->table();
} }
...@@ -91,8 +91,8 @@ RUNTIME_FUNCTION(Runtime_SetIteratorInitialize) { ...@@ -91,8 +91,8 @@ RUNTIME_FUNCTION(Runtime_SetIteratorInitialize) {
CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0);
CONVERT_ARG_HANDLE_CHECKED(JSSet, set, 1); CONVERT_ARG_HANDLE_CHECKED(JSSet, set, 1);
CONVERT_SMI_ARG_CHECKED(kind, 2) CONVERT_SMI_ARG_CHECKED(kind, 2)
RUNTIME_ASSERT(kind == JSSetIterator::kKindValues || CHECK(kind == JSSetIterator::kKindValues ||
kind == JSSetIterator::kKindEntries); kind == JSSetIterator::kKindEntries);
Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table())); Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table()));
holder->set_table(*table); holder->set_table(*table);
holder->set_index(Smi::FromInt(0)); holder->set_index(Smi::FromInt(0));
...@@ -186,9 +186,9 @@ RUNTIME_FUNCTION(Runtime_MapIteratorInitialize) { ...@@ -186,9 +186,9 @@ RUNTIME_FUNCTION(Runtime_MapIteratorInitialize) {
CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0);
CONVERT_ARG_HANDLE_CHECKED(JSMap, map, 1); CONVERT_ARG_HANDLE_CHECKED(JSMap, map, 1);
CONVERT_SMI_ARG_CHECKED(kind, 2) CONVERT_SMI_ARG_CHECKED(kind, 2)
RUNTIME_ASSERT(kind == JSMapIterator::kKindKeys || CHECK(kind == JSMapIterator::kKindKeys ||
kind == JSMapIterator::kKindValues || kind == JSMapIterator::kKindValues ||
kind == JSMapIterator::kKindEntries); kind == JSMapIterator::kKindEntries);
Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table())); Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table()));
holder->set_table(*table); holder->set_table(*table);
holder->set_index(Smi::FromInt(0)); holder->set_index(Smi::FromInt(0));
...@@ -232,7 +232,7 @@ RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) { ...@@ -232,7 +232,7 @@ RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) {
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0);
CONVERT_NUMBER_CHECKED(int, max_entries, Int32, args[1]); CONVERT_NUMBER_CHECKED(int, max_entries, Int32, args[1]);
RUNTIME_ASSERT(max_entries >= 0); CHECK(max_entries >= 0);
Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
if (max_entries == 0 || max_entries > table->NumberOfElements()) { if (max_entries == 0 || max_entries > table->NumberOfElements()) {
...@@ -286,10 +286,10 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionGet) { ...@@ -286,10 +286,10 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionGet) {
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
CONVERT_SMI_ARG_CHECKED(hash, 2) CONVERT_SMI_ARG_CHECKED(hash, 2)
RUNTIME_ASSERT(key->IsJSReceiver() || key->IsSymbol()); CHECK(key->IsJSReceiver() || key->IsSymbol());
Handle<ObjectHashTable> table( Handle<ObjectHashTable> table(
ObjectHashTable::cast(weak_collection->table())); ObjectHashTable::cast(weak_collection->table()));
RUNTIME_ASSERT(table->IsKey(isolate, *key)); CHECK(table->IsKey(isolate, *key));
Handle<Object> lookup(table->Lookup(key, hash), isolate); Handle<Object> lookup(table->Lookup(key, hash), isolate);
return lookup->IsTheHole(isolate) ? isolate->heap()->undefined_value() return lookup->IsTheHole(isolate) ? isolate->heap()->undefined_value()
: *lookup; : *lookup;
...@@ -302,10 +302,10 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionHas) { ...@@ -302,10 +302,10 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionHas) {
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
CONVERT_SMI_ARG_CHECKED(hash, 2) CONVERT_SMI_ARG_CHECKED(hash, 2)
RUNTIME_ASSERT(key->IsJSReceiver() || key->IsSymbol()); CHECK(key->IsJSReceiver() || key->IsSymbol());
Handle<ObjectHashTable> table( Handle<ObjectHashTable> table(
ObjectHashTable::cast(weak_collection->table())); ObjectHashTable::cast(weak_collection->table()));
RUNTIME_ASSERT(table->IsKey(isolate, *key)); CHECK(table->IsKey(isolate, *key));
Handle<Object> lookup(table->Lookup(key, hash), isolate); Handle<Object> lookup(table->Lookup(key, hash), isolate);
return isolate->heap()->ToBoolean(!lookup->IsTheHole(isolate)); return isolate->heap()->ToBoolean(!lookup->IsTheHole(isolate));
} }
...@@ -317,10 +317,10 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) { ...@@ -317,10 +317,10 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) {
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
CONVERT_SMI_ARG_CHECKED(hash, 2) CONVERT_SMI_ARG_CHECKED(hash, 2)
RUNTIME_ASSERT(key->IsJSReceiver() || key->IsSymbol()); CHECK(key->IsJSReceiver() || key->IsSymbol());
Handle<ObjectHashTable> table( Handle<ObjectHashTable> table(
ObjectHashTable::cast(weak_collection->table())); ObjectHashTable::cast(weak_collection->table()));
RUNTIME_ASSERT(table->IsKey(isolate, *key)); CHECK(table->IsKey(isolate, *key));
bool was_present = JSWeakCollection::Delete(weak_collection, key, hash); bool was_present = JSWeakCollection::Delete(weak_collection, key, hash);
return isolate->heap()->ToBoolean(was_present); return isolate->heap()->ToBoolean(was_present);
} }
...@@ -331,12 +331,12 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionSet) { ...@@ -331,12 +331,12 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionSet) {
DCHECK(args.length() == 4); DCHECK(args.length() == 4);
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
RUNTIME_ASSERT(key->IsJSReceiver() || key->IsSymbol()); CHECK(key->IsJSReceiver() || key->IsSymbol());
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
CONVERT_SMI_ARG_CHECKED(hash, 3) CONVERT_SMI_ARG_CHECKED(hash, 3)
Handle<ObjectHashTable> table( Handle<ObjectHashTable> table(
ObjectHashTable::cast(weak_collection->table())); ObjectHashTable::cast(weak_collection->table()));
RUNTIME_ASSERT(table->IsKey(isolate, *key)); CHECK(table->IsKey(isolate, *key));
JSWeakCollection::Set(weak_collection, key, value, hash); JSWeakCollection::Set(weak_collection, key, value, hash);
return *weak_collection; return *weak_collection;
} }
...@@ -347,7 +347,7 @@ RUNTIME_FUNCTION(Runtime_GetWeakSetValues) { ...@@ -347,7 +347,7 @@ RUNTIME_FUNCTION(Runtime_GetWeakSetValues) {
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0);
CONVERT_NUMBER_CHECKED(int, max_values, Int32, args[1]); CONVERT_NUMBER_CHECKED(int, max_values, Int32, args[1]);
RUNTIME_ASSERT(max_values >= 0); CHECK(max_values >= 0);
Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
if (max_values == 0 || max_values > table->NumberOfElements()) { if (max_values == 0 || max_values > table->NumberOfElements()) {
......
...@@ -202,7 +202,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) { ...@@ -202,7 +202,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
// We're not prepared to handle a function with arguments object. // We're not prepared to handle a function with arguments object.
DCHECK(!function->shared()->uses_arguments()); DCHECK(!function->shared()->uses_arguments());
RUNTIME_ASSERT(FLAG_use_osr); CHECK(FLAG_use_osr);
// Passing the PC in the javascript frame from the caller directly is // Passing the PC in the javascript frame from the caller directly is
// not GC safe, so we walk the stack to get it. // not GC safe, so we walk the stack to get it.
......
...@@ -48,7 +48,7 @@ RUNTIME_FUNCTION(Runtime_FunctionRemovePrototype) { ...@@ -48,7 +48,7 @@ RUNTIME_FUNCTION(Runtime_FunctionRemovePrototype) {
DCHECK(args.length() == 1); DCHECK(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, f, 0); CONVERT_ARG_CHECKED(JSFunction, f, 0);
RUNTIME_ASSERT(f->RemovePrototype()); CHECK(f->RemovePrototype());
f->shared()->set_construct_stub( f->shared()->set_construct_stub(
*isolate->builtins()->ConstructedNonConstructable()); *isolate->builtins()->ConstructedNonConstructable());
...@@ -128,8 +128,7 @@ RUNTIME_FUNCTION(Runtime_FunctionSetLength) { ...@@ -128,8 +128,7 @@ RUNTIME_FUNCTION(Runtime_FunctionSetLength) {
CONVERT_ARG_CHECKED(JSFunction, fun, 0); CONVERT_ARG_CHECKED(JSFunction, fun, 0);
CONVERT_SMI_ARG_CHECKED(length, 1); CONVERT_SMI_ARG_CHECKED(length, 1);
RUNTIME_ASSERT((length & 0xC0000000) == 0xC0000000 || CHECK((length & 0xC0000000) == 0xC0000000 || (length & 0xC0000000) == 0x0);
(length & 0xC0000000) == 0x0);
fun->shared()->set_length(length); fun->shared()->set_length(length);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -141,7 +140,7 @@ RUNTIME_FUNCTION(Runtime_FunctionSetPrototype) { ...@@ -141,7 +140,7 @@ RUNTIME_FUNCTION(Runtime_FunctionSetPrototype) {
CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
RUNTIME_ASSERT(fun->IsConstructor()); CHECK(fun->IsConstructor());
RETURN_FAILURE_ON_EXCEPTION(isolate, RETURN_FAILURE_ON_EXCEPTION(isolate,
Accessors::FunctionSetPrototype(fun, value)); Accessors::FunctionSetPrototype(fun, value));
return args[0]; // return TOS return args[0]; // return TOS
...@@ -228,7 +227,7 @@ RUNTIME_FUNCTION(Runtime_SetCode) { ...@@ -228,7 +227,7 @@ RUNTIME_FUNCTION(Runtime_SetCode) {
// into the global object when doing call and apply. // into the global object when doing call and apply.
RUNTIME_FUNCTION(Runtime_SetNativeFlag) { RUNTIME_FUNCTION(Runtime_SetNativeFlag) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
RUNTIME_ASSERT(args.length() == 1); DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(Object, object, 0); CONVERT_ARG_CHECKED(Object, object, 0);
...@@ -249,7 +248,7 @@ RUNTIME_FUNCTION(Runtime_IsConstructor) { ...@@ -249,7 +248,7 @@ RUNTIME_FUNCTION(Runtime_IsConstructor) {
RUNTIME_FUNCTION(Runtime_SetForceInlineFlag) { RUNTIME_FUNCTION(Runtime_SetForceInlineFlag) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
RUNTIME_ASSERT(args.length() == 1); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
if (object->IsJSFunction()) { if (object->IsJSFunction()) {
......
...@@ -18,7 +18,7 @@ RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) { ...@@ -18,7 +18,7 @@ RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) {
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1);
RUNTIME_ASSERT(function->shared()->is_resumable()); CHECK(function->shared()->is_resumable());
Handle<FixedArray> operand_stack; Handle<FixedArray> operand_stack;
if (FLAG_ignition && FLAG_ignition_generators) { if (FLAG_ignition && FLAG_ignition_generators) {
...@@ -47,7 +47,7 @@ RUNTIME_FUNCTION(Runtime_SuspendJSGeneratorObject) { ...@@ -47,7 +47,7 @@ RUNTIME_FUNCTION(Runtime_SuspendJSGeneratorObject) {
JavaScriptFrameIterator stack_iterator(isolate); JavaScriptFrameIterator stack_iterator(isolate);
JavaScriptFrame* frame = stack_iterator.frame(); JavaScriptFrame* frame = stack_iterator.frame();
RUNTIME_ASSERT(frame->function()->shared()->is_resumable()); CHECK(frame->function()->shared()->is_resumable());
DCHECK_EQ(frame->function(), generator_object->function()); DCHECK_EQ(frame->function(), generator_object->function());
DCHECK(frame->function()->shared()->is_compiled()); DCHECK(frame->function()->shared()->is_compiled());
DCHECK(!frame->function()->IsOptimized()); DCHECK(!frame->function()->IsOptimized());
...@@ -153,7 +153,7 @@ RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) { ...@@ -153,7 +153,7 @@ RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) {
DCHECK(!generator->function()->shared()->HasBytecodeArray()); DCHECK(!generator->function()->shared()->HasBytecodeArray());
Handle<Code> code(generator->function()->code(), isolate); Handle<Code> code(generator->function()->code(), isolate);
int offset = generator->continuation(); int offset = generator->continuation();
RUNTIME_ASSERT(0 <= offset && offset < code->instruction_size()); CHECK(0 <= offset && offset < code->instruction_size());
return Smi::FromInt(code->SourcePosition(offset)); return Smi::FromInt(code->SourcePosition(offset));
} }
......
...@@ -393,7 +393,7 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) { ...@@ -393,7 +393,7 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) {
RUNTIME_FUNCTION(Runtime_AddNamedProperty) { RUNTIME_FUNCTION(Runtime_AddNamedProperty) {
HandleScope scope(isolate); HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 4); DCHECK_EQ(4, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
...@@ -406,7 +406,7 @@ RUNTIME_FUNCTION(Runtime_AddNamedProperty) { ...@@ -406,7 +406,7 @@ RUNTIME_FUNCTION(Runtime_AddNamedProperty) {
LookupIterator it(object, name, object, LookupIterator::OWN_SKIP_INTERCEPTOR); LookupIterator it(object, name, object, LookupIterator::OWN_SKIP_INTERCEPTOR);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
if (!maybe.IsJust()) return isolate->heap()->exception(); if (!maybe.IsJust()) return isolate->heap()->exception();
RUNTIME_ASSERT(!it.IsFound()); CHECK(!it.IsFound());
#endif #endif
RETURN_RESULT_OR_FAILURE(isolate, JSObject::SetOwnPropertyIgnoreAttributes( RETURN_RESULT_OR_FAILURE(isolate, JSObject::SetOwnPropertyIgnoreAttributes(
...@@ -418,7 +418,7 @@ RUNTIME_FUNCTION(Runtime_AddNamedProperty) { ...@@ -418,7 +418,7 @@ RUNTIME_FUNCTION(Runtime_AddNamedProperty) {
// This is used to create an indexed data property into an array. // This is used to create an indexed data property into an array.
RUNTIME_FUNCTION(Runtime_AddElement) { RUNTIME_FUNCTION(Runtime_AddElement) {
HandleScope scope(isolate); HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 3); DCHECK_EQ(3, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
...@@ -432,11 +432,11 @@ RUNTIME_FUNCTION(Runtime_AddElement) { ...@@ -432,11 +432,11 @@ RUNTIME_FUNCTION(Runtime_AddElement) {
LookupIterator::OWN_SKIP_INTERCEPTOR); LookupIterator::OWN_SKIP_INTERCEPTOR);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
if (!maybe.IsJust()) return isolate->heap()->exception(); if (!maybe.IsJust()) return isolate->heap()->exception();
RUNTIME_ASSERT(!it.IsFound()); CHECK(!it.IsFound());
if (object->IsJSArray()) { if (object->IsJSArray()) {
Handle<JSArray> array = Handle<JSArray>::cast(object); Handle<JSArray> array = Handle<JSArray>::cast(object);
RUNTIME_ASSERT(!JSArray::WouldChangeReadOnlyLength(array, index)); CHECK(!JSArray::WouldChangeReadOnlyLength(array, index));
} }
#endif #endif
...@@ -447,7 +447,7 @@ RUNTIME_FUNCTION(Runtime_AddElement) { ...@@ -447,7 +447,7 @@ RUNTIME_FUNCTION(Runtime_AddElement) {
RUNTIME_FUNCTION(Runtime_AppendElement) { RUNTIME_FUNCTION(Runtime_AppendElement) {
HandleScope scope(isolate); HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 2); DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
...@@ -464,7 +464,7 @@ RUNTIME_FUNCTION(Runtime_AppendElement) { ...@@ -464,7 +464,7 @@ RUNTIME_FUNCTION(Runtime_AppendElement) {
RUNTIME_FUNCTION(Runtime_SetProperty) { RUNTIME_FUNCTION(Runtime_SetProperty) {
HandleScope scope(isolate); HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 4); DCHECK_EQ(4, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
...@@ -634,15 +634,14 @@ RUNTIME_FUNCTION(Runtime_LoadMutableDouble) { ...@@ -634,15 +634,14 @@ RUNTIME_FUNCTION(Runtime_LoadMutableDouble) {
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Smi, index, 1); CONVERT_ARG_HANDLE_CHECKED(Smi, index, 1);
RUNTIME_ASSERT((index->value() & 1) == 1); CHECK((index->value() & 1) == 1);
FieldIndex field_index = FieldIndex field_index =
FieldIndex::ForLoadByFieldIndex(object->map(), index->value()); FieldIndex::ForLoadByFieldIndex(object->map(), index->value());
if (field_index.is_inobject()) { if (field_index.is_inobject()) {
RUNTIME_ASSERT(field_index.property_index() < CHECK(field_index.property_index() <
object->map()->GetInObjectProperties()); object->map()->GetInObjectProperties());
} else { } else {
RUNTIME_ASSERT(field_index.outobject_array_index() < CHECK(field_index.outobject_array_index() < object->properties()->length());
object->properties()->length());
} }
return *JSObject::FastPropertyAt(object, Representation::Double(), return *JSObject::FastPropertyAt(object, Representation::Double(),
field_index); field_index);
...@@ -687,12 +686,12 @@ RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) { ...@@ -687,12 +686,12 @@ RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 5); DCHECK(args.length() == 5);
CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
RUNTIME_ASSERT(!obj->IsNull()); CHECK(!obj->IsNull());
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2);
RUNTIME_ASSERT(IsValidAccessor(isolate, getter)); CHECK(IsValidAccessor(isolate, getter));
CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3);
RUNTIME_ASSERT(IsValidAccessor(isolate, setter)); CHECK(IsValidAccessor(isolate, setter));
CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 4); CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 4);
RETURN_FAILURE_ON_EXCEPTION( RETURN_FAILURE_ON_EXCEPTION(
......
...@@ -149,14 +149,7 @@ RUNTIME_FUNCTION(Runtime_DeclareGlobals) { ...@@ -149,14 +149,7 @@ RUNTIME_FUNCTION(Runtime_DeclareGlobals) {
RUNTIME_FUNCTION(Runtime_InitializeVarGlobal) { RUNTIME_FUNCTION(Runtime_InitializeVarGlobal) {
HandleScope scope(isolate); HandleScope scope(isolate);
// args[0] == name DCHECK_EQ(3, args.length());
// args[1] == language_mode
// args[2] == value (optional)
// Determine if we need to assign to the variable if it already
// exists (based on the number of arguments).
RUNTIME_ASSERT(args.length() == 3);
CONVERT_ARG_HANDLE_CHECKED(String, name, 0); CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 1); CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
...@@ -169,10 +162,7 @@ RUNTIME_FUNCTION(Runtime_InitializeVarGlobal) { ...@@ -169,10 +162,7 @@ RUNTIME_FUNCTION(Runtime_InitializeVarGlobal) {
RUNTIME_FUNCTION(Runtime_InitializeConstGlobal) { RUNTIME_FUNCTION(Runtime_InitializeConstGlobal) {
HandleScope handle_scope(isolate); HandleScope handle_scope(isolate);
// All constants are declared with an initial value. The name DCHECK_EQ(2, args.length());
// of the constant is the first argument and the initial value
// is the second.
RUNTIME_ASSERT(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(String, name, 0); CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
......
...@@ -36,17 +36,17 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferSliceImpl) { ...@@ -36,17 +36,17 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferSliceImpl) {
"ArrayBuffer.prototype.slice"))); "ArrayBuffer.prototype.slice")));
} }
RUNTIME_ASSERT(!source.is_identical_to(target)); CHECK(!source.is_identical_to(target));
size_t start = 0, target_length = 0; size_t start = 0, target_length = 0;
RUNTIME_ASSERT(TryNumberToSize(isolate, *first, &start)); CHECK(TryNumberToSize(isolate, *first, &start));
RUNTIME_ASSERT(TryNumberToSize(isolate, *new_length, &target_length)); CHECK(TryNumberToSize(isolate, *new_length, &target_length));
RUNTIME_ASSERT(NumberToSize(isolate, target->byte_length()) >= target_length); CHECK(NumberToSize(isolate, target->byte_length()) >= target_length);
if (target_length == 0) return isolate->heap()->undefined_value(); if (target_length == 0) return isolate->heap()->undefined_value();
size_t source_byte_length = NumberToSize(isolate, source->byte_length()); size_t source_byte_length = NumberToSize(isolate, source->byte_length());
RUNTIME_ASSERT(start <= source_byte_length); CHECK(start <= source_byte_length);
RUNTIME_ASSERT(source_byte_length - start >= target_length); CHECK(source_byte_length - start >= target_length);
uint8_t* source_data = reinterpret_cast<uint8_t*>(source->backing_store()); uint8_t* source_data = reinterpret_cast<uint8_t*>(source->backing_store());
uint8_t* target_data = reinterpret_cast<uint8_t*>(target->backing_store()); uint8_t* target_data = reinterpret_cast<uint8_t*>(target->backing_store());
CopyBytes(target_data, source_data + start, target_length); CopyBytes(target_data, source_data + start, target_length);
...@@ -63,7 +63,7 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferNeuter) { ...@@ -63,7 +63,7 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferNeuter) {
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
// Shared array buffers should never be neutered. // Shared array buffers should never be neutered.
RUNTIME_ASSERT(!array_buffer->is_shared()); CHECK(!array_buffer->is_shared());
DCHECK(!array_buffer->is_external()); DCHECK(!array_buffer->is_external());
void* backing_store = array_buffer->backing_store(); void* backing_store = array_buffer->backing_store();
size_t byte_length = NumberToSize(isolate, array_buffer->byte_length()); size_t byte_length = NumberToSize(isolate, array_buffer->byte_length());
...@@ -105,32 +105,32 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitialize) { ...@@ -105,32 +105,32 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitialize) {
CONVERT_NUMBER_ARG_HANDLE_CHECKED(byte_length_object, 4); CONVERT_NUMBER_ARG_HANDLE_CHECKED(byte_length_object, 4);
CONVERT_BOOLEAN_ARG_CHECKED(initialize, 5); CONVERT_BOOLEAN_ARG_CHECKED(initialize, 5);
RUNTIME_ASSERT(arrayId >= Runtime::ARRAY_ID_FIRST && CHECK(arrayId >= Runtime::ARRAY_ID_FIRST &&
arrayId <= Runtime::ARRAY_ID_LAST); arrayId <= Runtime::ARRAY_ID_LAST);
ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization. ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization.
size_t element_size = 1; // Bogus initialization. size_t element_size = 1; // Bogus initialization.
ElementsKind fixed_elements_kind = INT8_ELEMENTS; // Bogus initialization. ElementsKind fixed_elements_kind = INT8_ELEMENTS; // Bogus initialization.
Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &fixed_elements_kind, Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &fixed_elements_kind,
&element_size); &element_size);
RUNTIME_ASSERT(holder->map()->elements_kind() == fixed_elements_kind); CHECK(holder->map()->elements_kind() == fixed_elements_kind);
size_t byte_offset = 0; size_t byte_offset = 0;
size_t byte_length = 0; size_t byte_length = 0;
RUNTIME_ASSERT(TryNumberToSize(isolate, *byte_offset_object, &byte_offset)); CHECK(TryNumberToSize(isolate, *byte_offset_object, &byte_offset));
RUNTIME_ASSERT(TryNumberToSize(isolate, *byte_length_object, &byte_length)); CHECK(TryNumberToSize(isolate, *byte_length_object, &byte_length));
if (maybe_buffer->IsJSArrayBuffer()) { if (maybe_buffer->IsJSArrayBuffer()) {
Handle<JSArrayBuffer> buffer = Handle<JSArrayBuffer>::cast(maybe_buffer); Handle<JSArrayBuffer> buffer = Handle<JSArrayBuffer>::cast(maybe_buffer);
size_t array_buffer_byte_length = size_t array_buffer_byte_length =
NumberToSize(isolate, buffer->byte_length()); NumberToSize(isolate, buffer->byte_length());
RUNTIME_ASSERT(byte_offset <= array_buffer_byte_length); CHECK(byte_offset <= array_buffer_byte_length);
RUNTIME_ASSERT(array_buffer_byte_length - byte_offset >= byte_length); CHECK(array_buffer_byte_length - byte_offset >= byte_length);
} else { } else {
RUNTIME_ASSERT(maybe_buffer->IsNull()); CHECK(maybe_buffer->IsNull());
} }
RUNTIME_ASSERT(byte_length % element_size == 0); CHECK(byte_length % element_size == 0);
size_t length = byte_length / element_size; size_t length = byte_length / element_size;
if (length > static_cast<unsigned>(Smi::kMaxValue)) { if (length > static_cast<unsigned>(Smi::kMaxValue)) {
...@@ -186,8 +186,8 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitializeFromArrayLike) { ...@@ -186,8 +186,8 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitializeFromArrayLike) {
CONVERT_ARG_HANDLE_CHECKED(Object, source, 2); CONVERT_ARG_HANDLE_CHECKED(Object, source, 2);
CONVERT_NUMBER_ARG_HANDLE_CHECKED(length_obj, 3); CONVERT_NUMBER_ARG_HANDLE_CHECKED(length_obj, 3);
RUNTIME_ASSERT(arrayId >= Runtime::ARRAY_ID_FIRST && CHECK(arrayId >= Runtime::ARRAY_ID_FIRST &&
arrayId <= Runtime::ARRAY_ID_LAST); arrayId <= Runtime::ARRAY_ID_LAST);
ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization. ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization.
size_t element_size = 1; // Bogus initialization. size_t element_size = 1; // Bogus initialization.
...@@ -195,7 +195,7 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitializeFromArrayLike) { ...@@ -195,7 +195,7 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitializeFromArrayLike) {
Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &fixed_elements_kind, Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &fixed_elements_kind,
&element_size); &element_size);
RUNTIME_ASSERT(holder->map()->elements_kind() == fixed_elements_kind); CHECK(holder->map()->elements_kind() == fixed_elements_kind);
Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer();
size_t length = 0; size_t length = 0;
...@@ -204,7 +204,7 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitializeFromArrayLike) { ...@@ -204,7 +204,7 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitializeFromArrayLike) {
length_obj = handle(JSTypedArray::cast(*source)->length(), isolate); length_obj = handle(JSTypedArray::cast(*source)->length(), isolate);
length = JSTypedArray::cast(*source)->length_value(); length = JSTypedArray::cast(*source)->length_value();
} else { } else {
RUNTIME_ASSERT(TryNumberToSize(isolate, *length_obj, &length)); CHECK(TryNumberToSize(isolate, *length_obj, &length));
} }
if ((length > static_cast<unsigned>(Smi::kMaxValue)) || if ((length > static_cast<unsigned>(Smi::kMaxValue)) ||
...@@ -328,7 +328,7 @@ RUNTIME_FUNCTION(Runtime_TypedArraySetFastCases) { ...@@ -328,7 +328,7 @@ RUNTIME_FUNCTION(Runtime_TypedArraySetFastCases) {
Handle<JSTypedArray> target(JSTypedArray::cast(*target_obj)); Handle<JSTypedArray> target(JSTypedArray::cast(*target_obj));
Handle<JSTypedArray> source(JSTypedArray::cast(*source_obj)); Handle<JSTypedArray> source(JSTypedArray::cast(*source_obj));
size_t offset = 0; size_t offset = 0;
RUNTIME_ASSERT(TryNumberToSize(isolate, *offset_obj, &offset)); CHECK(TryNumberToSize(isolate, *offset_obj, &offset));
size_t target_length = target->length_value(); size_t target_length = target->length_value();
size_t source_length = source->length_value(); size_t source_length = source->length_value();
size_t target_byte_length = NumberToSize(isolate, target->byte_length()); size_t target_byte_length = NumberToSize(isolate, target->byte_length());
......
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --expose-natives-as=builtins --expose-gc
var SetIterator = builtins.ImportNow("SetIterator");
var MapIterator = builtins.ImportNow("MapIterator");
var __v_7 = [];
var __v_8 = {};
var __v_10 = {};
var __v_11 = this;
var __v_12 = {};
var __v_13 = {};
var __v_14 = "";
var __v_15 = {};
try {
__v_1 = {x:0};
%OptimizeFunctionOnNextCall(__f_1);
assertEquals("good", __f_1());
delete __v_1.x;
assertEquals("good", __f_1());
} catch(e) { print("Caught: " + e); }
try {
__v_3 = new Set();
__v_5 = new SetIterator(__v_3, -12);
__v_4 = new Map();
__v_6 = new MapIterator(__v_4, 2);
__f_3(Array);
} catch(e) { print("Caught: " + e); }
function __f_4(__v_8, filter) {
function __f_6(v) {
for (var __v_4 in v) {
for (var __v_4 in v) {}
}
%OptimizeFunctionOnNextCall(filter);
return filter(v);
}
var __v_7 = eval(__v_8);
gc();
return __f_6(__v_7);
}
function __f_5(__v_6) {
var __v_5 = new Array(__v_6);
for (var __v_4 = 0; __v_4 < __v_6; __v_4++) __v_5.push('{}');
return __v_5;
}
try {
try {
__v_8.test("\x80");
assertUnreachable();
} catch (e) {
}
gc();
} catch(e) { print("Caught: " + e); }
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-sharedarraybuffer
var sab = new SharedArrayBuffer(16);
assertThrows(function() { %ArrayBufferNeuter(sab); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment