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 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 eternal_handles_(NULL), | 2008 eternal_handles_(NULL), |
2009 thread_manager_(NULL), | 2009 thread_manager_(NULL), |
2010 has_installed_extensions_(false), | 2010 has_installed_extensions_(false), |
2011 regexp_stack_(NULL), | 2011 regexp_stack_(NULL), |
2012 date_cache_(NULL), | 2012 date_cache_(NULL), |
2013 call_descriptor_data_(NULL), | 2013 call_descriptor_data_(NULL), |
2014 // TODO(bmeurer) Initialized lazily because it depends on flags; can | 2014 // TODO(bmeurer) Initialized lazily because it depends on flags; can |
2015 // be fixed once the default isolate cleanup is done. | 2015 // be fixed once the default isolate cleanup is done. |
2016 random_number_generator_(NULL), | 2016 random_number_generator_(NULL), |
2017 rail_mode_(PERFORMANCE_ANIMATION), | 2017 rail_mode_(PERFORMANCE_ANIMATION), |
| 2018 load_start_time_ms_(0), |
2018 serializer_enabled_(enable_serializer), | 2019 serializer_enabled_(enable_serializer), |
2019 has_fatal_error_(false), | 2020 has_fatal_error_(false), |
2020 initialized_from_snapshot_(false), | 2021 initialized_from_snapshot_(false), |
2021 is_tail_call_elimination_enabled_(true), | 2022 is_tail_call_elimination_enabled_(true), |
2022 is_isolate_in_background_(false), | 2023 is_isolate_in_background_(false), |
2023 cpu_profiler_(NULL), | 2024 cpu_profiler_(NULL), |
2024 heap_profiler_(NULL), | 2025 heap_profiler_(NULL), |
2025 code_event_dispatcher_(new CodeEventDispatcher()), | 2026 code_event_dispatcher_(new CodeEventDispatcher()), |
2026 function_entry_hook_(NULL), | 2027 function_entry_hook_(NULL), |
2027 deferred_handles_head_(NULL), | 2028 deferred_handles_head_(NULL), |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3253 } | 3254 } |
3254 } | 3255 } |
3255 if (new_length == 0) { | 3256 if (new_length == 0) { |
3256 heap()->set_detached_contexts(heap()->empty_fixed_array()); | 3257 heap()->set_detached_contexts(heap()->empty_fixed_array()); |
3257 } else if (new_length < length) { | 3258 } else if (new_length < length) { |
3258 heap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>( | 3259 heap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>( |
3259 *detached_contexts, length - new_length); | 3260 *detached_contexts, length - new_length); |
3260 } | 3261 } |
3261 } | 3262 } |
3262 | 3263 |
| 3264 double Isolate::LoadStartTimeMs() { |
| 3265 base::LockGuard<base::Mutex> guard(&rail_mutex_); |
| 3266 return load_start_time_ms_; |
| 3267 } |
| 3268 |
3263 void Isolate::SetRAILMode(RAILMode rail_mode) { | 3269 void Isolate::SetRAILMode(RAILMode rail_mode) { |
| 3270 RAILMode old_rail_mode = rail_mode_.Value(); |
| 3271 if (old_rail_mode != PERFORMANCE_LOAD && rail_mode == PERFORMANCE_LOAD) { |
| 3272 base::LockGuard<base::Mutex> guard(&rail_mutex_); |
| 3273 load_start_time_ms_ = heap()->MonotonicallyIncreasingTimeInMs(); |
| 3274 } |
3264 rail_mode_.SetValue(rail_mode); | 3275 rail_mode_.SetValue(rail_mode); |
| 3276 if (old_rail_mode == PERFORMANCE_LOAD && rail_mode != PERFORMANCE_LOAD) { |
| 3277 heap()->incremental_marking()->incremental_marking_job()->ScheduleTask( |
| 3278 heap()); |
| 3279 } |
3265 if (FLAG_trace_rail) { | 3280 if (FLAG_trace_rail) { |
3266 PrintIsolate(this, "RAIL mode: %s\n", RAILModeName(rail_mode)); | 3281 PrintIsolate(this, "RAIL mode: %s\n", RAILModeName(rail_mode)); |
3267 } | 3282 } |
3268 } | 3283 } |
3269 | 3284 |
3270 void Isolate::IsolateInBackgroundNotification() { | 3285 void Isolate::IsolateInBackgroundNotification() { |
3271 is_isolate_in_background_ = true; | 3286 is_isolate_in_background_ = true; |
3272 heap()->ActivateMemoryReducerIfNeeded(); | 3287 heap()->ActivateMemoryReducerIfNeeded(); |
3273 } | 3288 } |
3274 | 3289 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3323 // Then check whether this scope intercepts. | 3338 // Then check whether this scope intercepts. |
3324 if ((flag & intercept_mask_)) { | 3339 if ((flag & intercept_mask_)) { |
3325 intercepted_flags_ |= flag; | 3340 intercepted_flags_ |= flag; |
3326 return true; | 3341 return true; |
3327 } | 3342 } |
3328 return false; | 3343 return false; |
3329 } | 3344 } |
3330 | 3345 |
3331 } // namespace internal | 3346 } // namespace internal |
3332 } // namespace v8 | 3347 } // namespace v8 |
OLD | NEW |