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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 DeleteArray(encodings_[type]); | 474 DeleteArray(encodings_[type]); |
475 } | 475 } |
476 DeleteArray(encodings_); | 476 DeleteArray(encodings_); |
477 } | 477 } |
478 | 478 |
479 | 479 |
480 RootIndexMap::RootIndexMap(Isolate* isolate) { | 480 RootIndexMap::RootIndexMap(Isolate* isolate) { |
481 map_ = new HashMap(HashMap::PointersMatch); | 481 map_ = new HashMap(HashMap::PointersMatch); |
482 Object** root_array = isolate->heap()->roots_array_start(); | 482 Object** root_array = isolate->heap()->roots_array_start(); |
483 for (uint32_t i = 0; i < Heap::kStrongRootListLength; i++) { | 483 for (uint32_t i = 0; i < Heap::kStrongRootListLength; i++) { |
484 Object* root = root_array[i]; | 484 Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i); |
485 if (root->IsHeapObject() && !isolate->heap()->InNewSpace(root)) { | 485 Object* root = root_array[root_index]; |
| 486 // Omit root entries that can be written after initialization. They must |
| 487 // not be referenced through the root list in the snapshot. |
| 488 if (root->IsHeapObject() && |
| 489 isolate->heap()->RootCanBeTreatedAsConstant(root_index)) { |
486 HeapObject* heap_object = HeapObject::cast(root); | 490 HeapObject* heap_object = HeapObject::cast(root); |
487 HashMap::Entry* entry = LookupEntry(map_, heap_object, false); | 491 HashMap::Entry* entry = LookupEntry(map_, heap_object, false); |
488 if (entry != NULL) { | 492 if (entry != NULL) { |
489 // Some are initialized to a previous value in the root list. | 493 // Some are initialized to a previous value in the root list. |
490 DCHECK_LT(GetValue(entry), i); | 494 DCHECK_LT(GetValue(entry), i); |
491 } else { | 495 } else { |
492 SetValue(LookupEntry(map_, heap_object, true), i); | 496 SetValue(LookupEntry(map_, heap_object, true), i); |
493 } | 497 } |
494 } | 498 } |
495 } | 499 } |
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 DisallowHeapAllocation no_gc; | 2654 DisallowHeapAllocation no_gc; |
2651 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2655 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2652 SanityCheckResult r = scd->SanityCheck(source); | 2656 SanityCheckResult r = scd->SanityCheck(source); |
2653 if (r == CHECK_SUCCESS) return scd; | 2657 if (r == CHECK_SUCCESS) return scd; |
2654 cached_data->Reject(); | 2658 cached_data->Reject(); |
2655 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2659 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2656 delete scd; | 2660 delete scd; |
2657 return NULL; | 2661 return NULL; |
2658 } | 2662 } |
2659 } } // namespace v8::internal | 2663 } } // namespace v8::internal |
OLD | NEW |