OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
7 | 7 |
8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1377 | 1377 |
1378 | 1378 |
1379 void Intrinsifier::Double_lessEqualThan(Assembler* assembler) { | 1379 void Intrinsifier::Double_lessEqualThan(Assembler* assembler) { |
1380 CompareDoubles(assembler, LS); | 1380 CompareDoubles(assembler, LS); |
1381 } | 1381 } |
1382 | 1382 |
1383 | 1383 |
1384 // Expects left argument to be double (receiver). Right argument is unknown. | 1384 // Expects left argument to be double (receiver). Right argument is unknown. |
1385 // Both arguments are on stack. | 1385 // Both arguments are on stack. |
1386 static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { | 1386 static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { |
1387 Label fall_through; | 1387 Label fall_through, is_smi, double_op; |
1388 | 1388 |
1389 TestLastArgumentIsDouble(assembler, &fall_through, &fall_through); | 1389 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); |
1390 // Both arguments are double, right operand is in R0. | 1390 // Both arguments are double, right operand is in R0. |
1391 __ LoadDFieldFromOffset(V1, R0, Double::value_offset()); | 1391 __ LoadDFieldFromOffset(V1, R0, Double::value_offset()); |
1392 __ Bind(&double_op); | |
1392 __ ldr(R0, Address(SP, 1 * kWordSize)); // Left argument. | 1393 __ ldr(R0, Address(SP, 1 * kWordSize)); // Left argument. |
1393 __ LoadDFieldFromOffset(V0, R0, Double::value_offset()); | 1394 __ LoadDFieldFromOffset(V0, R0, Double::value_offset()); |
1394 switch (kind) { | 1395 switch (kind) { |
1395 case Token::kADD: __ faddd(V0, V0, V1); break; | 1396 case Token::kADD: __ faddd(V0, V0, V1); break; |
1396 case Token::kSUB: __ fsubd(V0, V0, V1); break; | 1397 case Token::kSUB: __ fsubd(V0, V0, V1); break; |
1397 case Token::kMUL: __ fmuld(V0, V0, V1); break; | 1398 case Token::kMUL: __ fmuld(V0, V0, V1); break; |
1398 case Token::kDIV: __ fdivd(V0, V0, V1); break; | 1399 case Token::kDIV: __ fdivd(V0, V0, V1); break; |
1399 default: UNREACHABLE(); | 1400 default: UNREACHABLE(); |
1400 } | 1401 } |
1401 const Class& double_class = Class::Handle( | 1402 const Class& double_class = Class::Handle( |
1402 Isolate::Current()->object_store()->double_class()); | 1403 Isolate::Current()->object_store()->double_class()); |
1403 __ TryAllocate(double_class, &fall_through, R0, R1); | 1404 __ TryAllocate(double_class, &fall_through, R0, R1); |
1404 __ StoreDFieldToOffset(V0, R0, Double::value_offset()); | 1405 __ StoreDFieldToOffset(V0, R0, Double::value_offset()); |
1405 __ ret(); | 1406 __ ret(); |
1407 | |
1408 __ Bind(&is_smi); // Convert R0 to a double. | |
1409 __ SmiUntag(R0); | |
1410 __ scvtfdx(V1, R0); | |
1411 __ b(&double_op); // Then do the comparison. | |
zra
2016/03/22 17:12:21
comparison -> operation. For other platforms as we
Florian Schneider
2016/03/25 16:09:47
Done.
| |
1412 | |
1406 __ Bind(&fall_through); | 1413 __ Bind(&fall_through); |
1407 } | 1414 } |
1408 | 1415 |
1409 | 1416 |
1410 void Intrinsifier::Double_add(Assembler* assembler) { | 1417 void Intrinsifier::Double_add(Assembler* assembler) { |
1411 DoubleArithmeticOperations(assembler, Token::kADD); | 1418 DoubleArithmeticOperations(assembler, Token::kADD); |
1412 } | 1419 } |
1413 | 1420 |
1414 | 1421 |
1415 void Intrinsifier::Double_mul(Assembler* assembler) { | 1422 void Intrinsifier::Double_mul(Assembler* assembler) { |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2189 | 2196 |
2190 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { | 2197 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { |
2191 __ LoadIsolate(R0); | 2198 __ LoadIsolate(R0); |
2192 __ ldr(R0, Address(R0, Isolate::current_tag_offset())); | 2199 __ ldr(R0, Address(R0, Isolate::current_tag_offset())); |
2193 __ ret(); | 2200 __ ret(); |
2194 } | 2201 } |
2195 | 2202 |
2196 } // namespace dart | 2203 } // namespace dart |
2197 | 2204 |
2198 #endif // defined TARGET_ARCH_ARM64 | 2205 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |