Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 | 85 |
| 86 // Variables set based on semispace_size_ and old_generation_size_ in | 86 // Variables set based on semispace_size_ and old_generation_size_ in |
| 87 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_) | 87 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_) |
| 88 // Will be 4 * reserved_semispace_size_ to ensure that young | 88 // Will be 4 * reserved_semispace_size_ to ensure that young |
| 89 // generation can be aligned to its size. | 89 // generation can be aligned to its size. |
| 90 survived_since_last_expansion_(0), | 90 survived_since_last_expansion_(0), |
| 91 sweep_generation_(0), | 91 sweep_generation_(0), |
| 92 always_allocate_scope_depth_(0), | 92 always_allocate_scope_depth_(0), |
| 93 linear_allocation_scope_depth_(0), | 93 linear_allocation_scope_depth_(0), |
| 94 contexts_disposed_(0), | 94 contexts_disposed_(0), |
| 95 global_context_disposed_count_(0), | |
| 95 scan_on_scavenge_pages_(0), | 96 scan_on_scavenge_pages_(0), |
| 96 new_space_(this), | 97 new_space_(this), |
| 97 old_pointer_space_(NULL), | 98 old_pointer_space_(NULL), |
| 98 old_data_space_(NULL), | 99 old_data_space_(NULL), |
| 99 code_space_(NULL), | 100 code_space_(NULL), |
| 100 map_space_(NULL), | 101 map_space_(NULL), |
| 101 cell_space_(NULL), | 102 cell_space_(NULL), |
| 102 lo_space_(NULL), | 103 lo_space_(NULL), |
| 103 gc_state_(NOT_IN_GC), | 104 gc_state_(NOT_IN_GC), |
| 104 gc_post_processing_depth_(0), | 105 gc_post_processing_depth_(0), |
| (...skipping 2785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2890 isolate_->builtins()->builtin(Builtins::kJSConstructStubGeneric); | 2891 isolate_->builtins()->builtin(Builtins::kJSConstructStubGeneric); |
| 2891 share->set_construct_stub(construct_stub); | 2892 share->set_construct_stub(construct_stub); |
| 2892 share->set_instance_class_name(Object_symbol()); | 2893 share->set_instance_class_name(Object_symbol()); |
| 2893 share->set_function_data(undefined_value(), SKIP_WRITE_BARRIER); | 2894 share->set_function_data(undefined_value(), SKIP_WRITE_BARRIER); |
| 2894 share->set_script(undefined_value(), SKIP_WRITE_BARRIER); | 2895 share->set_script(undefined_value(), SKIP_WRITE_BARRIER); |
| 2895 share->set_debug_info(undefined_value(), SKIP_WRITE_BARRIER); | 2896 share->set_debug_info(undefined_value(), SKIP_WRITE_BARRIER); |
| 2896 share->set_inferred_name(empty_string(), SKIP_WRITE_BARRIER); | 2897 share->set_inferred_name(empty_string(), SKIP_WRITE_BARRIER); |
| 2897 share->set_initial_map(undefined_value(), SKIP_WRITE_BARRIER); | 2898 share->set_initial_map(undefined_value(), SKIP_WRITE_BARRIER); |
| 2898 share->set_this_property_assignments(undefined_value(), SKIP_WRITE_BARRIER); | 2899 share->set_this_property_assignments(undefined_value(), SKIP_WRITE_BARRIER); |
| 2899 share->set_deopt_counter(FLAG_deopt_every_n_times); | 2900 share->set_deopt_counter(FLAG_deopt_every_n_times); |
| 2901 share->set_context_disposed_count(0); | |
| 2900 share->set_profiler_ticks(0); | 2902 share->set_profiler_ticks(0); |
| 2901 share->set_ast_node_count(0); | 2903 share->set_ast_node_count(0); |
| 2902 | 2904 |
| 2903 // Set integer fields (smi or int, depending on the architecture). | 2905 // Set integer fields (smi or int, depending on the architecture). |
| 2904 share->set_length(0); | 2906 share->set_length(0); |
| 2905 share->set_formal_parameter_count(0); | 2907 share->set_formal_parameter_count(0); |
| 2906 share->set_expected_nof_properties(0); | 2908 share->set_expected_nof_properties(0); |
| 2907 share->set_num_literals(0); | 2909 share->set_num_literals(0); |
| 2908 share->set_start_position_and_type(0); | 2910 share->set_start_position_and_type(0); |
| 2909 share->set_end_position(0); | 2911 share->set_end_position(0); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3386 code->set_instruction_size(desc.instr_size); | 3388 code->set_instruction_size(desc.instr_size); |
| 3387 code->set_relocation_info(reloc_info); | 3389 code->set_relocation_info(reloc_info); |
| 3388 code->set_flags(flags); | 3390 code->set_flags(flags); |
| 3389 if (code->is_call_stub() || code->is_keyed_call_stub()) { | 3391 if (code->is_call_stub() || code->is_keyed_call_stub()) { |
| 3390 code->set_check_type(RECEIVER_MAP_CHECK); | 3392 code->set_check_type(RECEIVER_MAP_CHECK); |
| 3391 } | 3393 } |
| 3392 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); | 3394 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); |
| 3393 code->set_type_feedback_info(undefined_value(), SKIP_WRITE_BARRIER); | 3395 code->set_type_feedback_info(undefined_value(), SKIP_WRITE_BARRIER); |
| 3394 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); | 3396 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); |
| 3395 code->set_gc_metadata(Smi::FromInt(0)); | 3397 code->set_gc_metadata(Smi::FromInt(0)); |
| 3398 code->set_context_disposed_count(global_context_disposed_count_); | |
| 3396 // Allow self references to created code object by patching the handle to | 3399 // Allow self references to created code object by patching the handle to |
| 3397 // point to the newly allocated Code object. | 3400 // point to the newly allocated Code object. |
| 3398 if (!self_reference.is_null()) { | 3401 if (!self_reference.is_null()) { |
| 3399 *(self_reference.location()) = code; | 3402 *(self_reference.location()) = code; |
| 3400 } | 3403 } |
| 3401 // Migrate generated code. | 3404 // Migrate generated code. |
| 3402 // The generated code can contain Object** values (typically from handles) | 3405 // The generated code can contain Object** values (typically from handles) |
| 3403 // that are dereferenced during the copy to point directly to the actual heap | 3406 // that are dereferenced during the copy to point directly to the actual heap |
| 3404 // objects. These pointers can include references to the code object itself, | 3407 // objects. These pointers can include references to the code object itself, |
| 3405 // through the self_reference parameter. | 3408 // through the self_reference parameter. |
| (...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4831 gc_count_at_last_idle_gc_ = gc_count_; | 4834 gc_count_at_last_idle_gc_ = gc_count_; |
| 4832 if (uncommit) { | 4835 if (uncommit) { |
| 4833 new_space_.Shrink(); | 4836 new_space_.Shrink(); |
| 4834 UncommitFromSpace(); | 4837 UncommitFromSpace(); |
| 4835 } | 4838 } |
| 4836 } | 4839 } |
| 4837 } | 4840 } |
| 4838 | 4841 |
| 4839 | 4842 |
| 4840 bool Heap::IdleNotification(int hint) { | 4843 bool Heap::IdleNotification(int hint) { |
| 4841 intptr_t size_factor = Min(Max(hint, 30), 1000) / 10; | 4844 const int kMaxHint = 1000; |
| 4845 intptr_t size_factor = Min(Max(hint, 30), kMaxHint) / 10; | |
| 4842 // The size factor is in range [3..100]. | 4846 // The size factor is in range [3..100]. |
| 4843 intptr_t step_size = size_factor * IncrementalMarking::kAllocatedThreshold; | 4847 intptr_t step_size = size_factor * IncrementalMarking::kAllocatedThreshold; |
| 4844 | 4848 |
| 4845 if (contexts_disposed_ > 0) { | 4849 if (contexts_disposed_ > 0) { |
| 4846 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); | 4850 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); |
| 4847 if (hint >= mark_sweep_time && !FLAG_expose_gc) { | 4851 if (hint >= mark_sweep_time && !FLAG_expose_gc) { |
| 4848 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 4852 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
| 4849 CollectAllGarbage(kReduceMemoryFootprintMask, | 4853 if (hint == kMaxHint) { |
| 4850 "idle notification: contexts disposed"); | 4854 NotifyGlobalContextDisposed(); |
|
Vyacheslav Egorov (Chromium)
2012/03/22 14:47:05
Why do we signal context disposal here and abort i
ulan
2012/03/23 10:47:13
Removed aborting of incremental marking and added
| |
| 4855 CollectAllGarbage(kReduceMemoryFootprintMask | | |
| 4856 kAbortIncrementalMarkingMask, | |
| 4857 "idle notification: global contexts disposed"); | |
| 4858 } else { | |
| 4859 CollectAllGarbage(kReduceMemoryFootprintMask, | |
| 4860 "idle notification: contexts disposed"); | |
| 4861 } | |
| 4851 } else { | 4862 } else { |
| 4852 AdvanceIdleIncrementalMarking(step_size); | 4863 AdvanceIdleIncrementalMarking(step_size); |
| 4853 contexts_disposed_ = 0; | 4864 contexts_disposed_ = 0; |
| 4854 } | 4865 } |
| 4855 // Make sure that we have no pending context disposals. | 4866 // Make sure that we have no pending context disposals. |
| 4856 // Take into account that we might have decided to delay full collection | 4867 // Take into account that we might have decided to delay full collection |
| 4857 // because incremental marking is in progress. | 4868 // because incremental marking is in progress. |
| 4858 ASSERT((contexts_disposed_ == 0) || !incremental_marking()->IsStopped()); | 4869 ASSERT((contexts_disposed_ == 0) || !incremental_marking()->IsStopped()); |
| 4859 return false; | 4870 return false; |
| 4860 } | 4871 } |
| (...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6967 } else { | 6978 } else { |
| 6968 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. | 6979 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. |
| 6969 } | 6980 } |
| 6970 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = | 6981 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = |
| 6971 reinterpret_cast<Address>(p); | 6982 reinterpret_cast<Address>(p); |
| 6972 remembered_unmapped_pages_index_++; | 6983 remembered_unmapped_pages_index_++; |
| 6973 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; | 6984 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; |
| 6974 } | 6985 } |
| 6975 | 6986 |
| 6976 } } // namespace v8::internal | 6987 } } // namespace v8::internal |
| OLD | NEW |