| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index 746810adc248c3d68c1e1c56bfc939b8a48b6c49..34a5fcbf70d82701105df218f86338c7da9b4afd 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -4480,27 +4480,30 @@ static Object* Runtime_DateCurrentTime(Arguments args) {
|
|
|
| static Object* Runtime_DateParseString(Arguments args) {
|
| HandleScope scope;
|
| - ASSERT(args.length() == 1);
|
| -
|
| - CONVERT_CHECKED(String, string_object, args[0]);
|
| + ASSERT(args.length() == 2);
|
|
|
| - Handle<String> str(string_object);
|
| + CONVERT_ARG_CHECKED(String, str, 0);
|
| FlattenString(str);
|
| - Handle<FixedArray> output = Factory::NewFixedArray(DateParser::OUTPUT_SIZE);
|
| +
|
| + CONVERT_ARG_CHECKED(JSArray, output, 1);
|
| + RUNTIME_ASSERT(output->HasFastElements());
|
| +
|
| + AssertNoAllocation no_allocation;
|
| +
|
| + FixedArray* output_array = output->elements();
|
| + RUNTIME_ASSERT(output_array->length() >= DateParser::OUTPUT_SIZE);
|
| bool result;
|
| - {
|
| - AssertNoAllocation no_allocation;
|
| - if (StringShape(*str).IsAsciiRepresentation()) {
|
| - result = DateParser::Parse(str->ToAsciiVector(), *output);
|
| - } else {
|
| - ASSERT(StringShape(*str).IsTwoByteRepresentation());
|
| - result = DateParser::Parse(str->ToUC16Vector(), *output);
|
| - }
|
| + if (StringShape(*str).IsAsciiRepresentation()) {
|
| + result = DateParser::Parse(str->ToAsciiVector(), output_array);
|
| + } else {
|
| + ASSERT(StringShape(*str).IsTwoByteRepresentation());
|
| + result = DateParser::Parse(str->ToUC16Vector(), output_array);
|
| }
|
| +
|
| if (result) {
|
| - return *Factory::NewJSArrayWithElements(output);
|
| + return *output;
|
| } else {
|
| - return *Factory::null_value();
|
| + return Heap::null_value();
|
| }
|
| }
|
|
|
|
|