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

Side by Side Diff: src/spaces.cc

Issue 3226014: Add functionality for finding code objects from a pc that points into... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/spaces.h ('k') | src/top.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 Initialize(start, space->top(), NULL); 61 Initialize(start, space->top(), NULL);
62 } 62 }
63 63
64 64
65 HeapObjectIterator::HeapObjectIterator(PagedSpace* space, Address start, 65 HeapObjectIterator::HeapObjectIterator(PagedSpace* space, Address start,
66 HeapObjectCallback size_func) { 66 HeapObjectCallback size_func) {
67 Initialize(start, space->top(), size_func); 67 Initialize(start, space->top(), size_func);
68 } 68 }
69 69
70 70
71 HeapObjectIterator::HeapObjectIterator(Page* page,
72 HeapObjectCallback size_func) {
73 Initialize(page->ObjectAreaStart(), page->AllocationTop(), size_func);
74 }
75
76
71 void HeapObjectIterator::Initialize(Address cur, Address end, 77 void HeapObjectIterator::Initialize(Address cur, Address end,
72 HeapObjectCallback size_f) { 78 HeapObjectCallback size_f) {
73 cur_addr_ = cur; 79 cur_addr_ = cur;
74 end_addr_ = end; 80 end_addr_ = end;
75 end_page_ = Page::FromAllocationTop(end); 81 end_page_ = Page::FromAllocationTop(end);
76 size_func_ = size_f; 82 size_func_ = size_f;
77 Page* p = Page::FromAllocationTop(cur_addr_); 83 Page* p = Page::FromAllocationTop(cur_addr_);
78 cur_limit_ = (p == end_page_) ? end_addr_ : p->AllocationTop(); 84 cur_limit_ = (p == end_page_) ? end_addr_ : p->AllocationTop();
79 85
80 #ifdef DEBUG 86 #ifdef DEBUG
(...skipping 2633 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 chunk != NULL; 2720 chunk != NULL;
2715 chunk = chunk->next()) { 2721 chunk = chunk->next()) {
2716 Address chunk_address = chunk->address(); 2722 Address chunk_address = chunk->address();
2717 if (chunk_address <= a && a < chunk_address + chunk->size()) { 2723 if (chunk_address <= a && a < chunk_address + chunk->size()) {
2718 return chunk->GetObject(); 2724 return chunk->GetObject();
2719 } 2725 }
2720 } 2726 }
2721 return Failure::Exception(); 2727 return Failure::Exception();
2722 } 2728 }
2723 2729
2730
2731 LargeObjectChunk* LargeObjectSpace::FindChunkContainingPc(Address pc) {
2732 // TODO(853): Change this implementation to only find executable
2733 // chunks and use some kind of hash-based approach to speed it up.
2734 for (LargeObjectChunk* chunk = first_chunk_;
2735 chunk != NULL;
2736 chunk = chunk->next()) {
2737 Address chunk_address = chunk->address();
2738 if (chunk_address <= pc && pc < chunk_address + chunk->size()) {
2739 return chunk;
2740 }
2741 }
2742 return NULL;
2743 }
2744
2745
2724 void LargeObjectSpace::IterateDirtyRegions(ObjectSlotCallback copy_object) { 2746 void LargeObjectSpace::IterateDirtyRegions(ObjectSlotCallback copy_object) {
2725 LargeObjectIterator it(this); 2747 LargeObjectIterator it(this);
2726 for (HeapObject* object = it.next(); object != NULL; object = it.next()) { 2748 for (HeapObject* object = it.next(); object != NULL; object = it.next()) {
2727 // We only have code, sequential strings, or fixed arrays in large 2749 // We only have code, sequential strings, or fixed arrays in large
2728 // object space, and only fixed arrays can possibly contain pointers to 2750 // object space, and only fixed arrays can possibly contain pointers to
2729 // the young generation. 2751 // the young generation.
2730 if (object->IsFixedArray()) { 2752 if (object->IsFixedArray()) {
2731 Page* page = Page::FromAddress(object->address()); 2753 Page* page = Page::FromAddress(object->address());
2732 uint32_t marks = page->GetRegionMarks(); 2754 uint32_t marks = page->GetRegionMarks();
2733 uint32_t newmarks = Page::kAllRegionsCleanMarks; 2755 uint32_t newmarks = Page::kAllRegionsCleanMarks;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2921 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { 2943 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) {
2922 if (obj->IsCode()) { 2944 if (obj->IsCode()) {
2923 Code* code = Code::cast(obj); 2945 Code* code = Code::cast(obj);
2924 code_kind_statistics[code->kind()] += code->Size(); 2946 code_kind_statistics[code->kind()] += code->Size();
2925 } 2947 }
2926 } 2948 }
2927 } 2949 }
2928 #endif // DEBUG 2950 #endif // DEBUG
2929 2951
2930 } } // namespace v8::internal 2952 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | src/top.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698