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

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, 9 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 13966 matching lines...) Expand 10 before | Expand all | Expand 10 after
13977 13977
13978 void Code::Relocate(intptr_t delta) { 13978 void Code::Relocate(intptr_t delta) {
13979 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { 13979 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) {
13980 it.rinfo()->apply(delta); 13980 it.rinfo()->apply(delta);
13981 } 13981 }
13982 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); 13982 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size());
13983 } 13983 }
13984 13984
13985 13985
13986 void Code::CopyFrom(const CodeDesc& desc) { 13986 void Code::CopyFrom(const CodeDesc& desc) {
13987 DCHECK(Marking::Color(this) == Marking::WHITE_OBJECT);
13988
13989 // copy code 13987 // copy code
13990 CopyBytes(instruction_start(), desc.buffer, 13988 CopyBytes(instruction_start(), desc.buffer,
13991 static_cast<size_t>(desc.instr_size)); 13989 static_cast<size_t>(desc.instr_size));
13992 13990
13993 // copy reloc info 13991 // copy reloc info
13994 CopyBytes(relocation_start(), 13992 CopyBytes(relocation_start(),
13995 desc.buffer + desc.buffer_size - desc.reloc_size, 13993 desc.buffer + desc.buffer_size - desc.reloc_size,
13996 static_cast<size_t>(desc.reloc_size)); 13994 static_cast<size_t>(desc.reloc_size));
13997 13995
13998 // unbox handles and relocate 13996 // unbox handles and relocate
13999 intptr_t delta = instruction_start() - desc.buffer; 13997 intptr_t delta = instruction_start() - desc.buffer;
14000 int mode_mask = RelocInfo::kCodeTargetMask | 13998 int mode_mask = RelocInfo::kCodeTargetMask |
14001 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | 13999 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
14002 RelocInfo::ModeMask(RelocInfo::CELL) | 14000 RelocInfo::ModeMask(RelocInfo::CELL) |
14003 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | 14001 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) |
14004 RelocInfo::kApplyMask; 14002 RelocInfo::kApplyMask;
14005 // Needed to find target_object and runtime_entry on X64 14003 // Needed to find target_object and runtime_entry on X64
14006 Assembler* origin = desc.origin; 14004 Assembler* origin = desc.origin;
14007 AllowDeferredHandleDereference embedding_raw_address; 14005 AllowDeferredHandleDereference embedding_raw_address;
14008 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { 14006 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
14009 RelocInfo::Mode mode = it.rinfo()->rmode(); 14007 RelocInfo::Mode mode = it.rinfo()->rmode();
14010 if (mode == RelocInfo::EMBEDDED_OBJECT) { 14008 if (mode == RelocInfo::EMBEDDED_OBJECT) {
14011 Handle<Object> p = it.rinfo()->target_object_handle(origin); 14009 Handle<Object> p = it.rinfo()->target_object_handle(origin);
14012 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH); 14010 it.rinfo()->set_target_object(*p, UPDATE_WRITE_BARRIER,
14011 SKIP_ICACHE_FLUSH);
14013 } else if (mode == RelocInfo::CELL) { 14012 } else if (mode == RelocInfo::CELL) {
14014 Handle<Cell> cell = it.rinfo()->target_cell_handle(); 14013 Handle<Cell> cell = it.rinfo()->target_cell_handle();
14015 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH); 14014 it.rinfo()->set_target_cell(*cell, UPDATE_WRITE_BARRIER,
14015 SKIP_ICACHE_FLUSH);
14016 } else if (RelocInfo::IsCodeTarget(mode)) { 14016 } else if (RelocInfo::IsCodeTarget(mode)) {
14017 // rewrite code handles in inline cache targets to direct 14017 // rewrite code handles in inline cache targets to direct
14018 // pointers to the first instruction in the code object 14018 // pointers to the first instruction in the code object
14019 Handle<Object> p = it.rinfo()->target_object_handle(origin); 14019 Handle<Object> p = it.rinfo()->target_object_handle(origin);
14020 Code* code = Code::cast(*p); 14020 Code* code = Code::cast(*p);
14021 it.rinfo()->set_target_address(code->instruction_start(), 14021 it.rinfo()->set_target_address(code->instruction_start(),
14022 SKIP_WRITE_BARRIER, 14022 UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
14023 SKIP_ICACHE_FLUSH);
14024 } else if (RelocInfo::IsRuntimeEntry(mode)) { 14023 } else if (RelocInfo::IsRuntimeEntry(mode)) {
14025 Address p = it.rinfo()->target_runtime_entry(origin); 14024 Address p = it.rinfo()->target_runtime_entry(origin);
14026 it.rinfo()->set_target_runtime_entry(p, SKIP_WRITE_BARRIER, 14025 it.rinfo()->set_target_runtime_entry(p, UPDATE_WRITE_BARRIER,
14027 SKIP_ICACHE_FLUSH); 14026 SKIP_ICACHE_FLUSH);
14028 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) { 14027 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) {
14029 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin); 14028 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin);
14030 Code* code = Code::cast(*p); 14029 Code* code = Code::cast(*p);
14031 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH); 14030 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH);
14032 } else { 14031 } else {
14033 it.rinfo()->apply(delta); 14032 it.rinfo()->apply(delta);
14034 } 14033 }
14035 } 14034 }
14036 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); 14035 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size());
(...skipping 5757 matching lines...) Expand 10 before | Expand all | Expand 10 after
19794 if (cell->value() != *new_value) { 19793 if (cell->value() != *new_value) {
19795 cell->set_value(*new_value); 19794 cell->set_value(*new_value);
19796 Isolate* isolate = cell->GetIsolate(); 19795 Isolate* isolate = cell->GetIsolate();
19797 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19796 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19798 isolate, DependentCode::kPropertyCellChangedGroup); 19797 isolate, DependentCode::kPropertyCellChangedGroup);
19799 } 19798 }
19800 } 19799 }
19801 19800
19802 } // namespace internal 19801 } // namespace internal
19803 } // namespace v8 19802 } // namespace v8
OLDNEW
« src/heap/mark-compact-inl.h ('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