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

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

Issue 113343003: Remove the last remnants of the TranscendentalCache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/full-codegen-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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { 48 void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const {
49 masm->LeaveFrame(StackFrame::INTERNAL); 49 masm->LeaveFrame(StackFrame::INTERNAL);
50 ASSERT(masm->has_frame()); 50 ASSERT(masm->has_frame());
51 masm->set_has_frame(false); 51 masm->set_has_frame(false);
52 } 52 }
53 53
54 54
55 #define __ masm. 55 #define __ masm.
56 56
57 57
58 UnaryMathFunction CreateTranscendentalFunction(TranscendentalCache::Type type) {
59 size_t actual_size;
60 // Allocate buffer in executable space.
61 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB,
62 &actual_size,
63 true));
64 if (buffer == NULL) {
65 // Fallback to library function if function cannot be created.
66 switch (type) {
67 case TranscendentalCache::LOG: return &log;
68 default: UNIMPLEMENTED();
69 }
70 }
71
72 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
73 // xmm0: raw double input.
74 // Move double input into registers.
75 __ push(rbx);
76 __ push(rdi);
77 __ movq(rbx, xmm0);
78 __ push(rbx);
79 __ fld_d(Operand(rsp, 0));
80 TranscendentalCacheStub::GenerateOperation(&masm, type);
81 // The return value is expected to be in xmm0.
82 __ fstp_d(Operand(rsp, 0));
83 __ pop(rbx);
84 __ movq(xmm0, rbx);
85 __ pop(rdi);
86 __ pop(rbx);
87 __ Ret();
88
89 CodeDesc desc;
90 masm.GetCode(&desc);
91 ASSERT(!RelocInfo::RequiresRelocation(desc));
92
93 CPU::FlushICache(buffer, actual_size);
94 OS::ProtectCode(buffer, actual_size);
95 return FUNCTION_CAST<UnaryMathFunction>(buffer);
96 }
97
98
99 UnaryMathFunction CreateExpFunction() { 58 UnaryMathFunction CreateExpFunction() {
100 if (!FLAG_fast_math) return &exp; 59 if (!FLAG_fast_math) return &exp;
101 size_t actual_size; 60 size_t actual_size;
102 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); 61 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true));
103 if (buffer == NULL) return &exp; 62 if (buffer == NULL) return &exp;
104 ExternalReference::InitializeMathExpData(); 63 ExternalReference::InitializeMathExpData();
105 64
106 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); 65 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
107 // xmm0: raw double input. 66 // xmm0: raw double input.
108 XMMRegister input = xmm0; 67 XMMRegister input = xmm0;
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. 710 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize.
752 return Operand(base_reg_, argument_count_reg_, times_pointer_size, 711 return Operand(base_reg_, argument_count_reg_, times_pointer_size,
753 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); 712 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize);
754 } 713 }
755 } 714 }
756 715
757 716
758 } } // namespace v8::internal 717 } } // namespace v8::internal
759 718
760 #endif // V8_TARGET_ARCH_X64 719 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698