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 "src/isolate.h" | 5 #include "src/isolate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 2869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2880 heap()->set_microtask_queue(heap()->empty_fixed_array()); | 2880 heap()->set_microtask_queue(heap()->empty_fixed_array()); |
2881 | 2881 |
2882 Isolate* isolate = this; | 2882 Isolate* isolate = this; |
2883 FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < num_tasks, i++, { | 2883 FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < num_tasks, i++, { |
2884 Handle<Object> microtask(queue->get(i), this); | 2884 Handle<Object> microtask(queue->get(i), this); |
2885 if (microtask->IsJSFunction()) { | 2885 if (microtask->IsJSFunction()) { |
2886 Handle<JSFunction> microtask_function = | 2886 Handle<JSFunction> microtask_function = |
2887 Handle<JSFunction>::cast(microtask); | 2887 Handle<JSFunction>::cast(microtask); |
2888 SaveContext save(this); | 2888 SaveContext save(this); |
2889 set_context(microtask_function->context()->native_context()); | 2889 set_context(microtask_function->context()->native_context()); |
2890 handle_scope_implementer_->EnterContext( | |
2891 handle(microtask_function->context(), this)); | |
2892 MaybeHandle<Object> maybe_exception; | 2890 MaybeHandle<Object> maybe_exception; |
2893 MaybeHandle<Object> result = Execution::TryCall( | 2891 MaybeHandle<Object> result = Execution::TryCall( |
2894 this, microtask_function, factory()->undefined_value(), 0, NULL, | 2892 this, microtask_function, factory()->undefined_value(), 0, NULL, |
2895 &maybe_exception); | 2893 &maybe_exception); |
2896 handle_scope_implementer_->LeaveContext(); | |
2897 // If execution is terminating, just bail out. | 2894 // If execution is terminating, just bail out. |
2898 Handle<Object> exception; | 2895 Handle<Object> exception; |
2899 if (result.is_null() && maybe_exception.is_null()) { | 2896 if (result.is_null() && maybe_exception.is_null()) { |
2900 // Clear out any remaining callbacks in the queue. | 2897 // Clear out any remaining callbacks in the queue. |
2901 heap()->set_microtask_queue(heap()->empty_fixed_array()); | 2898 heap()->set_microtask_queue(heap()->empty_fixed_array()); |
2902 set_pending_microtask_count(0); | 2899 set_pending_microtask_count(0); |
2903 return; | 2900 return; |
2904 } | 2901 } |
2905 } else { | 2902 } else { |
2906 Handle<CallHandlerInfo> callback_info = | 2903 Handle<CallHandlerInfo> callback_info = |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3088 // Then check whether this scope intercepts. | 3085 // Then check whether this scope intercepts. |
3089 if ((flag & intercept_mask_)) { | 3086 if ((flag & intercept_mask_)) { |
3090 intercepted_flags_ |= flag; | 3087 intercepted_flags_ |= flag; |
3091 return true; | 3088 return true; |
3092 } | 3089 } |
3093 return false; | 3090 return false; |
3094 } | 3091 } |
3095 | 3092 |
3096 } // namespace internal | 3093 } // namespace internal |
3097 } // namespace v8 | 3094 } // namespace v8 |
OLD | NEW |