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

Side by Side Diff: src/x64/codegen-x64.cc

Issue 1332283002: Make FlushICache part of Assembler(Base) and take Isolate as parameter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 PatchingAssembler that initialized its isolate with NULL :) Created 5 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 unified diff | Download patch
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | src/x64/macro-assembler-x64.cc » ('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 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/x64/codegen-x64.h" 5 #include "src/x64/codegen-x64.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 __ popq(rbx); 52 __ popq(rbx);
53 __ popq(rax); 53 __ popq(rax);
54 __ movsd(xmm0, result); 54 __ movsd(xmm0, result);
55 __ Ret(); 55 __ Ret();
56 56
57 CodeDesc desc; 57 CodeDesc desc;
58 masm.GetCode(&desc); 58 masm.GetCode(&desc);
59 DCHECK(!RelocInfo::RequiresRelocation(desc)); 59 DCHECK(!RelocInfo::RequiresRelocation(desc));
60 60
61 CpuFeatures::FlushICache(buffer, actual_size); 61 Assembler::FlushICacheWithoutIsolate(buffer, actual_size);
62 base::OS::ProtectCode(buffer, actual_size); 62 base::OS::ProtectCode(buffer, actual_size);
63 return FUNCTION_CAST<UnaryMathFunction>(buffer); 63 return FUNCTION_CAST<UnaryMathFunction>(buffer);
64 } 64 }
65 65
66 66
67 UnaryMathFunction CreateSqrtFunction() { 67 UnaryMathFunction CreateSqrtFunction() {
68 size_t actual_size; 68 size_t actual_size;
69 // Allocate buffer in executable space. 69 // Allocate buffer in executable space.
70 byte* buffer = 70 byte* buffer =
71 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); 71 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true));
72 if (buffer == NULL) return &std::sqrt; 72 if (buffer == NULL) return &std::sqrt;
73 73
74 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); 74 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
75 // xmm0: raw double input. 75 // xmm0: raw double input.
76 // Move double input into registers. 76 // Move double input into registers.
77 __ sqrtsd(xmm0, xmm0); 77 __ sqrtsd(xmm0, xmm0);
78 __ Ret(); 78 __ Ret();
79 79
80 CodeDesc desc; 80 CodeDesc desc;
81 masm.GetCode(&desc); 81 masm.GetCode(&desc);
82 DCHECK(!RelocInfo::RequiresRelocation(desc)); 82 DCHECK(!RelocInfo::RequiresRelocation(desc));
83 83
84 CpuFeatures::FlushICache(buffer, actual_size); 84 Assembler::FlushICacheWithoutIsolate(buffer, actual_size);
85 base::OS::ProtectCode(buffer, actual_size); 85 base::OS::ProtectCode(buffer, actual_size);
86 return FUNCTION_CAST<UnaryMathFunction>(buffer); 86 return FUNCTION_CAST<UnaryMathFunction>(buffer);
87 } 87 }
88 88
89 89
90 #ifdef _WIN64 90 #ifdef _WIN64
91 typedef double (*ModuloFunction)(double, double); 91 typedef double (*ModuloFunction)(double, double);
92 // Define custom fmod implementation. 92 // Define custom fmod implementation.
93 ModuloFunction CreateModuloFunction() { 93 ModuloFunction CreateModuloFunction() {
94 size_t actual_size; 94 size_t actual_size;
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 } 685 }
686 686
687 687
688 void Code::PatchPlatformCodeAge(Isolate* isolate, 688 void Code::PatchPlatformCodeAge(Isolate* isolate,
689 byte* sequence, 689 byte* sequence,
690 Code::Age age, 690 Code::Age age,
691 MarkingParity parity) { 691 MarkingParity parity) {
692 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); 692 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length();
693 if (age == kNoAgeCodeAge) { 693 if (age == kNoAgeCodeAge) {
694 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); 694 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence);
695 CpuFeatures::FlushICache(sequence, young_length); 695 Assembler::FlushICache(isolate, sequence, young_length);
696 } else { 696 } else {
697 Code* stub = GetCodeAgeStub(isolate, age, parity); 697 Code* stub = GetCodeAgeStub(isolate, age, parity);
698 CodePatcher patcher(sequence, young_length); 698 CodePatcher patcher(sequence, young_length);
699 patcher.masm()->call(stub->instruction_start()); 699 patcher.masm()->call(stub->instruction_start());
700 patcher.masm()->Nop( 700 patcher.masm()->Nop(
701 kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength); 701 kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength);
702 } 702 }
703 } 703 }
704 704
705 705
(...skipping 15 matching lines...) Expand all
721 return Operand(base_reg_, argument_count_reg_, times_pointer_size, 721 return Operand(base_reg_, argument_count_reg_, times_pointer_size,
722 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); 722 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize);
723 } 723 }
724 } 724 }
725 725
726 726
727 } // namespace internal 727 } // namespace internal
728 } // namespace v8 728 } // namespace v8
729 729
730 #endif // V8_TARGET_ARCH_X64 730 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698