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/spaces.cc

Issue 1147503002: MIPS64: Improve long branches utilizing code range. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed typo, addressed stale comment. 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/globals.h ('k') | src/mips64/assembler-mips64.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 // 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/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/full-codegen.h" 9 #include "src/full-codegen.h"
10 #include "src/heap/mark-compact.h" 10 #include "src/heap/mark-compact.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } else { 107 } else {
108 return true; 108 return true;
109 } 109 }
110 } 110 }
111 111
112 if (requested <= kMinimumCodeRangeSize) { 112 if (requested <= kMinimumCodeRangeSize) {
113 requested = kMinimumCodeRangeSize; 113 requested = kMinimumCodeRangeSize;
114 } 114 }
115 115
116 DCHECK(!kRequiresCodeRange || requested <= kMaximalCodeRangeSize); 116 DCHECK(!kRequiresCodeRange || requested <= kMaximalCodeRangeSize);
117 #ifdef V8_TARGET_ARCH_MIPS64
118 // To use pseudo-relative jumps such as j/jal instructions which have 28-bit
119 // encoded immediate, the addresses have to be in range of 256Mb aligned
120 // region.
121 code_range_ = new base::VirtualMemory(requested, kMaximalCodeRangeSize);
122 #else
117 code_range_ = new base::VirtualMemory(requested); 123 code_range_ = new base::VirtualMemory(requested);
124 #endif
118 CHECK(code_range_ != NULL); 125 CHECK(code_range_ != NULL);
119 if (!code_range_->IsReserved()) { 126 if (!code_range_->IsReserved()) {
120 delete code_range_; 127 delete code_range_;
121 code_range_ = NULL; 128 code_range_ = NULL;
122 return false; 129 return false;
123 } 130 }
124 131
125 // We are sure that we have mapped a block of requested addresses. 132 // We are sure that we have mapped a block of requested addresses.
126 DCHECK(code_range_->size() == requested); 133 DCHECK(code_range_->size() == requested);
127 Address base = reinterpret_cast<Address>(code_range_->address()); 134 Address base = reinterpret_cast<Address>(code_range_->address());
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 LOG(isolate_, StringEvent("MemoryAllocator::AllocateRawMemory", 645 LOG(isolate_, StringEvent("MemoryAllocator::AllocateRawMemory",
639 "V8 Executable Allocation capacity exceeded")); 646 "V8 Executable Allocation capacity exceeded"));
640 return NULL; 647 return NULL;
641 } 648 }
642 649
643 // Size of header (not executable) plus area (executable). 650 // Size of header (not executable) plus area (executable).
644 size_t commit_size = RoundUp(CodePageGuardStartOffset() + commit_area_size, 651 size_t commit_size = RoundUp(CodePageGuardStartOffset() + commit_area_size,
645 base::OS::CommitPageSize()); 652 base::OS::CommitPageSize());
646 // Allocate executable memory either from code range or from the 653 // Allocate executable memory either from code range or from the
647 // OS. 654 // OS.
655 #ifdef V8_TARGET_ARCH_MIPS64
656 // Use code range only for large object space on mips64 to keep address
657 // range within 256-MB memory region.
658 if (isolate_->code_range() != NULL && isolate_->code_range()->valid() &&
659 commit_area_size > CodePageAreaSize()) {
660 #else
648 if (isolate_->code_range() != NULL && isolate_->code_range()->valid()) { 661 if (isolate_->code_range() != NULL && isolate_->code_range()->valid()) {
662 #endif
649 base = isolate_->code_range()->AllocateRawMemory(chunk_size, commit_size, 663 base = isolate_->code_range()->AllocateRawMemory(chunk_size, commit_size,
650 &chunk_size); 664 &chunk_size);
651 DCHECK( 665 DCHECK(
652 IsAligned(reinterpret_cast<intptr_t>(base), MemoryChunk::kAlignment)); 666 IsAligned(reinterpret_cast<intptr_t>(base), MemoryChunk::kAlignment));
653 if (base == NULL) return NULL; 667 if (base == NULL) return NULL;
654 size_ += chunk_size; 668 size_ += chunk_size;
655 // Update executable memory size. 669 // Update executable memory size.
656 size_executable_ += chunk_size; 670 size_executable_ += chunk_size;
657 } else { 671 } else {
658 base = AllocateAlignedMemory(chunk_size, commit_size, 672 base = AllocateAlignedMemory(chunk_size, commit_size,
(...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after
3133 object->ShortPrint(); 3147 object->ShortPrint();
3134 PrintF("\n"); 3148 PrintF("\n");
3135 } 3149 }
3136 printf(" --------------------------------------\n"); 3150 printf(" --------------------------------------\n");
3137 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3151 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3138 } 3152 }
3139 3153
3140 #endif // DEBUG 3154 #endif // DEBUG
3141 } 3155 }
3142 } // namespace v8::internal 3156 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/mips64/assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698