Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: src/runtime.cc

Issue 42280: Made Date parser work on flat strings instead of arbitrary ones. (Closed)
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4466 matching lines...) Expand 10 before | Expand all | Expand 10 after
4477 } 4477 }
4478 4478
4479 4479
4480 static Object* Runtime_DateParseString(Arguments args) { 4480 static Object* Runtime_DateParseString(Arguments args) {
4481 HandleScope scope; 4481 HandleScope scope;
4482 ASSERT(args.length() == 1); 4482 ASSERT(args.length() == 1);
4483 4483
4484 CONVERT_CHECKED(String, string_object, args[0]); 4484 CONVERT_CHECKED(String, string_object, args[0]);
4485 4485
4486 Handle<String> str(string_object); 4486 Handle<String> str(string_object);
4487 FlattenString(str);
4487 Handle<FixedArray> output = Factory::NewFixedArray(DateParser::OUTPUT_SIZE); 4488 Handle<FixedArray> output = Factory::NewFixedArray(DateParser::OUTPUT_SIZE);
4488 if (DateParser::Parse(*str, *output)) { 4489 bool result;
4490 {
4491 AssertNoAllocation no_allocation;
4492 if (StringShape(*str).IsAsciiRepresentation()) {
4493 result = DateParser::Parse(str->ToAsciiVector(), *output);
4494 } else {
4495 ASSERT(StringShape(*str).IsTwoByteRepresentation());
4496 result = DateParser::Parse(str->ToUC16Vector(), *output);
4497 }
4498 }
4499 if (result) {
4489 return *Factory::NewJSArrayWithElements(output); 4500 return *Factory::NewJSArrayWithElements(output);
4490 } else { 4501 } else {
4491 return *Factory::null_value(); 4502 return *Factory::null_value();
4492 } 4503 }
4493 } 4504 }
4494 4505
4495 4506
4496 static Object* Runtime_DateLocalTimezone(Arguments args) { 4507 static Object* Runtime_DateLocalTimezone(Arguments args) {
4497 NoHandleAllocation ha; 4508 NoHandleAllocation ha;
4498 ASSERT(args.length() == 1); 4509 ASSERT(args.length() == 1);
(...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after
6640 } else { 6651 } else {
6641 // Handle last resort GC and make sure to allow future allocations 6652 // Handle last resort GC and make sure to allow future allocations
6642 // to grow the heap without causing GCs (if possible). 6653 // to grow the heap without causing GCs (if possible).
6643 Counters::gc_last_resort_from_js.Increment(); 6654 Counters::gc_last_resort_from_js.Increment();
6644 Heap::CollectAllGarbage(); 6655 Heap::CollectAllGarbage();
6645 } 6656 }
6646 } 6657 }
6647 6658
6648 6659
6649 } } // namespace v8::internal 6660 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698