Cleaned up runtime macros a bit.

The bulk of this CL is purely mechanical: Make the CONVERT_FOO macros more
uniform by always using an index instead of an object. Apart from this, it
includes a few minor changes like using CONVERT_SMI_ARG_CHECKED a bit more or
introducing a new macro for PropertyDetails. Nothing spectacular, just something
sitting on my disk for quite some time now...

Review URL: https://chromiumcodereview.appspot.com/9395075

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10772 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4f28e9a0
...@@ -69,20 +69,20 @@ namespace internal { ...@@ -69,20 +69,20 @@ namespace internal {
// Cast the given object to a value of the specified type and store // Cast the given object to a value of the specified type and store
// it in a variable with the given name. If the object is not of the // it in a variable with the given name. If the object is not of the
// expected type call IllegalOperation and return. // expected type call IllegalOperation and return.
#define CONVERT_CHECKED(Type, name, obj) \
RUNTIME_ASSERT(obj->Is##Type()); \
Type* name = Type::cast(obj);
#define CONVERT_ARG_CHECKED(Type, name, index) \ #define CONVERT_ARG_CHECKED(Type, name, index) \
RUNTIME_ASSERT(args[index]->Is##Type()); \
Type* name = Type::cast(args[index]);
#define CONVERT_ARG_HANDLE_CHECKED(Type, name, index) \
RUNTIME_ASSERT(args[index]->Is##Type()); \ RUNTIME_ASSERT(args[index]->Is##Type()); \
Handle<Type> name = args.at<Type>(index); Handle<Type> name = args.at<Type>(index);
// Cast the given object to a boolean and store it in a variable with // Cast the given object to a boolean and store it in a variable with
// the given name. If the object is not a boolean call IllegalOperation // the given name. If the object is not a boolean call IllegalOperation
// and return. // and return.
#define CONVERT_BOOLEAN_CHECKED(name, obj) \ #define CONVERT_BOOLEAN_ARG_CHECKED(name, index) \
RUNTIME_ASSERT(obj->IsBoolean()); \ RUNTIME_ASSERT(args[index]->IsBoolean()); \
bool name = (obj)->IsTrue(); bool name = args[index]->IsTrue();
// Cast the given argument to a Smi and store its value in an int variable // Cast the given argument to a Smi and store its value in an int variable
// with the given name. If the argument is not a Smi call IllegalOperation // with the given name. If the argument is not a Smi call IllegalOperation
...@@ -106,12 +106,20 @@ namespace internal { ...@@ -106,12 +106,20 @@ namespace internal {
type name = NumberTo##Type(obj); type name = NumberTo##Type(obj);
// Cast the given argument to PropertyDetails and store its value in a
// variable with the given name. If the argument is not a Smi call
// IllegalOperation and return.
#define CONVERT_PROPERTY_DETAILS_CHECKED(name, index) \
RUNTIME_ASSERT(args[index]->IsSmi()); \
PropertyDetails name = PropertyDetails(Smi::cast(args[index]));
// Assert that the given argument has a valid value for a StrictModeFlag // Assert that the given argument has a valid value for a StrictModeFlag
// and store it in a StrictModeFlag variable with the given name. // and store it in a StrictModeFlag variable with the given name.
#define CONVERT_STRICT_MODE_ARG(name, index) \ #define CONVERT_STRICT_MODE_ARG_CHECKED(name, index) \
ASSERT(args[index]->IsSmi()); \ RUNTIME_ASSERT(args[index]->IsSmi()); \
ASSERT(args.smi_at(index) == kStrictMode || \ RUNTIME_ASSERT(args.smi_at(index) == kStrictMode || \
args.smi_at(index) == kNonStrictMode); \ args.smi_at(index) == kNonStrictMode); \
StrictModeFlag name = \ StrictModeFlag name = \
static_cast<StrictModeFlag>(args.smi_at(index)); static_cast<StrictModeFlag>(args.smi_at(index));
...@@ -558,9 +566,9 @@ static Handle<Object> CreateLiteralBoilerplate( ...@@ -558,9 +566,9 @@ static Handle<Object> CreateLiteralBoilerplate(
RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) { RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
CONVERT_ARG_CHECKED(FixedArray, literals, 0); CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
CONVERT_SMI_ARG_CHECKED(literals_index, 1); CONVERT_SMI_ARG_CHECKED(literals_index, 1);
CONVERT_ARG_CHECKED(FixedArray, constant_properties, 2); CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2);
CONVERT_SMI_ARG_CHECKED(flags, 3); CONVERT_SMI_ARG_CHECKED(flags, 3);
bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0;
bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0;
...@@ -584,9 +592,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) { ...@@ -584,9 +592,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) { RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
CONVERT_ARG_CHECKED(FixedArray, literals, 0); CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
CONVERT_SMI_ARG_CHECKED(literals_index, 1); CONVERT_SMI_ARG_CHECKED(literals_index, 1);
CONVERT_ARG_CHECKED(FixedArray, constant_properties, 2); CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2);
CONVERT_SMI_ARG_CHECKED(flags, 3); CONVERT_SMI_ARG_CHECKED(flags, 3);
bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0;
bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0;
...@@ -610,9 +618,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) { ...@@ -610,9 +618,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(FixedArray, literals, 0); CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
CONVERT_SMI_ARG_CHECKED(literals_index, 1); CONVERT_SMI_ARG_CHECKED(literals_index, 1);
CONVERT_ARG_CHECKED(FixedArray, elements, 2); CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
// Check if boilerplate exists. If not, create it first. // Check if boilerplate exists. If not, create it first.
Handle<Object> boilerplate(literals->get(literals_index), isolate); Handle<Object> boilerplate(literals->get(literals_index), isolate);
...@@ -630,9 +638,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { ...@@ -630,9 +638,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(FixedArray, literals, 0); CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
CONVERT_SMI_ARG_CHECKED(literals_index, 1); CONVERT_SMI_ARG_CHECKED(literals_index, 1);
CONVERT_ARG_CHECKED(FixedArray, elements, 2); CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
// Check if boilerplate exists. If not, create it first. // Check if boilerplate exists. If not, create it first.
Handle<Object> boilerplate(literals->get(literals_index), isolate); Handle<Object> boilerplate(literals->get(literals_index), isolate);
...@@ -691,28 +699,28 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSFunctionProxy) { ...@@ -691,28 +699,28 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSFunctionProxy) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSProxy, proxy, args[0]); CONVERT_ARG_CHECKED(JSProxy, proxy, 0);
return proxy->handler(); return proxy->handler();
} }
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetCallTrap) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetCallTrap) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunctionProxy, proxy, args[0]); CONVERT_ARG_CHECKED(JSFunctionProxy, proxy, 0);
return proxy->call_trap(); return proxy->call_trap();
} }
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructTrap) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructTrap) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunctionProxy, proxy, args[0]); CONVERT_ARG_CHECKED(JSFunctionProxy, proxy, 0);
return proxy->construct_trap(); return proxy->construct_trap();
} }
RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSProxy, proxy, args[0]); CONVERT_ARG_CHECKED(JSProxy, proxy, 0);
proxy->Fix(); proxy->Fix();
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -721,7 +729,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { ...@@ -721,7 +729,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetInitialize) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SetInitialize) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSSet, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
Handle<ObjectHashSet> table = isolate->factory()->NewObjectHashSet(0); Handle<ObjectHashSet> table = isolate->factory()->NewObjectHashSet(0);
holder->set_table(*table); holder->set_table(*table);
return *holder; return *holder;
...@@ -731,7 +739,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetInitialize) { ...@@ -731,7 +739,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetInitialize) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSSet, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
Handle<Object> key(args[1]); Handle<Object> key(args[1]);
Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table()));
table = ObjectHashSetAdd(table, key); table = ObjectHashSetAdd(table, key);
...@@ -743,7 +751,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) { ...@@ -743,7 +751,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSSet, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
Handle<Object> key(args[1]); Handle<Object> key(args[1]);
Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table()));
return isolate->heap()->ToBoolean(table->Contains(*key)); return isolate->heap()->ToBoolean(table->Contains(*key));
...@@ -753,7 +761,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) { ...@@ -753,7 +761,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSSet, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
Handle<Object> key(args[1]); Handle<Object> key(args[1]);
Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table()));
table = ObjectHashSetRemove(table, key); table = ObjectHashSetRemove(table, key);
...@@ -765,7 +773,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) { ...@@ -765,7 +773,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_MapInitialize) { RUNTIME_FUNCTION(MaybeObject*, Runtime_MapInitialize) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSMap, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0);
holder->set_table(*table); holder->set_table(*table);
return *holder; return *holder;
...@@ -775,7 +783,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MapInitialize) { ...@@ -775,7 +783,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MapInitialize) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGet) { RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGet) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSMap, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
Handle<Object> key(args[1]); Handle<Object> key(args[1]);
return ObjectHashTable::cast(holder->table())->Lookup(*key); return ObjectHashTable::cast(holder->table())->Lookup(*key);
} }
...@@ -784,7 +792,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGet) { ...@@ -784,7 +792,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGet) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) { RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(JSMap, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
Handle<Object> key(args[1]); Handle<Object> key(args[1]);
Handle<Object> value(args[2]); Handle<Object> value(args[2]);
Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
...@@ -797,7 +805,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) { ...@@ -797,7 +805,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0);
ASSERT(weakmap->map()->inobject_properties() == 0); ASSERT(weakmap->map()->inobject_properties() == 0);
Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0);
weakmap->set_table(*table); weakmap->set_table(*table);
...@@ -809,8 +817,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) { ...@@ -809,8 +817,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapInitialize) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) { RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0);
CONVERT_ARG_CHECKED(JSReceiver, key, 1); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1);
return ObjectHashTable::cast(weakmap->table())->Lookup(*key); return ObjectHashTable::cast(weakmap->table())->Lookup(*key);
} }
...@@ -818,8 +826,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) { ...@@ -818,8 +826,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapGet) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapSet) { RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakMapSet) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0); CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0);
CONVERT_ARG_CHECKED(JSReceiver, key, 1); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1);
Handle<Object> value(args[2]); Handle<Object> value(args[2]);
Handle<ObjectHashTable> table(ObjectHashTable::cast(weakmap->table())); Handle<ObjectHashTable> table(ObjectHashTable::cast(weakmap->table()));
Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value);
...@@ -840,7 +848,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { ...@@ -840,7 +848,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSReceiver, input_obj, args[0]); CONVERT_ARG_CHECKED(JSReceiver, input_obj, 0);
Object* obj = input_obj; Object* obj = input_obj;
// We don't expect access checks to be needed on JSProxy objects. // We don't expect access checks to be needed on JSProxy objects.
ASSERT(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); ASSERT(!obj->IsAccessCheckNeeded() || obj->IsJSObject());
...@@ -1009,8 +1017,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOwnProperty) { ...@@ -1009,8 +1017,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOwnProperty) {
Handle<FixedArray> elms = isolate->factory()->NewFixedArray(DESCRIPTOR_SIZE); Handle<FixedArray> elms = isolate->factory()->NewFixedArray(DESCRIPTOR_SIZE);
Handle<JSArray> desc = isolate->factory()->NewJSArrayWithElements(elms); Handle<JSArray> desc = isolate->factory()->NewJSArrayWithElements(elms);
LookupResult result(isolate); LookupResult result(isolate);
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
CONVERT_ARG_CHECKED(String, name, 1); CONVERT_ARG_HANDLE_CHECKED(String, name, 1);
// This could be an element. // This could be an element.
uint32_t index; uint32_t index;
...@@ -1147,14 +1155,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOwnProperty) { ...@@ -1147,14 +1155,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOwnProperty) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_PreventExtensions) { RUNTIME_FUNCTION(MaybeObject*, Runtime_PreventExtensions) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSObject, obj, args[0]); CONVERT_ARG_CHECKED(JSObject, obj, 0);
return obj->PreventExtensions(); return obj->PreventExtensions();
} }
RUNTIME_FUNCTION(MaybeObject*, Runtime_IsExtensible) { RUNTIME_FUNCTION(MaybeObject*, Runtime_IsExtensible) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSObject, obj, args[0]); CONVERT_ARG_CHECKED(JSObject, obj, 0);
if (obj->IsJSGlobalProxy()) { if (obj->IsJSGlobalProxy()) {
Object* proto = obj->GetPrototype(); Object* proto = obj->GetPrototype();
if (proto->IsNull()) return isolate->heap()->false_value(); if (proto->IsNull()) return isolate->heap()->false_value();
...@@ -1168,9 +1176,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsExtensible) { ...@@ -1168,9 +1176,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsExtensible) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) { RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(JSRegExp, re, 0); CONVERT_ARG_HANDLE_CHECKED(JSRegExp, re, 0);
CONVERT_ARG_CHECKED(String, pattern, 1); CONVERT_ARG_HANDLE_CHECKED(String, pattern, 1);
CONVERT_ARG_CHECKED(String, flags, 2); CONVERT_ARG_HANDLE_CHECKED(String, flags, 2);
Handle<Object> result = RegExpImpl::Compile(re, pattern, flags); Handle<Object> result = RegExpImpl::Compile(re, pattern, flags);
if (result.is_null()) return Failure::Exception(); if (result.is_null()) return Failure::Exception();
return *result; return *result;
...@@ -1180,7 +1188,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) { ...@@ -1180,7 +1188,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateApiFunction) { RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateApiFunction) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(FunctionTemplateInfo, data, 0); CONVERT_ARG_HANDLE_CHECKED(FunctionTemplateInfo, data, 0);
return *isolate->factory()->CreateApiFunction(data); return *isolate->factory()->CreateApiFunction(data);
} }
...@@ -1195,9 +1203,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsTemplate) { ...@@ -1195,9 +1203,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsTemplate) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetTemplateField) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetTemplateField) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(HeapObject, templ, args[0]); CONVERT_ARG_CHECKED(HeapObject, templ, 0);
CONVERT_CHECKED(Smi, field, args[1]); CONVERT_SMI_ARG_CHECKED(index, 1)
int index = field->value();
int offset = index * kPointerSize + HeapObject::kHeaderSize; int offset = index * kPointerSize + HeapObject::kHeaderSize;
InstanceType type = templ->map()->instance_type(); InstanceType type = templ->map()->instance_type();
RUNTIME_ASSERT(type == FUNCTION_TEMPLATE_INFO_TYPE || RUNTIME_ASSERT(type == FUNCTION_TEMPLATE_INFO_TYPE ||
...@@ -1214,7 +1221,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetTemplateField) { ...@@ -1214,7 +1221,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetTemplateField) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(HeapObject, object, args[0]); CONVERT_ARG_CHECKED(HeapObject, object, 0);
Map* old_map = object->map(); Map* old_map = object->map();
bool needs_access_checks = old_map->is_access_check_needed(); bool needs_access_checks = old_map->is_access_check_needed();
if (needs_access_checks) { if (needs_access_checks) {
...@@ -1233,7 +1240,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) { ...@@ -1233,7 +1240,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) { RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(HeapObject, object, args[0]); CONVERT_ARG_CHECKED(HeapObject, object, 0);
Map* old_map = object->map(); Map* old_map = object->map();
if (!old_map->is_access_check_needed()) { if (!old_map->is_access_check_needed()) {
// Copy map so it won't interfere constructor's initial map. // Copy map so it won't interfere constructor's initial map.
...@@ -1269,7 +1276,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) { ...@@ -1269,7 +1276,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
isolate->context()->global()); isolate->context()->global());
Handle<Context> context = args.at<Context>(0); Handle<Context> context = args.at<Context>(0);
CONVERT_ARG_CHECKED(FixedArray, pairs, 1); CONVERT_ARG_HANDLE_CHECKED(FixedArray, pairs, 1);
CONVERT_SMI_ARG_CHECKED(flags, 2); CONVERT_SMI_ARG_CHECKED(flags, 2);
// Traverse the name/value pairs and set the properties. // Traverse the name/value pairs and set the properties.
...@@ -1471,7 +1478,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) { ...@@ -1471,7 +1478,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
RUNTIME_ASSERT(args.length() == 2 || args.length() == 3); RUNTIME_ASSERT(args.length() == 2 || args.length() == 3);
bool assign = args.length() == 3; bool assign = args.length() == 3;
CONVERT_ARG_CHECKED(String, name, 0); CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
GlobalObject* global = isolate->context()->global(); GlobalObject* global = isolate->context()->global();
RUNTIME_ASSERT(args[1]->IsSmi()); RUNTIME_ASSERT(args[1]->IsSmi());
CONVERT_LANGUAGE_MODE_ARG(language_mode, 1); CONVERT_LANGUAGE_MODE_ARG(language_mode, 1);
...@@ -1528,7 +1535,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) { ...@@ -1528,7 +1535,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
// of the constant is the first argument and the initial value // of the constant is the first argument and the initial value
// is the second. // is the second.
RUNTIME_ASSERT(args.length() == 2); RUNTIME_ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(String, name, 0); CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
Handle<Object> value = args.at<Object>(1); Handle<Object> value = args.at<Object>(1);
// Get the current global object from top. // Get the current global object from top.
...@@ -1700,7 +1707,7 @@ RUNTIME_FUNCTION(MaybeObject*, ...@@ -1700,7 +1707,7 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_OptimizeObjectForAddingMultipleProperties) { Runtime_OptimizeObjectForAddingMultipleProperties) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSObject, object, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_SMI_ARG_CHECKED(properties, 1); CONVERT_SMI_ARG_CHECKED(properties, 1);
if (object->HasFastProperties()) { if (object->HasFastProperties()) {
JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties); JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties);
...@@ -1712,12 +1719,12 @@ RUNTIME_FUNCTION(MaybeObject*, ...@@ -1712,12 +1719,12 @@ RUNTIME_FUNCTION(MaybeObject*,
RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExec) { RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExec) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
CONVERT_ARG_CHECKED(String, subject, 1); CONVERT_ARG_HANDLE_CHECKED(String, subject, 1);
// Due to the way the JS calls are constructed this must be less than the // Due to the way the JS calls are constructed this must be less than the
// length of a string, i.e. it is always a Smi. We check anyway for security. // length of a string, i.e. it is always a Smi. We check anyway for security.
CONVERT_SMI_ARG_CHECKED(index, 2); CONVERT_SMI_ARG_CHECKED(index, 2);
CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); CONVERT_ARG_HANDLE_CHECKED(JSArray, last_match_info, 3);
RUNTIME_ASSERT(last_match_info->HasFastElements()); RUNTIME_ASSERT(last_match_info->HasFastElements());
RUNTIME_ASSERT(index >= 0); RUNTIME_ASSERT(index >= 0);
RUNTIME_ASSERT(index <= subject->length()); RUNTIME_ASSERT(index <= subject->length());
...@@ -1769,8 +1776,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) { ...@@ -1769,8 +1776,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) { RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
AssertNoAllocation no_alloc; AssertNoAllocation no_alloc;
ASSERT(args.length() == 5); ASSERT(args.length() == 5);
CONVERT_CHECKED(JSRegExp, regexp, args[0]); CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
CONVERT_CHECKED(String, source, args[1]); CONVERT_ARG_CHECKED(String, source, 1);
Object* global = args[2]; Object* global = args[2];
if (!global->IsTrue()) global = isolate->heap()->false_value(); if (!global->IsTrue()) global = isolate->heap()->false_value();
...@@ -1838,7 +1845,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) { ...@@ -1838,7 +1845,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_FinishArrayPrototypeSetup) { RUNTIME_FUNCTION(MaybeObject*, Runtime_FinishArrayPrototypeSetup) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSArray, prototype, 0); CONVERT_ARG_HANDLE_CHECKED(JSArray, prototype, 0);
// This is necessary to enable fast checks for absence of elements // This is necessary to enable fast checks for absence of elements
// on Array.prototype and below. // on Array.prototype and below.
prototype->set_elements(isolate->heap()->empty_fixed_array()); prototype->set_elements(isolate->heap()->empty_fixed_array());
...@@ -1867,7 +1874,7 @@ static Handle<JSFunction> InstallBuiltin(Isolate* isolate, ...@@ -1867,7 +1874,7 @@ static Handle<JSFunction> InstallBuiltin(Isolate* isolate,
RUNTIME_FUNCTION(MaybeObject*, Runtime_SpecialArrayFunctions) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SpecialArrayFunctions) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSObject, holder, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, holder, 0);
InstallBuiltin(isolate, holder, "pop", Builtins::kArrayPop); InstallBuiltin(isolate, holder, "pop", Builtins::kArrayPop);
InstallBuiltin(isolate, holder, "push", Builtins::kArrayPush); InstallBuiltin(isolate, holder, "push", Builtins::kArrayPush);
...@@ -1883,7 +1890,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SpecialArrayFunctions) { ...@@ -1883,7 +1890,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SpecialArrayFunctions) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSReceiver, callable, args[0]); CONVERT_ARG_CHECKED(JSReceiver, callable, 0);
if (!callable->IsJSFunction()) { if (!callable->IsJSFunction()) {
HandleScope scope(isolate); HandleScope scope(isolate);
...@@ -1911,7 +1918,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) { ...@@ -1911,7 +1918,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_MaterializeRegExpLiteral) { RUNTIME_FUNCTION(MaybeObject*, Runtime_MaterializeRegExpLiteral) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
CONVERT_ARG_CHECKED(FixedArray, literals, 0); CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
int index = args.smi_at(1); int index = args.smi_at(1);
Handle<String> pattern = args.at<String>(2); Handle<String> pattern = args.at<String>(2);
Handle<String> flags = args.at<String>(3); Handle<String> flags = args.at<String>(3);
...@@ -1942,7 +1949,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetName) { ...@@ -1942,7 +1949,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetName) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, f, args[0]); CONVERT_ARG_CHECKED(JSFunction, f, 0);
return f->shared()->name(); return f->shared()->name();
} }
...@@ -1951,8 +1958,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetName) { ...@@ -1951,8 +1958,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetName) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSFunction, f, args[0]); CONVERT_ARG_CHECKED(JSFunction, f, 0);
CONVERT_CHECKED(String, name, args[1]); CONVERT_ARG_CHECKED(String, name, 1);
f->shared()->set_name(name); f->shared()->set_name(name);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -1961,7 +1968,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetName) { ...@@ -1961,7 +1968,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetName) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionNameShouldPrintAsAnonymous) { RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionNameShouldPrintAsAnonymous) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, f, args[0]); CONVERT_ARG_CHECKED(JSFunction, f, 0);
return isolate->heap()->ToBoolean( return isolate->heap()->ToBoolean(
f->shared()->name_should_print_as_anonymous()); f->shared()->name_should_print_as_anonymous());
} }
...@@ -1970,7 +1977,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionNameShouldPrintAsAnonymous) { ...@@ -1970,7 +1977,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionNameShouldPrintAsAnonymous) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionMarkNameShouldPrintAsAnonymous) { RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionMarkNameShouldPrintAsAnonymous) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, f, args[0]); CONVERT_ARG_CHECKED(JSFunction, f, 0);
f->shared()->set_name_should_print_as_anonymous(true); f->shared()->set_name_should_print_as_anonymous(true);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -1980,7 +1987,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionRemovePrototype) { ...@@ -1980,7 +1987,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionRemovePrototype) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, f, args[0]); CONVERT_ARG_CHECKED(JSFunction, f, 0);
Object* obj = f->RemovePrototype(); Object* obj = f->RemovePrototype();
if (obj->IsFailure()) return obj; if (obj->IsFailure()) return obj;
...@@ -1992,7 +1999,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetScript) { ...@@ -1992,7 +1999,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetScript) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, fun, args[0]); CONVERT_ARG_CHECKED(JSFunction, fun, 0);
Handle<Object> script = Handle<Object>(fun->shared()->script(), isolate); Handle<Object> script = Handle<Object>(fun->shared()->script(), isolate);
if (!script->IsScript()) return isolate->heap()->undefined_value(); if (!script->IsScript()) return isolate->heap()->undefined_value();
...@@ -2004,7 +2011,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetSourceCode) { ...@@ -2004,7 +2011,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetSourceCode) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, f, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0);
Handle<SharedFunctionInfo> shared(f->shared()); Handle<SharedFunctionInfo> shared(f->shared());
return *shared->GetSourceCode(); return *shared->GetSourceCode();
} }
...@@ -2014,7 +2021,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetScriptSourcePosition) { ...@@ -2014,7 +2021,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetScriptSourcePosition) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, fun, args[0]); CONVERT_ARG_CHECKED(JSFunction, fun, 0);
int pos = fun->shared()->start_position(); int pos = fun->shared()->start_position();
return Smi::FromInt(pos); return Smi::FromInt(pos);
} }
...@@ -2023,7 +2030,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetScriptSourcePosition) { ...@@ -2023,7 +2030,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetScriptSourcePosition) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetPositionForOffset) { RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetPositionForOffset) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(Code, code, args[0]); CONVERT_ARG_CHECKED(Code, code, 0);
CONVERT_NUMBER_CHECKED(int, offset, Int32, args[1]); CONVERT_NUMBER_CHECKED(int, offset, Int32, args[1]);
RUNTIME_ASSERT(0 <= offset && offset < code->Size()); RUNTIME_ASSERT(0 <= offset && offset < code->Size());
...@@ -2037,8 +2044,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetInstanceClassName) { ...@@ -2037,8 +2044,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetInstanceClassName) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSFunction, fun, args[0]); CONVERT_ARG_CHECKED(JSFunction, fun, 0);
CONVERT_CHECKED(String, name, args[1]); CONVERT_ARG_CHECKED(String, name, 1);
fun->SetInstanceClassName(name); fun->SetInstanceClassName(name);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -2048,10 +2055,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetLength) { ...@@ -2048,10 +2055,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetLength) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSFunction, fun, args[0]); CONVERT_ARG_CHECKED(JSFunction, fun, 0);
CONVERT_CHECKED(Smi, length, args[1]); CONVERT_SMI_ARG_CHECKED(length, 1);
fun->shared()->set_length(length->value()); fun->shared()->set_length(length);
return length; return isolate->heap()->undefined_value();
} }
...@@ -2059,7 +2066,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetPrototype) { ...@@ -2059,7 +2066,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetPrototype) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSFunction, fun, args[0]); CONVERT_ARG_CHECKED(JSFunction, fun, 0);
ASSERT(fun->should_have_prototype()); ASSERT(fun->should_have_prototype());
Object* obj; Object* obj;
{ MaybeObject* maybe_obj = { MaybeObject* maybe_obj =
...@@ -2073,7 +2080,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetPrototype) { ...@@ -2073,7 +2080,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetPrototype) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) { RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) {
NoHandleAllocation ha; NoHandleAllocation ha;
RUNTIME_ASSERT(args.length() == 1); RUNTIME_ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, function, args[0]); CONVERT_ARG_CHECKED(JSFunction, function, 0);
MaybeObject* maybe_name = MaybeObject* maybe_name =
isolate->heap()->AllocateStringFromAscii(CStrVector("prototype")); isolate->heap()->AllocateStringFromAscii(CStrVector("prototype"));
...@@ -2129,7 +2136,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsAPIFunction) { ...@@ -2129,7 +2136,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsAPIFunction) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, f, args[0]); CONVERT_ARG_CHECKED(JSFunction, f, 0);
return isolate->heap()->ToBoolean(f->shared()->IsApiFunction()); return isolate->heap()->ToBoolean(f->shared()->IsApiFunction());
} }
...@@ -2138,7 +2145,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsBuiltin) { ...@@ -2138,7 +2145,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsBuiltin) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, f, args[0]); CONVERT_ARG_CHECKED(JSFunction, f, 0);
return isolate->heap()->ToBoolean(f->IsBuiltin()); return isolate->heap()->ToBoolean(f->IsBuiltin());
} }
...@@ -2147,7 +2154,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) { ...@@ -2147,7 +2154,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSFunction, target, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0);
Handle<Object> code = args.at<Object>(1); Handle<Object> code = args.at<Object>(1);
Handle<Context> context(target->context()); Handle<Context> context(target->context());
...@@ -2211,7 +2218,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) { ...@@ -2211,7 +2218,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetExpectedNumberOfProperties) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SetExpectedNumberOfProperties) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
CONVERT_SMI_ARG_CHECKED(num, 1); CONVERT_SMI_ARG_CHECKED(num, 1);
RUNTIME_ASSERT(num >= 0); RUNTIME_ASSERT(num >= 0);
SetExpectedNofProperties(function, num); SetExpectedNofProperties(function, num);
...@@ -2235,7 +2242,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCharCodeAt) { ...@@ -2235,7 +2242,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCharCodeAt) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(String, subject, args[0]); CONVERT_ARG_CHECKED(String, subject, 0);
Object* index = args[1]; Object* index = args[1];
RUNTIME_ASSERT(index->IsNumber()); RUNTIME_ASSERT(index->IsNumber());
...@@ -3212,7 +3219,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithEmptyString( ...@@ -3212,7 +3219,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithEmptyString(
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) {
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
CONVERT_CHECKED(String, subject, args[0]); CONVERT_ARG_CHECKED(String, subject, 0);
if (!subject->IsFlat()) { if (!subject->IsFlat()) {
Object* flat_subject; Object* flat_subject;
{ MaybeObject* maybe_flat_subject = subject->TryFlatten(); { MaybeObject* maybe_flat_subject = subject->TryFlatten();
...@@ -3223,7 +3230,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) { ...@@ -3223,7 +3230,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) {
subject = String::cast(flat_subject); subject = String::cast(flat_subject);
} }
CONVERT_CHECKED(String, replacement, args[2]); CONVERT_ARG_CHECKED(String, replacement, 2);
if (!replacement->IsFlat()) { if (!replacement->IsFlat()) {
Object* flat_replacement; Object* flat_replacement;
{ MaybeObject* maybe_flat_replacement = replacement->TryFlatten(); { MaybeObject* maybe_flat_replacement = replacement->TryFlatten();
...@@ -3234,8 +3241,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) { ...@@ -3234,8 +3241,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) {
replacement = String::cast(flat_replacement); replacement = String::cast(flat_replacement);
} }
CONVERT_CHECKED(JSRegExp, regexp, args[1]); CONVERT_ARG_CHECKED(JSRegExp, regexp, 1);
CONVERT_CHECKED(JSArray, last_match_info, args[3]); CONVERT_ARG_CHECKED(JSArray, last_match_info, 3);
ASSERT(last_match_info->HasFastElements()); ASSERT(last_match_info->HasFastElements());
...@@ -3305,9 +3312,9 @@ Handle<String> Runtime::StringReplaceOneCharWithString(Isolate* isolate, ...@@ -3305,9 +3312,9 @@ Handle<String> Runtime::StringReplaceOneCharWithString(Isolate* isolate,
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceOneCharWithString) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceOneCharWithString) {
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(String, subject, 0); CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
CONVERT_ARG_CHECKED(String, search, 1); CONVERT_ARG_HANDLE_CHECKED(String, search, 1);
CONVERT_ARG_CHECKED(String, replace, 2); CONVERT_ARG_HANDLE_CHECKED(String, replace, 2);
// If the cons string tree is too deep, we simply abort the recursion and // If the cons string tree is too deep, we simply abort the recursion and
// retry with a flattened subject string. // retry with a flattened subject string.
...@@ -3386,8 +3393,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringIndexOf) { ...@@ -3386,8 +3393,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringIndexOf) {
HandleScope scope(isolate); // create a new handle scope HandleScope scope(isolate); // create a new handle scope
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(String, sub, 0); CONVERT_ARG_HANDLE_CHECKED(String, sub, 0);
CONVERT_ARG_CHECKED(String, pat, 1); CONVERT_ARG_HANDLE_CHECKED(String, pat, 1);
Object* index = args[2]; Object* index = args[2];
uint32_t start_index; uint32_t start_index;
...@@ -3438,8 +3445,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringLastIndexOf) { ...@@ -3438,8 +3445,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringLastIndexOf) {
HandleScope scope(isolate); // create a new handle scope HandleScope scope(isolate); // create a new handle scope
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(String, sub, 0); CONVERT_ARG_HANDLE_CHECKED(String, sub, 0);
CONVERT_ARG_CHECKED(String, pat, 1); CONVERT_ARG_HANDLE_CHECKED(String, pat, 1);
Object* index = args[2]; Object* index = args[2];
uint32_t start_index; uint32_t start_index;
...@@ -3497,8 +3504,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringLocaleCompare) { ...@@ -3497,8 +3504,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringLocaleCompare) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(String, str1, args[0]); CONVERT_ARG_CHECKED(String, str1, 0);
CONVERT_CHECKED(String, str2, args[1]); CONVERT_ARG_CHECKED(String, str2, 1);
if (str1 == str2) return Smi::FromInt(0); // Equal. if (str1 == str2) return Smi::FromInt(0); // Equal.
int str1_length = str1->length(); int str1_length = str1->length();
...@@ -3545,7 +3552,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SubString) { ...@@ -3545,7 +3552,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SubString) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_CHECKED(String, value, args[0]); CONVERT_ARG_CHECKED(String, value, 0);
int start, end; int start, end;
// We have a fast integer-only case here to avoid a conversion to double in // We have a fast integer-only case here to avoid a conversion to double in
// the common case where from and to are Smis. // the common case where from and to are Smis.
...@@ -3571,9 +3578,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SubString) { ...@@ -3571,9 +3578,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SubString) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) {
ASSERT_EQ(3, args.length()); ASSERT_EQ(3, args.length());
CONVERT_ARG_CHECKED(String, subject, 0); CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
CONVERT_ARG_CHECKED(JSRegExp, regexp, 1); CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1);
CONVERT_ARG_CHECKED(JSArray, regexp_info, 2); CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2);
HandleScope handles; HandleScope handles;
Handle<Object> match = RegExpImpl::Exec(regexp, subject, 0, regexp_info); Handle<Object> match = RegExpImpl::Exec(regexp, subject, 0, regexp_info);
...@@ -3964,11 +3971,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExecMultiple) { ...@@ -3964,11 +3971,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExecMultiple) {
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
HandleScope handles(isolate); HandleScope handles(isolate);
CONVERT_ARG_CHECKED(String, subject, 1); CONVERT_ARG_HANDLE_CHECKED(String, subject, 1);
if (!subject->IsFlat()) FlattenString(subject); if (!subject->IsFlat()) FlattenString(subject);
CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
CONVERT_ARG_CHECKED(JSArray, last_match_info, 2); CONVERT_ARG_HANDLE_CHECKED(JSArray, last_match_info, 2);
CONVERT_ARG_CHECKED(JSArray, result_array, 3); CONVERT_ARG_HANDLE_CHECKED(JSArray, result_array, 3);
ASSERT(last_match_info->HasFastElements()); ASSERT(last_match_info->HasFastElements());
ASSERT(regexp->GetFlags().is_global()); ASSERT(regexp->GetFlags().is_global());
...@@ -4317,19 +4324,18 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_KeyedGetProperty) { ...@@ -4317,19 +4324,18 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_KeyedGetProperty) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineAccessorProperty) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineAccessorProperty) {
ASSERT(args.length() == 5); ASSERT(args.length() == 5);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
CONVERT_CHECKED(String, name, args[1]); CONVERT_ARG_CHECKED(String, name, 1);
CONVERT_CHECKED(Smi, flag_setter, args[2]); CONVERT_SMI_ARG_CHECKED(flag_setter, 2);
Object* fun = args[3]; Object* fun = args[3];
CONVERT_CHECKED(Smi, flag_attr, args[4]); CONVERT_SMI_ARG_CHECKED(unchecked, 4);
int unchecked = flag_attr->value();
RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);
RUNTIME_ASSERT(!obj->IsNull()); RUNTIME_ASSERT(!obj->IsNull());
RUNTIME_ASSERT(fun->IsSpecFunction() || fun->IsUndefined()); RUNTIME_ASSERT(fun->IsSpecFunction() || fun->IsUndefined());
return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr); return obj->DefineAccessor(name, flag_setter == 0, fun, attr);
} }
// Implements part of 8.12.9 DefineOwnProperty. // Implements part of 8.12.9 DefineOwnProperty.
...@@ -4341,12 +4347,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineAccessorProperty) { ...@@ -4341,12 +4347,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineAccessorProperty) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSObject, js_object, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, js_object, 0);
CONVERT_ARG_CHECKED(String, name, 1); CONVERT_ARG_HANDLE_CHECKED(String, name, 1);
Handle<Object> obj_value = args.at<Object>(2); Handle<Object> obj_value = args.at<Object>(2);
CONVERT_CHECKED(Smi, flag, args[3]); CONVERT_SMI_ARG_CHECKED(unchecked, 3);
int unchecked = flag->value();
RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);
...@@ -4667,7 +4672,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) { ...@@ -4667,7 +4672,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) {
StrictModeFlag strict_mode = kNonStrictMode; StrictModeFlag strict_mode = kNonStrictMode;
if (args.length() == 5) { if (args.length() == 5) {
CONVERT_STRICT_MODE_ARG(strict_mode_flag, 4); CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode_flag, 4);
strict_mode = strict_mode_flag; strict_mode = strict_mode_flag;
} }
...@@ -4715,10 +4720,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) { ...@@ -4715,10 +4720,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) {
RUNTIME_ASSERT(args.length() == 5); RUNTIME_ASSERT(args.length() == 5);
CONVERT_ARG_CHECKED(JSObject, object, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_SMI_ARG_CHECKED(store_index, 1); CONVERT_SMI_ARG_CHECKED(store_index, 1);
Handle<Object> value = args.at<Object>(2); Handle<Object> value = args.at<Object>(2);
CONVERT_ARG_CHECKED(FixedArray, literals, 3); CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3);
CONVERT_SMI_ARG_CHECKED(literal_index, 4); CONVERT_SMI_ARG_CHECKED(literal_index, 4);
HandleScope scope; HandleScope scope;
...@@ -4758,13 +4763,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) { ...@@ -4758,13 +4763,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) {
NoHandleAllocation ha; NoHandleAllocation ha;
RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); RUNTIME_ASSERT(args.length() == 3 || args.length() == 4);
CONVERT_CHECKED(JSObject, object, args[0]); CONVERT_ARG_CHECKED(JSObject, object, 0);
CONVERT_CHECKED(String, name, args[1]); CONVERT_ARG_CHECKED(String, name, 1);
// Compute attributes. // Compute attributes.
PropertyAttributes attributes = NONE; PropertyAttributes attributes = NONE;
if (args.length() == 4) { if (args.length() == 4) {
CONVERT_CHECKED(Smi, value_obj, args[3]); CONVERT_SMI_ARG_CHECKED(unchecked_value, 3);
int unchecked_value = value_obj->value();
// Only attribute bits should be set. // Only attribute bits should be set.
RUNTIME_ASSERT( RUNTIME_ASSERT(
(unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); (unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
...@@ -4780,9 +4784,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) { ...@@ -4780,9 +4784,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_CHECKED(JSReceiver, object, args[0]); CONVERT_ARG_CHECKED(JSReceiver, object, 0);
CONVERT_CHECKED(String, key, args[1]); CONVERT_ARG_CHECKED(String, key, 1);
CONVERT_STRICT_MODE_ARG(strict_mode, 2); CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 2);
return object->DeleteProperty(key, (strict_mode == kStrictMode) return object->DeleteProperty(key, (strict_mode == kStrictMode)
? JSReceiver::STRICT_DELETION ? JSReceiver::STRICT_DELETION
: JSReceiver::NORMAL_DELETION); : JSReceiver::NORMAL_DELETION);
...@@ -4810,7 +4814,7 @@ static Object* HasLocalPropertyImplementation(Isolate* isolate, ...@@ -4810,7 +4814,7 @@ static Object* HasLocalPropertyImplementation(Isolate* isolate,
RUNTIME_FUNCTION(MaybeObject*, Runtime_HasLocalProperty) { RUNTIME_FUNCTION(MaybeObject*, Runtime_HasLocalProperty) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(String, key, args[1]); CONVERT_ARG_CHECKED(String, key, 1);
uint32_t index; uint32_t index;
const bool key_is_array_index = key->AsArrayIndex(&index); const bool key_is_array_index = key->AsArrayIndex(&index);
...@@ -4848,8 +4852,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasLocalProperty) { ...@@ -4848,8 +4852,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasLocalProperty) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) { RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) {
NoHandleAllocation na; NoHandleAllocation na;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSReceiver, receiver, args[0]); CONVERT_ARG_CHECKED(JSReceiver, receiver, 0);
CONVERT_CHECKED(String, key, args[1]); CONVERT_ARG_CHECKED(String, key, 1);
bool result = receiver->HasProperty(key); bool result = receiver->HasProperty(key);
if (isolate->has_pending_exception()) return Failure::Exception(); if (isolate->has_pending_exception()) return Failure::Exception();
...@@ -4860,10 +4864,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) { ...@@ -4860,10 +4864,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_HasElement) { RUNTIME_FUNCTION(MaybeObject*, Runtime_HasElement) {
NoHandleAllocation na; NoHandleAllocation na;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSReceiver, receiver, args[0]); CONVERT_ARG_CHECKED(JSReceiver, receiver, 0);
CONVERT_CHECKED(Smi, index, args[1]); CONVERT_SMI_ARG_CHECKED(index, 1);
bool result = receiver->HasElement(index->value()); bool result = receiver->HasElement(index);
if (isolate->has_pending_exception()) return Failure::Exception(); if (isolate->has_pending_exception()) return Failure::Exception();
return isolate->heap()->ToBoolean(result); return isolate->heap()->ToBoolean(result);
} }
...@@ -4873,8 +4877,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) { ...@@ -4873,8 +4877,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSObject, object, args[0]); CONVERT_ARG_CHECKED(JSObject, object, 0);
CONVERT_CHECKED(String, key, args[1]); CONVERT_ARG_CHECKED(String, key, 1);
uint32_t index; uint32_t index;
if (key->AsArrayIndex(&index)) { if (key->AsArrayIndex(&index)) {
...@@ -4919,7 +4923,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) { ...@@ -4919,7 +4923,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPropertyNames) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPropertyNames) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSReceiver, object, 0); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
bool threw = false; bool threw = false;
Handle<JSArray> result = GetKeysFor(object, &threw); Handle<JSArray> result = GetKeysFor(object, &threw);
if (threw) return Failure::Exception(); if (threw) return Failure::Exception();
...@@ -4935,7 +4939,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPropertyNames) { ...@@ -4935,7 +4939,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPropertyNames) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPropertyNamesFast) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPropertyNamesFast) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSReceiver, raw_object, args[0]); CONVERT_ARG_CHECKED(JSReceiver, raw_object, 0);
if (raw_object->IsSimpleEnum()) return raw_object->map(); if (raw_object->IsSimpleEnum()) return raw_object->map();
...@@ -4976,7 +4980,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLocalPropertyNames) { ...@@ -4976,7 +4980,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLocalPropertyNames) {
if (!args[0]->IsJSObject()) { if (!args[0]->IsJSObject()) {
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
// Skip the global proxy as it has no properties and always delegates to the // Skip the global proxy as it has no properties and always delegates to the
// real global object. // real global object.
...@@ -5063,7 +5067,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLocalElementNames) { ...@@ -5063,7 +5067,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLocalElementNames) {
if (!args[0]->IsJSObject()) { if (!args[0]->IsJSObject()) {
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
int n = obj->NumberOfLocalElements(static_cast<PropertyAttributes>(NONE)); int n = obj->NumberOfLocalElements(static_cast<PropertyAttributes>(NONE));
Handle<FixedArray> names = isolate->factory()->NewFixedArray(n); Handle<FixedArray> names = isolate->factory()->NewFixedArray(n);
...@@ -5080,7 +5084,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetInterceptorInfo) { ...@@ -5080,7 +5084,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetInterceptorInfo) {
if (!args[0]->IsJSObject()) { if (!args[0]->IsJSObject()) {
return Smi::FromInt(0); return Smi::FromInt(0);
} }
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
int result = 0; int result = 0;
if (obj->HasNamedInterceptor()) result |= 2; if (obj->HasNamedInterceptor()) result |= 2;
...@@ -5095,7 +5099,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetInterceptorInfo) { ...@@ -5095,7 +5099,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetInterceptorInfo) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetNamedInterceptorPropertyNames) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetNamedInterceptorPropertyNames) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
if (obj->HasNamedInterceptor()) { if (obj->HasNamedInterceptor()) {
v8::Handle<v8::Array> result = GetKeysForNamedInterceptor(obj, obj); v8::Handle<v8::Array> result = GetKeysForNamedInterceptor(obj, obj);
...@@ -5110,7 +5114,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetNamedInterceptorPropertyNames) { ...@@ -5110,7 +5114,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetNamedInterceptorPropertyNames) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetIndexedInterceptorElementNames) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetIndexedInterceptorElementNames) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
if (obj->HasIndexedInterceptor()) { if (obj->HasIndexedInterceptor()) {
v8::Handle<v8::Array> result = GetKeysForIndexedInterceptor(obj, obj); v8::Handle<v8::Array> result = GetKeysForIndexedInterceptor(obj, obj);
...@@ -5122,7 +5126,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetIndexedInterceptorElementNames) { ...@@ -5122,7 +5126,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetIndexedInterceptorElementNames) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_LocalKeys) { RUNTIME_FUNCTION(MaybeObject*, Runtime_LocalKeys) {
ASSERT_EQ(args.length(), 1); ASSERT_EQ(args.length(), 1);
CONVERT_CHECKED(JSObject, raw_object, args[0]); CONVERT_ARG_CHECKED(JSObject, raw_object, 0);
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<JSObject> object(raw_object); Handle<JSObject> object(raw_object);
...@@ -5314,7 +5318,7 @@ static int ParseDecimalInteger(const char*s, int from, int to) { ...@@ -5314,7 +5318,7 @@ static int ParseDecimalInteger(const char*s, int from, int to) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToNumber) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToNumber) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(String, subject, args[0]); CONVERT_ARG_CHECKED(String, subject, 0);
subject->TryFlatten(); subject->TryFlatten();
// Fast case: short integer or some sorts of junk values. // Fast case: short integer or some sorts of junk values.
...@@ -5370,7 +5374,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringFromCharCodeArray) { ...@@ -5370,7 +5374,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringFromCharCodeArray) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSArray, codes, args[0]); CONVERT_ARG_CHECKED(JSArray, codes, 0);
int length = Smi::cast(codes->length())->value(); int length = Smi::cast(codes->length())->value();
// Check if the string can be ASCII. // Check if the string can be ASCII.
...@@ -5450,7 +5454,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_URIEscape) { ...@@ -5450,7 +5454,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_URIEscape) {
const char hex_chars[] = "0123456789ABCDEF"; const char hex_chars[] = "0123456789ABCDEF";
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(String, source, args[0]); CONVERT_ARG_CHECKED(String, source, 0);
source->TryFlatten(); source->TryFlatten();
...@@ -5568,7 +5572,7 @@ static inline int Unescape(String* source, ...@@ -5568,7 +5572,7 @@ static inline int Unescape(String* source,
RUNTIME_FUNCTION(MaybeObject*, Runtime_URIUnescape) { RUNTIME_FUNCTION(MaybeObject*, Runtime_URIUnescape) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(String, source, args[0]); CONVERT_ARG_CHECKED(String, source, 0);
source->TryFlatten(); source->TryFlatten();
...@@ -5825,7 +5829,7 @@ static MaybeObject* QuoteJsonString(Isolate* isolate, ...@@ -5825,7 +5829,7 @@ static MaybeObject* QuoteJsonString(Isolate* isolate,
RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONString) { RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONString) {
NoHandleAllocation ha; NoHandleAllocation ha;
CONVERT_CHECKED(String, str, args[0]); CONVERT_ARG_CHECKED(String, str, 0);
if (!str->IsFlat()) { if (!str->IsFlat()) {
MaybeObject* try_flatten = str->TryFlatten(); MaybeObject* try_flatten = str->TryFlatten();
Object* flat; Object* flat;
...@@ -5849,7 +5853,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONString) { ...@@ -5849,7 +5853,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONString) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONStringComma) { RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONStringComma) {
NoHandleAllocation ha; NoHandleAllocation ha;
CONVERT_CHECKED(String, str, args[0]); CONVERT_ARG_CHECKED(String, str, 0);
if (!str->IsFlat()) { if (!str->IsFlat()) {
MaybeObject* try_flatten = str->TryFlatten(); MaybeObject* try_flatten = str->TryFlatten();
Object* flat; Object* flat;
...@@ -5926,7 +5930,7 @@ static MaybeObject* QuoteJsonStringArray(Isolate* isolate, ...@@ -5926,7 +5930,7 @@ static MaybeObject* QuoteJsonStringArray(Isolate* isolate,
RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONStringArray) { RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONStringArray) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSArray, array, args[0]); CONVERT_ARG_CHECKED(JSArray, array, 0);
if (!array->HasFastElements()) return isolate->heap()->undefined_value(); if (!array->HasFastElements()) return isolate->heap()->undefined_value();
FixedArray* elements = FixedArray::cast(array->elements()); FixedArray* elements = FixedArray::cast(array->elements());
...@@ -5968,7 +5972,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONStringArray) { ...@@ -5968,7 +5972,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONStringArray) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringParseInt) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringParseInt) {
NoHandleAllocation ha; NoHandleAllocation ha;
CONVERT_CHECKED(String, s, args[0]); CONVERT_ARG_CHECKED(String, s, 0);
CONVERT_SMI_ARG_CHECKED(radix, 1); CONVERT_SMI_ARG_CHECKED(radix, 1);
s->TryFlatten(); s->TryFlatten();
...@@ -5981,7 +5985,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringParseInt) { ...@@ -5981,7 +5985,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringParseInt) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringParseFloat) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringParseFloat) {
NoHandleAllocation ha; NoHandleAllocation ha;
CONVERT_CHECKED(String, str, args[0]); CONVERT_ARG_CHECKED(String, str, 0);
// ECMA-262 section 15.1.2.3, empty string is NaN // ECMA-262 section 15.1.2.3, empty string is NaN
double value = StringToDouble(isolate->unicode_cache(), double value = StringToDouble(isolate->unicode_cache(),
...@@ -6230,7 +6234,7 @@ MUST_USE_RESULT static MaybeObject* ConvertCase( ...@@ -6230,7 +6234,7 @@ MUST_USE_RESULT static MaybeObject* ConvertCase(
Isolate* isolate, Isolate* isolate,
unibrow::Mapping<typename ConvertTraits::UnibrowConverter, 128>* mapping) { unibrow::Mapping<typename ConvertTraits::UnibrowConverter, 128>* mapping) {
NoHandleAllocation ha; NoHandleAllocation ha;
CONVERT_CHECKED(String, s, args[0]); CONVERT_ARG_CHECKED(String, s, 0);
s = s->TryFlattenGetString(); s = s->TryFlattenGetString();
const int length = s->length(); const int length = s->length();
...@@ -6292,9 +6296,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) { ...@@ -6292,9 +6296,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_CHECKED(String, s, args[0]); CONVERT_ARG_CHECKED(String, s, 0);
CONVERT_BOOLEAN_CHECKED(trimLeft, args[1]); CONVERT_BOOLEAN_ARG_CHECKED(trimLeft, 1);
CONVERT_BOOLEAN_CHECKED(trimRight, args[2]); CONVERT_BOOLEAN_ARG_CHECKED(trimRight, 2);
s->TryFlatten(); s->TryFlatten();
int length = s->length(); int length = s->length();
...@@ -6319,8 +6323,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) { ...@@ -6319,8 +6323,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) {
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
HandleScope handle_scope(isolate); HandleScope handle_scope(isolate);
CONVERT_ARG_CHECKED(String, subject, 0); CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
CONVERT_ARG_CHECKED(String, pattern, 1); CONVERT_ARG_HANDLE_CHECKED(String, pattern, 1);
CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[2]); CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[2]);
int subject_length = subject->length(); int subject_length = subject->length();
...@@ -6441,7 +6445,7 @@ static int CopyCachedAsciiCharsToArray(Heap* heap, ...@@ -6441,7 +6445,7 @@ static int CopyCachedAsciiCharsToArray(Heap* heap,
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToArray) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToArray) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(String, s, 0); CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[1]); CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[1]);
s = FlattenGetString(s); s = FlattenGetString(s);
...@@ -6492,7 +6496,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToArray) { ...@@ -6492,7 +6496,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToArray) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStringWrapper) { RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStringWrapper) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(String, value, args[0]); CONVERT_ARG_CHECKED(String, value, 0);
return value->ToObject(); return value->ToObject();
} }
...@@ -6683,8 +6687,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberMod) { ...@@ -6683,8 +6687,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberMod) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringAdd) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringAdd) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(String, str1, args[0]); CONVERT_ARG_CHECKED(String, str1, 0);
CONVERT_CHECKED(String, str2, args[1]); CONVERT_ARG_CHECKED(String, str2, 1);
isolate->counters()->string_add_runtime()->Increment(); isolate->counters()->string_add_runtime()->Increment();
return isolate->heap()->AllocateConsString(str1, str2); return isolate->heap()->AllocateConsString(str1, str2);
} }
...@@ -6732,13 +6736,13 @@ static inline void StringBuilderConcatHelper(String* special, ...@@ -6732,13 +6736,13 @@ static inline void StringBuilderConcatHelper(String* special,
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderConcat) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderConcat) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_CHECKED(JSArray, array, args[0]); CONVERT_ARG_CHECKED(JSArray, array, 0);
if (!args[1]->IsSmi()) { if (!args[1]->IsSmi()) {
isolate->context()->mark_out_of_memory(); isolate->context()->mark_out_of_memory();
return Failure::OutOfMemoryException(); return Failure::OutOfMemoryException();
} }
int array_length = args.smi_at(1); int array_length = args.smi_at(1);
CONVERT_CHECKED(String, special, args[2]); CONVERT_ARG_CHECKED(String, special, 2);
// This assumption is used by the slice encoding in one or two smis. // This assumption is used by the slice encoding in one or two smis.
ASSERT(Smi::kMaxValue >= String::kMaxLength); ASSERT(Smi::kMaxValue >= String::kMaxLength);
...@@ -6848,13 +6852,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderConcat) { ...@@ -6848,13 +6852,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderConcat) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderJoin) { RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderJoin) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_CHECKED(JSArray, array, args[0]); CONVERT_ARG_CHECKED(JSArray, array, 0);
if (!args[1]->IsSmi()) { if (!args[1]->IsSmi()) {
isolate->context()->mark_out_of_memory(); isolate->context()->mark_out_of_memory();
return Failure::OutOfMemoryException(); return Failure::OutOfMemoryException();
} }
int array_length = args.smi_at(1); int array_length = args.smi_at(1);
CONVERT_CHECKED(String, separator, args[2]); CONVERT_ARG_CHECKED(String, separator, 2);
if (!array->HasFastElements()) { if (!array->HasFastElements()) {
return isolate->Throw(isolate->heap()->illegal_argument_symbol()); return isolate->Throw(isolate->heap()->illegal_argument_symbol());
...@@ -6972,11 +6976,11 @@ static void JoinSparseArrayWithSeparator(FixedArray* elements, ...@@ -6972,11 +6976,11 @@ static void JoinSparseArrayWithSeparator(FixedArray* elements,
RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_CHECKED(JSArray, elements_array, args[0]); CONVERT_ARG_CHECKED(JSArray, elements_array, 0);
RUNTIME_ASSERT(elements_array->HasFastElements() || RUNTIME_ASSERT(elements_array->HasFastElements() ||
elements_array->HasFastSmiOnlyElements()); elements_array->HasFastSmiOnlyElements());
CONVERT_NUMBER_CHECKED(uint32_t, array_length, Uint32, args[1]); CONVERT_NUMBER_CHECKED(uint32_t, array_length, Uint32, args[1]);
CONVERT_CHECKED(String, separator, args[2]); CONVERT_ARG_CHECKED(String, separator, 2);
// elements_array is fast-mode JSarray of alternating positions // elements_array is fast-mode JSarray of alternating positions
// (increasing order) and strings. // (increasing order) and strings.
// array_length is length of original array (used to add separators); // array_length is length of original array (used to add separators);
...@@ -6998,7 +7002,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) { ...@@ -6998,7 +7002,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) {
FixedArray* elements = FixedArray::cast(elements_array->elements()); FixedArray* elements = FixedArray::cast(elements_array->elements());
for (int i = 0; i < elements_length; i += 2) { for (int i = 0; i < elements_length; i += 2) {
RUNTIME_ASSERT(elements->get(i)->IsNumber()); RUNTIME_ASSERT(elements->get(i)->IsNumber());
CONVERT_CHECKED(String, string, elements->get(i + 1)); RUNTIME_ASSERT(elements->get(i + 1)->IsString());
String* string = String::cast(elements->get(i + 1));
int length = string->length(); int length = string->length();
if (is_ascii && !string->IsAsciiRepresentation()) { if (is_ascii && !string->IsAsciiRepresentation()) {
is_ascii = false; is_ascii = false;
...@@ -7156,8 +7161,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringEquals) { ...@@ -7156,8 +7161,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringEquals) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(String, x, args[0]); CONVERT_ARG_CHECKED(String, x, 0);
CONVERT_CHECKED(String, y, args[1]); CONVERT_ARG_CHECKED(String, y, 1);
bool not_equal = !x->Equals(y); bool not_equal = !x->Equals(y);
// This is slightly convoluted because the value that signifies // This is slightly convoluted because the value that signifies
...@@ -7188,12 +7193,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberCompare) { ...@@ -7188,12 +7193,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberCompare) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_SmiLexicographicCompare) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SmiLexicographicCompare) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_SMI_ARG_CHECKED(x_value, 0);
// Extract the integer values from the Smis. CONVERT_SMI_ARG_CHECKED(y_value, 1);
CONVERT_CHECKED(Smi, x, args[0]);
CONVERT_CHECKED(Smi, y, args[1]);
int x_value = x->value();
int y_value = y->value();
// If the integers are equal so are the string representations. // If the integers are equal so are the string representations.
if (x_value == y_value) return Smi::FromInt(EQUAL); if (x_value == y_value) return Smi::FromInt(EQUAL);
...@@ -7333,8 +7334,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCompare) { ...@@ -7333,8 +7334,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCompare) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(String, x, args[0]); CONVERT_ARG_CHECKED(String, x, 0);
CONVERT_CHECKED(String, y, args[1]); CONVERT_ARG_CHECKED(String, y, 1);
isolate->counters()->string_compare_runtime()->Increment(); isolate->counters()->string_compare_runtime()->Increment();
...@@ -7941,7 +7942,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateYMDFromTime) { ...@@ -7941,7 +7942,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateYMDFromTime) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_DOUBLE_ARG_CHECKED(t, 0); CONVERT_DOUBLE_ARG_CHECKED(t, 0);
CONVERT_CHECKED(JSArray, res_array, args[1]); CONVERT_ARG_CHECKED(JSArray, res_array, 1);
int year, month, day; int year, month, day;
DateYMDFromTime(static_cast<int>(floor(t / 86400000)), year, month, day); DateYMDFromTime(static_cast<int>(floor(t / 86400000)), year, month, day);
...@@ -8096,9 +8097,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStrictArgumentsFast) { ...@@ -8096,9 +8097,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStrictArgumentsFast) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_NewClosure) { RUNTIME_FUNCTION(MaybeObject*, Runtime_NewClosure) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(Context, context, 0); CONVERT_ARG_HANDLE_CHECKED(Context, context, 0);
CONVERT_ARG_CHECKED(SharedFunctionInfo, shared, 1); CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 1);
CONVERT_BOOLEAN_CHECKED(pretenure, args[2]); CONVERT_BOOLEAN_ARG_CHECKED(pretenure, 2);
// The caller ensures that we pretenure closures that are assigned // The caller ensures that we pretenure closures that are assigned
// directly to properties. // directly to properties.
...@@ -8164,7 +8165,7 @@ static SmartArrayPointer<Handle<Object> > GetCallerArguments( ...@@ -8164,7 +8165,7 @@ static SmartArrayPointer<Handle<Object> > GetCallerArguments(
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionBindArguments) { RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionBindArguments) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
CONVERT_ARG_CHECKED(JSFunction, bound_function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, bound_function, 0);
RUNTIME_ASSERT(args[3]->IsNumber()); RUNTIME_ASSERT(args[3]->IsNumber());
Handle<Object> bindee = args.at<Object>(1); Handle<Object> bindee = args.at<Object>(1);
...@@ -8222,7 +8223,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionBindArguments) { ...@@ -8222,7 +8223,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionBindArguments) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_BoundFunctionGetBindings) { RUNTIME_FUNCTION(MaybeObject*, Runtime_BoundFunctionGetBindings) {
HandleScope handles(isolate); HandleScope handles(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSReceiver, callable, 0); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, callable, 0);
if (callable->IsJSFunction()) { if (callable->IsJSFunction()) {
Handle<JSFunction> function = Handle<JSFunction>::cast(callable); Handle<JSFunction> function = Handle<JSFunction>::cast(callable);
if (function->shared()->bound()) { if (function->shared()->bound()) {
...@@ -8239,7 +8240,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObjectFromBound) { ...@@ -8239,7 +8240,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObjectFromBound) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
// First argument is a function to use as a constructor. // First argument is a function to use as a constructor.
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
RUNTIME_ASSERT(function->shared()->bound()); RUNTIME_ASSERT(function->shared()->bound());
// The argument is a bound function. Extract its bound arguments // The argument is a bound function. Extract its bound arguments
...@@ -8380,7 +8381,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FinalizeInstanceSize) { ...@@ -8380,7 +8381,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FinalizeInstanceSize) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
function->shared()->CompleteInobjectSlackTracking(); function->shared()->CompleteInobjectSlackTracking();
TrySettingInlineConstructStub(isolate, function); TrySettingInlineConstructStub(isolate, function);
...@@ -8569,7 +8570,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyOSR) { ...@@ -8569,7 +8570,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyOSR) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_DeoptimizeFunction) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DeoptimizeFunction) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
if (!function->IsOptimized()) return isolate->heap()->undefined_value(); if (!function->IsOptimized()) return isolate->heap()->undefined_value();
Deoptimizer::DeoptimizeFunction(*function); Deoptimizer::DeoptimizeFunction(*function);
...@@ -8590,7 +8591,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RunningInSimulator) { ...@@ -8590,7 +8591,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RunningInSimulator) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); if (!function->IsOptimizable()) return isolate->heap()->undefined_value();
function->MarkForLazyRecompilation(); function->MarkForLazyRecompilation();
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
...@@ -8608,7 +8609,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { ...@@ -8608,7 +8609,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) {
if (FLAG_always_opt) { if (FLAG_always_opt) {
return Smi::FromInt(3); // 3 == "always". return Smi::FromInt(3); // 3 == "always".
} }
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes". return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes".
: Smi::FromInt(2); // 2 == "no". : Smi::FromInt(2); // 2 == "no".
} }
...@@ -8617,7 +8618,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { ...@@ -8617,7 +8618,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
return Smi::FromInt(function->shared()->opt_count()); return Smi::FromInt(function->shared()->opt_count());
} }
...@@ -8625,7 +8626,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) { ...@@ -8625,7 +8626,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
// We're not prepared to handle a function with arguments object. // We're not prepared to handle a function with arguments object.
ASSERT(!function->shared()->uses_arguments()); ASSERT(!function->shared()->uses_arguments());
...@@ -8754,9 +8755,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CheckIsBootstrapping) { ...@@ -8754,9 +8755,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CheckIsBootstrapping) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_Call) { RUNTIME_FUNCTION(MaybeObject*, Runtime_Call) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() >= 2); ASSERT(args.length() >= 2);
CONVERT_CHECKED(JSReceiver, fun, args[args.length() - 1]);
Object* receiver = args[0];
int argc = args.length() - 2; int argc = args.length() - 2;
CONVERT_ARG_CHECKED(JSReceiver, fun, argc + 1);
Object* receiver = args[0];
// If there are too many arguments, allocate argv via malloc. // If there are too many arguments, allocate argv via malloc.
const int argv_small_size = 10; const int argv_small_size = 10;
...@@ -8790,9 +8791,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Call) { ...@@ -8790,9 +8791,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Call) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_Apply) { RUNTIME_FUNCTION(MaybeObject*, Runtime_Apply) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 5); ASSERT(args.length() == 5);
CONVERT_ARG_CHECKED(JSReceiver, fun, 0); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, fun, 0);
Handle<Object> receiver = args.at<Object>(1); Handle<Object> receiver = args.at<Object>(1);
CONVERT_ARG_CHECKED(JSObject, arguments, 2); CONVERT_ARG_HANDLE_CHECKED(JSObject, arguments, 2);
CONVERT_SMI_ARG_CHECKED(offset, 3); CONVERT_SMI_ARG_CHECKED(offset, 3);
CONVERT_SMI_ARG_CHECKED(argc, 4); CONVERT_SMI_ARG_CHECKED(argc, 4);
ASSERT(offset >= 0); ASSERT(offset >= 0);
...@@ -8842,7 +8843,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) { ...@@ -8842,7 +8843,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, function, args[0]); CONVERT_ARG_CHECKED(JSFunction, function, 0);
int length = function->shared()->scope_info()->ContextLength(); int length = function->shared()->scope_info()->ContextLength();
Object* result; Object* result;
{ MaybeObject* maybe_result = { MaybeObject* maybe_result =
...@@ -8954,8 +8955,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteContextSlot) { ...@@ -8954,8 +8955,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteContextSlot) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(Context, context, 0); CONVERT_ARG_HANDLE_CHECKED(Context, context, 0);
CONVERT_ARG_CHECKED(String, name, 1); CONVERT_ARG_HANDLE_CHECKED(String, name, 1);
int index; int index;
PropertyAttributes attributes; PropertyAttributes attributes;
...@@ -9147,8 +9148,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) { ...@@ -9147,8 +9148,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) {
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
Handle<Object> value(args[0], isolate); Handle<Object> value(args[0], isolate);
CONVERT_ARG_CHECKED(Context, context, 1); CONVERT_ARG_HANDLE_CHECKED(Context, context, 1);
CONVERT_ARG_CHECKED(String, name, 2); CONVERT_ARG_HANDLE_CHECKED(String, name, 2);
CONVERT_LANGUAGE_MODE_ARG(language_mode, 3); CONVERT_LANGUAGE_MODE_ARG(language_mode, 3);
StrictModeFlag strict_mode = (language_mode == CLASSIC_MODE) StrictModeFlag strict_mode = (language_mode == CLASSIC_MODE)
? kNonStrictMode : kStrictMode; ? kNonStrictMode : kStrictMode;
...@@ -9381,10 +9382,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateParseString) { ...@@ -9381,10 +9382,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateParseString) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(String, str, 0); CONVERT_ARG_HANDLE_CHECKED(String, str, 0);
FlattenString(str); FlattenString(str);
CONVERT_ARG_CHECKED(JSArray, output, 1); CONVERT_ARG_HANDLE_CHECKED(JSArray, output, 1);
MaybeObject* maybe_result_array = MaybeObject* maybe_result_array =
output->EnsureCanContainHeapObjectElements(); output->EnsureCanContainHeapObjectElements();
...@@ -9454,7 +9455,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalReceiver) { ...@@ -9454,7 +9455,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalReceiver) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) { RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT_EQ(1, args.length()); ASSERT_EQ(1, args.length());
CONVERT_ARG_CHECKED(String, source, 0); CONVERT_ARG_HANDLE_CHECKED(String, source, 0);
source = Handle<String>(source->TryFlattenGetString()); source = Handle<String>(source->TryFlattenGetString());
// Optimized fast case where we only have ASCII characters. // Optimized fast case where we only have ASCII characters.
...@@ -9493,7 +9494,7 @@ bool CodeGenerationFromStringsAllowed(Isolate* isolate, ...@@ -9493,7 +9494,7 @@ bool CodeGenerationFromStringsAllowed(Isolate* isolate,
RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileString) { RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileString) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT_EQ(1, args.length()); ASSERT_EQ(1, args.length());
CONVERT_ARG_CHECKED(String, source, 0); CONVERT_ARG_HANDLE_CHECKED(String, source, 0);
// Extract global context. // Extract global context.
Handle<Context> context(isolate->context()->global_context()); Handle<Context> context(isolate->context()->global_context());
...@@ -9584,7 +9585,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNewFunctionAttributes) { ...@@ -9584,7 +9585,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNewFunctionAttributes) {
// as specified in ECMA262, 15.3.5.2. // as specified in ECMA262, 15.3.5.2.
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, func, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
Handle<Map> map = func->shared()->is_classic_mode() Handle<Map> map = func->shared()->is_classic_mode()
? isolate->function_instance_map() ? isolate->function_instance_map()
...@@ -9602,7 +9603,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInNewSpace) { ...@@ -9602,7 +9603,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInNewSpace) {
// Use as fallback for allocation in generated code when NewSpace // Use as fallback for allocation in generated code when NewSpace
// is full. // is full.
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(Smi, size_smi, 0); CONVERT_ARG_HANDLE_CHECKED(Smi, size_smi, 0);
int size = size_smi->value(); int size = size_smi->value();
RUNTIME_ASSERT(IsAligned(size, kPointerSize)); RUNTIME_ASSERT(IsAligned(size, kPointerSize));
RUNTIME_ASSERT(size > 0); RUNTIME_ASSERT(size > 0);
...@@ -9624,8 +9625,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInNewSpace) { ...@@ -9624,8 +9625,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInNewSpace) {
// false otherwise. // false otherwise.
RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) { RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSArray, array, args[0]); CONVERT_ARG_CHECKED(JSArray, array, 0);
CONVERT_CHECKED(JSObject, element, args[1]); CONVERT_ARG_CHECKED(JSObject, element, 1);
RUNTIME_ASSERT(array->HasFastElements() || array->HasFastSmiOnlyElements()); RUNTIME_ASSERT(array->HasFastElements() || array->HasFastSmiOnlyElements());
int length = Smi::cast(array->length())->value(); int length = Smi::cast(array->length())->value();
FixedArray* elements = FixedArray::cast(array->elements()); FixedArray* elements = FixedArray::cast(array->elements());
...@@ -10116,7 +10117,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayConcat) { ...@@ -10116,7 +10117,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayConcat) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
HandleScope handle_scope(isolate); HandleScope handle_scope(isolate);
CONVERT_ARG_CHECKED(JSArray, arguments, 0); CONVERT_ARG_HANDLE_CHECKED(JSArray, arguments, 0);
int argument_count = static_cast<int>(arguments->length()->Number()); int argument_count = static_cast<int>(arguments->length()->Number());
RUNTIME_ASSERT(arguments->HasFastElements()); RUNTIME_ASSERT(arguments->HasFastElements());
Handle<FixedArray> elements(FixedArray::cast(arguments->elements())); Handle<FixedArray> elements(FixedArray::cast(arguments->elements()));
...@@ -10211,7 +10212,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalPrint) { ...@@ -10211,7 +10212,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalPrint) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(String, string, args[0]); CONVERT_ARG_CHECKED(String, string, 0);
StringInputBuffer buffer(string); StringInputBuffer buffer(string);
while (buffer.has_more()) { while (buffer.has_more()) {
uint16_t character = buffer.GetNext(); uint16_t character = buffer.GetNext();
...@@ -10227,7 +10228,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalPrint) { ...@@ -10227,7 +10228,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalPrint) {
// Returns the number of non-undefined elements collected. // Returns the number of non-undefined elements collected.
RUNTIME_FUNCTION(MaybeObject*, Runtime_RemoveArrayHoles) { RUNTIME_FUNCTION(MaybeObject*, Runtime_RemoveArrayHoles) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSObject, object, args[0]); CONVERT_ARG_CHECKED(JSObject, object, 0);
CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[1]); CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[1]);
return object->PrepareElementsForSort(limit); return object->PrepareElementsForSort(limit);
} }
...@@ -10236,8 +10237,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RemoveArrayHoles) { ...@@ -10236,8 +10237,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RemoveArrayHoles) {
// Move contents of argument 0 (an array) to argument 1 (an array) // Move contents of argument 0 (an array) to argument 1 (an array)
RUNTIME_FUNCTION(MaybeObject*, Runtime_MoveArrayContents) { RUNTIME_FUNCTION(MaybeObject*, Runtime_MoveArrayContents) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSArray, from, args[0]); CONVERT_ARG_CHECKED(JSArray, from, 0);
CONVERT_CHECKED(JSArray, to, args[1]); CONVERT_ARG_CHECKED(JSArray, to, 1);
FixedArrayBase* new_elements = from->elements(); FixedArrayBase* new_elements = from->elements();
MaybeObject* maybe_new_map; MaybeObject* maybe_new_map;
ElementsKind elements_kind; ElementsKind elements_kind;
...@@ -10268,7 +10269,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MoveArrayContents) { ...@@ -10268,7 +10269,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MoveArrayContents) {
// How many elements does this object/array have? // How many elements does this object/array have?
RUNTIME_FUNCTION(MaybeObject*, Runtime_EstimateNumberOfElements) { RUNTIME_FUNCTION(MaybeObject*, Runtime_EstimateNumberOfElements) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSObject, object, args[0]); CONVERT_ARG_CHECKED(JSObject, object, 0);
HeapObject* elements = object->elements(); HeapObject* elements = object->elements();
if (elements->IsDictionary()) { if (elements->IsDictionary()) {
int result = SeededNumberDictionary::cast(elements)->NumberOfElements(); int result = SeededNumberDictionary::cast(elements)->NumberOfElements();
...@@ -10286,7 +10287,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SwapElements) { ...@@ -10286,7 +10287,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SwapElements) {
ASSERT_EQ(3, args.length()); ASSERT_EQ(3, args.length());
CONVERT_ARG_CHECKED(JSObject, object, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
Handle<Object> key1 = args.at<Object>(1); Handle<Object> key1 = args.at<Object>(1);
Handle<Object> key2 = args.at<Object>(2); Handle<Object> key2 = args.at<Object>(2);
...@@ -10319,7 +10320,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SwapElements) { ...@@ -10319,7 +10320,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SwapElements) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArrayKeys) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArrayKeys) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSObject, array, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
CONVERT_NUMBER_CHECKED(uint32_t, length, Uint32, args[1]); CONVERT_NUMBER_CHECKED(uint32_t, length, Uint32, args[1]);
if (array->elements()->IsDictionary()) { if (array->elements()->IsDictionary()) {
// Create an array and get all the keys into it, then remove all the // Create an array and get all the keys into it, then remove all the
...@@ -10368,27 +10369,26 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineAccessor) { ...@@ -10368,27 +10369,26 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineAccessor) {
// Compute attributes. // Compute attributes.
PropertyAttributes attributes = NONE; PropertyAttributes attributes = NONE;
if (args.length() == 5) { if (args.length() == 5) {
CONVERT_CHECKED(Smi, attrs, args[4]); CONVERT_SMI_ARG_CHECKED(value, 4);
int value = attrs->value();
// Only attribute bits should be set. // Only attribute bits should be set.
ASSERT((value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); ASSERT((value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
attributes = static_cast<PropertyAttributes>(value); attributes = static_cast<PropertyAttributes>(value);
} }
CONVERT_CHECKED(JSObject, obj, args[0]); CONVERT_ARG_CHECKED(JSObject, obj, 0);
CONVERT_CHECKED(String, name, args[1]); CONVERT_ARG_CHECKED(String, name, 1);
CONVERT_CHECKED(Smi, flag, args[2]); CONVERT_SMI_ARG_CHECKED(flag, 2);
CONVERT_CHECKED(JSFunction, fun, args[3]); CONVERT_ARG_CHECKED(JSFunction, fun, 3);
return obj->DefineAccessor(name, flag->value() == 0, fun, attributes); return obj->DefineAccessor(name, flag == 0, fun, attributes);
} }
RUNTIME_FUNCTION(MaybeObject*, Runtime_LookupAccessor) { RUNTIME_FUNCTION(MaybeObject*, Runtime_LookupAccessor) {
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_CHECKED(JSObject, obj, args[0]); CONVERT_ARG_CHECKED(JSObject, obj, 0);
CONVERT_CHECKED(String, name, args[1]); CONVERT_ARG_CHECKED(String, name, 1);
CONVERT_CHECKED(Smi, flag, args[2]); CONVERT_SMI_ARG_CHECKED(flag, 2);
return obj->LookupAccessor(name, flag->value() == 0); return obj->LookupAccessor(name, flag == 0);
} }
...@@ -10406,8 +10406,8 @@ static Smi* WrapFrameId(StackFrame::Id id) { ...@@ -10406,8 +10406,8 @@ static Smi* WrapFrameId(StackFrame::Id id) {
} }
static StackFrame::Id UnwrapFrameId(Smi* wrapped) { static StackFrame::Id UnwrapFrameId(int wrapped) {
return static_cast<StackFrame::Id>(wrapped->value() << 2); return static_cast<StackFrame::Id>(wrapped << 2);
} }
...@@ -10510,8 +10510,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPropertyDetails) { ...@@ -10510,8 +10510,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPropertyDetails) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
CONVERT_ARG_CHECKED(String, name, 1); CONVERT_ARG_HANDLE_CHECKED(String, name, 1);
// Make sure to set the current context to the context before the debugger was // Make sure to set the current context to the context before the debugger was
// entered (if the debugger is entered). The reason for switching context here // entered (if the debugger is entered). The reason for switching context here
...@@ -10608,8 +10608,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetProperty) { ...@@ -10608,8 +10608,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetProperty) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
CONVERT_ARG_CHECKED(String, name, 1); CONVERT_ARG_HANDLE_CHECKED(String, name, 1);
LookupResult result(isolate); LookupResult result(isolate);
obj->Lookup(*name, &result); obj->Lookup(*name, &result);
...@@ -10624,9 +10624,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetProperty) { ...@@ -10624,9 +10624,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetProperty) {
// args[0]: smi with property details. // args[0]: smi with property details.
RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyTypeFromDetails) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyTypeFromDetails) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(Smi, details, args[0]); CONVERT_PROPERTY_DETAILS_CHECKED(details, 0);
PropertyType type = PropertyDetails(details).type(); return Smi::FromInt(static_cast<int>(details.type()));
return Smi::FromInt(static_cast<int>(type));
} }
...@@ -10634,9 +10633,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyTypeFromDetails) { ...@@ -10634,9 +10633,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyTypeFromDetails) {
// args[0]: smi with property details. // args[0]: smi with property details.
RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyAttributesFromDetails) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyAttributesFromDetails) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(Smi, details, args[0]); CONVERT_PROPERTY_DETAILS_CHECKED(details, 0);
PropertyAttributes attributes = PropertyDetails(details).attributes(); return Smi::FromInt(static_cast<int>(details.attributes()));
return Smi::FromInt(static_cast<int>(attributes));
} }
...@@ -10644,9 +10642,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyAttributesFromDetails) { ...@@ -10644,9 +10642,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyAttributesFromDetails) {
// args[0]: smi with property details. // args[0]: smi with property details.
RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyIndexFromDetails) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyIndexFromDetails) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(Smi, details, args[0]); CONVERT_PROPERTY_DETAILS_CHECKED(details, 0);
int index = PropertyDetails(details).index(); return Smi::FromInt(details.index());
return Smi::FromInt(index);
} }
...@@ -10656,9 +10653,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyIndexFromDetails) { ...@@ -10656,9 +10653,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyIndexFromDetails) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugNamedInterceptorPropertyValue) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugNamedInterceptorPropertyValue) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
RUNTIME_ASSERT(obj->HasNamedInterceptor()); RUNTIME_ASSERT(obj->HasNamedInterceptor());
CONVERT_ARG_CHECKED(String, name, 1); CONVERT_ARG_HANDLE_CHECKED(String, name, 1);
PropertyAttributes attributes; PropertyAttributes attributes;
return obj->GetPropertyWithInterceptor(*obj, *name, &attributes); return obj->GetPropertyWithInterceptor(*obj, *name, &attributes);
...@@ -10671,7 +10668,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugNamedInterceptorPropertyValue) { ...@@ -10671,7 +10668,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugNamedInterceptorPropertyValue) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugIndexedInterceptorElementValue) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugIndexedInterceptorElementValue) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
RUNTIME_ASSERT(obj->HasIndexedInterceptor()); RUNTIME_ASSERT(obj->HasIndexedInterceptor());
CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]); CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]);
...@@ -11607,7 +11604,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { ...@@ -11607,7 +11604,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) {
RUNTIME_ARGUMENTS(isolate, args)); RUNTIME_ARGUMENTS(isolate, args));
if (!maybe_check->ToObject(&check)) return maybe_check; if (!maybe_check->ToObject(&check)) return maybe_check;
} }
CONVERT_CHECKED(Smi, wrapped_id, args[1]); CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
// Get the frame where the debugging is performed. // Get the frame where the debugging is performed.
StackFrame::Id id = UnwrapFrameId(wrapped_id); StackFrame::Id id = UnwrapFrameId(wrapped_id);
...@@ -11649,7 +11646,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeDetails) { ...@@ -11649,7 +11646,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeDetails) {
RUNTIME_ARGUMENTS(isolate, args)); RUNTIME_ARGUMENTS(isolate, args));
if (!maybe_check->ToObject(&check)) return maybe_check; if (!maybe_check->ToObject(&check)) return maybe_check;
} }
CONVERT_CHECKED(Smi, wrapped_id, args[1]); CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
CONVERT_NUMBER_CHECKED(int, index, Int32, args[3]); CONVERT_NUMBER_CHECKED(int, index, Int32, args[3]);
...@@ -11789,7 +11786,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetThreadDetails) { ...@@ -11789,7 +11786,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetThreadDetails) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDisableBreak) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDisableBreak) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_BOOLEAN_CHECKED(disable_break, args[0]); CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 0);
isolate->debug()->set_disable_break(disable_break); isolate->debug()->set_disable_break(disable_break);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -11799,7 +11796,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetBreakLocations) { ...@@ -11799,7 +11796,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetBreakLocations) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, fun, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
Handle<SharedFunctionInfo> shared(fun->shared()); Handle<SharedFunctionInfo> shared(fun->shared());
// Find the number of break points // Find the number of break points
Handle<Object> break_locations = Debug::GetSourceBreakLocations(shared); Handle<Object> break_locations = Debug::GetSourceBreakLocations(shared);
...@@ -11817,7 +11814,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetBreakLocations) { ...@@ -11817,7 +11814,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetBreakLocations) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetFunctionBreakPoint) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SetFunctionBreakPoint) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(JSFunction, fun, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
Handle<SharedFunctionInfo> shared(fun->shared()); Handle<SharedFunctionInfo> shared(fun->shared());
CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]);
RUNTIME_ASSERT(source_position >= 0); RUNTIME_ASSERT(source_position >= 0);
...@@ -11923,7 +11920,7 @@ Object* Runtime::FindSharedFunctionInfoInScript(Isolate* isolate, ...@@ -11923,7 +11920,7 @@ Object* Runtime::FindSharedFunctionInfoInScript(Isolate* isolate,
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetScriptBreakPoint) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SetScriptBreakPoint) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(JSValue, wrapper, 0); CONVERT_ARG_HANDLE_CHECKED(JSValue, wrapper, 0);
CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]);
RUNTIME_ASSERT(source_position >= 0); RUNTIME_ASSERT(source_position >= 0);
Handle<Object> break_point_object_arg = args.at<Object>(2); Handle<Object> break_point_object_arg = args.at<Object>(2);
...@@ -11973,7 +11970,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ChangeBreakOnException) { ...@@ -11973,7 +11970,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ChangeBreakOnException) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
RUNTIME_ASSERT(args[0]->IsNumber()); RUNTIME_ASSERT(args[0]->IsNumber());
CONVERT_BOOLEAN_CHECKED(enable, args[1]); CONVERT_BOOLEAN_ARG_CHECKED(enable, 1);
// If the number doesn't match an enum value, the ChangeBreakOnException // If the number doesn't match an enum value, the ChangeBreakOnException
// function will default to affecting caught exceptions. // function will default to affecting caught exceptions.
...@@ -12188,10 +12185,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) { ...@@ -12188,10 +12185,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
return maybe_check_result; return maybe_check_result;
} }
} }
CONVERT_CHECKED(Smi, wrapped_id, args[1]); CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
CONVERT_ARG_CHECKED(String, source, 3); CONVERT_ARG_HANDLE_CHECKED(String, source, 3);
CONVERT_BOOLEAN_CHECKED(disable_break, args[4]); CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4);
Handle<Object> additional_context(args[5]); Handle<Object> additional_context(args[5]);
// Handle the processing of break. // Handle the processing of break.
...@@ -12327,8 +12324,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) { ...@@ -12327,8 +12324,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
return maybe_check_result; return maybe_check_result;
} }
} }
CONVERT_ARG_CHECKED(String, source, 1); CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
CONVERT_BOOLEAN_CHECKED(disable_break, args[2]); CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2);
Handle<Object> additional_context(args[3]); Handle<Object> additional_context(args[3]);
// Handle the processing of break. // Handle the processing of break.
...@@ -12501,7 +12498,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugReferencedBy) { ...@@ -12501,7 +12498,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugReferencedBy) {
// Object* locals that are not protected by handles. // Object* locals that are not protected by handles.
// Check parameters. // Check parameters.
CONVERT_CHECKED(JSObject, target, args[0]); CONVERT_ARG_CHECKED(JSObject, target, 0);
Object* instance_filter = args[1]; Object* instance_filter = args[1];
RUNTIME_ASSERT(instance_filter->IsUndefined() || RUNTIME_ASSERT(instance_filter->IsUndefined() ||
instance_filter->IsJSObject()); instance_filter->IsJSObject());
...@@ -12589,7 +12586,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugConstructedBy) { ...@@ -12589,7 +12586,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugConstructedBy) {
"%DebugConstructedBy"); "%DebugConstructedBy");
// Check parameters. // Check parameters.
CONVERT_CHECKED(JSFunction, constructor, args[0]); CONVERT_ARG_CHECKED(JSFunction, constructor, 0);
CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[1]);
RUNTIME_ASSERT(max_references >= 0); RUNTIME_ASSERT(max_references >= 0);
...@@ -12633,7 +12630,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugConstructedBy) { ...@@ -12633,7 +12630,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugConstructedBy) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPrototype) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPrototype) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSObject, obj, args[0]); CONVERT_ARG_CHECKED(JSObject, obj, 0);
// Use the __proto__ accessor. // Use the __proto__ accessor.
return Accessors::ObjectPrototype.getter(obj, NULL); return Accessors::ObjectPrototype.getter(obj, NULL);
...@@ -12652,7 +12649,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) { ...@@ -12652,7 +12649,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
// Get the function and make sure it is compiled. // Get the function and make sure it is compiled.
CONVERT_ARG_CHECKED(JSFunction, func, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
Handle<SharedFunctionInfo> shared(func->shared()); Handle<SharedFunctionInfo> shared(func->shared());
if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) { if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) {
return Failure::Exception(); return Failure::Exception();
...@@ -12668,7 +12665,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) { ...@@ -12668,7 +12665,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
// Get the function and make sure it is compiled. // Get the function and make sure it is compiled.
CONVERT_ARG_CHECKED(JSFunction, func, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
Handle<SharedFunctionInfo> shared(func->shared()); Handle<SharedFunctionInfo> shared(func->shared());
if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) { if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) {
return Failure::Exception(); return Failure::Exception();
...@@ -12683,7 +12680,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) { ...@@ -12683,7 +12680,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) {
NoHandleAllocation ha; NoHandleAllocation ha;
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(JSFunction, f, args[0]); CONVERT_ARG_CHECKED(JSFunction, f, 0);
return f->shared()->inferred_name(); return f->shared()->inferred_name();
} }
...@@ -12720,7 +12717,7 @@ RUNTIME_FUNCTION(MaybeObject*, ...@@ -12720,7 +12717,7 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_LiveEditFindSharedFunctionInfosForScript) { Runtime_LiveEditFindSharedFunctionInfosForScript) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_CHECKED(JSValue, script_value, args[0]); CONVERT_ARG_CHECKED(JSValue, script_value, 0);
Handle<Script> script = Handle<Script>(Script::cast(script_value->value())); Handle<Script> script = Handle<Script>(Script::cast(script_value->value()));
...@@ -12766,8 +12763,8 @@ RUNTIME_FUNCTION(MaybeObject*, ...@@ -12766,8 +12763,8 @@ RUNTIME_FUNCTION(MaybeObject*,
RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditGatherCompileInfo) { RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditGatherCompileInfo) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_CHECKED(JSValue, script, args[0]); CONVERT_ARG_CHECKED(JSValue, script, 0);
CONVERT_ARG_CHECKED(String, source, 1); CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle = Handle<Script>(Script::cast(script->value()));
JSArray* result = LiveEdit::GatherCompileInfo(script_handle, source); JSArray* result = LiveEdit::GatherCompileInfo(script_handle, source);
...@@ -12785,13 +12782,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditGatherCompileInfo) { ...@@ -12785,13 +12782,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditGatherCompileInfo) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceScript) { RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceScript) {
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_CHECKED(JSValue, original_script_value, args[0]); CONVERT_ARG_CHECKED(JSValue, original_script_value, 0);
CONVERT_ARG_CHECKED(String, new_source, 1); CONVERT_ARG_HANDLE_CHECKED(String, new_source, 1);
Handle<Object> old_script_name(args[2], isolate); Handle<Object> old_script_name(args[2], isolate);
CONVERT_CHECKED(Script, original_script_pointer, RUNTIME_ASSERT(original_script_value->value()->IsScript());
original_script_value->value()); Handle<Script> original_script(Script::cast(original_script_value->value()));
Handle<Script> original_script(original_script_pointer);
Object* old_script = LiveEdit::ChangeScriptSource(original_script, Object* old_script = LiveEdit::ChangeScriptSource(original_script,
new_source, new_source,
...@@ -12809,7 +12805,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceScript) { ...@@ -12809,7 +12805,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceScript) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSourceUpdated) { RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSourceUpdated) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSArray, shared_info, 0); CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0);
return LiveEdit::FunctionSourceUpdated(shared_info); return LiveEdit::FunctionSourceUpdated(shared_info);
} }
...@@ -12818,8 +12814,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSourceUpdated) { ...@@ -12818,8 +12814,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSourceUpdated) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceFunctionCode) { RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceFunctionCode) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSArray, new_compile_info, 0); CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0);
CONVERT_ARG_CHECKED(JSArray, shared_info, 1); CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 1);
return LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info); return LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info);
} }
...@@ -12834,7 +12830,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSetScript) { ...@@ -12834,7 +12830,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSetScript) {
if (function_object->IsJSValue()) { if (function_object->IsJSValue()) {
Handle<JSValue> function_wrapper = Handle<JSValue>::cast(function_object); Handle<JSValue> function_wrapper = Handle<JSValue>::cast(function_object);
if (script_object->IsJSValue()) { if (script_object->IsJSValue()) {
CONVERT_CHECKED(Script, script, JSValue::cast(*script_object)->value()); RUNTIME_ASSERT(JSValue::cast(*script_object)->value()->IsScript());
Script* script = Script::cast(JSValue::cast(*script_object)->value());
script_object = Handle<Object>(script, isolate); script_object = Handle<Object>(script, isolate);
} }
...@@ -12854,9 +12851,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceRefToNestedFunction) { ...@@ -12854,9 +12851,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceRefToNestedFunction) {
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSValue, parent_wrapper, 0); CONVERT_ARG_HANDLE_CHECKED(JSValue, parent_wrapper, 0);
CONVERT_ARG_CHECKED(JSValue, orig_wrapper, 1); CONVERT_ARG_HANDLE_CHECKED(JSValue, orig_wrapper, 1);
CONVERT_ARG_CHECKED(JSValue, subst_wrapper, 2); CONVERT_ARG_HANDLE_CHECKED(JSValue, subst_wrapper, 2);
LiveEdit::ReplaceRefToNestedFunction(parent_wrapper, orig_wrapper, LiveEdit::ReplaceRefToNestedFunction(parent_wrapper, orig_wrapper,
subst_wrapper); subst_wrapper);
...@@ -12873,8 +12870,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceRefToNestedFunction) { ...@@ -12873,8 +12870,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceRefToNestedFunction) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditPatchFunctionPositions) { RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditPatchFunctionPositions) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSArray, shared_array, 0); CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0);
CONVERT_ARG_CHECKED(JSArray, position_change_array, 1); CONVERT_ARG_HANDLE_CHECKED(JSArray, position_change_array, 1);
return LiveEdit::PatchFunctionPositions(shared_array, position_change_array); return LiveEdit::PatchFunctionPositions(shared_array, position_change_array);
} }
...@@ -12887,8 +12884,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditPatchFunctionPositions) { ...@@ -12887,8 +12884,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditPatchFunctionPositions) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCheckAndDropActivations) { RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCheckAndDropActivations) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSArray, shared_array, 0); CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0);
CONVERT_BOOLEAN_CHECKED(do_drop, args[1]); CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 1);
return *LiveEdit::CheckAndDropActivations(shared_array, do_drop); return *LiveEdit::CheckAndDropActivations(shared_array, do_drop);
} }
...@@ -12899,8 +12896,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCheckAndDropActivations) { ...@@ -12899,8 +12896,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCheckAndDropActivations) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCompareStrings) { RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCompareStrings) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(String, s1, 0); CONVERT_ARG_HANDLE_CHECKED(String, s1, 0);
CONVERT_ARG_CHECKED(String, s2, 1); CONVERT_ARG_HANDLE_CHECKED(String, s2, 1);
return *LiveEdit::CompareStrings(s1, s2); return *LiveEdit::CompareStrings(s1, s2);
} }
...@@ -12911,7 +12908,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCompareStrings) { ...@@ -12911,7 +12908,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCompareStrings) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]);
Handle<Code> code(function->code(), isolate); Handle<Code> code(function->code(), isolate);
...@@ -12948,8 +12945,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) { ...@@ -12948,8 +12945,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_ExecuteInDebugContext) { RUNTIME_FUNCTION(MaybeObject*, Runtime_ExecuteInDebugContext) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
CONVERT_BOOLEAN_CHECKED(without_debugger, args[1]); CONVERT_BOOLEAN_ARG_CHECKED(without_debugger, 1);
Handle<Object> result; Handle<Object> result;
bool pending_exception; bool pending_exception;
...@@ -12973,7 +12970,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ExecuteInDebugContext) { ...@@ -12973,7 +12970,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ExecuteInDebugContext) {
// Sets a v8 flag. // Sets a v8 flag.
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetFlags) { RUNTIME_FUNCTION(MaybeObject*, Runtime_SetFlags) {
CONVERT_CHECKED(String, arg, args[0]); CONVERT_ARG_CHECKED(String, arg, 0);
SmartArrayPointer<char> flags = SmartArrayPointer<char> flags =
arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
FlagList::SetFlagsFromString(*flags, StrLength(*flags)); FlagList::SetFlagsFromString(*flags, StrLength(*flags));
...@@ -13043,7 +13040,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DumpLOL) { ...@@ -13043,7 +13040,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DumpLOL) {
CONVERT_SMI_ARG_CHECKED(id2, 1); CONVERT_SMI_ARG_CHECKED(id2, 1);
CONVERT_SMI_ARG_CHECKED(start, 2); CONVERT_SMI_ARG_CHECKED(start, 2);
CONVERT_SMI_ARG_CHECKED(count, 3); CONVERT_SMI_ARG_CHECKED(count, 3);
CONVERT_ARG_CHECKED(JSObject, filter_obj, 4); CONVERT_ARG_HANDLE_CHECKED(JSObject, filter_obj, 4);
EnterDebugger enter_debugger; EnterDebugger enter_debugger;
return LiveObjectList::Dump(id1, id2, start, count, filter_obj); return LiveObjectList::Dump(id1, id2, start, count, filter_obj);
#else #else
...@@ -13070,7 +13067,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLOLObj) { ...@@ -13070,7 +13067,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLOLObj) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLOLObjId) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLOLObjId) {
#ifdef LIVE_OBJECT_LIST #ifdef LIVE_OBJECT_LIST
HandleScope scope; HandleScope scope;
CONVERT_ARG_CHECKED(String, address, 0); CONVERT_ARG_HANDLE_CHECKED(String, address, 0);
Object* result = LiveObjectList::GetObjId(address); Object* result = LiveObjectList::GetObjId(address);
return result; return result;
#else #else
...@@ -13088,7 +13085,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLOLObjRetainers) { ...@@ -13088,7 +13085,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLOLObjRetainers) {
RUNTIME_ASSERT(args[2]->IsUndefined() || args[2]->IsBoolean()); RUNTIME_ASSERT(args[2]->IsUndefined() || args[2]->IsBoolean());
RUNTIME_ASSERT(args[3]->IsUndefined() || args[3]->IsSmi()); RUNTIME_ASSERT(args[3]->IsUndefined() || args[3]->IsSmi());
RUNTIME_ASSERT(args[4]->IsUndefined() || args[4]->IsSmi()); RUNTIME_ASSERT(args[4]->IsUndefined() || args[4]->IsSmi());
CONVERT_ARG_CHECKED(JSObject, filter_obj, 5); CONVERT_ARG_HANDLE_CHECKED(JSObject, filter_obj, 5);
Handle<JSObject> instance_filter; Handle<JSObject> instance_filter;
if (args[1]->IsJSObject()) { if (args[1]->IsJSObject()) {
...@@ -13189,7 +13186,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SummarizeLOL) { ...@@ -13189,7 +13186,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SummarizeLOL) {
HandleScope scope; HandleScope scope;
CONVERT_SMI_ARG_CHECKED(id1, 0); CONVERT_SMI_ARG_CHECKED(id1, 0);
CONVERT_SMI_ARG_CHECKED(id2, 1); CONVERT_SMI_ARG_CHECKED(id2, 1);
CONVERT_ARG_CHECKED(JSObject, filter_obj, 2); CONVERT_ARG_HANDLE_CHECKED(JSObject, filter_obj, 2);
EnterDebugger enter_debugger; EnterDebugger enter_debugger;
return LiveObjectList::Summarize(id1, id2, filter_obj); return LiveObjectList::Summarize(id1, id2, filter_obj);
...@@ -13257,7 +13254,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScript) { ...@@ -13257,7 +13254,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScript) {
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_CHECKED(String, script_name, args[0]); CONVERT_ARG_CHECKED(String, script_name, 0);
// Find the requested script. // Find the requested script.
Handle<Object> result = Handle<Object> result =
...@@ -13312,7 +13309,7 @@ static bool ShowFrameInStackTrace(StackFrame* raw_frame, ...@@ -13312,7 +13309,7 @@ static bool ShowFrameInStackTrace(StackFrame* raw_frame,
// native code offset. // native code offset.
RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectStackTrace) { RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectStackTrace) {
ASSERT_EQ(args.length(), 3); ASSERT_EQ(args.length(), 3);
CONVERT_ARG_CHECKED(JSObject, error_object, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0);
Handle<Object> caller = args.at<Object>(1); Handle<Object> caller = args.at<Object>(1);
CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]); CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]);
...@@ -13397,7 +13394,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Abort) { ...@@ -13397,7 +13394,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Abort) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) {
// This is only called from codegen, so checks might be more lax. // This is only called from codegen, so checks might be more lax.
CONVERT_CHECKED(JSFunctionResultCache, cache, args[0]); CONVERT_ARG_CHECKED(JSFunctionResultCache, cache, 0);
Object* key = args[1]; Object* key = args[1];
int finger_index = cache->finger_index(); int finger_index = cache->finger_index();
...@@ -13493,8 +13490,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) { ...@@ -13493,8 +13490,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_NewMessageObject) { RUNTIME_FUNCTION(MaybeObject*, Runtime_NewMessageObject) {
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(String, type, 0); CONVERT_ARG_HANDLE_CHECKED(String, type, 0);
CONVERT_ARG_CHECKED(JSArray, arguments, 1); CONVERT_ARG_HANDLE_CHECKED(JSArray, arguments, 1);
return *isolate->factory()->NewJSMessageObject( return *isolate->factory()->NewJSMessageObject(
type, type,
arguments, arguments,
...@@ -13507,25 +13504,25 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewMessageObject) { ...@@ -13507,25 +13504,25 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewMessageObject) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetType) { RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetType) {
CONVERT_CHECKED(JSMessageObject, message, args[0]); CONVERT_ARG_CHECKED(JSMessageObject, message, 0);
return message->type(); return message->type();
} }
RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetArguments) { RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetArguments) {
CONVERT_CHECKED(JSMessageObject, message, args[0]); CONVERT_ARG_CHECKED(JSMessageObject, message, 0);
return message->arguments(); return message->arguments();
} }
RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetStartPosition) { RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetStartPosition) {
CONVERT_CHECKED(JSMessageObject, message, args[0]); CONVERT_ARG_CHECKED(JSMessageObject, message, 0);
return Smi::FromInt(message->start_position()); return Smi::FromInt(message->start_position());
} }
RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetScript) { RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetScript) {
CONVERT_CHECKED(JSMessageObject, message, args[0]); CONVERT_ARG_CHECKED(JSMessageObject, message, 0);
return message->script(); return message->script();
} }
...@@ -13579,8 +13576,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ListNatives) { ...@@ -13579,8 +13576,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ListNatives) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_Log) { RUNTIME_FUNCTION(MaybeObject*, Runtime_Log) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(String, format, args[0]); CONVERT_ARG_CHECKED(String, format, 0);
CONVERT_CHECKED(JSArray, elms, args[1]); CONVERT_ARG_CHECKED(JSArray, elms, 1);
String::FlatContent format_content = format->GetFlatContent(); String::FlatContent format_content = format->GetFlatContent();
RUNTIME_ASSERT(format_content.IsAscii()); RUNTIME_ASSERT(format_content.IsAscii());
Vector<const char> chars = format_content.ToAsciiVector(); Vector<const char> chars = format_content.ToAsciiVector();
...@@ -13597,7 +13594,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IS_VAR) { ...@@ -13597,7 +13594,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IS_VAR) {
#define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \ #define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \
RUNTIME_FUNCTION(MaybeObject*, Runtime_Has##Name) { \ RUNTIME_FUNCTION(MaybeObject*, Runtime_Has##Name) { \
CONVERT_CHECKED(JSObject, obj, args[0]); \ CONVERT_ARG_CHECKED(JSObject, obj, 0); \
return isolate->heap()->ToBoolean(obj->Has##Name()); \ return isolate->heap()->ToBoolean(obj->Has##Name()); \
} }
...@@ -13621,8 +13618,8 @@ ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalDoubleElements) ...@@ -13621,8 +13618,8 @@ ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalDoubleElements)
RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) { RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(JSObject, obj1, args[0]); CONVERT_ARG_CHECKED(JSObject, obj1, 0);
CONVERT_CHECKED(JSObject, obj2, args[1]); CONVERT_ARG_CHECKED(JSObject, obj2, 1);
return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); return isolate->heap()->ToBoolean(obj1->map() == obj2->map());
} }
......
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