| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <limits> | 6 #include <limits> |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 9622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9633 | 9633 |
| 9634 | 9634 |
| 9635 RUNTIME_FUNCTION(Runtime_DateCurrentTime) { | 9635 RUNTIME_FUNCTION(Runtime_DateCurrentTime) { |
| 9636 HandleScope scope(isolate); | 9636 HandleScope scope(isolate); |
| 9637 ASSERT(args.length() == 0); | 9637 ASSERT(args.length() == 0); |
| 9638 | 9638 |
| 9639 // According to ECMA-262, section 15.9.1, page 117, the precision of | 9639 // According to ECMA-262, section 15.9.1, page 117, the precision of |
| 9640 // the number in a Date object representing a particular instant in | 9640 // the number in a Date object representing a particular instant in |
| 9641 // time is milliseconds. Therefore, we floor the result of getting | 9641 // time is milliseconds. Therefore, we floor the result of getting |
| 9642 // the OS time. | 9642 // the OS time. |
| 9643 double millis = std::floor(OS::TimeCurrentMillis()); | 9643 double millis; |
| 9644 if (FLAG_verify_predictable) { |
| 9645 millis = 1388534400000.0; // Jan 1 2014 00:00:00 GMT+0000 |
| 9646 millis += std::floor(isolate->heap()->allocations_count()); |
| 9647 } else { |
| 9648 millis = std::floor(OS::TimeCurrentMillis()); |
| 9649 } |
| 9644 return *isolate->factory()->NewNumber(millis); | 9650 return *isolate->factory()->NewNumber(millis); |
| 9645 } | 9651 } |
| 9646 | 9652 |
| 9647 | 9653 |
| 9648 RUNTIME_FUNCTION(Runtime_DateParseString) { | 9654 RUNTIME_FUNCTION(Runtime_DateParseString) { |
| 9649 HandleScope scope(isolate); | 9655 HandleScope scope(isolate); |
| 9650 ASSERT(args.length() == 2); | 9656 ASSERT(args.length() == 2); |
| 9651 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); | 9657 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); |
| 9652 CONVERT_ARG_HANDLE_CHECKED(JSArray, output, 1); | 9658 CONVERT_ARG_HANDLE_CHECKED(JSArray, output, 1); |
| 9653 | 9659 |
| (...skipping 5490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15144 } | 15150 } |
| 15145 return NULL; | 15151 return NULL; |
| 15146 } | 15152 } |
| 15147 | 15153 |
| 15148 | 15154 |
| 15149 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15155 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15150 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15156 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15151 } | 15157 } |
| 15152 | 15158 |
| 15153 } } // namespace v8::internal | 15159 } } // namespace v8::internal |
| OLD | NEW |