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

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.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_ia32.h ('k') | runtime/vm/flow_graph_compiler_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 (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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 __ movl(EAX, Address(ESP, 2 * kWordSize)); // Receiver. 64 __ movl(EAX, Address(ESP, 2 * kWordSize)); // Receiver.
65 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Value. 65 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Value.
66 __ StoreIntoObject(EAX, FieldAddress(EAX, offset), EBX); 66 __ StoreIntoObject(EAX, FieldAddress(EAX, offset), EBX);
67 const Immediate raw_null = 67 const Immediate raw_null =
68 Immediate(reinterpret_cast<intptr_t>(Object::null())); 68 Immediate(reinterpret_cast<intptr_t>(Object::null()));
69 __ movl(EAX, raw_null); 69 __ movl(EAX, raw_null);
70 __ ret(); 70 __ ret();
71 } 71 }
72 72
73 73
74 void FlowGraphCompiler::GenerateInlinedMathSqrt(Label* done) {
75 Label smi_to_double, double_op, call_method;
76 __ movl(EAX, Address(ESP, 0));
77 __ testl(EAX, Immediate(kSmiTagMask));
78 __ j(ZERO, &smi_to_double);
79 __ CompareClassId(EAX, kDouble, EBX);
80 __ j(NOT_EQUAL, &call_method);
81 __ movsd(XMM1, FieldAddress(EAX, Double::value_offset()));
82 __ Bind(&double_op);
83 __ sqrtsd(XMM0, XMM1);
84 AssemblerMacros::TryAllocate(assembler_,
85 double_class_,
86 &call_method,
87 EAX); // Result register.
88 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0);
89 __ jmp(done);
90 __ Bind(&smi_to_double);
91 __ SmiUntag(EAX);
92 __ cvtsi2sd(XMM1, EAX);
93 __ jmp(&double_op);
94 __ Bind(&call_method);
95 }
96
97
74 void FlowGraphCompiler::GenerateCallRuntime(intptr_t cid, 98 void FlowGraphCompiler::GenerateCallRuntime(intptr_t cid,
75 intptr_t token_index, 99 intptr_t token_index,
76 intptr_t try_index, 100 intptr_t try_index,
77 const RuntimeEntry& entry) { 101 const RuntimeEntry& entry) {
78 __ CallRuntime(entry); 102 __ CallRuntime(entry);
79 AddCurrentDescriptor(PcDescriptors::kOther, cid, token_index, try_index); 103 AddCurrentDescriptor(PcDescriptors::kOther, cid, token_index, try_index);
80 } 104 }
81 105
82 106
83 void FlowGraphCompiler::CopyParameters() { 107 void FlowGraphCompiler::CopyParameters() {
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 __ cvtsi2sd(result, temp); 1030 __ cvtsi2sd(result, temp);
1007 __ Bind(&done); 1031 __ Bind(&done);
1008 } 1032 }
1009 1033
1010 1034
1011 #undef __ 1035 #undef __
1012 1036
1013 } // namespace dart 1037 } // namespace dart
1014 1038
1015 #endif // defined TARGET_ARCH_IA32 1039 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.h ('k') | runtime/vm/flow_graph_compiler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698