| 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_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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 __ movq(RAX, Address(RSP, 2 * kWordSize)); // Receiver. | 913 __ movq(RAX, Address(RSP, 2 * kWordSize)); // Receiver. |
| 914 __ movq(RBX, Address(RSP, 1 * kWordSize)); // Value. | 914 __ movq(RBX, Address(RSP, 1 * kWordSize)); // Value. |
| 915 __ StoreIntoObject(RAX, FieldAddress(RAX, offset), RBX); | 915 __ StoreIntoObject(RAX, FieldAddress(RAX, offset), RBX); |
| 916 const Immediate raw_null = | 916 const Immediate raw_null = |
| 917 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 917 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 918 __ movq(RAX, raw_null); | 918 __ movq(RAX, raw_null); |
| 919 __ ret(); | 919 __ ret(); |
| 920 } | 920 } |
| 921 | 921 |
| 922 | 922 |
| 923 void FlowGraphCompiler::GenerateInlinedMathSqrt(Label* done) { | |
| 924 Label smi_to_double, double_op, call_method; | |
| 925 __ movq(RAX, Address(RSP, 0)); | |
| 926 __ testq(RAX, Immediate(kSmiTagMask)); | |
| 927 __ j(ZERO, &smi_to_double); | |
| 928 __ CompareClassId(RAX, kDoubleCid); | |
| 929 __ j(NOT_EQUAL, &call_method); | |
| 930 __ movsd(XMM1, FieldAddress(RAX, Double::value_offset())); | |
| 931 __ Bind(&double_op); | |
| 932 __ sqrtsd(XMM0, XMM1); | |
| 933 AssemblerMacros::TryAllocate(assembler_, | |
| 934 double_class_, | |
| 935 &call_method, | |
| 936 Assembler::kNearJump, | |
| 937 RAX); // Result register. | |
| 938 __ movsd(FieldAddress(RAX, Double::value_offset()), XMM0); | |
| 939 __ Drop(1); | |
| 940 __ jmp(done); | |
| 941 __ Bind(&smi_to_double); | |
| 942 __ SmiUntag(RAX); | |
| 943 __ cvtsi2sd(XMM1, RAX); | |
| 944 __ jmp(&double_op); | |
| 945 __ Bind(&call_method); | |
| 946 } | |
| 947 | |
| 948 | |
| 949 void FlowGraphCompiler::CompileGraph() { | 923 void FlowGraphCompiler::CompileGraph() { |
| 950 InitCompiler(); | 924 InitCompiler(); |
| 951 if (TryIntrinsify()) { | 925 if (TryIntrinsify()) { |
| 952 // Although this intrinsified code will never be patched, it must satisfy | 926 // Although this intrinsified code will never be patched, it must satisfy |
| 953 // CodePatcher::CodeIsPatchable, which verifies that this code has a minimum | 927 // CodePatcher::CodeIsPatchable, which verifies that this code has a minimum |
| 954 // code size, and nop(2) increases the minimum code size appropriately. | 928 // code size, and nop(2) increases the minimum code size appropriately. |
| 955 __ nop(2); | 929 __ nop(2); |
| 956 __ int3(); | 930 __ int3(); |
| 957 __ jmp(&StubCode::FixCallersTargetLabel()); | 931 __ jmp(&StubCode::FixCallersTargetLabel()); |
| 958 return; | 932 return; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1340 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
| 1367 __ Exchange(mem1, mem2); | 1341 __ Exchange(mem1, mem2); |
| 1368 } | 1342 } |
| 1369 | 1343 |
| 1370 | 1344 |
| 1371 #undef __ | 1345 #undef __ |
| 1372 | 1346 |
| 1373 } // namespace dart | 1347 } // namespace dart |
| 1374 | 1348 |
| 1375 #endif // defined TARGET_ARCH_X64 | 1349 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |