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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 for (int type = kFirstTypeCode; type < kTypeCodeCount; ++type) { | 473 for (int type = kFirstTypeCode; type < kTypeCodeCount; ++type) { |
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 (int i = 0; i < Heap::kStrongRootListLength; i++) { | 483 for (uint32_t i = 0; i < Heap::kStrongRootListLength; i++) { |
484 Object* root = root_array[i]; | 484 Object* root = root_array[i]; |
485 if (root->IsHeapObject() && !isolate->heap()->InNewSpace(root)) { | 485 if (root->IsHeapObject() && !isolate->heap()->InNewSpace(root)) { |
486 HeapObject* heap_object = HeapObject::cast(root); | 486 HeapObject* heap_object = HeapObject::cast(root); |
487 if (LookupEntry(map_, heap_object, false) != NULL) { | 487 HashMap::Entry* entry = LookupEntry(map_, heap_object, false); |
488 // Some root values are initialized to the empty FixedArray(); | 488 if (entry != NULL) { |
489 // Do not add them to the map. | 489 // Some are initialized to a previous value in the root list. |
490 // TODO(yangguo): This assert is not true. Some roots like | 490 DCHECK_LT(GetValue(entry), i); |
491 // instanceof_cache_answer can be e.g. null. | |
492 // DCHECK_EQ(isolate->heap()->empty_fixed_array(), heap_object); | |
493 } else { | 491 } else { |
494 SetValue(LookupEntry(map_, heap_object, true), i); | 492 SetValue(LookupEntry(map_, heap_object, true), i); |
495 } | 493 } |
496 } | 494 } |
497 } | 495 } |
498 } | 496 } |
499 | 497 |
500 | 498 |
501 class CodeAddressMap: public CodeEventLogger { | 499 class CodeAddressMap: public CodeEventLogger { |
502 public: | 500 public: |
(...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 DisallowHeapAllocation no_gc; | 2650 DisallowHeapAllocation no_gc; |
2653 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2651 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2654 SanityCheckResult r = scd->SanityCheck(source); | 2652 SanityCheckResult r = scd->SanityCheck(source); |
2655 if (r == CHECK_SUCCESS) return scd; | 2653 if (r == CHECK_SUCCESS) return scd; |
2656 cached_data->Reject(); | 2654 cached_data->Reject(); |
2657 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2655 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2658 delete scd; | 2656 delete scd; |
2659 return NULL; | 2657 return NULL; |
2660 } | 2658 } |
2661 } } // namespace v8::internal | 2659 } } // namespace v8::internal |
OLD | NEW |