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

Unified Diff: src/x64/codegen-x64.cc

Issue 606013002: Install function tables for the code range on Win64 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@bleeding_edge
Patch Set: updates Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« include/v8.h ('K') | « src/x64/codegen-x64.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/codegen-x64.cc
diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc
index 44e1618c319b5abe542cb183618bb05598523235..a1140158dbee2df874bd43747496a7c34d8b7732 100644
--- a/src/x64/codegen-x64.cc
+++ b/src/x64/codegen-x64.cc
@@ -31,6 +31,70 @@ void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const {
#define __ masm.
+#ifdef _WIN64
+
cpu_(ooo_6.6-7.5) 2014/09/26 20:35:31 can you copy the definition of UndwinIfo from Mic
+struct UnwindInfo {
+ unsigned char version : 3;
+ unsigned char flags : 5;
+ unsigned char size_of_prolog;
+ unsigned char count_of_codes;
+ unsigned frame_register : 4;
+ unsigned frame_offset : 4;
+ Address exception_handler;
+ Address exception_data;
+};
+
+struct ExceptionTableEntry {
+ char trampoline[16];
+ ::RUNTIME_FUNCTION runtime_function;
+ UnwindInfo unwind_info;
+};
+
+void InstallExceptionFilter(Isolate* isolate,
+ WinExceptionFilter exception_filter) {
+ CHECK(exception_filter);
+ MemoryChunk* chunk = isolate->memory_allocator()->AllocateChunk(
+ sizeof(ExceptionTableEntry), sizeof(ExceptionTableEntry),
+ EXECUTABLE, NULL);
+ CHECK(chunk && chunk->address());
+ byte* buffer = chunk->area_start();
+ MacroAssembler masm(NULL, buffer, chunk->area_size());
+
+ __ Jump(reinterpret_cast<Address>(exception_filter),
+ RelocInfo::EXTERNAL_REFERENCE);
cpu_(ooo_6.6-7.5) 2014/09/26 17:03:51 what is ^^ that?
jochen (gone - plz use gerrit) 2014/09/26 17:25:31 this emits a jump to the breakpad exception filter
cpu_(ooo_6.6-7.5) 2014/09/26 20:35:31 Acknowledged.
+
+ CodeDesc desc;
+ masm.GetCode(&desc);
+ DCHECK(!RelocInfo::RequiresRelocation(desc));
+
+ ExceptionTableEntry* table_entry =
+ reinterpret_cast<ExceptionTableEntry*>(buffer);
+ table_entry->runtime_function.BeginAddress = 0;
cpu_(ooo_6.6-7.5) 2014/09/26 17:03:51 is that begin address absolute?
jochen (gone - plz use gerrit) 2014/09/26 17:25:31 no, all addresses are 32bit offsets to the start o
cpu_(ooo_6.6-7.5) 2014/09/26 20:35:31 Acknowledged.
+ table_entry->runtime_function.EndAddress =
+ static_cast<DWORD>(isolate->code_range()->size());
+ table_entry->runtime_function.UnwindData =
+ reinterpret_cast<Address>(&table_entry->unwind_info) -
+ isolate->code_range()->start();
+
+ table_entry->unwind_info.version = 1;
+ table_entry->unwind_info.flags = UNW_FLAG_EHANDLER;
+ table_entry->unwind_info.size_of_prolog = 0;
+ table_entry->unwind_info.count_of_codes = 0;
+ table_entry->unwind_info.frame_register = 0;
+ table_entry->unwind_info.frame_offset = 0;
+ table_entry->unwind_info.exception_handler = reinterpret_cast<Address>(
+ reinterpret_cast<Address>(&table_entry->trampoline) -
+ isolate->code_range()->start());
+ table_entry->unwind_info.exception_data = 0;
+
+ CpuFeatures::FlushICache(buffer, chunk->area_size());
+ base::OS::ProtectCode(buffer, chunk->area_size());
+
+ CHECK(RtlAddFunctionTable(
+ &table_entry->runtime_function, 1,
+ reinterpret_cast<DWORD64>(isolate->code_range()->start())));
+}
+#endif
UnaryMathFunction CreateExpFunction() {
if (!FLAG_fast_math) return &std::exp;
« include/v8.h ('K') | « src/x64/codegen-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698