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 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 global_handles_(NULL), | 2133 global_handles_(NULL), |
2134 eternal_handles_(NULL), | 2134 eternal_handles_(NULL), |
2135 thread_manager_(NULL), | 2135 thread_manager_(NULL), |
2136 regexp_stack_(NULL), | 2136 regexp_stack_(NULL), |
2137 date_cache_(NULL), | 2137 date_cache_(NULL), |
2138 call_descriptor_data_(NULL), | 2138 call_descriptor_data_(NULL), |
2139 // TODO(bmeurer) Initialized lazily because it depends on flags; can | 2139 // TODO(bmeurer) Initialized lazily because it depends on flags; can |
2140 // be fixed once the default isolate cleanup is done. | 2140 // be fixed once the default isolate cleanup is done. |
2141 random_number_generator_(NULL), | 2141 random_number_generator_(NULL), |
2142 rail_mode_(PERFORMANCE_ANIMATION), | 2142 rail_mode_(PERFORMANCE_ANIMATION), |
| 2143 load_start_time_ms_(0), |
2143 serializer_enabled_(enable_serializer), | 2144 serializer_enabled_(enable_serializer), |
2144 has_fatal_error_(false), | 2145 has_fatal_error_(false), |
2145 initialized_from_snapshot_(false), | 2146 initialized_from_snapshot_(false), |
2146 is_promisehook_enabled_(false), | 2147 is_promisehook_enabled_(false), |
2147 is_tail_call_elimination_enabled_(true), | 2148 is_tail_call_elimination_enabled_(true), |
2148 is_isolate_in_background_(false), | 2149 is_isolate_in_background_(false), |
2149 cpu_profiler_(NULL), | 2150 cpu_profiler_(NULL), |
2150 heap_profiler_(NULL), | 2151 heap_profiler_(NULL), |
2151 code_event_dispatcher_(new CodeEventDispatcher()), | 2152 code_event_dispatcher_(new CodeEventDispatcher()), |
2152 function_entry_hook_(NULL), | 2153 function_entry_hook_(NULL), |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3488 } | 3489 } |
3489 } | 3490 } |
3490 } | 3491 } |
3491 if (new_length == 0) { | 3492 if (new_length == 0) { |
3492 heap()->set_detached_contexts(heap()->empty_fixed_array()); | 3493 heap()->set_detached_contexts(heap()->empty_fixed_array()); |
3493 } else if (new_length < length) { | 3494 } else if (new_length < length) { |
3494 heap()->RightTrimFixedArray(*detached_contexts, length - new_length); | 3495 heap()->RightTrimFixedArray(*detached_contexts, length - new_length); |
3495 } | 3496 } |
3496 } | 3497 } |
3497 | 3498 |
| 3499 double Isolate::LoadStartTimeMs() { |
| 3500 base::LockGuard<base::Mutex> guard(&rail_mutex_); |
| 3501 return load_start_time_ms_; |
| 3502 } |
| 3503 |
3498 void Isolate::SetRAILMode(RAILMode rail_mode) { | 3504 void Isolate::SetRAILMode(RAILMode rail_mode) { |
| 3505 RAILMode old_rail_mode = rail_mode_.Value(); |
| 3506 if (old_rail_mode != PERFORMANCE_LOAD && rail_mode == PERFORMANCE_LOAD) { |
| 3507 base::LockGuard<base::Mutex> guard(&rail_mutex_); |
| 3508 load_start_time_ms_ = heap()->MonotonicallyIncreasingTimeInMs(); |
| 3509 } |
3499 rail_mode_.SetValue(rail_mode); | 3510 rail_mode_.SetValue(rail_mode); |
| 3511 if (old_rail_mode == PERFORMANCE_LOAD && rail_mode != PERFORMANCE_LOAD) { |
| 3512 heap()->incremental_marking()->incremental_marking_job()->ScheduleTask( |
| 3513 heap()); |
| 3514 } |
3500 if (FLAG_trace_rail) { | 3515 if (FLAG_trace_rail) { |
3501 PrintIsolate(this, "RAIL mode: %s\n", RAILModeName(rail_mode)); | 3516 PrintIsolate(this, "RAIL mode: %s\n", RAILModeName(rail_mode)); |
3502 } | 3517 } |
3503 } | 3518 } |
3504 | 3519 |
3505 void Isolate::IsolateInBackgroundNotification() { | 3520 void Isolate::IsolateInBackgroundNotification() { |
3506 is_isolate_in_background_ = true; | 3521 is_isolate_in_background_ = true; |
3507 heap()->ActivateMemoryReducerIfNeeded(); | 3522 heap()->ActivateMemoryReducerIfNeeded(); |
3508 } | 3523 } |
3509 | 3524 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3558 // Then check whether this scope intercepts. | 3573 // Then check whether this scope intercepts. |
3559 if ((flag & intercept_mask_)) { | 3574 if ((flag & intercept_mask_)) { |
3560 intercepted_flags_ |= flag; | 3575 intercepted_flags_ |= flag; |
3561 return true; | 3576 return true; |
3562 } | 3577 } |
3563 return false; | 3578 return false; |
3564 } | 3579 } |
3565 | 3580 |
3566 } // namespace internal | 3581 } // namespace internal |
3567 } // namespace v8 | 3582 } // namespace v8 |
OLD | NEW |