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

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

Issue 1476763002: Make whether or not a Code object should be created by masm explicit (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: enum class FTW Created 5 years 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/regexp/x87/regexp-macro-assembler-x87.cc ('k') | src/x64/macro-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 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 21 matching lines...) Expand all
32 #define __ masm. 32 #define __ masm.
33 33
34 34
35 UnaryMathFunctionWithIsolate CreateExpFunction(Isolate* isolate) { 35 UnaryMathFunctionWithIsolate CreateExpFunction(Isolate* isolate) {
36 size_t actual_size; 36 size_t actual_size;
37 byte* buffer = 37 byte* buffer =
38 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); 38 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true));
39 if (buffer == nullptr) return nullptr; 39 if (buffer == nullptr) return nullptr;
40 ExternalReference::InitializeMathExpData(); 40 ExternalReference::InitializeMathExpData();
41 41
42 MacroAssembler masm(nullptr, buffer, static_cast<int>(actual_size)); 42 MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size),
43 CodeObjectRequired::kNo);
43 // xmm0: raw double input. 44 // xmm0: raw double input.
44 XMMRegister input = xmm0; 45 XMMRegister input = xmm0;
45 XMMRegister result = xmm1; 46 XMMRegister result = xmm1;
46 __ pushq(rax); 47 __ pushq(rax);
47 __ pushq(rbx); 48 __ pushq(rbx);
48 49
49 MathExpGenerator::EmitMathExp(&masm, input, result, xmm2, rax, rbx); 50 MathExpGenerator::EmitMathExp(&masm, input, result, xmm2, rax, rbx);
50 51
51 __ popq(rbx); 52 __ popq(rbx);
52 __ popq(rax); 53 __ popq(rax);
(...skipping 10 matching lines...) Expand all
63 } 64 }
64 65
65 66
66 UnaryMathFunction CreateSqrtFunction() { 67 UnaryMathFunction CreateSqrtFunction() {
67 size_t actual_size; 68 size_t actual_size;
68 // Allocate buffer in executable space. 69 // Allocate buffer in executable space.
69 byte* buffer = 70 byte* buffer =
70 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); 71 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true));
71 if (buffer == NULL) return &std::sqrt; 72 if (buffer == NULL) return &std::sqrt;
72 73
73 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); 74 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size),
75 CodeObjectRequired::kNo);
74 // xmm0: raw double input. 76 // xmm0: raw double input.
75 // Move double input into registers. 77 // Move double input into registers.
76 __ Sqrtsd(xmm0, xmm0); 78 __ Sqrtsd(xmm0, xmm0);
77 __ Ret(); 79 __ Ret();
78 80
79 CodeDesc desc; 81 CodeDesc desc;
80 masm.GetCode(&desc); 82 masm.GetCode(&desc);
81 DCHECK(!RelocInfo::RequiresRelocation(desc)); 83 DCHECK(!RelocInfo::RequiresRelocation(desc));
82 84
83 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); 85 Assembler::FlushICacheWithoutIsolate(buffer, actual_size);
84 base::OS::ProtectCode(buffer, actual_size); 86 base::OS::ProtectCode(buffer, actual_size);
85 return FUNCTION_CAST<UnaryMathFunction>(buffer); 87 return FUNCTION_CAST<UnaryMathFunction>(buffer);
86 } 88 }
87 89
88 90
89 #ifdef _WIN64 91 #ifdef _WIN64
90 typedef double (*ModuloFunction)(double, double); 92 typedef double (*ModuloFunction)(double, double);
91 // Define custom fmod implementation. 93 // Define custom fmod implementation.
92 ModuloFunction CreateModuloFunction() { 94 ModuloFunction CreateModuloFunction() {
93 size_t actual_size; 95 size_t actual_size;
94 byte* buffer = static_cast<byte*>( 96 byte* buffer = static_cast<byte*>(
95 base::OS::Allocate(Assembler::kMinimalBufferSize, &actual_size, true)); 97 base::OS::Allocate(Assembler::kMinimalBufferSize, &actual_size, true));
96 CHECK(buffer); 98 CHECK(buffer);
97 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); 99 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size),
100 CodeObjectRequired::kNo);
98 // Generated code is put into a fixed, unmovable, buffer, and not into 101 // Generated code is put into a fixed, unmovable, buffer, and not into
99 // the V8 heap. We can't, and don't, refer to any relocatable addresses 102 // the V8 heap. We can't, and don't, refer to any relocatable addresses
100 // (e.g. the JavaScript nan-object). 103 // (e.g. the JavaScript nan-object).
101 104
102 // Windows 64 ABI passes double arguments in xmm0, xmm1 and 105 // Windows 64 ABI passes double arguments in xmm0, xmm1 and
103 // returns result in xmm0. 106 // returns result in xmm0.
104 // Argument backing space is allocated on the stack above 107 // Argument backing space is allocated on the stack above
105 // the return address. 108 // the return address.
106 109
107 // Compute x mod y. 110 // Compute x mod y.
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 return Operand(base_reg_, argument_count_reg_, times_pointer_size, 722 return Operand(base_reg_, argument_count_reg_, times_pointer_size,
720 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); 723 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize);
721 } 724 }
722 } 725 }
723 726
724 727
725 } // namespace internal 728 } // namespace internal
726 } // namespace v8 729 } // namespace v8
727 730
728 #endif // V8_TARGET_ARCH_X64 731 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/regexp/x87/regexp-macro-assembler-x87.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698