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 14667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14678 CONVERT_BOOLEAN_ARG_CHECKED(new_state, 0); | 14678 CONVERT_BOOLEAN_ARG_CHECKED(new_state, 0); |
14679 bool old_state = isolate->microtask_pending(); | 14679 bool old_state = isolate->microtask_pending(); |
14680 isolate->set_microtask_pending(new_state); | 14680 isolate->set_microtask_pending(new_state); |
14681 return isolate->heap()->ToBoolean(old_state); | 14681 return isolate->heap()->ToBoolean(old_state); |
14682 } | 14682 } |
14683 | 14683 |
14684 | 14684 |
14685 RUNTIME_FUNCTION(MaybeObject*, Runtime_RunMicrotasks) { | 14685 RUNTIME_FUNCTION(MaybeObject*, Runtime_RunMicrotasks) { |
14686 HandleScope scope(isolate); | 14686 HandleScope scope(isolate); |
14687 ASSERT(args.length() == 0); | 14687 ASSERT(args.length() == 0); |
14688 Execution::RunMicrotasks(isolate); | 14688 if (isolate->microtask_pending()) |
| 14689 Execution::RunMicrotasks(isolate); |
14689 return isolate->heap()->undefined_value(); | 14690 return isolate->heap()->undefined_value(); |
14690 } | 14691 } |
14691 | 14692 |
14692 | 14693 |
14693 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetMicrotaskState) { | 14694 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetMicrotaskState) { |
14694 SealHandleScope shs(isolate); | 14695 SealHandleScope shs(isolate); |
14695 ASSERT(args.length() == 0); | 14696 ASSERT(args.length() == 0); |
14696 return isolate->heap()->microtask_state(); | 14697 return isolate->heap()->microtask_state(); |
14697 } | 14698 } |
14698 | 14699 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14965 // Handle last resort GC and make sure to allow future allocations | 14966 // Handle last resort GC and make sure to allow future allocations |
14966 // to grow the heap without causing GCs (if possible). | 14967 // to grow the heap without causing GCs (if possible). |
14967 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14968 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14969 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14969 "Runtime::PerformGC"); | 14970 "Runtime::PerformGC"); |
14970 } | 14971 } |
14971 } | 14972 } |
14972 | 14973 |
14973 | 14974 |
14974 } } // namespace v8::internal | 14975 } } // namespace v8::internal |
OLD | NEW |