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 9531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9542 | 9542 |
9543 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCurrentTime) { | 9543 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCurrentTime) { |
9544 SealHandleScope shs(isolate); | 9544 SealHandleScope shs(isolate); |
9545 ASSERT(args.length() == 0); | 9545 ASSERT(args.length() == 0); |
9546 | 9546 |
9547 // According to ECMA-262, section 15.9.1, page 117, the precision of | 9547 // According to ECMA-262, section 15.9.1, page 117, the precision of |
9548 // the number in a Date object representing a particular instant in | 9548 // the number in a Date object representing a particular instant in |
9549 // time is milliseconds. Therefore, we floor the result of getting | 9549 // time is milliseconds. Therefore, we floor the result of getting |
9550 // the OS time. | 9550 // the OS time. |
9551 double millis = std::floor(OS::TimeCurrentMillis()); | 9551 double millis = std::floor(OS::TimeCurrentMillis()); |
9552 isolate->date_cache()->CheckTimezone(); | |
9553 return isolate->heap()->NumberFromDouble(millis); | 9552 return isolate->heap()->NumberFromDouble(millis); |
9554 } | 9553 } |
9555 | 9554 |
9556 | 9555 |
9557 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateParseString) { | 9556 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateParseString) { |
9558 HandleScope scope(isolate); | 9557 HandleScope scope(isolate); |
9559 ASSERT(args.length() == 2); | 9558 ASSERT(args.length() == 2); |
9560 | 9559 |
9561 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); | 9560 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); |
9562 FlattenString(str); | 9561 FlattenString(str); |
(...skipping 26 matching lines...) Expand all Loading... |
9589 return isolate->heap()->null_value(); | 9588 return isolate->heap()->null_value(); |
9590 } | 9589 } |
9591 } | 9590 } |
9592 | 9591 |
9593 | 9592 |
9594 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) { | 9593 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) { |
9595 SealHandleScope shs(isolate); | 9594 SealHandleScope shs(isolate); |
9596 ASSERT(args.length() == 1); | 9595 ASSERT(args.length() == 1); |
9597 | 9596 |
9598 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 9597 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
9599 isolate->date_cache()->CheckTimezone(); | |
9600 int64_t time = isolate->date_cache()->EquivalentTime(static_cast<int64_t>(x)); | 9598 int64_t time = isolate->date_cache()->EquivalentTime(static_cast<int64_t>(x)); |
9601 const char* zone = OS::LocalTimezone(static_cast<double>(time)); | 9599 const char* zone = OS::LocalTimezone(static_cast<double>(time)); |
9602 return isolate->heap()->AllocateStringFromUtf8(CStrVector(zone)); | 9600 return isolate->heap()->AllocateStringFromUtf8(CStrVector(zone)); |
9603 } | 9601 } |
9604 | 9602 |
9605 | 9603 |
9606 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateToUTC) { | 9604 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateToUTC) { |
9607 SealHandleScope shs(isolate); | 9605 SealHandleScope shs(isolate); |
9608 ASSERT(args.length() == 1); | 9606 ASSERT(args.length() == 1); |
9609 | 9607 |
(...skipping 5359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14969 // Handle last resort GC and make sure to allow future allocations | 14967 // Handle last resort GC and make sure to allow future allocations |
14970 // to grow the heap without causing GCs (if possible). | 14968 // to grow the heap without causing GCs (if possible). |
14971 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14969 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14972 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14970 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14973 "Runtime::PerformGC"); | 14971 "Runtime::PerformGC"); |
14974 } | 14972 } |
14975 } | 14973 } |
14976 | 14974 |
14977 | 14975 |
14978 } } // namespace v8::internal | 14976 } } // namespace v8::internal |
OLD | NEW |