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

Side by Side Diff: src/objects.cc

Issue 1420423009: [heap] Black allocation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 14170 matching lines...) Expand 10 before | Expand all | Expand 10 after
14181 14181
14182 void Code::Relocate(intptr_t delta) { 14182 void Code::Relocate(intptr_t delta) {
14183 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { 14183 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) {
14184 it.rinfo()->apply(delta); 14184 it.rinfo()->apply(delta);
14185 } 14185 }
14186 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); 14186 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size());
14187 } 14187 }
14188 14188
14189 14189
14190 void Code::CopyFrom(const CodeDesc& desc) { 14190 void Code::CopyFrom(const CodeDesc& desc) {
14191 DCHECK(Marking::Color(this) == Marking::WHITE_OBJECT);
14192
14193 // copy code 14191 // copy code
14194 CopyBytes(instruction_start(), desc.buffer, 14192 CopyBytes(instruction_start(), desc.buffer,
14195 static_cast<size_t>(desc.instr_size)); 14193 static_cast<size_t>(desc.instr_size));
14196 14194
14197 // copy reloc info 14195 // copy reloc info
14198 CopyBytes(relocation_start(), 14196 CopyBytes(relocation_start(),
14199 desc.buffer + desc.buffer_size - desc.reloc_size, 14197 desc.buffer + desc.buffer_size - desc.reloc_size,
14200 static_cast<size_t>(desc.reloc_size)); 14198 static_cast<size_t>(desc.reloc_size));
14201 14199
14202 // unbox handles and relocate 14200 // unbox handles and relocate
14203 intptr_t delta = instruction_start() - desc.buffer; 14201 intptr_t delta = instruction_start() - desc.buffer;
14204 int mode_mask = RelocInfo::kCodeTargetMask | 14202 int mode_mask = RelocInfo::kCodeTargetMask |
14205 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | 14203 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
14206 RelocInfo::ModeMask(RelocInfo::CELL) | 14204 RelocInfo::ModeMask(RelocInfo::CELL) |
14207 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | 14205 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) |
14208 RelocInfo::kApplyMask; 14206 RelocInfo::kApplyMask;
14209 // Needed to find target_object and runtime_entry on X64 14207 // Needed to find target_object and runtime_entry on X64
14210 Assembler* origin = desc.origin; 14208 Assembler* origin = desc.origin;
14211 AllowDeferredHandleDereference embedding_raw_address; 14209 AllowDeferredHandleDereference embedding_raw_address;
14212 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { 14210 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
14213 RelocInfo::Mode mode = it.rinfo()->rmode(); 14211 RelocInfo::Mode mode = it.rinfo()->rmode();
14214 if (mode == RelocInfo::EMBEDDED_OBJECT) { 14212 if (mode == RelocInfo::EMBEDDED_OBJECT) {
14215 Handle<Object> p = it.rinfo()->target_object_handle(origin); 14213 Handle<Object> p = it.rinfo()->target_object_handle(origin);
14216 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH); 14214 it.rinfo()->set_target_object(*p, UPDATE_WRITE_BARRIER,
14215 SKIP_ICACHE_FLUSH);
14217 } else if (mode == RelocInfo::CELL) { 14216 } else if (mode == RelocInfo::CELL) {
14218 Handle<Cell> cell = it.rinfo()->target_cell_handle(); 14217 Handle<Cell> cell = it.rinfo()->target_cell_handle();
14219 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH); 14218 it.rinfo()->set_target_cell(*cell, UPDATE_WRITE_BARRIER,
14219 SKIP_ICACHE_FLUSH);
14220 } else if (RelocInfo::IsCodeTarget(mode)) { 14220 } else if (RelocInfo::IsCodeTarget(mode)) {
14221 // rewrite code handles in inline cache targets to direct 14221 // rewrite code handles in inline cache targets to direct
14222 // pointers to the first instruction in the code object 14222 // pointers to the first instruction in the code object
14223 Handle<Object> p = it.rinfo()->target_object_handle(origin); 14223 Handle<Object> p = it.rinfo()->target_object_handle(origin);
14224 Code* code = Code::cast(*p); 14224 Code* code = Code::cast(*p);
14225 it.rinfo()->set_target_address(code->instruction_start(), 14225 it.rinfo()->set_target_address(code->instruction_start(),
14226 SKIP_WRITE_BARRIER, 14226 UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
14227 SKIP_ICACHE_FLUSH);
14228 } else if (RelocInfo::IsRuntimeEntry(mode)) { 14227 } else if (RelocInfo::IsRuntimeEntry(mode)) {
14229 Address p = it.rinfo()->target_runtime_entry(origin); 14228 Address p = it.rinfo()->target_runtime_entry(origin);
14230 it.rinfo()->set_target_runtime_entry(p, SKIP_WRITE_BARRIER, 14229 it.rinfo()->set_target_runtime_entry(p, UPDATE_WRITE_BARRIER,
14231 SKIP_ICACHE_FLUSH); 14230 SKIP_ICACHE_FLUSH);
14232 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) { 14231 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) {
14233 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin); 14232 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin);
14234 Code* code = Code::cast(*p); 14233 Code* code = Code::cast(*p);
14235 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH); 14234 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH);
14236 } else { 14235 } else {
14237 it.rinfo()->apply(delta); 14236 it.rinfo()->apply(delta);
14238 } 14237 }
14239 } 14238 }
14240 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); 14239 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size());
(...skipping 5729 matching lines...) Expand 10 before | Expand all | Expand 10 after
19970 if (cell->value() != *new_value) { 19969 if (cell->value() != *new_value) {
19971 cell->set_value(*new_value); 19970 cell->set_value(*new_value);
19972 Isolate* isolate = cell->GetIsolate(); 19971 Isolate* isolate = cell->GetIsolate();
19973 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19972 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19974 isolate, DependentCode::kPropertyCellChangedGroup); 19973 isolate, DependentCode::kPropertyCellChangedGroup);
19975 } 19974 }
19976 } 19975 }
19977 19976
19978 } // namespace internal 19977 } // namespace internal
19979 } // namespace v8 19978 } // namespace v8
OLDNEW
« src/heap/heap.cc ('K') | « src/heap/spaces-inl.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698