OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 9602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9613 | 9613 |
9614 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCurrentTime) { | 9614 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCurrentTime) { |
9615 SealHandleScope shs(isolate); | 9615 SealHandleScope shs(isolate); |
9616 ASSERT(args.length() == 0); | 9616 ASSERT(args.length() == 0); |
9617 | 9617 |
9618 // According to ECMA-262, section 15.9.1, page 117, the precision of | 9618 // According to ECMA-262, section 15.9.1, page 117, the precision of |
9619 // the number in a Date object representing a particular instant in | 9619 // the number in a Date object representing a particular instant in |
9620 // time is milliseconds. Therefore, we floor the result of getting | 9620 // time is milliseconds. Therefore, we floor the result of getting |
9621 // the OS time. | 9621 // the OS time. |
9622 double millis = std::floor(OS::TimeCurrentMillis()); | 9622 double millis = std::floor(OS::TimeCurrentMillis()); |
| 9623 isolate->date_cache()->CheckTimezone(); |
9623 return isolate->heap()->NumberFromDouble(millis); | 9624 return isolate->heap()->NumberFromDouble(millis); |
9624 } | 9625 } |
9625 | 9626 |
9626 | 9627 |
9627 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateParseString) { | 9628 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateParseString) { |
9628 HandleScope scope(isolate); | 9629 HandleScope scope(isolate); |
9629 ASSERT(args.length() == 2); | 9630 ASSERT(args.length() == 2); |
9630 | 9631 |
9631 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); | 9632 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); |
9632 FlattenString(str); | 9633 FlattenString(str); |
(...skipping 26 matching lines...) Expand all Loading... |
9659 return isolate->heap()->null_value(); | 9660 return isolate->heap()->null_value(); |
9660 } | 9661 } |
9661 } | 9662 } |
9662 | 9663 |
9663 | 9664 |
9664 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) { | 9665 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) { |
9665 SealHandleScope shs(isolate); | 9666 SealHandleScope shs(isolate); |
9666 ASSERT(args.length() == 1); | 9667 ASSERT(args.length() == 1); |
9667 | 9668 |
9668 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 9669 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 9670 isolate->date_cache()->CheckTimezone(); |
9669 int64_t time = isolate->date_cache()->EquivalentTime(static_cast<int64_t>(x)); | 9671 int64_t time = isolate->date_cache()->EquivalentTime(static_cast<int64_t>(x)); |
9670 const char* zone = OS::LocalTimezone(static_cast<double>(time)); | 9672 const char* zone = OS::LocalTimezone(static_cast<double>(time)); |
9671 return isolate->heap()->AllocateStringFromUtf8(CStrVector(zone)); | 9673 return isolate->heap()->AllocateStringFromUtf8(CStrVector(zone)); |
9672 } | 9674 } |
9673 | 9675 |
9674 | 9676 |
9675 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateToUTC) { | 9677 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateToUTC) { |
9676 SealHandleScope shs(isolate); | 9678 SealHandleScope shs(isolate); |
9677 ASSERT(args.length() == 1); | 9679 ASSERT(args.length() == 1); |
9678 | 9680 |
(...skipping 5310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14989 // Handle last resort GC and make sure to allow future allocations | 14991 // Handle last resort GC and make sure to allow future allocations |
14990 // to grow the heap without causing GCs (if possible). | 14992 // to grow the heap without causing GCs (if possible). |
14991 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14993 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14992 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14994 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14993 "Runtime::PerformGC"); | 14995 "Runtime::PerformGC"); |
14994 } | 14996 } |
14995 } | 14997 } |
14996 | 14998 |
14997 | 14999 |
14998 } } // namespace v8::internal | 15000 } } // namespace v8::internal |
OLD | NEW |