Index: src/runtime.cc |
=================================================================== |
--- src/runtime.cc (revision 8259) |
+++ src/runtime.cc (working copy) |
@@ -81,19 +81,19 @@ |
RUNTIME_ASSERT(obj->IsBoolean()); \ |
bool name = (obj)->IsTrue(); |
-// Cast the given object to a Smi and store its value in an int variable |
-// with the given name. If the object is not a Smi call IllegalOperation |
+// 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 |
// and return. |
-#define CONVERT_SMI_CHECKED(name, obj) \ |
- RUNTIME_ASSERT(obj->IsSmi()); \ |
- int name = Smi::cast(obj)->value(); |
+#define CONVERT_SMI_ARG_CHECKED(name, index) \ |
+ RUNTIME_ASSERT(args[index]->IsSmi()); \ |
+ int name = args.smi_at(index); |
-// Cast the given object to a double and store it in a variable with |
-// the given name. If the object is not a number (as opposed to |
+// Cast the given argument to a double and store it in a variable with |
+// the given name. If the argument is not a number (as opposed to |
// the number not-a-number) call IllegalOperation and return. |
-#define CONVERT_DOUBLE_CHECKED(name, obj) \ |
- RUNTIME_ASSERT(obj->IsNumber()); \ |
- double name = (obj)->Number(); |
+#define CONVERT_DOUBLE_ARG_CHECKED(name, index) \ |
+ RUNTIME_ASSERT(args[index]->IsNumber()); \ |
+ double name = args.number_at(index); |
// Call the specified converter on the object *comand store the result in |
// a variable of the specified type with the given name. If the |
@@ -482,7 +482,7 @@ |
HandleScope scope(isolate); |
ASSERT(args.length() == 3); |
CONVERT_ARG_CHECKED(FixedArray, literals, 0); |
- CONVERT_SMI_CHECKED(literals_index, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
CONVERT_ARG_CHECKED(FixedArray, elements, 2); |
Handle<Object> object = |
@@ -499,9 +499,9 @@ |
HandleScope scope(isolate); |
ASSERT(args.length() == 4); |
CONVERT_ARG_CHECKED(FixedArray, literals, 0); |
- CONVERT_SMI_CHECKED(literals_index, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
CONVERT_ARG_CHECKED(FixedArray, constant_properties, 2); |
- CONVERT_SMI_CHECKED(flags, args[3]); |
+ CONVERT_SMI_ARG_CHECKED(flags, 3); |
bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; |
bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; |
@@ -525,9 +525,9 @@ |
HandleScope scope(isolate); |
ASSERT(args.length() == 4); |
CONVERT_ARG_CHECKED(FixedArray, literals, 0); |
- CONVERT_SMI_CHECKED(literals_index, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
CONVERT_ARG_CHECKED(FixedArray, constant_properties, 2); |
- CONVERT_SMI_CHECKED(flags, args[3]); |
+ CONVERT_SMI_ARG_CHECKED(flags, 3); |
bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; |
bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; |
@@ -551,7 +551,7 @@ |
HandleScope scope(isolate); |
ASSERT(args.length() == 3); |
CONVERT_ARG_CHECKED(FixedArray, literals, 0); |
- CONVERT_SMI_CHECKED(literals_index, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
CONVERT_ARG_CHECKED(FixedArray, elements, 2); |
// Check if boilerplate exists. If not, create it first. |
@@ -570,7 +570,7 @@ |
HandleScope scope(isolate); |
ASSERT(args.length() == 3); |
CONVERT_ARG_CHECKED(FixedArray, literals, 0); |
- CONVERT_SMI_CHECKED(literals_index, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
CONVERT_ARG_CHECKED(FixedArray, elements, 2); |
// Check if boilerplate exists. If not, create it first. |
@@ -1111,9 +1111,8 @@ |
Handle<Context> context = args.at<Context>(0); |
CONVERT_ARG_CHECKED(FixedArray, pairs, 1); |
- bool is_eval = Smi::cast(args[2])->value() == 1; |
- StrictModeFlag strict_mode = |
- static_cast<StrictModeFlag>(Smi::cast(args[3])->value()); |
+ bool is_eval = args.smi_at(2) == 1; |
+ StrictModeFlag strict_mode = static_cast<StrictModeFlag>(args.smi_at(3)); |
ASSERT(strict_mode == kStrictMode || strict_mode == kNonStrictMode); |
// Compute the property attributes. According to ECMA-262, section |
@@ -1252,8 +1251,7 @@ |
CONVERT_ARG_CHECKED(Context, context, 0); |
Handle<String> name(String::cast(args[1])); |
- PropertyAttributes mode = |
- static_cast<PropertyAttributes>(Smi::cast(args[2])->value()); |
+ PropertyAttributes mode = static_cast<PropertyAttributes>(args.smi_at(2)); |
RUNTIME_ASSERT(mode == READ_ONLY || mode == NONE); |
Handle<Object> initial_value(args[3], isolate); |
@@ -1366,8 +1364,7 @@ |
CONVERT_ARG_CHECKED(String, name, 0); |
GlobalObject* global = isolate->context()->global(); |
RUNTIME_ASSERT(args[1]->IsSmi()); |
- StrictModeFlag strict_mode = |
- static_cast<StrictModeFlag>(Smi::cast(args[1])->value()); |
+ StrictModeFlag strict_mode = static_cast<StrictModeFlag>(args.smi_at(1)); |
ASSERT(strict_mode == kStrictMode || strict_mode == kNonStrictMode); |
// According to ECMA-262, section 12.2, page 62, the property must |
@@ -1649,7 +1646,7 @@ |
HandleScope scope(isolate); |
ASSERT(args.length() == 2); |
CONVERT_ARG_CHECKED(JSObject, object, 0); |
- CONVERT_SMI_CHECKED(properties, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(properties, 1); |
if (object->HasFastProperties()) { |
NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties); |
} |
@@ -1664,7 +1661,7 @@ |
CONVERT_ARG_CHECKED(String, subject, 1); |
// 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. |
- CONVERT_SMI_CHECKED(index, args[2]); |
+ CONVERT_SMI_ARG_CHECKED(index, 2); |
CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); |
RUNTIME_ASSERT(last_match_info->HasFastElements()); |
RUNTIME_ASSERT(index >= 0); |
@@ -1681,7 +1678,7 @@ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) { |
ASSERT(args.length() == 3); |
- CONVERT_SMI_CHECKED(elements_count, args[0]); |
+ CONVERT_SMI_ARG_CHECKED(elements_count, 0); |
if (elements_count > JSArray::kMaxFastElementsLength) { |
return isolate->ThrowIllegalOperation(); |
} |
@@ -1836,7 +1833,7 @@ |
HandleScope scope(isolate); |
ASSERT(args.length() == 4); |
CONVERT_ARG_CHECKED(FixedArray, literals, 0); |
- int index = Smi::cast(args[1])->value(); |
+ int index = args.smi_at(1); |
Handle<String> pattern = args.at<String>(2); |
Handle<String> flags = args.at<String>(3); |
@@ -2062,7 +2059,7 @@ |
HandleScope scope(isolate); |
ASSERT(args.length() == 2); |
CONVERT_ARG_CHECKED(JSFunction, function, 0); |
- CONVERT_SMI_CHECKED(num, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(num, 1); |
RUNTIME_ASSERT(num >= 0); |
SetExpectedNofProperties(function, num); |
return isolate->heap()->undefined_value(); |
@@ -3116,17 +3113,17 @@ |
ASSERT(args.length() == 3); |
CONVERT_CHECKED(String, value, args[0]); |
- Object* from = args[1]; |
- Object* to = args[2]; |
int start, end; |
// We have a fast integer-only case here to avoid a conversion to double in |
// the common case where from and to are Smis. |
- if (from->IsSmi() && to->IsSmi()) { |
- start = Smi::cast(from)->value(); |
- end = Smi::cast(to)->value(); |
+ if (args[1]->IsSmi() && args[2]->IsSmi()) { |
+ CONVERT_SMI_ARG_CHECKED(from_number, 1); |
+ CONVERT_SMI_ARG_CHECKED(to_number, 2); |
+ start = from_number; |
+ end = to_number; |
} else { |
- CONVERT_DOUBLE_CHECKED(from_number, from); |
- CONVERT_DOUBLE_CHECKED(to_number, to); |
+ CONVERT_DOUBLE_ARG_CHECKED(from_number, 1); |
+ CONVERT_DOUBLE_ARG_CHECKED(to_number, 2); |
start = FastD2I(from_number); |
end = FastD2I(to_number); |
} |
@@ -3562,12 +3559,12 @@ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToRadixString) { |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_SMI_CHECKED(radix, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(radix, 1); |
RUNTIME_ASSERT(2 <= radix && radix <= 36); |
// Fast case where the result is a one character string. |
if (args[0]->IsSmi()) { |
- int value = Smi::cast(args[0])->value(); |
+ int value = args.smi_at(0); |
if (value >= 0 && value < radix) { |
// Character array used for conversion. |
static const char kCharTable[] = "0123456789abcdefghijklmnopqrstuvwxyz"; |
@@ -3577,7 +3574,7 @@ |
} |
// Slow case. |
- CONVERT_DOUBLE_CHECKED(value, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(value, 0); |
if (isnan(value)) { |
return isolate->heap()->AllocateStringFromAscii(CStrVector("NaN")); |
} |
@@ -3599,7 +3596,7 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(value, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(value, 0); |
if (isnan(value)) { |
return isolate->heap()->AllocateStringFromAscii(CStrVector("NaN")); |
} |
@@ -3609,7 +3606,7 @@ |
} |
return isolate->heap()->AllocateStringFromAscii(CStrVector("Infinity")); |
} |
- CONVERT_DOUBLE_CHECKED(f_number, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(f_number, 1); |
int f = FastD2I(f_number); |
RUNTIME_ASSERT(f >= 0); |
char* str = DoubleToFixedCString(value, f); |
@@ -3624,7 +3621,7 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(value, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(value, 0); |
if (isnan(value)) { |
return isolate->heap()->AllocateStringFromAscii(CStrVector("NaN")); |
} |
@@ -3634,7 +3631,7 @@ |
} |
return isolate->heap()->AllocateStringFromAscii(CStrVector("Infinity")); |
} |
- CONVERT_DOUBLE_CHECKED(f_number, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(f_number, 1); |
int f = FastD2I(f_number); |
RUNTIME_ASSERT(f >= -1 && f <= 20); |
char* str = DoubleToExponentialCString(value, f); |
@@ -3649,7 +3646,7 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(value, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(value, 0); |
if (isnan(value)) { |
return isolate->heap()->AllocateStringFromAscii(CStrVector("NaN")); |
} |
@@ -3659,7 +3656,7 @@ |
} |
return isolate->heap()->AllocateStringFromAscii(CStrVector("Infinity")); |
} |
- CONVERT_DOUBLE_CHECKED(f_number, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(f_number, 1); |
int f = FastD2I(f_number); |
RUNTIME_ASSERT(f >= 1 && f <= 21); |
char* str = DoubleToPrecisionCString(value, f); |
@@ -3821,7 +3818,7 @@ |
// Fast case for string indexing using [] with a smi index. |
HandleScope scope(isolate); |
Handle<String> str = args.at<String>(0); |
- int index = Smi::cast(args[1])->value(); |
+ int index = args.smi_at(1); |
if (index >= 0 && index < str->length()) { |
Handle<Object> result = GetCharAt(str, index); |
return *result; |
@@ -4124,7 +4121,7 @@ |
Handle<Object> object = args.at<Object>(0); |
Handle<Object> key = args.at<Object>(1); |
Handle<Object> value = args.at<Object>(2); |
- CONVERT_SMI_CHECKED(unchecked_attributes, args[3]); |
+ CONVERT_SMI_ARG_CHECKED(unchecked_attributes, 3); |
RUNTIME_ASSERT( |
(unchecked_attributes & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
// Compute attributes. |
@@ -4133,7 +4130,7 @@ |
StrictModeFlag strict_mode = kNonStrictMode; |
if (args.length() == 5) { |
- CONVERT_SMI_CHECKED(strict_unchecked, args[4]); |
+ CONVERT_SMI_ARG_CHECKED(strict_unchecked, 4); |
RUNTIME_ASSERT(strict_unchecked == kStrictMode || |
strict_unchecked == kNonStrictMode); |
strict_mode = static_cast<StrictModeFlag>(strict_unchecked); |
@@ -4194,7 +4191,7 @@ |
CONVERT_CHECKED(JSObject, object, args[0]); |
CONVERT_CHECKED(String, key, args[1]); |
- CONVERT_SMI_CHECKED(strict, args[2]); |
+ CONVERT_SMI_ARG_CHECKED(strict, 2); |
return object->DeleteProperty(key, (strict == kStrictMode) |
? JSObject::STRICT_DELETION |
: JSObject::NORMAL_DELETION); |
@@ -5352,7 +5349,7 @@ |
NoHandleAllocation ha; |
CONVERT_CHECKED(String, s, args[0]); |
- CONVERT_SMI_CHECKED(radix, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(radix, 1); |
s->TryFlatten(); |
@@ -5941,7 +5938,7 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 1); |
- CONVERT_DOUBLE_CHECKED(number, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(number, 0); |
// We do not include 0 so that we don't have to treat +0 / -0 cases. |
if (number > 0 && number <= Smi::kMaxValue) { |
@@ -5955,7 +5952,7 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 1); |
- CONVERT_DOUBLE_CHECKED(number, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(number, 0); |
// We do not include 0 so that we don't have to treat +0 / -0 cases. |
if (number > 0 && number <= Smi::kMaxValue) { |
@@ -5983,7 +5980,7 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 1); |
- CONVERT_DOUBLE_CHECKED(number, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(number, 0); |
// We do not include 0 so that we don't have to treat +0 / -0 cases. |
if (number > 0 && number <= Smi::kMaxValue) { |
@@ -6025,8 +6022,8 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
- CONVERT_DOUBLE_CHECKED(y, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
+ CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
return isolate->heap()->NumberFromDouble(x + y); |
} |
@@ -6035,8 +6032,8 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
- CONVERT_DOUBLE_CHECKED(y, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
+ CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
return isolate->heap()->NumberFromDouble(x - y); |
} |
@@ -6045,8 +6042,8 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
- CONVERT_DOUBLE_CHECKED(y, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
+ CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
return isolate->heap()->NumberFromDouble(x * y); |
} |
@@ -6055,7 +6052,7 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 1); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->heap()->NumberFromDouble(-x); |
} |
@@ -6072,8 +6069,8 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
- CONVERT_DOUBLE_CHECKED(y, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
+ CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
return isolate->heap()->NumberFromDouble(x / y); |
} |
@@ -6082,8 +6079,8 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
- CONVERT_DOUBLE_CHECKED(y, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
+ CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
x = modulo(x, y); |
// NumberFromDouble may return a Smi instead of a Number object |
@@ -6148,7 +6145,7 @@ |
isolate->context()->mark_out_of_memory(); |
return Failure::OutOfMemoryException(); |
} |
- int array_length = Smi::cast(args[1])->value(); |
+ int array_length = args.smi_at(1); |
CONVERT_CHECKED(String, special, args[2]); |
// This assumption is used by the slice encoding in one or two smis. |
@@ -6261,7 +6258,7 @@ |
isolate->context()->mark_out_of_memory(); |
return Failure::OutOfMemoryException(); |
} |
- int array_length = Smi::cast(args[1])->value(); |
+ int array_length = args.smi_at(1); |
CONVERT_CHECKED(String, separator, args[2]); |
if (!array->HasFastElements()) { |
@@ -6539,8 +6536,8 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
- CONVERT_DOUBLE_CHECKED(y, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
+ CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
if (isnan(x)) return Smi::FromInt(NOT_EQUAL); |
if (isnan(y)) return Smi::FromInt(NOT_EQUAL); |
if (x == y) return Smi::FromInt(EQUAL); |
@@ -6576,8 +6573,8 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 3); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
- CONVERT_DOUBLE_CHECKED(y, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
+ CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
if (isnan(x) || isnan(y)) return args[2]; |
if (x == y) return Smi::FromInt(EQUAL); |
if (isless(x, y)) return Smi::FromInt(LESS); |
@@ -6750,7 +6747,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_acos()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->transcendental_cache()->Get(TranscendentalCache::ACOS, x); |
} |
@@ -6760,7 +6757,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_asin()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->transcendental_cache()->Get(TranscendentalCache::ASIN, x); |
} |
@@ -6770,7 +6767,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_atan()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->transcendental_cache()->Get(TranscendentalCache::ATAN, x); |
} |
@@ -6783,8 +6780,8 @@ |
ASSERT(args.length() == 2); |
isolate->counters()->math_atan2()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
- CONVERT_DOUBLE_CHECKED(y, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
+ CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
double result; |
if (isinf(x) && isinf(y)) { |
// Make sure that the result in case of two infinite arguments |
@@ -6806,7 +6803,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_ceil()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->heap()->NumberFromDouble(ceiling(x)); |
} |
@@ -6816,7 +6813,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_cos()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->transcendental_cache()->Get(TranscendentalCache::COS, x); |
} |
@@ -6826,7 +6823,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_exp()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->transcendental_cache()->Get(TranscendentalCache::EXP, x); |
} |
@@ -6836,7 +6833,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_floor()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->heap()->NumberFromDouble(floor(x)); |
} |
@@ -6846,7 +6843,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_log()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->transcendental_cache()->Get(TranscendentalCache::LOG, x); |
} |
@@ -6856,16 +6853,16 @@ |
ASSERT(args.length() == 2); |
isolate->counters()->math_pow()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
// If the second argument is a smi, it is much faster to call the |
// custom powi() function than the generic pow(). |
if (args[1]->IsSmi()) { |
- int y = Smi::cast(args[1])->value(); |
+ int y = args.smi_at(1); |
return isolate->heap()->NumberFromDouble(power_double_int(x, y)); |
} |
- CONVERT_DOUBLE_CHECKED(y, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
return isolate->heap()->AllocateHeapNumber(power_double_double(x, y)); |
} |
@@ -6874,8 +6871,8 @@ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow_cfunction) { |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
- CONVERT_DOUBLE_CHECKED(y, args[1]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
+ CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
if (y == 0) { |
return Smi::FromInt(1); |
} else if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) { |
@@ -6934,7 +6931,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_sin()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->transcendental_cache()->Get(TranscendentalCache::SIN, x); |
} |
@@ -6944,7 +6941,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_sqrt()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->heap()->AllocateHeapNumber(sqrt(x)); |
} |
@@ -6954,7 +6951,7 @@ |
ASSERT(args.length() == 1); |
isolate->counters()->math_tan()->Increment(); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->transcendental_cache()->Get(TranscendentalCache::TAN, x); |
} |
@@ -7008,9 +7005,9 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 3); |
- CONVERT_SMI_CHECKED(year, args[0]); |
- CONVERT_SMI_CHECKED(month, args[1]); |
- CONVERT_SMI_CHECKED(date, args[2]); |
+ CONVERT_SMI_ARG_CHECKED(year, 0); |
+ CONVERT_SMI_ARG_CHECKED(month, 1); |
+ CONVERT_SMI_ARG_CHECKED(date, 2); |
return Smi::FromInt(MakeDay(year, month, date)); |
} |
@@ -7307,7 +7304,7 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
- CONVERT_DOUBLE_CHECKED(t, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(t, 0); |
CONVERT_CHECKED(JSArray, res_array, args[1]); |
int year, month, day; |
@@ -7332,7 +7329,7 @@ |
JSFunction* callee = JSFunction::cast(args[0]); |
Object** parameters = reinterpret_cast<Object**>(args[1]); |
- const int length = Smi::cast(args[2])->value(); |
+ const int length = args.smi_at(2); |
Object* result; |
{ MaybeObject* maybe_result = |
@@ -7633,7 +7630,7 @@ |
ASSERT(args.length() == 1); |
RUNTIME_ASSERT(args[0]->IsSmi()); |
Deoptimizer::BailoutType type = |
- static_cast<Deoptimizer::BailoutType>(Smi::cast(args[0])->value()); |
+ static_cast<Deoptimizer::BailoutType>(args.smi_at(0)); |
Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); |
ASSERT(isolate->heap()->IsAllocationAllowed()); |
int frames = deoptimizer->output_count(); |
@@ -8143,7 +8140,7 @@ |
Handle<Object> value(args[0], isolate); |
CONVERT_ARG_CHECKED(Context, context, 1); |
CONVERT_ARG_CHECKED(String, name, 2); |
- CONVERT_SMI_CHECKED(strict_unchecked, args[3]); |
+ CONVERT_SMI_ARG_CHECKED(strict_unchecked, 3); |
RUNTIME_ASSERT(strict_unchecked == kStrictMode || |
strict_unchecked == kNonStrictMode); |
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(strict_unchecked); |
@@ -8457,7 +8454,7 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 1); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
const char* zone = OS::LocalTimezone(x); |
return isolate->heap()->AllocateStringFromUtf8(CStrVector(zone)); |
} |
@@ -8475,7 +8472,7 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 1); |
- CONVERT_DOUBLE_CHECKED(x, args[0]); |
+ CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
return isolate->heap()->NumberFromDouble(OS::DaylightSavingsOffset(x)); |
} |
@@ -8649,8 +8646,7 @@ |
return CompileGlobalEval(isolate, |
args.at<String>(1), |
args.at<Object>(2), |
- static_cast<StrictModeFlag>( |
- Smi::cast(args[3])->value())); |
+ static_cast<StrictModeFlag>(args.smi_at(3))); |
} |
@@ -8671,8 +8667,7 @@ |
return CompileGlobalEval(isolate, |
args.at<String>(1), |
args.at<Object>(2), |
- static_cast<StrictModeFlag>( |
- Smi::cast(args[3])->value())); |
+ static_cast<StrictModeFlag>(args.smi_at(3))); |
} |
@@ -11731,7 +11726,7 @@ |
// Deletes the specified live object list. |
RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteLOL) { |
#ifdef LIVE_OBJECT_LIST |
- CONVERT_SMI_CHECKED(id, args[0]); |
+ CONVERT_SMI_ARG_CHECKED(id, 0); |
bool success = LiveObjectList::Delete(id); |
return success ? isolate->heap()->true_value() : |
isolate->heap()->false_value(); |
@@ -11749,10 +11744,10 @@ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_DumpLOL) { |
#ifdef LIVE_OBJECT_LIST |
HandleScope scope; |
- CONVERT_SMI_CHECKED(id1, args[0]); |
- CONVERT_SMI_CHECKED(id2, args[1]); |
- CONVERT_SMI_CHECKED(start, args[2]); |
- CONVERT_SMI_CHECKED(count, args[3]); |
+ CONVERT_SMI_ARG_CHECKED(id1, 0); |
+ CONVERT_SMI_ARG_CHECKED(id2, 1); |
+ CONVERT_SMI_ARG_CHECKED(start, 2); |
+ CONVERT_SMI_ARG_CHECKED(count, 3); |
CONVERT_ARG_CHECKED(JSObject, filter_obj, 4); |
EnterDebugger enter_debugger; |
return LiveObjectList::Dump(id1, id2, start, count, filter_obj); |
@@ -11766,7 +11761,7 @@ |
// This is only used for obj ids shown in live object lists. |
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLOLObj) { |
#ifdef LIVE_OBJECT_LIST |
- CONVERT_SMI_CHECKED(obj_id, args[0]); |
+ CONVERT_SMI_ARG_CHECKED(obj_id, 0); |
Object* result = LiveObjectList::GetObj(obj_id); |
return result; |
#else |
@@ -11793,7 +11788,7 @@ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLOLObjRetainers) { |
#ifdef LIVE_OBJECT_LIST |
HandleScope scope; |
- CONVERT_SMI_CHECKED(obj_id, args[0]); |
+ CONVERT_SMI_ARG_CHECKED(obj_id, 0); |
RUNTIME_ASSERT(args[1]->IsUndefined() || args[1]->IsJSObject()); |
RUNTIME_ASSERT(args[2]->IsUndefined() || args[2]->IsBoolean()); |
RUNTIME_ASSERT(args[3]->IsUndefined() || args[3]->IsSmi()); |
@@ -11810,11 +11805,11 @@ |
} |
int start = 0; |
if (args[3]->IsSmi()) { |
- start = Smi::cast(args[3])->value(); |
+ start = args.smi_at(3); |
} |
int limit = Smi::kMaxValue; |
if (args[4]->IsSmi()) { |
- limit = Smi::cast(args[4])->value(); |
+ limit = args.smi_at(4); |
} |
return LiveObjectList::GetObjRetainers(obj_id, |
@@ -11833,8 +11828,8 @@ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLOLPath) { |
#ifdef LIVE_OBJECT_LIST |
HandleScope scope; |
- CONVERT_SMI_CHECKED(obj_id1, args[0]); |
- CONVERT_SMI_CHECKED(obj_id2, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(obj_id1, 0); |
+ CONVERT_SMI_ARG_CHECKED(obj_id2, 1); |
RUNTIME_ASSERT(args[2]->IsUndefined() || args[2]->IsJSObject()); |
Handle<JSObject> instance_filter; |
@@ -11855,8 +11850,8 @@ |
// previously captured live object lists. |
RUNTIME_FUNCTION(MaybeObject*, Runtime_InfoLOL) { |
#ifdef LIVE_OBJECT_LIST |
- CONVERT_SMI_CHECKED(start, args[0]); |
- CONVERT_SMI_CHECKED(count, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(start, 0); |
+ CONVERT_SMI_ARG_CHECKED(count, 1); |
return LiveObjectList::Info(start, count); |
#else |
return isolate->heap()->undefined_value(); |
@@ -11869,7 +11864,7 @@ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_PrintLOLObj) { |
#ifdef LIVE_OBJECT_LIST |
HandleScope scope; |
- CONVERT_SMI_CHECKED(obj_id, args[0]); |
+ CONVERT_SMI_ARG_CHECKED(obj_id, 0); |
Object* result = LiveObjectList::PrintObj(obj_id); |
return result; |
#else |
@@ -11897,8 +11892,8 @@ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_SummarizeLOL) { |
#ifdef LIVE_OBJECT_LIST |
HandleScope scope; |
- CONVERT_SMI_CHECKED(id1, args[0]); |
- CONVERT_SMI_CHECKED(id2, args[1]); |
+ CONVERT_SMI_ARG_CHECKED(id1, 0); |
+ CONVERT_SMI_ARG_CHECKED(id2, 1); |
CONVERT_ARG_CHECKED(JSObject, filter_obj, 2); |
EnterDebugger enter_debugger; |
@@ -12088,8 +12083,8 @@ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_Abort) { |
ASSERT(args.length() == 2); |
- OS::PrintError("abort: %s\n", reinterpret_cast<char*>(args[0]) + |
- Smi::cast(args[1])->value()); |
+ OS::PrintError("abort: %s\n", |
+ reinterpret_cast<char*>(args[0]) + args.smi_at(1)); |
isolate->PrintStack(); |
OS::Abort(); |
UNREACHABLE(); |