| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 max_alive_after_gc_(0), | 138 max_alive_after_gc_(0), |
| 139 min_in_mutator_(kMaxInt), | 139 min_in_mutator_(kMaxInt), |
| 140 alive_after_last_gc_(0), | 140 alive_after_last_gc_(0), |
| 141 last_gc_end_timestamp_(0.0), | 141 last_gc_end_timestamp_(0.0), |
| 142 store_buffer_(this), | 142 store_buffer_(this), |
| 143 marking_(this), | 143 marking_(this), |
| 144 incremental_marking_(this), | 144 incremental_marking_(this), |
| 145 number_idle_notifications_(0), | 145 number_idle_notifications_(0), |
| 146 last_idle_notification_gc_count_(0), | 146 last_idle_notification_gc_count_(0), |
| 147 last_idle_notification_gc_count_init_(false), | 147 last_idle_notification_gc_count_init_(false), |
| 148 idle_notification_will_schedule_next_gc_(false), | |
| 149 mark_sweeps_since_idle_round_started_(0), | 148 mark_sweeps_since_idle_round_started_(0), |
| 150 ms_count_at_last_idle_notification_(0), | 149 ms_count_at_last_idle_notification_(0), |
| 151 gc_count_at_last_idle_gc_(0), | 150 gc_count_at_last_idle_gc_(0), |
| 152 scavenges_since_last_idle_round_(kIdleScavengeThreshold), | 151 scavenges_since_last_idle_round_(kIdleScavengeThreshold), |
| 153 promotion_queue_(this), | 152 promotion_queue_(this), |
| 154 configured_(false), | 153 configured_(false), |
| 155 chunks_queued_for_free_(NULL) { | 154 chunks_queued_for_free_(NULL) { |
| 156 // Allow build-time customization of the max semispace size. Building | 155 // Allow build-time customization of the max semispace size. Building |
| 157 // V8 with snapshots and a non-default max semispace size is much | 156 // V8 with snapshots and a non-default max semispace size is much |
| 158 // easier if you can define it as part of the build environment. | 157 // easier if you can define it as part of the build environment. |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 if (FLAG_trace_incremental_marking) { | 496 if (FLAG_trace_incremental_marking) { |
| 498 PrintF("[IncrementalMarking] Scavenge during marking.\n"); | 497 PrintF("[IncrementalMarking] Scavenge during marking.\n"); |
| 499 } | 498 } |
| 500 } | 499 } |
| 501 | 500 |
| 502 if (collector == MARK_COMPACTOR && | 501 if (collector == MARK_COMPACTOR && |
| 503 !mark_compact_collector()->abort_incremental_marking_ && | 502 !mark_compact_collector()->abort_incremental_marking_ && |
| 504 !incremental_marking()->IsStopped() && | 503 !incremental_marking()->IsStopped() && |
| 505 !incremental_marking()->should_hurry() && | 504 !incremental_marking()->should_hurry() && |
| 506 FLAG_incremental_marking_steps) { | 505 FLAG_incremental_marking_steps) { |
| 507 if (FLAG_trace_incremental_marking) { | 506 // Make progress in incremental marking. |
| 508 PrintF("[IncrementalMarking] Delaying MarkSweep.\n"); | 507 const intptr_t kStepSizeWhenDelayedByScavenge = 1 * MB; |
| 508 incremental_marking()->Step(kStepSizeWhenDelayedByScavenge, |
| 509 IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
| 510 if (!incremental_marking()->IsComplete()) { |
| 511 if (FLAG_trace_incremental_marking) { |
| 512 PrintF("[IncrementalMarking] Delaying MarkSweep.\n"); |
| 513 } |
| 514 collector = SCAVENGER; |
| 515 collector_reason = "incremental marking delaying mark-sweep"; |
| 509 } | 516 } |
| 510 collector = SCAVENGER; | |
| 511 collector_reason = "incremental marking delaying mark-sweep"; | |
| 512 } | 517 } |
| 513 | 518 |
| 514 bool next_gc_likely_to_collect_more = false; | 519 bool next_gc_likely_to_collect_more = false; |
| 515 | 520 |
| 516 { GCTracer tracer(this, gc_reason, collector_reason); | 521 { GCTracer tracer(this, gc_reason, collector_reason); |
| 517 GarbageCollectionPrologue(); | 522 GarbageCollectionPrologue(); |
| 518 // The GC count was incremented in the prologue. Tell the tracer about | 523 // The GC count was incremented in the prologue. Tell the tracer about |
| 519 // it. | 524 // it. |
| 520 tracer.set_gc_count(gc_count_); | 525 tracer.set_gc_count(gc_count_); |
| 521 | 526 |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1946 return accessors; | 1951 return accessors; |
| 1947 } | 1952 } |
| 1948 | 1953 |
| 1949 | 1954 |
| 1950 MaybeObject* Heap::AllocateTypeFeedbackInfo() { | 1955 MaybeObject* Heap::AllocateTypeFeedbackInfo() { |
| 1951 TypeFeedbackInfo* info; | 1956 TypeFeedbackInfo* info; |
| 1952 { MaybeObject* maybe_info = AllocateStruct(TYPE_FEEDBACK_INFO_TYPE); | 1957 { MaybeObject* maybe_info = AllocateStruct(TYPE_FEEDBACK_INFO_TYPE); |
| 1953 if (!maybe_info->To(&info)) return maybe_info; | 1958 if (!maybe_info->To(&info)) return maybe_info; |
| 1954 } | 1959 } |
| 1955 info->set_ic_total_count(0); | 1960 info->set_ic_total_count(0); |
| 1956 info->set_ic_with_typeinfo_count(0); | 1961 info->set_ic_with_type_info_count(0); |
| 1957 info->set_type_feedback_cells(TypeFeedbackCells::cast(empty_fixed_array()), | 1962 info->set_type_feedback_cells(TypeFeedbackCells::cast(empty_fixed_array()), |
| 1958 SKIP_WRITE_BARRIER); | 1963 SKIP_WRITE_BARRIER); |
| 1959 return info; | 1964 return info; |
| 1960 } | 1965 } |
| 1961 | 1966 |
| 1962 | 1967 |
| 1963 MaybeObject* Heap::AllocateAliasedArgumentsEntry(int aliased_context_slot) { | 1968 MaybeObject* Heap::AllocateAliasedArgumentsEntry(int aliased_context_slot) { |
| 1964 AliasedArgumentsEntry* entry; | 1969 AliasedArgumentsEntry* entry; |
| 1965 { MaybeObject* maybe_entry = AllocateStruct(ALIASED_ARGUMENTS_ENTRY_TYPE); | 1970 { MaybeObject* maybe_entry = AllocateStruct(ALIASED_ARGUMENTS_ENTRY_TYPE); |
| 1966 if (!maybe_entry->To(&entry)) return maybe_entry; | 1971 if (!maybe_entry->To(&entry)) return maybe_entry; |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2890 Code* construct_stub = | 2895 Code* construct_stub = |
| 2891 isolate_->builtins()->builtin(Builtins::kJSConstructStubGeneric); | 2896 isolate_->builtins()->builtin(Builtins::kJSConstructStubGeneric); |
| 2892 share->set_construct_stub(construct_stub); | 2897 share->set_construct_stub(construct_stub); |
| 2893 share->set_instance_class_name(Object_symbol()); | 2898 share->set_instance_class_name(Object_symbol()); |
| 2894 share->set_function_data(undefined_value(), SKIP_WRITE_BARRIER); | 2899 share->set_function_data(undefined_value(), SKIP_WRITE_BARRIER); |
| 2895 share->set_script(undefined_value(), SKIP_WRITE_BARRIER); | 2900 share->set_script(undefined_value(), SKIP_WRITE_BARRIER); |
| 2896 share->set_debug_info(undefined_value(), SKIP_WRITE_BARRIER); | 2901 share->set_debug_info(undefined_value(), SKIP_WRITE_BARRIER); |
| 2897 share->set_inferred_name(empty_string(), SKIP_WRITE_BARRIER); | 2902 share->set_inferred_name(empty_string(), SKIP_WRITE_BARRIER); |
| 2898 share->set_initial_map(undefined_value(), SKIP_WRITE_BARRIER); | 2903 share->set_initial_map(undefined_value(), SKIP_WRITE_BARRIER); |
| 2899 share->set_this_property_assignments(undefined_value(), SKIP_WRITE_BARRIER); | 2904 share->set_this_property_assignments(undefined_value(), SKIP_WRITE_BARRIER); |
| 2905 share->set_ast_node_count(0); |
| 2900 share->set_deopt_counter(FLAG_deopt_every_n_times); | 2906 share->set_deopt_counter(FLAG_deopt_every_n_times); |
| 2901 share->set_profiler_ticks(0); | 2907 share->set_ic_age(0); |
| 2902 share->set_ast_node_count(0); | |
| 2903 | 2908 |
| 2904 // Set integer fields (smi or int, depending on the architecture). | 2909 // Set integer fields (smi or int, depending on the architecture). |
| 2905 share->set_length(0); | 2910 share->set_length(0); |
| 2906 share->set_formal_parameter_count(0); | 2911 share->set_formal_parameter_count(0); |
| 2907 share->set_expected_nof_properties(0); | 2912 share->set_expected_nof_properties(0); |
| 2908 share->set_num_literals(0); | 2913 share->set_num_literals(0); |
| 2909 share->set_start_position_and_type(0); | 2914 share->set_start_position_and_type(0); |
| 2910 share->set_end_position(0); | 2915 share->set_end_position(0); |
| 2911 share->set_function_token_position(0); | 2916 share->set_function_token_position(0); |
| 2912 // All compiler hints default to false or 0. | 2917 // All compiler hints default to false or 0. |
| (...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4810 void Heap::EnsureHeapIsIterable() { | 4815 void Heap::EnsureHeapIsIterable() { |
| 4811 ASSERT(IsAllocationAllowed()); | 4816 ASSERT(IsAllocationAllowed()); |
| 4812 if (!IsHeapIterable()) { | 4817 if (!IsHeapIterable()) { |
| 4813 CollectAllGarbage(kMakeHeapIterableMask, "Heap::EnsureHeapIsIterable"); | 4818 CollectAllGarbage(kMakeHeapIterableMask, "Heap::EnsureHeapIsIterable"); |
| 4814 } | 4819 } |
| 4815 ASSERT(IsHeapIterable()); | 4820 ASSERT(IsHeapIterable()); |
| 4816 } | 4821 } |
| 4817 | 4822 |
| 4818 | 4823 |
| 4819 void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { | 4824 void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { |
| 4820 // This flag prevents incremental marking from requesting GC via stack guard | 4825 incremental_marking()->Step(step_size, |
| 4821 idle_notification_will_schedule_next_gc_ = true; | 4826 IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
| 4822 incremental_marking()->Step(step_size); | |
| 4823 idle_notification_will_schedule_next_gc_ = false; | |
| 4824 | 4827 |
| 4825 if (incremental_marking()->IsComplete()) { | 4828 if (incremental_marking()->IsComplete()) { |
| 4826 bool uncommit = false; | 4829 bool uncommit = false; |
| 4827 if (gc_count_at_last_idle_gc_ == gc_count_) { | 4830 if (gc_count_at_last_idle_gc_ == gc_count_) { |
| 4828 // No GC since the last full GC, the mutator is probably not active. | 4831 // No GC since the last full GC, the mutator is probably not active. |
| 4829 isolate_->compilation_cache()->Clear(); | 4832 isolate_->compilation_cache()->Clear(); |
| 4830 uncommit = true; | 4833 uncommit = true; |
| 4831 } | 4834 } |
| 4832 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); | 4835 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); |
| 4833 gc_count_at_last_idle_gc_ = gc_count_; | 4836 gc_count_at_last_idle_gc_ = gc_count_; |
| (...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6977 } else { | 6980 } else { |
| 6978 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. | 6981 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. |
| 6979 } | 6982 } |
| 6980 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = | 6983 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = |
| 6981 reinterpret_cast<Address>(p); | 6984 reinterpret_cast<Address>(p); |
| 6982 remembered_unmapped_pages_index_++; | 6985 remembered_unmapped_pages_index_++; |
| 6983 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; | 6986 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; |
| 6984 } | 6987 } |
| 6985 | 6988 |
| 6986 } } // namespace v8::internal | 6989 } } // namespace v8::internal |
| OLD | NEW |