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

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 10542167: Inline Math.sqrt in new compilers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.h ('k') | runtime/vm/flow_graph_optimizer.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 __ movq(RAX, Address(RSP, 2 * kWordSize)); // Receiver. 858 __ movq(RAX, Address(RSP, 2 * kWordSize)); // Receiver.
859 __ movq(RBX, Address(RSP, 1 * kWordSize)); // Value. 859 __ movq(RBX, Address(RSP, 1 * kWordSize)); // Value.
860 __ StoreIntoObject(RAX, FieldAddress(RAX, offset), RBX); 860 __ StoreIntoObject(RAX, FieldAddress(RAX, offset), RBX);
861 const Immediate raw_null = 861 const Immediate raw_null =
862 Immediate(reinterpret_cast<intptr_t>(Object::null())); 862 Immediate(reinterpret_cast<intptr_t>(Object::null()));
863 __ movq(RAX, raw_null); 863 __ movq(RAX, raw_null);
864 __ ret(); 864 __ ret();
865 } 865 }
866 866
867 867
868 void FlowGraphCompiler::GenerateInlinedMathSqrt(Label* done) {
869 Label smi_to_double, double_op, call_method;
870 __ movq(RAX, Address(RSP, 0));
871 __ testq(RAX, Immediate(kSmiTagMask));
872 __ j(ZERO, &smi_to_double);
873 __ CompareClassId(RAX, kDouble);
874 __ j(NOT_EQUAL, &call_method);
875 __ movsd(XMM1, FieldAddress(RAX, Double::value_offset()));
876 __ Bind(&double_op);
877 __ sqrtsd(XMM0, XMM1);
878 AssemblerMacros::TryAllocate(assembler_,
879 double_class_,
880 &call_method,
881 RAX); // Result register.
882 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0);
883 __ jmp(done);
884 __ Bind(&smi_to_double);
885 __ SmiUntag(RAX);
886 __ cvtsi2sd(XMM1, RAX);
887 __ jmp(&double_op);
888 __ Bind(&call_method);
889 }
890
891
868 void FlowGraphCompiler::CompileGraph() { 892 void FlowGraphCompiler::CompileGraph() {
869 InitCompiler(); 893 InitCompiler();
870 if (TryIntrinsify()) { 894 if (TryIntrinsify()) {
871 // Make it patchable: code must have a minimum code size, nop(2) increases 895 // Make it patchable: code must have a minimum code size, nop(2) increases
872 // the minimum code size appropriately. 896 // the minimum code size appropriately.
873 __ nop(2); 897 __ nop(2);
874 __ int3(); 898 __ int3();
875 __ jmp(&StubCode::FixCallersTargetLabel()); 899 __ jmp(&StubCode::FixCallersTargetLabel());
876 return; 900 return;
877 } 901 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 __ cvtsi2sd(result, temp); 1050 __ cvtsi2sd(result, temp);
1027 __ Bind(&done); 1051 __ Bind(&done);
1028 } 1052 }
1029 1053
1030 1054
1031 #undef __ 1055 #undef __
1032 1056
1033 } // namespace dart 1057 } // namespace dart
1034 1058
1035 #endif // defined TARGET_ARCH_X64 1059 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.h ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698