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

Side by Side Diff: src/spaces.cc

Issue 7753001: Fixed bool <-> Executability confusion and improved typing a bit. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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/spaces-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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2744 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 return true; 2755 return true;
2756 } 2756 }
2757 2757
2758 2758
2759 void LargeObjectSpace::TearDown() { 2759 void LargeObjectSpace::TearDown() {
2760 while (first_chunk_ != NULL) { 2760 while (first_chunk_ != NULL) {
2761 LargeObjectChunk* chunk = first_chunk_; 2761 LargeObjectChunk* chunk = first_chunk_;
2762 first_chunk_ = first_chunk_->next(); 2762 first_chunk_ = first_chunk_->next();
2763 LOG(heap()->isolate(), DeleteEvent("LargeObjectChunk", chunk->address())); 2763 LOG(heap()->isolate(), DeleteEvent("LargeObjectChunk", chunk->address()));
2764 Page* page = Page::FromAddress(RoundUp(chunk->address(), Page::kPageSize)); 2764 Page* page = Page::FromAddress(RoundUp(chunk->address(), Page::kPageSize));
2765 Executability executable = 2765 Executability executable = page->PageExecutability();
2766 page->IsPageExecutable() ? EXECUTABLE : NOT_EXECUTABLE;
2767 ObjectSpace space = kObjectSpaceLoSpace; 2766 ObjectSpace space = kObjectSpaceLoSpace;
2768 if (executable == EXECUTABLE) space = kObjectSpaceCodeSpace; 2767 if (executable == EXECUTABLE) space = kObjectSpaceCodeSpace;
2769 size_t size = chunk->size(); 2768 size_t size = chunk->size();
2770 size_t guard_size = (executable == EXECUTABLE) ? Page::kPageSize : 0; 2769 size_t guard_size = (executable == EXECUTABLE) ? Page::kPageSize : 0;
2771 heap()->isolate()->memory_allocator()->FreeRawMemory( 2770 heap()->isolate()->memory_allocator()->FreeRawMemory(
2772 chunk->address() - guard_size, 2771 chunk->address() - guard_size,
2773 size + guard_size, 2772 size + guard_size,
2774 executable); 2773 executable);
2775 heap()->isolate()->memory_allocator()->PerformAllocationCallback( 2774 heap()->isolate()->memory_allocator()->PerformAllocationCallback(
2776 space, kAllocationActionFree, size); 2775 space, kAllocationActionFree, size);
(...skipping 29 matching lines...) Expand all
2806 first_chunk_ = chunk; 2805 first_chunk_ = chunk;
2807 2806
2808 // Initialize page header. 2807 // Initialize page header.
2809 Page* page = Page::FromAddress(RoundUp(chunk->address(), Page::kPageSize)); 2808 Page* page = Page::FromAddress(RoundUp(chunk->address(), Page::kPageSize));
2810 Address object_address = page->ObjectAreaStart(); 2809 Address object_address = page->ObjectAreaStart();
2811 2810
2812 // Clear the low order bit of the second word in the page to flag it as a 2811 // Clear the low order bit of the second word in the page to flag it as a
2813 // large object page. If the chunk_size happened to be written there, its 2812 // large object page. If the chunk_size happened to be written there, its
2814 // low order bit should already be clear. 2813 // low order bit should already be clear.
2815 page->SetIsLargeObjectPage(true); 2814 page->SetIsLargeObjectPage(true);
2816 page->SetIsPageExecutable(executable); 2815 page->SetPageExecutability(executable);
2817 page->SetRegionMarks(Page::kAllRegionsCleanMarks); 2816 page->SetRegionMarks(Page::kAllRegionsCleanMarks);
2818 return HeapObject::FromAddress(object_address); 2817 return HeapObject::FromAddress(object_address);
2819 } 2818 }
2820 2819
2821 2820
2822 MaybeObject* LargeObjectSpace::AllocateRawCode(int size_in_bytes) { 2821 MaybeObject* LargeObjectSpace::AllocateRawCode(int size_in_bytes) {
2823 ASSERT(0 < size_in_bytes); 2822 ASSERT(0 < size_in_bytes);
2824 return AllocateRawInternal(size_in_bytes, 2823 return AllocateRawInternal(size_in_bytes,
2825 size_in_bytes, 2824 size_in_bytes,
2826 EXECUTABLE); 2825 EXECUTABLE);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2939 while (current != NULL) { 2938 while (current != NULL) {
2940 HeapObject* object = current->GetObject(); 2939 HeapObject* object = current->GetObject();
2941 if (object->IsMarked()) { 2940 if (object->IsMarked()) {
2942 object->ClearMark(); 2941 object->ClearMark();
2943 heap()->mark_compact_collector()->tracer()->decrement_marked_count(); 2942 heap()->mark_compact_collector()->tracer()->decrement_marked_count();
2944 previous = current; 2943 previous = current;
2945 current = current->next(); 2944 current = current->next();
2946 } else { 2945 } else {
2947 Page* page = Page::FromAddress(RoundUp(current->address(), 2946 Page* page = Page::FromAddress(RoundUp(current->address(),
2948 Page::kPageSize)); 2947 Page::kPageSize));
2949 Executability executable = 2948 Executability executable = page->PageExecutability();
2950 page->IsPageExecutable() ? EXECUTABLE : NOT_EXECUTABLE;
2951 Address chunk_address = current->address(); 2949 Address chunk_address = current->address();
2952 size_t chunk_size = current->size(); 2950 size_t chunk_size = current->size();
2953 2951
2954 // Cut the chunk out from the chunk list. 2952 // Cut the chunk out from the chunk list.
2955 current = current->next(); 2953 current = current->next();
2956 if (previous == NULL) { 2954 if (previous == NULL) {
2957 first_chunk_ = current; 2955 first_chunk_ = current;
2958 } else { 2956 } else {
2959 previous->set_next(current); 2957 previous->set_next(current);
2960 } 2958 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
3089 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { 3087 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) {
3090 if (obj->IsCode()) { 3088 if (obj->IsCode()) {
3091 Code* code = Code::cast(obj); 3089 Code* code = Code::cast(obj);
3092 isolate->code_kind_statistics()[code->kind()] += code->Size(); 3090 isolate->code_kind_statistics()[code->kind()] += code->Size();
3093 } 3091 }
3094 } 3092 }
3095 } 3093 }
3096 #endif // DEBUG 3094 #endif // DEBUG
3097 3095
3098 } } // namespace v8::internal 3096 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | src/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698