| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "accessors.h" | 7 #include "accessors.h" |
| 8 #include "api.h" | 8 #include "api.h" |
| 9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
| 10 #include "codegen.h" | 10 #include "codegen.h" |
| (...skipping 4657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4668 old_data_space_->Verify(&no_dirty_regions_visitor); | 4668 old_data_space_->Verify(&no_dirty_regions_visitor); |
| 4669 code_space_->Verify(&no_dirty_regions_visitor); | 4669 code_space_->Verify(&no_dirty_regions_visitor); |
| 4670 cell_space_->Verify(&no_dirty_regions_visitor); | 4670 cell_space_->Verify(&no_dirty_regions_visitor); |
| 4671 property_cell_space_->Verify(&no_dirty_regions_visitor); | 4671 property_cell_space_->Verify(&no_dirty_regions_visitor); |
| 4672 | 4672 |
| 4673 lo_space_->Verify(); | 4673 lo_space_->Verify(); |
| 4674 } | 4674 } |
| 4675 #endif | 4675 #endif |
| 4676 | 4676 |
| 4677 | 4677 |
| 4678 bool Heap::InternalizeStringIfExists(String* string, String** result) { | |
| 4679 if (string->IsInternalizedString()) { | |
| 4680 *result = string; | |
| 4681 return true; | |
| 4682 } | |
| 4683 return string_table()->LookupStringIfExists(string, result); | |
| 4684 } | |
| 4685 | |
| 4686 | |
| 4687 void Heap::ZapFromSpace() { | 4678 void Heap::ZapFromSpace() { |
| 4688 NewSpacePageIterator it(new_space_.FromSpaceStart(), | 4679 NewSpacePageIterator it(new_space_.FromSpaceStart(), |
| 4689 new_space_.FromSpaceEnd()); | 4680 new_space_.FromSpaceEnd()); |
| 4690 while (it.has_next()) { | 4681 while (it.has_next()) { |
| 4691 NewSpacePage* page = it.next(); | 4682 NewSpacePage* page = it.next(); |
| 4692 for (Address cursor = page->area_start(), limit = page->area_end(); | 4683 for (Address cursor = page->area_start(), limit = page->area_end(); |
| 4693 cursor < limit; | 4684 cursor < limit; |
| 4694 cursor += kPointerSize) { | 4685 cursor += kPointerSize) { |
| 4695 Memory::Address_at(cursor) = kFromSpaceZapValue; | 4686 Memory::Address_at(cursor) = kFromSpaceZapValue; |
| 4696 } | 4687 } |
| (...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6255 } | 6246 } |
| 6256 } | 6247 } |
| 6257 return kNotFound; | 6248 return kNotFound; |
| 6258 } | 6249 } |
| 6259 | 6250 |
| 6260 | 6251 |
| 6261 void KeyedLookupCache::Update(Handle<Map> map, | 6252 void KeyedLookupCache::Update(Handle<Map> map, |
| 6262 Handle<Name> name, | 6253 Handle<Name> name, |
| 6263 int field_offset) { | 6254 int field_offset) { |
| 6264 if (!name->IsUniqueName()) { | 6255 if (!name->IsUniqueName()) { |
| 6265 String* internalized_string; | 6256 if (!StringTable::InternalizeStringIfExists(name->GetIsolate(), |
| 6266 if (!map->GetIsolate()->heap()->InternalizeStringIfExists( | 6257 Handle<String>::cast(name)). |
| 6267 String::cast(*name), &internalized_string)) { | 6258 ToHandle(&name)) { |
| 6268 return; | 6259 return; |
| 6269 } | 6260 } |
| 6270 name = handle(internalized_string); | |
| 6271 } | 6261 } |
| 6272 // This cache is cleared only between mark compact passes, so we expect the | 6262 // This cache is cleared only between mark compact passes, so we expect the |
| 6273 // cache to only contain old space names. | 6263 // cache to only contain old space names. |
| 6274 ASSERT(!map->GetIsolate()->heap()->InNewSpace(*name)); | 6264 ASSERT(!map->GetIsolate()->heap()->InNewSpace(*name)); |
| 6275 | 6265 |
| 6276 int index = (Hash(map, name) & kHashMask); | 6266 int index = (Hash(map, name) & kHashMask); |
| 6277 // After a GC there will be free slots, so we use them in order (this may | 6267 // After a GC there will be free slots, so we use them in order (this may |
| 6278 // help to get the most frequently used one in position 0). | 6268 // help to get the most frequently used one in position 0). |
| 6279 for (int i = 0; i< kEntriesPerBucket; i++) { | 6269 for (int i = 0; i< kEntriesPerBucket; i++) { |
| 6280 Key& key = keys_[index]; | 6270 Key& key = keys_[index]; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6494 static_cast<int>(object_sizes_last_time_[index])); | 6484 static_cast<int>(object_sizes_last_time_[index])); |
| 6495 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6485 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6496 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6486 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6497 | 6487 |
| 6498 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6488 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6499 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6489 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6500 ClearObjectStats(); | 6490 ClearObjectStats(); |
| 6501 } | 6491 } |
| 6502 | 6492 |
| 6503 } } // namespace v8::internal | 6493 } } // namespace v8::internal |
| OLD | NEW |