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

Side by Side Diff: src/heap/heap.cc

Issue 1149563011: Verify a bit more about external strings (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 6 months 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
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('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 // 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/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 519
520 void Heap::RepairFreeListsAfterDeserialization() { 520 void Heap::RepairFreeListsAfterDeserialization() {
521 PagedSpaces spaces(this); 521 PagedSpaces spaces(this);
522 for (PagedSpace* space = spaces.next(); space != NULL; 522 for (PagedSpace* space = spaces.next(); space != NULL;
523 space = spaces.next()) { 523 space = spaces.next()) {
524 space->RepairFreeListsAfterDeserialization(); 524 space->RepairFreeListsAfterDeserialization();
525 } 525 }
526 } 526 }
527 527
528 528
529 void Heap::FinalizeExternalString(String* string) {
530 DCHECK(string->IsExternalString());
531 v8::String::ExternalStringResourceBase** resource_addr =
532 reinterpret_cast<v8::String::ExternalStringResourceBase**>(
533 reinterpret_cast<byte*>(string) + ExternalString::kResourceOffset -
534 kHeapObjectTag);
535
536 // Dispose of the C++ object if it has not already been disposed.
537 if (*resource_addr != NULL) {
538 #ifdef V8_ENABLE_CHECKS
539 {
540 HandleScope scope(string->GetIsolate());
541 i::Handle<i::String> str_obj(string);
542 v8::Utils::ToLocal(str_obj)->VerifyExternalStringResourceBase(
543 *resource_addr, StringShape(string).IsExternalOneByte()
544 ? v8::String::ONE_BYTE_ENCODING
545 : v8::String::TWO_BYTE_ENCODING);
546 }
547 #endif
548 (*resource_addr)->Dispose();
549 *resource_addr = NULL;
550 }
551 }
552
553
529 void Heap::ProcessPretenuringFeedback() { 554 void Heap::ProcessPretenuringFeedback() {
530 if (FLAG_allocation_site_pretenuring) { 555 if (FLAG_allocation_site_pretenuring) {
531 int tenure_decisions = 0; 556 int tenure_decisions = 0;
532 int dont_tenure_decisions = 0; 557 int dont_tenure_decisions = 0;
533 int allocation_mementos_found = 0; 558 int allocation_mementos_found = 0;
534 int allocation_sites = 0; 559 int allocation_sites = 0;
535 int active_allocation_sites = 0; 560 int active_allocation_sites = 0;
536 561
537 // If the scratchpad overflowed, we have to iterate over the allocation 562 // If the scratchpad overflowed, we have to iterate over the allocation
538 // sites list. 563 // sites list.
(...skipping 6014 matching lines...) Expand 10 before | Expand all | Expand 10 after
6553 *object_type = "CODE_TYPE"; \ 6578 *object_type = "CODE_TYPE"; \
6554 *object_sub_type = "CODE_AGE/" #name; \ 6579 *object_sub_type = "CODE_AGE/" #name; \
6555 return true; 6580 return true;
6556 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6581 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6557 #undef COMPARE_AND_RETURN_NAME 6582 #undef COMPARE_AND_RETURN_NAME
6558 } 6583 }
6559 return false; 6584 return false;
6560 } 6585 }
6561 } // namespace internal 6586 } // namespace internal
6562 } // namespace v8 6587 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698