Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 | 24 |
| 25 void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { | 25 void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { |
| 26 masm->LeaveFrame(StackFrame::INTERNAL); | 26 masm->LeaveFrame(StackFrame::INTERNAL); |
| 27 DCHECK(masm->has_frame()); | 27 DCHECK(masm->has_frame()); |
| 28 masm->set_has_frame(false); | 28 masm->set_has_frame(false); |
| 29 } | 29 } |
| 30 | 30 |
| 31 | 31 |
| 32 #define __ masm. | 32 #define __ masm. |
| 33 | 33 |
| 34 #ifdef _WIN64 | |
| 35 | |
|
cpu_(ooo_6.6-7.5)
2014/09/26 20:35:31
can you copy the definition of UndwinIfo from
Mic
| |
| 36 struct UnwindInfo { | |
| 37 unsigned char version : 3; | |
| 38 unsigned char flags : 5; | |
| 39 unsigned char size_of_prolog; | |
| 40 unsigned char count_of_codes; | |
| 41 unsigned frame_register : 4; | |
| 42 unsigned frame_offset : 4; | |
| 43 Address exception_handler; | |
| 44 Address exception_data; | |
| 45 }; | |
| 46 | |
| 47 struct ExceptionTableEntry { | |
| 48 char trampoline[16]; | |
| 49 ::RUNTIME_FUNCTION runtime_function; | |
| 50 UnwindInfo unwind_info; | |
| 51 }; | |
| 52 | |
| 53 void InstallExceptionFilter(Isolate* isolate, | |
| 54 WinExceptionFilter exception_filter) { | |
| 55 CHECK(exception_filter); | |
| 56 MemoryChunk* chunk = isolate->memory_allocator()->AllocateChunk( | |
| 57 sizeof(ExceptionTableEntry), sizeof(ExceptionTableEntry), | |
| 58 EXECUTABLE, NULL); | |
| 59 CHECK(chunk && chunk->address()); | |
| 60 byte* buffer = chunk->area_start(); | |
| 61 MacroAssembler masm(NULL, buffer, chunk->area_size()); | |
| 62 | |
| 63 __ Jump(reinterpret_cast<Address>(exception_filter), | |
| 64 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.
| |
| 65 | |
| 66 CodeDesc desc; | |
| 67 masm.GetCode(&desc); | |
| 68 DCHECK(!RelocInfo::RequiresRelocation(desc)); | |
| 69 | |
| 70 ExceptionTableEntry* table_entry = | |
| 71 reinterpret_cast<ExceptionTableEntry*>(buffer); | |
| 72 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.
| |
| 73 table_entry->runtime_function.EndAddress = | |
| 74 static_cast<DWORD>(isolate->code_range()->size()); | |
| 75 table_entry->runtime_function.UnwindData = | |
| 76 reinterpret_cast<Address>(&table_entry->unwind_info) - | |
| 77 isolate->code_range()->start(); | |
| 78 | |
| 79 table_entry->unwind_info.version = 1; | |
| 80 table_entry->unwind_info.flags = UNW_FLAG_EHANDLER; | |
| 81 table_entry->unwind_info.size_of_prolog = 0; | |
| 82 table_entry->unwind_info.count_of_codes = 0; | |
| 83 table_entry->unwind_info.frame_register = 0; | |
| 84 table_entry->unwind_info.frame_offset = 0; | |
| 85 table_entry->unwind_info.exception_handler = reinterpret_cast<Address>( | |
| 86 reinterpret_cast<Address>(&table_entry->trampoline) - | |
| 87 isolate->code_range()->start()); | |
| 88 table_entry->unwind_info.exception_data = 0; | |
| 89 | |
| 90 CpuFeatures::FlushICache(buffer, chunk->area_size()); | |
| 91 base::OS::ProtectCode(buffer, chunk->area_size()); | |
| 92 | |
| 93 CHECK(RtlAddFunctionTable( | |
| 94 &table_entry->runtime_function, 1, | |
| 95 reinterpret_cast<DWORD64>(isolate->code_range()->start()))); | |
| 96 } | |
| 97 #endif | |
| 34 | 98 |
| 35 UnaryMathFunction CreateExpFunction() { | 99 UnaryMathFunction CreateExpFunction() { |
| 36 if (!FLAG_fast_math) return &std::exp; | 100 if (!FLAG_fast_math) return &std::exp; |
| 37 size_t actual_size; | 101 size_t actual_size; |
| 38 byte* buffer = | 102 byte* buffer = |
| 39 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 103 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 40 if (buffer == NULL) return &std::exp; | 104 if (buffer == NULL) return &std::exp; |
| 41 ExternalReference::InitializeMathExpData(); | 105 ExternalReference::InitializeMathExpData(); |
| 42 | 106 |
| 43 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 107 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 706 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. | 770 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. |
| 707 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 771 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
| 708 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 772 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
| 709 } | 773 } |
| 710 } | 774 } |
| 711 | 775 |
| 712 | 776 |
| 713 } } // namespace v8::internal | 777 } } // namespace v8::internal |
| 714 | 778 |
| 715 #endif // V8_TARGET_ARCH_X64 | 779 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |