| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 : isolate_(NULL), | 67 : isolate_(NULL), |
| 68 // semispace_size_ should be a power of 2 and old_generation_size_ should be | 68 // semispace_size_ should be a power of 2 and old_generation_size_ should be |
| 69 // a multiple of Page::kPageSize. | 69 // a multiple of Page::kPageSize. |
| 70 #if V8_TARGET_ARCH_X64 | 70 #if V8_TARGET_ARCH_X64 |
| 71 #define LUMP_OF_MEMORY (2 * MB) | 71 #define LUMP_OF_MEMORY (2 * MB) |
| 72 code_range_size_(512*MB), | 72 code_range_size_(512*MB), |
| 73 #else | 73 #else |
| 74 #define LUMP_OF_MEMORY MB | 74 #define LUMP_OF_MEMORY MB |
| 75 code_range_size_(0), | 75 code_range_size_(0), |
| 76 #endif | 76 #endif |
| 77 #if defined(ANDROID) | 77 #if defined(ANDROID) || V8_TARGET_ARCH_MIPS |
| 78 reserved_semispace_size_(4 * Max(LUMP_OF_MEMORY, Page::kPageSize)), | 78 reserved_semispace_size_(4 * Max(LUMP_OF_MEMORY, Page::kPageSize)), |
| 79 max_semispace_size_(4 * Max(LUMP_OF_MEMORY, Page::kPageSize)), | 79 max_semispace_size_(4 * Max(LUMP_OF_MEMORY, Page::kPageSize)), |
| 80 initial_semispace_size_(Page::kPageSize), | 80 initial_semispace_size_(Page::kPageSize), |
| 81 max_old_generation_size_(192*MB), | 81 max_old_generation_size_(192*MB), |
| 82 max_executable_size_(max_old_generation_size_), | 82 max_executable_size_(max_old_generation_size_), |
| 83 #else | 83 #else |
| 84 reserved_semispace_size_(8 * Max(LUMP_OF_MEMORY, Page::kPageSize)), | 84 reserved_semispace_size_(8 * Max(LUMP_OF_MEMORY, Page::kPageSize)), |
| 85 max_semispace_size_(8 * Max(LUMP_OF_MEMORY, Page::kPageSize)), | 85 max_semispace_size_(8 * Max(LUMP_OF_MEMORY, Page::kPageSize)), |
| 86 initial_semispace_size_(Page::kPageSize), | 86 initial_semispace_size_(Page::kPageSize), |
| 87 max_old_generation_size_(700ul * LUMP_OF_MEMORY), | 87 max_old_generation_size_(700ul * LUMP_OF_MEMORY), |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 // major GC. Therefore if we collect aggressively and weak handle callback | 606 // major GC. Therefore if we collect aggressively and weak handle callback |
| 607 // has been invoked, we rerun major GC to release objects which become | 607 // has been invoked, we rerun major GC to release objects which become |
| 608 // garbage. | 608 // garbage. |
| 609 // Note: as weak callbacks can execute arbitrary code, we cannot | 609 // Note: as weak callbacks can execute arbitrary code, we cannot |
| 610 // hope that eventually there will be no weak callbacks invocations. | 610 // hope that eventually there will be no weak callbacks invocations. |
| 611 // Therefore stop recollecting after several attempts. | 611 // Therefore stop recollecting after several attempts. |
| 612 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | | 612 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | |
| 613 kReduceMemoryFootprintMask); | 613 kReduceMemoryFootprintMask); |
| 614 isolate_->compilation_cache()->Clear(); | 614 isolate_->compilation_cache()->Clear(); |
| 615 const int kMaxNumberOfAttempts = 7; | 615 const int kMaxNumberOfAttempts = 7; |
| 616 const int kMinNumberOfAttempts = 2; |
| 616 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { | 617 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { |
| 617 if (!CollectGarbage(OLD_POINTER_SPACE, MARK_COMPACTOR, gc_reason, NULL)) { | 618 if (!CollectGarbage(OLD_POINTER_SPACE, MARK_COMPACTOR, gc_reason, NULL) && |
| 619 attempt + 1 >= kMinNumberOfAttempts) { |
| 618 break; | 620 break; |
| 619 } | 621 } |
| 620 } | 622 } |
| 621 mark_compact_collector()->SetFlags(kNoGCFlags); | 623 mark_compact_collector()->SetFlags(kNoGCFlags); |
| 622 new_space_.Shrink(); | 624 new_space_.Shrink(); |
| 623 UncommitFromSpace(); | 625 UncommitFromSpace(); |
| 624 incremental_marking()->UncommitMarkingDeque(); | 626 incremental_marking()->UncommitMarkingDeque(); |
| 625 } | 627 } |
| 626 | 628 |
| 627 | 629 |
| (...skipping 3917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4545 { MaybeObject* maybe_initial_map = AllocateInitialMap(constructor); | 4547 { MaybeObject* maybe_initial_map = AllocateInitialMap(constructor); |
| 4546 if (!maybe_initial_map->ToObject(&initial_map)) return maybe_initial_map; | 4548 if (!maybe_initial_map->ToObject(&initial_map)) return maybe_initial_map; |
| 4547 } | 4549 } |
| 4548 constructor->set_initial_map(Map::cast(initial_map)); | 4550 constructor->set_initial_map(Map::cast(initial_map)); |
| 4549 Map::cast(initial_map)->set_constructor(constructor); | 4551 Map::cast(initial_map)->set_constructor(constructor); |
| 4550 } | 4552 } |
| 4551 // Allocate the object based on the constructors initial map, or the payload | 4553 // Allocate the object based on the constructors initial map, or the payload |
| 4552 // advice | 4554 // advice |
| 4553 Map* initial_map = constructor->initial_map(); | 4555 Map* initial_map = constructor->initial_map(); |
| 4554 | 4556 |
| 4555 Smi* smi = Smi::cast(allocation_site->payload()); | 4557 Smi* smi = Smi::cast(allocation_site->transition_info()); |
| 4556 ElementsKind to_kind = static_cast<ElementsKind>(smi->value()); | 4558 ElementsKind to_kind = static_cast<ElementsKind>(smi->value()); |
| 4557 AllocationSiteMode mode = TRACK_ALLOCATION_SITE; | 4559 AllocationSiteMode mode = TRACK_ALLOCATION_SITE; |
| 4558 if (to_kind != initial_map->elements_kind()) { | 4560 if (to_kind != initial_map->elements_kind()) { |
| 4559 MaybeObject* maybe_new_map = initial_map->AsElementsKind(to_kind); | 4561 MaybeObject* maybe_new_map = initial_map->AsElementsKind(to_kind); |
| 4560 if (!maybe_new_map->To(&initial_map)) return maybe_new_map; | 4562 if (!maybe_new_map->To(&initial_map)) return maybe_new_map; |
| 4561 // Possibly alter the mode, since we found an updated elements kind | 4563 // Possibly alter the mode, since we found an updated elements kind |
| 4562 // in the type info cell. | 4564 // in the type info cell. |
| 4563 mode = AllocationSite::GetMode(to_kind); | 4565 mode = AllocationSite::GetMode(to_kind); |
| 4564 } | 4566 } |
| 4565 | 4567 |
| (...skipping 3573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8139 if (FLAG_parallel_recompilation) { | 8141 if (FLAG_parallel_recompilation) { |
| 8140 heap_->relocation_mutex_->Lock(); | 8142 heap_->relocation_mutex_->Lock(); |
| 8141 #ifdef DEBUG | 8143 #ifdef DEBUG |
| 8142 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8144 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
| 8143 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8145 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
| 8144 #endif // DEBUG | 8146 #endif // DEBUG |
| 8145 } | 8147 } |
| 8146 } | 8148 } |
| 8147 | 8149 |
| 8148 } } // namespace v8::internal | 8150 } } // namespace v8::internal |
| OLD | NEW |