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 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 regexp_stack_(NULL), | 2122 regexp_stack_(NULL), |
2123 date_cache_(NULL), | 2123 date_cache_(NULL), |
2124 call_descriptor_data_(NULL), | 2124 call_descriptor_data_(NULL), |
2125 // TODO(bmeurer) Initialized lazily because it depends on flags; can | 2125 // TODO(bmeurer) Initialized lazily because it depends on flags; can |
2126 // be fixed once the default isolate cleanup is done. | 2126 // be fixed once the default isolate cleanup is done. |
2127 random_number_generator_(NULL), | 2127 random_number_generator_(NULL), |
2128 rail_mode_(PERFORMANCE_ANIMATION), | 2128 rail_mode_(PERFORMANCE_ANIMATION), |
2129 serializer_enabled_(enable_serializer), | 2129 serializer_enabled_(enable_serializer), |
2130 has_fatal_error_(false), | 2130 has_fatal_error_(false), |
2131 initialized_from_snapshot_(false), | 2131 initialized_from_snapshot_(false), |
| 2132 is_promisehook_enabled_(false), |
2132 is_tail_call_elimination_enabled_(true), | 2133 is_tail_call_elimination_enabled_(true), |
2133 is_isolate_in_background_(false), | 2134 is_isolate_in_background_(false), |
2134 cpu_profiler_(NULL), | 2135 cpu_profiler_(NULL), |
2135 heap_profiler_(NULL), | 2136 heap_profiler_(NULL), |
2136 code_event_dispatcher_(new CodeEventDispatcher()), | 2137 code_event_dispatcher_(new CodeEventDispatcher()), |
2137 function_entry_hook_(NULL), | 2138 function_entry_hook_(NULL), |
2138 deferred_handles_head_(NULL), | 2139 deferred_handles_head_(NULL), |
2139 optimizing_compile_dispatcher_(NULL), | 2140 optimizing_compile_dispatcher_(NULL), |
2140 stress_deopt_count_(0), | 2141 stress_deopt_count_(0), |
2141 next_optimization_id_(0), | 2142 next_optimization_id_(0), |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3133 | 3134 |
3134 if (call_completed_callbacks_.is_empty()) return; | 3135 if (call_completed_callbacks_.is_empty()) return; |
3135 // Fire callbacks. Increase call depth to prevent recursive callbacks. | 3136 // Fire callbacks. Increase call depth to prevent recursive callbacks. |
3136 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this); | 3137 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this); |
3137 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); | 3138 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); |
3138 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 3139 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
3139 call_completed_callbacks_.at(i)(isolate); | 3140 call_completed_callbacks_.at(i)(isolate); |
3140 } | 3141 } |
3141 } | 3142 } |
3142 | 3143 |
| 3144 void Isolate::EnablePromiseHook() { is_promisehook_enabled_ = true; } |
| 3145 |
| 3146 void Isolate::DisablePromiseHook() { is_promisehook_enabled_ = false; } |
3143 | 3147 |
3144 void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { | 3148 void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { |
3145 promise_reject_callback_ = callback; | 3149 promise_reject_callback_ = callback; |
3146 } | 3150 } |
3147 | 3151 |
3148 | 3152 |
3149 void Isolate::ReportPromiseReject(Handle<JSObject> promise, | 3153 void Isolate::ReportPromiseReject(Handle<JSObject> promise, |
3150 Handle<Object> value, | 3154 Handle<Object> value, |
3151 v8::PromiseRejectEvent event) { | 3155 v8::PromiseRejectEvent event) { |
3152 if (promise_reject_callback_ == NULL) return; | 3156 if (promise_reject_callback_ == NULL) return; |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3535 // Then check whether this scope intercepts. | 3539 // Then check whether this scope intercepts. |
3536 if ((flag & intercept_mask_)) { | 3540 if ((flag & intercept_mask_)) { |
3537 intercepted_flags_ |= flag; | 3541 intercepted_flags_ |= flag; |
3538 return true; | 3542 return true; |
3539 } | 3543 } |
3540 return false; | 3544 return false; |
3541 } | 3545 } |
3542 | 3546 |
3543 } // namespace internal | 3547 } // namespace internal |
3544 } // namespace v8 | 3548 } // namespace v8 |
OLD | NEW |