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

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

Issue 1468313004: Make fast_exp take an Isolate* paramter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/runtime/runtime-maths.cc ('k') | src/x87/codegen-x87.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 14 matching lines...) Expand all
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 34
35 UnaryMathFunction CreateExpFunction() { 35 UnaryMathFunctionWithIsolate CreateExpFunction(Isolate* isolate) {
36 if (!FLAG_fast_math) return &std::exp;
37 size_t actual_size; 36 size_t actual_size;
38 byte* buffer = 37 byte* buffer =
39 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); 38 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true));
40 if (buffer == NULL) return &std::exp; 39 if (buffer == nullptr) return nullptr;
41 ExternalReference::InitializeMathExpData(); 40 ExternalReference::InitializeMathExpData();
42 41
43 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); 42 MacroAssembler masm(nullptr, buffer, static_cast<int>(actual_size));
44 // xmm0: raw double input. 43 // xmm0: raw double input.
45 XMMRegister input = xmm0; 44 XMMRegister input = xmm0;
46 XMMRegister result = xmm1; 45 XMMRegister result = xmm1;
47 __ pushq(rax); 46 __ pushq(rax);
48 __ pushq(rbx); 47 __ pushq(rbx);
49 48
50 MathExpGenerator::EmitMathExp(&masm, input, result, xmm2, rax, rbx); 49 MathExpGenerator::EmitMathExp(&masm, input, result, xmm2, rax, rbx);
51 50
52 __ popq(rbx); 51 __ popq(rbx);
53 __ popq(rax); 52 __ popq(rax);
54 __ Movsd(xmm0, result); 53 __ Movsd(xmm0, result);
55 __ Ret(); 54 __ Ret();
56 55
57 CodeDesc desc; 56 CodeDesc desc;
58 masm.GetCode(&desc); 57 masm.GetCode(&desc);
59 DCHECK(!RelocInfo::RequiresRelocation(desc)); 58 DCHECK(!RelocInfo::RequiresRelocation(desc));
60 59
61 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); 60 Assembler::FlushICache(isolate, buffer, actual_size);
62 base::OS::ProtectCode(buffer, actual_size); 61 base::OS::ProtectCode(buffer, actual_size);
63 return FUNCTION_CAST<UnaryMathFunction>(buffer); 62 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer);
64 } 63 }
65 64
66 65
67 UnaryMathFunction CreateSqrtFunction() { 66 UnaryMathFunction CreateSqrtFunction() {
68 size_t actual_size; 67 size_t actual_size;
69 // Allocate buffer in executable space. 68 // Allocate buffer in executable space.
70 byte* buffer = 69 byte* buffer =
71 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); 70 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true));
72 if (buffer == NULL) return &std::sqrt; 71 if (buffer == NULL) return &std::sqrt;
73 72
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 return Operand(base_reg_, argument_count_reg_, times_pointer_size, 719 return Operand(base_reg_, argument_count_reg_, times_pointer_size,
721 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); 720 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize);
722 } 721 }
723 } 722 }
724 723
725 724
726 } // namespace internal 725 } // namespace internal
727 } // namespace v8 726 } // namespace v8
728 727
729 #endif // V8_TARGET_ARCH_X64 728 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime/runtime-maths.cc ('k') | src/x87/codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698