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 9596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9607 SealHandleScope shs(isolate); | 9607 SealHandleScope shs(isolate); |
9608 ASSERT(args.length() == 1); | 9608 ASSERT(args.length() == 1); |
9609 | 9609 |
9610 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 9610 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
9611 int64_t time = isolate->date_cache()->ToUTC(static_cast<int64_t>(x)); | 9611 int64_t time = isolate->date_cache()->ToUTC(static_cast<int64_t>(x)); |
9612 | 9612 |
9613 return isolate->heap()->NumberFromDouble(static_cast<double>(time)); | 9613 return isolate->heap()->NumberFromDouble(static_cast<double>(time)); |
9614 } | 9614 } |
9615 | 9615 |
9616 | 9616 |
| 9617 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCacheVersion) { |
| 9618 HandleScope hs(isolate); |
| 9619 ASSERT(args.length() == 0); |
| 9620 if (!isolate->eternal_handles()->Exists(EternalHandles::DATE_CACHE_VERSION)) { |
| 9621 Handle<FixedArray> date_cache_version = |
| 9622 isolate->factory()->NewFixedArray(1, TENURED); |
| 9623 date_cache_version->set(0, Smi::FromInt(0)); |
| 9624 isolate->eternal_handles()->CreateSingleton( |
| 9625 isolate, *date_cache_version, EternalHandles::DATE_CACHE_VERSION); |
| 9626 } |
| 9627 Handle<FixedArray> date_cache_version = |
| 9628 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( |
| 9629 EternalHandles::DATE_CACHE_VERSION)); |
| 9630 // Return result as a JS array. |
| 9631 Handle<JSObject> result = |
| 9632 isolate->factory()->NewJSObject(isolate->array_function()); |
| 9633 isolate->factory()->SetContent(Handle<JSArray>::cast(result), |
| 9634 date_cache_version); |
| 9635 return *result; |
| 9636 } |
| 9637 |
| 9638 |
9617 RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalReceiver) { | 9639 RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalReceiver) { |
9618 SealHandleScope shs(isolate); | 9640 SealHandleScope shs(isolate); |
9619 ASSERT(args.length() == 1); | 9641 ASSERT(args.length() == 1); |
9620 Object* global = args[0]; | 9642 Object* global = args[0]; |
9621 if (!global->IsJSGlobalObject()) return isolate->heap()->null_value(); | 9643 if (!global->IsJSGlobalObject()) return isolate->heap()->null_value(); |
9622 return JSGlobalObject::cast(global)->global_receiver(); | 9644 return JSGlobalObject::cast(global)->global_receiver(); |
9623 } | 9645 } |
9624 | 9646 |
9625 | 9647 |
9626 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsAttachedGlobal) { | 9648 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsAttachedGlobal) { |
(...skipping 5342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14969 // Handle last resort GC and make sure to allow future allocations | 14991 // Handle last resort GC and make sure to allow future allocations |
14970 // to grow the heap without causing GCs (if possible). | 14992 // to grow the heap without causing GCs (if possible). |
14971 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14993 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14972 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14994 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14973 "Runtime::PerformGC"); | 14995 "Runtime::PerformGC"); |
14974 } | 14996 } |
14975 } | 14997 } |
14976 | 14998 |
14977 | 14999 |
14978 } } // namespace v8::internal | 15000 } } // namespace v8::internal |
OLD | NEW |