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

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 14018 matching lines...) Expand 10 before | Expand all | Expand 10 after
14029 14029
14030 void Code::Relocate(intptr_t delta) { 14030 void Code::Relocate(intptr_t delta) {
14031 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { 14031 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) {
14032 it.rinfo()->apply(delta); 14032 it.rinfo()->apply(delta);
14033 } 14033 }
14034 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); 14034 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size());
14035 } 14035 }
14036 14036
14037 14037
14038 void Code::CopyFrom(const CodeDesc& desc) { 14038 void Code::CopyFrom(const CodeDesc& desc) {
14039 DCHECK(Marking::Color(this) == Marking::WHITE_OBJECT);
14040
14041 // copy code 14039 // copy code
14042 CopyBytes(instruction_start(), desc.buffer, 14040 CopyBytes(instruction_start(), desc.buffer,
14043 static_cast<size_t>(desc.instr_size)); 14041 static_cast<size_t>(desc.instr_size));
14044 14042
14045 // copy reloc info 14043 // copy reloc info
14046 CopyBytes(relocation_start(), 14044 CopyBytes(relocation_start(),
14047 desc.buffer + desc.buffer_size - desc.reloc_size, 14045 desc.buffer + desc.buffer_size - desc.reloc_size,
14048 static_cast<size_t>(desc.reloc_size)); 14046 static_cast<size_t>(desc.reloc_size));
14049 14047
14050 // unbox handles and relocate 14048 // unbox handles and relocate
14051 intptr_t delta = instruction_start() - desc.buffer; 14049 intptr_t delta = instruction_start() - desc.buffer;
14052 int mode_mask = RelocInfo::kCodeTargetMask | 14050 int mode_mask = RelocInfo::kCodeTargetMask |
14053 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | 14051 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
14054 RelocInfo::ModeMask(RelocInfo::CELL) | 14052 RelocInfo::ModeMask(RelocInfo::CELL) |
14055 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | 14053 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) |
14056 RelocInfo::kApplyMask; 14054 RelocInfo::kApplyMask;
14057 // Needed to find target_object and runtime_entry on X64 14055 // Needed to find target_object and runtime_entry on X64
14058 Assembler* origin = desc.origin; 14056 Assembler* origin = desc.origin;
14059 AllowDeferredHandleDereference embedding_raw_address; 14057 AllowDeferredHandleDereference embedding_raw_address;
14060 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { 14058 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
14061 RelocInfo::Mode mode = it.rinfo()->rmode(); 14059 RelocInfo::Mode mode = it.rinfo()->rmode();
14062 if (mode == RelocInfo::EMBEDDED_OBJECT) { 14060 if (mode == RelocInfo::EMBEDDED_OBJECT) {
14063 Handle<Object> p = it.rinfo()->target_object_handle(origin); 14061 Handle<Object> p = it.rinfo()->target_object_handle(origin);
14064 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH); 14062 it.rinfo()->set_target_object(*p, UPDATE_WRITE_BARRIER,
14063 SKIP_ICACHE_FLUSH);
14065 } else if (mode == RelocInfo::CELL) { 14064 } else if (mode == RelocInfo::CELL) {
14066 Handle<Cell> cell = it.rinfo()->target_cell_handle(); 14065 Handle<Cell> cell = it.rinfo()->target_cell_handle();
14067 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH); 14066 it.rinfo()->set_target_cell(*cell, UPDATE_WRITE_BARRIER,
14067 SKIP_ICACHE_FLUSH);
14068 } else if (RelocInfo::IsCodeTarget(mode)) { 14068 } else if (RelocInfo::IsCodeTarget(mode)) {
14069 // rewrite code handles in inline cache targets to direct 14069 // rewrite code handles in inline cache targets to direct
14070 // pointers to the first instruction in the code object 14070 // pointers to the first instruction in the code object
14071 Handle<Object> p = it.rinfo()->target_object_handle(origin); 14071 Handle<Object> p = it.rinfo()->target_object_handle(origin);
14072 Code* code = Code::cast(*p); 14072 Code* code = Code::cast(*p);
14073 it.rinfo()->set_target_address(code->instruction_start(), 14073 it.rinfo()->set_target_address(code->instruction_start(),
14074 SKIP_WRITE_BARRIER, 14074 UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
14075 SKIP_ICACHE_FLUSH);
14076 } else if (RelocInfo::IsRuntimeEntry(mode)) { 14075 } else if (RelocInfo::IsRuntimeEntry(mode)) {
14077 Address p = it.rinfo()->target_runtime_entry(origin); 14076 Address p = it.rinfo()->target_runtime_entry(origin);
14078 it.rinfo()->set_target_runtime_entry(p, SKIP_WRITE_BARRIER, 14077 it.rinfo()->set_target_runtime_entry(p, UPDATE_WRITE_BARRIER,
14079 SKIP_ICACHE_FLUSH); 14078 SKIP_ICACHE_FLUSH);
14080 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) { 14079 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) {
14081 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin); 14080 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin);
14082 Code* code = Code::cast(*p); 14081 Code* code = Code::cast(*p);
14083 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH); 14082 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH);
14084 } else { 14083 } else {
14085 it.rinfo()->apply(delta); 14084 it.rinfo()->apply(delta);
14086 } 14085 }
14087 } 14086 }
14088 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); 14087 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size());
(...skipping 5694 matching lines...) Expand 10 before | Expand all | Expand 10 after
19783 if (cell->value() != *new_value) { 19782 if (cell->value() != *new_value) {
19784 cell->set_value(*new_value); 19783 cell->set_value(*new_value);
19785 Isolate* isolate = cell->GetIsolate(); 19784 Isolate* isolate = cell->GetIsolate();
19786 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19785 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19787 isolate, DependentCode::kPropertyCellChangedGroup); 19786 isolate, DependentCode::kPropertyCellChangedGroup);
19788 } 19787 }
19789 } 19788 }
19790 19789
19791 } // namespace internal 19790 } // namespace internal
19792 } // namespace v8 19791 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698