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 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2105 eternal_handles_(NULL), | 2105 eternal_handles_(NULL), |
2106 thread_manager_(NULL), | 2106 thread_manager_(NULL), |
2107 has_installed_extensions_(false), | 2107 has_installed_extensions_(false), |
2108 regexp_stack_(NULL), | 2108 regexp_stack_(NULL), |
2109 date_cache_(NULL), | 2109 date_cache_(NULL), |
2110 call_descriptor_data_(NULL), | 2110 call_descriptor_data_(NULL), |
2111 // TODO(bmeurer) Initialized lazily because it depends on flags; can | 2111 // TODO(bmeurer) Initialized lazily because it depends on flags; can |
2112 // be fixed once the default isolate cleanup is done. | 2112 // be fixed once the default isolate cleanup is done. |
2113 random_number_generator_(NULL), | 2113 random_number_generator_(NULL), |
2114 rail_mode_(PERFORMANCE_ANIMATION), | 2114 rail_mode_(PERFORMANCE_ANIMATION), |
| 2115 load_start_time_ms_(0), |
2115 serializer_enabled_(enable_serializer), | 2116 serializer_enabled_(enable_serializer), |
2116 has_fatal_error_(false), | 2117 has_fatal_error_(false), |
2117 initialized_from_snapshot_(false), | 2118 initialized_from_snapshot_(false), |
2118 is_tail_call_elimination_enabled_(true), | 2119 is_tail_call_elimination_enabled_(true), |
2119 is_isolate_in_background_(false), | 2120 is_isolate_in_background_(false), |
2120 cpu_profiler_(NULL), | 2121 cpu_profiler_(NULL), |
2121 heap_profiler_(NULL), | 2122 heap_profiler_(NULL), |
2122 code_event_dispatcher_(new CodeEventDispatcher()), | 2123 code_event_dispatcher_(new CodeEventDispatcher()), |
2123 function_entry_hook_(NULL), | 2124 function_entry_hook_(NULL), |
2124 deferred_handles_head_(NULL), | 2125 deferred_handles_head_(NULL), |
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3434 } | 3435 } |
3435 } | 3436 } |
3436 } | 3437 } |
3437 if (new_length == 0) { | 3438 if (new_length == 0) { |
3438 heap()->set_detached_contexts(heap()->empty_fixed_array()); | 3439 heap()->set_detached_contexts(heap()->empty_fixed_array()); |
3439 } else if (new_length < length) { | 3440 } else if (new_length < length) { |
3440 heap()->RightTrimFixedArray(*detached_contexts, length - new_length); | 3441 heap()->RightTrimFixedArray(*detached_contexts, length - new_length); |
3441 } | 3442 } |
3442 } | 3443 } |
3443 | 3444 |
| 3445 double Isolate::LoadStartTimeMs() { |
| 3446 base::LockGuard<base::Mutex> guard(&rail_mutex_); |
| 3447 return load_start_time_ms_; |
| 3448 } |
| 3449 |
3444 void Isolate::SetRAILMode(RAILMode rail_mode) { | 3450 void Isolate::SetRAILMode(RAILMode rail_mode) { |
| 3451 RAILMode old_rail_mode = rail_mode_.Value(); |
| 3452 if (old_rail_mode != PERFORMANCE_LOAD && rail_mode == PERFORMANCE_LOAD) { |
| 3453 base::LockGuard<base::Mutex> guard(&rail_mutex_); |
| 3454 load_start_time_ms_ = heap()->MonotonicallyIncreasingTimeInMs(); |
| 3455 } |
3445 rail_mode_.SetValue(rail_mode); | 3456 rail_mode_.SetValue(rail_mode); |
| 3457 if (old_rail_mode == PERFORMANCE_LOAD && rail_mode != PERFORMANCE_LOAD) { |
| 3458 heap()->incremental_marking()->incremental_marking_job()->ScheduleTask( |
| 3459 heap()); |
| 3460 } |
3446 if (FLAG_trace_rail) { | 3461 if (FLAG_trace_rail) { |
3447 PrintIsolate(this, "RAIL mode: %s\n", RAILModeName(rail_mode)); | 3462 PrintIsolate(this, "RAIL mode: %s\n", RAILModeName(rail_mode)); |
3448 } | 3463 } |
3449 } | 3464 } |
3450 | 3465 |
3451 void Isolate::IsolateInBackgroundNotification() { | 3466 void Isolate::IsolateInBackgroundNotification() { |
3452 is_isolate_in_background_ = true; | 3467 is_isolate_in_background_ = true; |
3453 heap()->ActivateMemoryReducerIfNeeded(); | 3468 heap()->ActivateMemoryReducerIfNeeded(); |
3454 } | 3469 } |
3455 | 3470 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3504 // Then check whether this scope intercepts. | 3519 // Then check whether this scope intercepts. |
3505 if ((flag & intercept_mask_)) { | 3520 if ((flag & intercept_mask_)) { |
3506 intercepted_flags_ |= flag; | 3521 intercepted_flags_ |= flag; |
3507 return true; | 3522 return true; |
3508 } | 3523 } |
3509 return false; | 3524 return false; |
3510 } | 3525 } |
3511 | 3526 |
3512 } // namespace internal | 3527 } // namespace internal |
3513 } // namespace v8 | 3528 } // namespace v8 |
OLD | NEW |