Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: src/heap.cc

Issue 109213005: Merged r17432, r17526, r17545, r17620, r17747 into 3.20 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.20
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 return next_gc_likely_to_collect_more; 702 return next_gc_likely_to_collect_more;
703 } 703 }
704 704
705 705
706 int Heap::NotifyContextDisposed() { 706 int Heap::NotifyContextDisposed() {
707 if (FLAG_parallel_recompilation) { 707 if (FLAG_parallel_recompilation) {
708 // Flush the queued recompilation tasks. 708 // Flush the queued recompilation tasks.
709 isolate()->optimizing_compiler_thread()->Flush(); 709 isolate()->optimizing_compiler_thread()->Flush();
710 } 710 }
711 flush_monomorphic_ics_ = true; 711 flush_monomorphic_ics_ = true;
712 AgeInlineCaches();
712 return ++contexts_disposed_; 713 return ++contexts_disposed_;
713 } 714 }
714 715
715 716
716 void Heap::PerformScavenge() { 717 void Heap::PerformScavenge() {
717 GCTracer tracer(this, NULL, NULL); 718 GCTracer tracer(this, NULL, NULL);
718 if (incremental_marking()->IsStopped()) { 719 if (incremental_marking()->IsStopped()) {
719 PerformGarbageCollection(SCAVENGER, &tracer); 720 PerformGarbageCollection(SCAVENGER, &tracer);
720 } else { 721 } else {
721 PerformGarbageCollection(MARK_COMPACTOR, &tracer); 722 PerformGarbageCollection(MARK_COMPACTOR, &tracer);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 MarkCompactPrologue(); 1089 MarkCompactPrologue();
1089 1090
1090 mark_compact_collector_.CollectGarbage(); 1091 mark_compact_collector_.CollectGarbage();
1091 1092
1092 LOG(isolate_, ResourceEvent("markcompact", "end")); 1093 LOG(isolate_, ResourceEvent("markcompact", "end"));
1093 1094
1094 gc_state_ = NOT_IN_GC; 1095 gc_state_ = NOT_IN_GC;
1095 1096
1096 isolate_->counters()->objs_since_last_full()->Set(0); 1097 isolate_->counters()->objs_since_last_full()->Set(0);
1097 1098
1098 contexts_disposed_ = 0;
1099
1100 flush_monomorphic_ics_ = false; 1099 flush_monomorphic_ics_ = false;
1101 } 1100 }
1102 1101
1103 1102
1104 void Heap::MarkCompactPrologue() { 1103 void Heap::MarkCompactPrologue() {
1105 // At any old GC clear the keyed lookup cache to enable collection of unused 1104 // At any old GC clear the keyed lookup cache to enable collection of unused
1106 // maps. 1105 // maps.
1107 isolate_->keyed_lookup_cache()->Clear(); 1106 isolate_->keyed_lookup_cache()->Clear();
1108 isolate_->context_slot_cache()->Clear(); 1107 isolate_->context_slot_cache()->Clear();
1109 isolate_->descriptor_lookup_cache()->Clear(); 1108 isolate_->descriptor_lookup_cache()->Clear();
(...skipping 2883 matching lines...) Expand 10 before | Expand all | Expand 10 after
3993 buffer[0] = static_cast<uint8_t>(code); 3992 buffer[0] = static_cast<uint8_t>(code);
3994 Object* result; 3993 Object* result;
3995 MaybeObject* maybe_result = 3994 MaybeObject* maybe_result =
3996 InternalizeOneByteString(Vector<const uint8_t>(buffer, 1)); 3995 InternalizeOneByteString(Vector<const uint8_t>(buffer, 1));
3997 3996
3998 if (!maybe_result->ToObject(&result)) return maybe_result; 3997 if (!maybe_result->ToObject(&result)) return maybe_result;
3999 single_character_string_cache()->set(code, result); 3998 single_character_string_cache()->set(code, result);
4000 return result; 3999 return result;
4001 } 4000 }
4002 4001
4003 Object* result; 4002 SeqTwoByteString* result;
4004 { MaybeObject* maybe_result = AllocateRawTwoByteString(1); 4003 { MaybeObject* maybe_result = AllocateRawTwoByteString(1);
4005 if (!maybe_result->ToObject(&result)) return maybe_result; 4004 if (!maybe_result->To<SeqTwoByteString>(&result)) return maybe_result;
4006 } 4005 }
4007 String* answer = String::cast(result); 4006 result->SeqTwoByteStringSet(0, code);
4008 answer->Set(0, code); 4007 return result;
4009 return answer;
4010 } 4008 }
4011 4009
4012 4010
4013 MaybeObject* Heap::AllocateByteArray(int length, PretenureFlag pretenure) { 4011 MaybeObject* Heap::AllocateByteArray(int length, PretenureFlag pretenure) {
4014 if (length < 0 || length > ByteArray::kMaxLength) { 4012 if (length < 0 || length > ByteArray::kMaxLength) {
4015 return Failure::OutOfMemoryException(0x7); 4013 return Failure::OutOfMemoryException(0x7);
4016 } 4014 }
4017 if (pretenure == NOT_TENURED) { 4015 if (pretenure == NOT_TENURED) {
4018 return AllocateByteArray(length); 4016 return AllocateByteArray(length);
4019 } 4017 }
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
5950 // Minimal hint that allows to do full GC. 5948 // Minimal hint that allows to do full GC.
5951 const int kMinHintForFullGC = 100; 5949 const int kMinHintForFullGC = 100;
5952 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4; 5950 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4;
5953 // The size factor is in range [5..250]. The numbers here are chosen from 5951 // The size factor is in range [5..250]. The numbers here are chosen from
5954 // experiments. If you changes them, make sure to test with 5952 // experiments. If you changes them, make sure to test with
5955 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.* 5953 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.*
5956 intptr_t step_size = 5954 intptr_t step_size =
5957 size_factor * IncrementalMarking::kAllocatedThreshold; 5955 size_factor * IncrementalMarking::kAllocatedThreshold;
5958 5956
5959 if (contexts_disposed_ > 0) { 5957 if (contexts_disposed_ > 0) {
5960 if (hint >= kMaxHint) { 5958 contexts_disposed_ = 0;
5961 // The embedder is requesting a lot of GC work after context disposal,
5962 // we age inline caches so that they don't keep objects from
5963 // the old context alive.
5964 AgeInlineCaches();
5965 }
5966 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); 5959 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000);
5967 if (hint >= mark_sweep_time && !FLAG_expose_gc && 5960 if (hint >= mark_sweep_time && !FLAG_expose_gc &&
5968 incremental_marking()->IsStopped()) { 5961 incremental_marking()->IsStopped()) {
5969 HistogramTimerScope scope(isolate_->counters()->gc_context()); 5962 HistogramTimerScope scope(isolate_->counters()->gc_context());
5970 CollectAllGarbage(kReduceMemoryFootprintMask, 5963 CollectAllGarbage(kReduceMemoryFootprintMask,
5971 "idle notification: contexts disposed"); 5964 "idle notification: contexts disposed");
5972 } else { 5965 } else {
5973 AdvanceIdleIncrementalMarking(step_size); 5966 AdvanceIdleIncrementalMarking(step_size);
5974 contexts_disposed_ = 0;
5975 } 5967 }
5968
5976 // After context disposal there is likely a lot of garbage remaining, reset 5969 // After context disposal there is likely a lot of garbage remaining, reset
5977 // the idle notification counters in order to trigger more incremental GCs 5970 // the idle notification counters in order to trigger more incremental GCs
5978 // on subsequent idle notifications. 5971 // on subsequent idle notifications.
5979 StartIdleRound(); 5972 StartIdleRound();
5980 return false; 5973 return false;
5981 } 5974 }
5982 5975
5983 if (!FLAG_incremental_marking || FLAG_expose_gc || Serializer::enabled()) { 5976 if (!FLAG_incremental_marking || FLAG_expose_gc || Serializer::enabled()) {
5984 return IdleGlobalGC(); 5977 return IdleGlobalGC();
5985 } 5978 }
(...skipping 2064 matching lines...) Expand 10 before | Expand all | Expand 10 after
8050 if (FLAG_parallel_recompilation) { 8043 if (FLAG_parallel_recompilation) {
8051 heap_->relocation_mutex_->Lock(); 8044 heap_->relocation_mutex_->Lock();
8052 #ifdef DEBUG 8045 #ifdef DEBUG
8053 heap_->relocation_mutex_locked_by_optimizer_thread_ = 8046 heap_->relocation_mutex_locked_by_optimizer_thread_ =
8054 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 8047 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
8055 #endif // DEBUG 8048 #endif // DEBUG
8056 } 8049 }
8057 } 8050 }
8058 8051
8059 } } // namespace v8::internal 8052 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698