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

Side by Side Diff: src/objects.cc

Issue 284153004: Avoid flushing the icache unnecessarily when updating target addresses in code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix intenting Created 6 years, 7 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/ia32/assembler-ia32-inl.h ('k') | src/x64/assembler-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "allocation-site-scopes.h" 8 #include "allocation-site-scopes.h"
9 #include "api.h" 9 #include "api.h"
10 #include "arguments.h" 10 #include "arguments.h"
(...skipping 10951 matching lines...) Expand 10 before | Expand all | Expand 10 after
10962 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER); 10962 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER);
10963 } else if (mode == RelocInfo::CELL) { 10963 } else if (mode == RelocInfo::CELL) {
10964 it.rinfo()->set_target_cell(undefined_cell, SKIP_WRITE_BARRIER); 10964 it.rinfo()->set_target_cell(undefined_cell, SKIP_WRITE_BARRIER);
10965 } 10965 }
10966 } 10966 }
10967 } 10967 }
10968 10968
10969 10969
10970 void Code::Relocate(intptr_t delta) { 10970 void Code::Relocate(intptr_t delta) {
10971 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { 10971 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) {
10972 it.rinfo()->apply(delta); 10972 it.rinfo()->apply(delta, SKIP_ICACHE_FLUSH);
10973 } 10973 }
10974 CPU::FlushICache(instruction_start(), instruction_size()); 10974 CPU::FlushICache(instruction_start(), instruction_size());
10975 } 10975 }
10976 10976
10977 10977
10978 void Code::CopyFrom(const CodeDesc& desc) { 10978 void Code::CopyFrom(const CodeDesc& desc) {
10979 ASSERT(Marking::Color(this) == Marking::WHITE_OBJECT); 10979 ASSERT(Marking::Color(this) == Marking::WHITE_OBJECT);
10980 10980
10981 // copy code 10981 // copy code
10982 CopyBytes(instruction_start(), desc.buffer, 10982 CopyBytes(instruction_start(), desc.buffer,
(...skipping 11 matching lines...) Expand all
10994 RelocInfo::ModeMask(RelocInfo::CELL) | 10994 RelocInfo::ModeMask(RelocInfo::CELL) |
10995 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | 10995 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) |
10996 RelocInfo::kApplyMask; 10996 RelocInfo::kApplyMask;
10997 // Needed to find target_object and runtime_entry on X64 10997 // Needed to find target_object and runtime_entry on X64
10998 Assembler* origin = desc.origin; 10998 Assembler* origin = desc.origin;
10999 AllowDeferredHandleDereference embedding_raw_address; 10999 AllowDeferredHandleDereference embedding_raw_address;
11000 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { 11000 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
11001 RelocInfo::Mode mode = it.rinfo()->rmode(); 11001 RelocInfo::Mode mode = it.rinfo()->rmode();
11002 if (mode == RelocInfo::EMBEDDED_OBJECT) { 11002 if (mode == RelocInfo::EMBEDDED_OBJECT) {
11003 Handle<Object> p = it.rinfo()->target_object_handle(origin); 11003 Handle<Object> p = it.rinfo()->target_object_handle(origin);
11004 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER); 11004 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
11005 } else if (mode == RelocInfo::CELL) { 11005 } else if (mode == RelocInfo::CELL) {
11006 Handle<Cell> cell = it.rinfo()->target_cell_handle(); 11006 Handle<Cell> cell = it.rinfo()->target_cell_handle();
11007 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER); 11007 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
11008 } else if (RelocInfo::IsCodeTarget(mode)) { 11008 } else if (RelocInfo::IsCodeTarget(mode)) {
11009 // rewrite code handles in inline cache targets to direct 11009 // rewrite code handles in inline cache targets to direct
11010 // pointers to the first instruction in the code object 11010 // pointers to the first instruction in the code object
11011 Handle<Object> p = it.rinfo()->target_object_handle(origin); 11011 Handle<Object> p = it.rinfo()->target_object_handle(origin);
11012 Code* code = Code::cast(*p); 11012 Code* code = Code::cast(*p);
11013 it.rinfo()->set_target_address(code->instruction_start(), 11013 it.rinfo()->set_target_address(code->instruction_start(),
11014 SKIP_WRITE_BARRIER); 11014 SKIP_WRITE_BARRIER,
11015 SKIP_ICACHE_FLUSH);
11015 } else if (RelocInfo::IsRuntimeEntry(mode)) { 11016 } else if (RelocInfo::IsRuntimeEntry(mode)) {
11016 Address p = it.rinfo()->target_runtime_entry(origin); 11017 Address p = it.rinfo()->target_runtime_entry(origin);
11017 it.rinfo()->set_target_runtime_entry(p, SKIP_WRITE_BARRIER); 11018 it.rinfo()->set_target_runtime_entry(p, SKIP_WRITE_BARRIER,
11019 SKIP_ICACHE_FLUSH);
11018 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) { 11020 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) {
11019 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin); 11021 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin);
11020 Code* code = Code::cast(*p); 11022 Code* code = Code::cast(*p);
11021 it.rinfo()->set_code_age_stub(code); 11023 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH);
11022 } else { 11024 } else {
11023 it.rinfo()->apply(delta); 11025 it.rinfo()->apply(delta, SKIP_ICACHE_FLUSH);
11024 } 11026 }
11025 } 11027 }
11026 CPU::FlushICache(instruction_start(), instruction_size()); 11028 CPU::FlushICache(instruction_start(), instruction_size());
11027 } 11029 }
11028 11030
11029 11031
11030 // Locate the source position which is closest to the address in the code. This 11032 // Locate the source position which is closest to the address in the code. This
11031 // is using the source position information embedded in the relocation info. 11033 // is using the source position information embedded in the relocation info.
11032 // The position returned is relative to the beginning of the script where the 11034 // The position returned is relative to the beginning of the script where the
11033 // source for this function is found. 11035 // source for this function is found.
(...skipping 6246 matching lines...) Expand 10 before | Expand all | Expand 10 after
17280 #define ERROR_MESSAGES_TEXTS(C, T) T, 17282 #define ERROR_MESSAGES_TEXTS(C, T) T,
17281 static const char* error_messages_[] = { 17283 static const char* error_messages_[] = {
17282 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17284 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17283 }; 17285 };
17284 #undef ERROR_MESSAGES_TEXTS 17286 #undef ERROR_MESSAGES_TEXTS
17285 return error_messages_[reason]; 17287 return error_messages_[reason];
17286 } 17288 }
17287 17289
17288 17290
17289 } } // namespace v8::internal 17291 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32-inl.h ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698