| 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 9597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9608 | 9608 |
| 9609 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCurrentTime) { | 9609 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCurrentTime) { |
| 9610 SealHandleScope shs(isolate); | 9610 SealHandleScope shs(isolate); |
| 9611 ASSERT(args.length() == 0); | 9611 ASSERT(args.length() == 0); |
| 9612 | 9612 |
| 9613 // According to ECMA-262, section 15.9.1, page 117, the precision of | 9613 // According to ECMA-262, section 15.9.1, page 117, the precision of |
| 9614 // the number in a Date object representing a particular instant in | 9614 // the number in a Date object representing a particular instant in |
| 9615 // time is milliseconds. Therefore, we floor the result of getting | 9615 // time is milliseconds. Therefore, we floor the result of getting |
| 9616 // the OS time. | 9616 // the OS time. |
| 9617 double millis = std::floor(OS::TimeCurrentMillis()); | 9617 double millis = std::floor(OS::TimeCurrentMillis()); |
| 9618 isolate->date_cache()->CheckTimezone(); |
| 9618 return isolate->heap()->NumberFromDouble(millis); | 9619 return isolate->heap()->NumberFromDouble(millis); |
| 9619 } | 9620 } |
| 9620 | 9621 |
| 9621 | 9622 |
| 9622 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateParseString) { | 9623 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateParseString) { |
| 9623 HandleScope scope(isolate); | 9624 HandleScope scope(isolate); |
| 9624 ASSERT(args.length() == 2); | 9625 ASSERT(args.length() == 2); |
| 9625 | 9626 |
| 9626 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); | 9627 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); |
| 9627 FlattenString(str); | 9628 FlattenString(str); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 9654 return isolate->heap()->null_value(); | 9655 return isolate->heap()->null_value(); |
| 9655 } | 9656 } |
| 9656 } | 9657 } |
| 9657 | 9658 |
| 9658 | 9659 |
| 9659 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) { | 9660 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) { |
| 9660 SealHandleScope shs(isolate); | 9661 SealHandleScope shs(isolate); |
| 9661 ASSERT(args.length() == 1); | 9662 ASSERT(args.length() == 1); |
| 9662 | 9663 |
| 9663 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 9664 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 9665 isolate->date_cache()->CheckTimezone(); |
| 9664 int64_t time = isolate->date_cache()->EquivalentTime(static_cast<int64_t>(x)); | 9666 int64_t time = isolate->date_cache()->EquivalentTime(static_cast<int64_t>(x)); |
| 9665 const char* zone = OS::LocalTimezone(static_cast<double>(time)); | 9667 const char* zone = OS::LocalTimezone(static_cast<double>(time)); |
| 9666 return isolate->heap()->AllocateStringFromUtf8(CStrVector(zone)); | 9668 return isolate->heap()->AllocateStringFromUtf8(CStrVector(zone)); |
| 9667 } | 9669 } |
| 9668 | 9670 |
| 9669 | 9671 |
| 9670 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateToUTC) { | 9672 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateToUTC) { |
| 9671 SealHandleScope shs(isolate); | 9673 SealHandleScope shs(isolate); |
| 9672 ASSERT(args.length() == 1); | 9674 ASSERT(args.length() == 1); |
| 9673 | 9675 |
| (...skipping 5291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14965 // Handle last resort GC and make sure to allow future allocations | 14967 // Handle last resort GC and make sure to allow future allocations |
| 14966 // to grow the heap without causing GCs (if possible). | 14968 // to grow the heap without causing GCs (if possible). |
| 14967 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14969 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14970 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14969 "Runtime::PerformGC"); | 14971 "Runtime::PerformGC"); |
| 14970 } | 14972 } |
| 14971 } | 14973 } |
| 14972 | 14974 |
| 14973 | 14975 |
| 14974 } } // namespace v8::internal | 14976 } } // namespace v8::internal |
| OLD | NEW |