| OLD | NEW |
| 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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 __ movl(EAX, Address(ESP, 2 * kWordSize)); // Receiver. | 906 __ movl(EAX, Address(ESP, 2 * kWordSize)); // Receiver. |
| 907 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Value. | 907 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Value. |
| 908 __ StoreIntoObject(EAX, FieldAddress(EAX, offset), EBX); | 908 __ StoreIntoObject(EAX, FieldAddress(EAX, offset), EBX); |
| 909 const Immediate raw_null = | 909 const Immediate raw_null = |
| 910 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 910 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 911 __ movl(EAX, raw_null); | 911 __ movl(EAX, raw_null); |
| 912 __ ret(); | 912 __ ret(); |
| 913 } | 913 } |
| 914 | 914 |
| 915 | 915 |
| 916 void FlowGraphCompiler::GenerateInlinedMathSqrt(Label* done) { | |
| 917 Label smi_to_double, double_op, call_method; | |
| 918 __ movl(EAX, Address(ESP, 0)); | |
| 919 __ testl(EAX, Immediate(kSmiTagMask)); | |
| 920 __ j(ZERO, &smi_to_double); | |
| 921 __ CompareClassId(EAX, kDoubleCid, EBX); | |
| 922 __ j(NOT_EQUAL, &call_method); | |
| 923 __ movsd(XMM1, FieldAddress(EAX, Double::value_offset())); | |
| 924 __ Bind(&double_op); | |
| 925 __ sqrtsd(XMM0, XMM1); | |
| 926 AssemblerMacros::TryAllocate(assembler_, | |
| 927 double_class_, | |
| 928 &call_method, | |
| 929 Assembler::kNearJump, | |
| 930 EAX); // Result register. | |
| 931 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); | |
| 932 __ Drop(1); | |
| 933 __ jmp(done); | |
| 934 __ Bind(&smi_to_double); | |
| 935 __ SmiUntag(EAX); | |
| 936 __ cvtsi2sd(XMM1, EAX); | |
| 937 __ jmp(&double_op); | |
| 938 __ Bind(&call_method); | |
| 939 } | |
| 940 | |
| 941 | |
| 942 void FlowGraphCompiler::CompileGraph() { | 916 void FlowGraphCompiler::CompileGraph() { |
| 943 InitCompiler(); | 917 InitCompiler(); |
| 944 if (TryIntrinsify()) { | 918 if (TryIntrinsify()) { |
| 945 // Although this intrinsified code will never be patched, it must satisfy | 919 // Although this intrinsified code will never be patched, it must satisfy |
| 946 // CodePatcher::CodeIsPatchable, which verifies that this code has a minimum | 920 // CodePatcher::CodeIsPatchable, which verifies that this code has a minimum |
| 947 // code size. | 921 // code size. |
| 948 __ int3(); | 922 __ int3(); |
| 949 __ jmp(&StubCode::FixCallersTargetLabel()); | 923 __ jmp(&StubCode::FixCallersTargetLabel()); |
| 950 return; | 924 return; |
| 951 } | 925 } |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 __ popl(ECX); | 1357 __ popl(ECX); |
| 1384 __ popl(EAX); | 1358 __ popl(EAX); |
| 1385 } | 1359 } |
| 1386 | 1360 |
| 1387 | 1361 |
| 1388 #undef __ | 1362 #undef __ |
| 1389 | 1363 |
| 1390 } // namespace dart | 1364 } // namespace dart |
| 1391 | 1365 |
| 1392 #endif // defined TARGET_ARCH_IA32 | 1366 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |