| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 | 998 |
| 999 int Simulator::ReadW(int32_t addr, Instruction* instr) { | 999 int Simulator::ReadW(int32_t addr, Instruction* instr) { |
| 1000 #if V8_TARGET_CAN_READ_UNALIGNED | 1000 #if V8_TARGET_CAN_READ_UNALIGNED |
| 1001 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); | 1001 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); |
| 1002 return *ptr; | 1002 return *ptr; |
| 1003 #else | 1003 #else |
| 1004 if ((addr & 3) == 0) { | 1004 if ((addr & 3) == 0) { |
| 1005 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); | 1005 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); |
| 1006 return *ptr; | 1006 return *ptr; |
| 1007 } | 1007 } |
| 1008 PrintF("Unaligned read at 0x%08x, pc=%p\n", addr, instr); | 1008 PrintF("Unaligned read at 0x%08x, pc=0x%08" V8PRIxPTR "\n", |
| 1009 addr, |
| 1010 reinterpret_cast<intptr_t>(instr)); |
| 1009 UNIMPLEMENTED(); | 1011 UNIMPLEMENTED(); |
| 1010 return 0; | 1012 return 0; |
| 1011 #endif | 1013 #endif |
| 1012 } | 1014 } |
| 1013 | 1015 |
| 1014 | 1016 |
| 1015 void Simulator::WriteW(int32_t addr, int value, Instruction* instr) { | 1017 void Simulator::WriteW(int32_t addr, int value, Instruction* instr) { |
| 1016 #if V8_TARGET_CAN_READ_UNALIGNED | 1018 #if V8_TARGET_CAN_READ_UNALIGNED |
| 1017 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); | 1019 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); |
| 1018 *ptr = value; | 1020 *ptr = value; |
| 1019 return; | 1021 return; |
| 1020 #else | 1022 #else |
| 1021 if ((addr & 3) == 0) { | 1023 if ((addr & 3) == 0) { |
| 1022 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); | 1024 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); |
| 1023 *ptr = value; | 1025 *ptr = value; |
| 1024 return; | 1026 return; |
| 1025 } | 1027 } |
| 1026 PrintF("Unaligned write at 0x%08x, pc=%p\n", addr, instr); | 1028 PrintF("Unaligned write at 0x%08x, pc=0x%08" V8PRIxPTR "\n", |
| 1029 addr, |
| 1030 reinterpret_cast<intptr_t>(instr)); |
| 1027 UNIMPLEMENTED(); | 1031 UNIMPLEMENTED(); |
| 1028 #endif | 1032 #endif |
| 1029 } | 1033 } |
| 1030 | 1034 |
| 1031 | 1035 |
| 1032 uint16_t Simulator::ReadHU(int32_t addr, Instruction* instr) { | 1036 uint16_t Simulator::ReadHU(int32_t addr, Instruction* instr) { |
| 1033 #if V8_TARGET_CAN_READ_UNALIGNED | 1037 #if V8_TARGET_CAN_READ_UNALIGNED |
| 1034 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); | 1038 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); |
| 1035 return *ptr; | 1039 return *ptr; |
| 1036 #else | 1040 #else |
| 1037 if ((addr & 1) == 0) { | 1041 if ((addr & 1) == 0) { |
| 1038 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); | 1042 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); |
| 1039 return *ptr; | 1043 return *ptr; |
| 1040 } | 1044 } |
| 1041 PrintF("Unaligned unsigned halfword read at 0x%08x, pc=%p\n", addr, instr); | 1045 PrintF("Unaligned unsigned halfword read at 0x%08x, pc=0x%08" V8PRIxPTR "\n", |
| 1046 addr, |
| 1047 reinterpret_cast<intptr_t>(instr)); |
| 1042 UNIMPLEMENTED(); | 1048 UNIMPLEMENTED(); |
| 1043 return 0; | 1049 return 0; |
| 1044 #endif | 1050 #endif |
| 1045 } | 1051 } |
| 1046 | 1052 |
| 1047 | 1053 |
| 1048 int16_t Simulator::ReadH(int32_t addr, Instruction* instr) { | 1054 int16_t Simulator::ReadH(int32_t addr, Instruction* instr) { |
| 1049 #if V8_TARGET_CAN_READ_UNALIGNED | 1055 #if V8_TARGET_CAN_READ_UNALIGNED |
| 1050 int16_t* ptr = reinterpret_cast<int16_t*>(addr); | 1056 int16_t* ptr = reinterpret_cast<int16_t*>(addr); |
| 1051 return *ptr; | 1057 return *ptr; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1065 #if V8_TARGET_CAN_READ_UNALIGNED | 1071 #if V8_TARGET_CAN_READ_UNALIGNED |
| 1066 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); | 1072 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); |
| 1067 *ptr = value; | 1073 *ptr = value; |
| 1068 return; | 1074 return; |
| 1069 #else | 1075 #else |
| 1070 if ((addr & 1) == 0) { | 1076 if ((addr & 1) == 0) { |
| 1071 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); | 1077 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); |
| 1072 *ptr = value; | 1078 *ptr = value; |
| 1073 return; | 1079 return; |
| 1074 } | 1080 } |
| 1075 PrintF("Unaligned unsigned halfword write at 0x%08x, pc=%p\n", addr, instr); | 1081 PrintF("Unaligned unsigned halfword write at 0x%08x, pc=0x%08" V8PRIxPTR "\n", |
| 1082 addr, |
| 1083 reinterpret_cast<intptr_t>(instr)); |
| 1076 UNIMPLEMENTED(); | 1084 UNIMPLEMENTED(); |
| 1077 #endif | 1085 #endif |
| 1078 } | 1086 } |
| 1079 | 1087 |
| 1080 | 1088 |
| 1081 void Simulator::WriteH(int32_t addr, int16_t value, Instruction* instr) { | 1089 void Simulator::WriteH(int32_t addr, int16_t value, Instruction* instr) { |
| 1082 #if V8_TARGET_CAN_READ_UNALIGNED | 1090 #if V8_TARGET_CAN_READ_UNALIGNED |
| 1083 int16_t* ptr = reinterpret_cast<int16_t*>(addr); | 1091 int16_t* ptr = reinterpret_cast<int16_t*>(addr); |
| 1084 *ptr = value; | 1092 *ptr = value; |
| 1085 return; | 1093 return; |
| 1086 #else | 1094 #else |
| 1087 if ((addr & 1) == 0) { | 1095 if ((addr & 1) == 0) { |
| 1088 int16_t* ptr = reinterpret_cast<int16_t*>(addr); | 1096 int16_t* ptr = reinterpret_cast<int16_t*>(addr); |
| 1089 *ptr = value; | 1097 *ptr = value; |
| 1090 return; | 1098 return; |
| 1091 } | 1099 } |
| 1092 PrintF("Unaligned halfword write at 0x%08x, pc=%p\n", addr, instr); | 1100 PrintF("Unaligned halfword write at 0x%08x, pc=0x%08" V8PRIxPTR "\n", |
| 1101 addr, |
| 1102 reinterpret_cast<intptr_t>(instr)); |
| 1093 UNIMPLEMENTED(); | 1103 UNIMPLEMENTED(); |
| 1094 #endif | 1104 #endif |
| 1095 } | 1105 } |
| 1096 | 1106 |
| 1097 | 1107 |
| 1098 uint8_t Simulator::ReadBU(int32_t addr) { | 1108 uint8_t Simulator::ReadBU(int32_t addr) { |
| 1099 uint8_t* ptr = reinterpret_cast<uint8_t*>(addr); | 1109 uint8_t* ptr = reinterpret_cast<uint8_t*>(addr); |
| 1100 return *ptr; | 1110 return *ptr; |
| 1101 } | 1111 } |
| 1102 | 1112 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 int32_t arg2, | 1534 int32_t arg2, |
| 1525 int32_t arg3, | 1535 int32_t arg3, |
| 1526 int32_t arg4); | 1536 int32_t arg4); |
| 1527 typedef double (*SimulatorRuntimeFPCall)(int32_t arg0, | 1537 typedef double (*SimulatorRuntimeFPCall)(int32_t arg0, |
| 1528 int32_t arg1, | 1538 int32_t arg1, |
| 1529 int32_t arg2, | 1539 int32_t arg2, |
| 1530 int32_t arg3); | 1540 int32_t arg3); |
| 1531 | 1541 |
| 1532 // This signature supports direct call in to API function native callback | 1542 // This signature supports direct call in to API function native callback |
| 1533 // (refer to InvocationCallback in v8.h). | 1543 // (refer to InvocationCallback in v8.h). |
| 1534 typedef v8::Handle<v8::Value> (*SimulatorRuntimeApiCall)(int32_t arg0); | 1544 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0); |
| 1545 |
| 1546 // This signature supports direct call to accessor getter callback. |
| 1547 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, |
| 1548 int32_t arg1); |
| 1535 | 1549 |
| 1536 // Software interrupt instructions are used by the simulator to call into the | 1550 // Software interrupt instructions are used by the simulator to call into the |
| 1537 // C-based V8 runtime. | 1551 // C-based V8 runtime. |
| 1538 void Simulator::SoftwareInterrupt(Instruction* instr) { | 1552 void Simulator::SoftwareInterrupt(Instruction* instr) { |
| 1539 int svc = instr->SvcValue(); | 1553 int svc = instr->SvcValue(); |
| 1540 switch (svc) { | 1554 switch (svc) { |
| 1541 case kCallRtRedirected: { | 1555 case kCallRtRedirected: { |
| 1542 // Check if stack is aligned. Error if not aligned is reported below to | 1556 // Check if stack is aligned. Error if not aligned is reported below to |
| 1543 // include information on the function called. | 1557 // include information on the function called. |
| 1544 bool stack_aligned = | 1558 bool stack_aligned = |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1565 PrintF("Call to host function at %p with args %f, %f", | 1579 PrintF("Call to host function at %p with args %f, %f", |
| 1566 FUNCTION_ADDR(target), x, y); | 1580 FUNCTION_ADDR(target), x, y); |
| 1567 if (!stack_aligned) { | 1581 if (!stack_aligned) { |
| 1568 PrintF(" with unaligned stack %08x\n", get_register(sp)); | 1582 PrintF(" with unaligned stack %08x\n", get_register(sp)); |
| 1569 } | 1583 } |
| 1570 PrintF("\n"); | 1584 PrintF("\n"); |
| 1571 } | 1585 } |
| 1572 CHECK(stack_aligned); | 1586 CHECK(stack_aligned); |
| 1573 double result = target(arg0, arg1, arg2, arg3); | 1587 double result = target(arg0, arg1, arg2, arg3); |
| 1574 SetFpResult(result); | 1588 SetFpResult(result); |
| 1575 } else if (redirection->type() == ExternalReference::DIRECT_CALL) { | 1589 } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) { |
| 1576 SimulatorRuntimeApiCall target = | 1590 SimulatorRuntimeDirectApiCall target = |
| 1577 reinterpret_cast<SimulatorRuntimeApiCall>(external); | 1591 reinterpret_cast<SimulatorRuntimeDirectApiCall>(external); |
| 1578 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { | 1592 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { |
| 1579 PrintF( | 1593 PrintF("Call to host function at %p args %08x", |
| 1580 "Call to host function at %p args %08x", | 1594 FUNCTION_ADDR(target), arg0); |
| 1581 FUNCTION_ADDR(target), | |
| 1582 arg0); | |
| 1583 if (!stack_aligned) { | 1595 if (!stack_aligned) { |
| 1584 PrintF(" with unaligned stack %08x\n", get_register(sp)); | 1596 PrintF(" with unaligned stack %08x\n", get_register(sp)); |
| 1585 } | 1597 } |
| 1586 PrintF("\n"); | 1598 PrintF("\n"); |
| 1587 } | 1599 } |
| 1588 CHECK(stack_aligned); | 1600 CHECK(stack_aligned); |
| 1589 v8::Handle<v8::Value> result = target(arg0); | 1601 v8::Handle<v8::Value> result = target(arg0); |
| 1590 if (::v8::internal::FLAG_trace_sim) { | 1602 if (::v8::internal::FLAG_trace_sim) { |
| 1591 PrintF("Returned %p\n", reinterpret_cast<void *>(*result)); | 1603 PrintF("Returned %p\n", reinterpret_cast<void *>(*result)); |
| 1592 } | 1604 } |
| 1593 set_register(r0, (int32_t) *result); | 1605 set_register(r0, (int32_t) *result); |
| 1606 } else if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { |
| 1607 SimulatorRuntimeDirectGetterCall target = |
| 1608 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external); |
| 1609 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { |
| 1610 PrintF("Call to host function at %p args %08x %08x", |
| 1611 FUNCTION_ADDR(target), arg0, arg1); |
| 1612 if (!stack_aligned) { |
| 1613 PrintF(" with unaligned stack %08x\n", get_register(sp)); |
| 1614 } |
| 1615 PrintF("\n"); |
| 1616 } |
| 1617 CHECK(stack_aligned); |
| 1618 v8::Handle<v8::Value> result = target(arg0, arg1); |
| 1619 if (::v8::internal::FLAG_trace_sim) { |
| 1620 PrintF("Returned %p\n", reinterpret_cast<void *>(*result)); |
| 1621 } |
| 1622 set_register(r0, (int32_t) *result); |
| 1594 } else { | 1623 } else { |
| 1595 // builtin call. | 1624 // builtin call. |
| 1596 ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL); | 1625 ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL); |
| 1597 SimulatorRuntimeCall target = | 1626 SimulatorRuntimeCall target = |
| 1598 reinterpret_cast<SimulatorRuntimeCall>(external); | 1627 reinterpret_cast<SimulatorRuntimeCall>(external); |
| 1599 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { | 1628 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { |
| 1600 PrintF( | 1629 PrintF( |
| 1601 "Call to host function at %p args %08x, %08x, %08x, %08x, %0xc", | 1630 "Call to host function at %p args %08x, %08x, %08x, %08x, %0xc", |
| 1602 FUNCTION_ADDR(target), | 1631 FUNCTION_ADDR(target), |
| 1603 arg0, | 1632 arg0, |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2431 } | 2460 } |
| 2432 } | 2461 } |
| 2433 | 2462 |
| 2434 | 2463 |
| 2435 // void Simulator::DecodeTypeVFP(Instruction* instr) | 2464 // void Simulator::DecodeTypeVFP(Instruction* instr) |
| 2436 // The Following ARMv7 VFPv instructions are currently supported. | 2465 // The Following ARMv7 VFPv instructions are currently supported. |
| 2437 // vmov :Sn = Rt | 2466 // vmov :Sn = Rt |
| 2438 // vmov :Rt = Sn | 2467 // vmov :Rt = Sn |
| 2439 // vcvt: Dd = Sm | 2468 // vcvt: Dd = Sm |
| 2440 // vcvt: Sd = Dm | 2469 // vcvt: Sd = Dm |
| 2470 // Dd = vabs(Dm) |
| 2471 // Dd = vneg(Dm) |
| 2441 // Dd = vadd(Dn, Dm) | 2472 // Dd = vadd(Dn, Dm) |
| 2442 // Dd = vsub(Dn, Dm) | 2473 // Dd = vsub(Dn, Dm) |
| 2443 // Dd = vmul(Dn, Dm) | 2474 // Dd = vmul(Dn, Dm) |
| 2444 // Dd = vdiv(Dn, Dm) | 2475 // Dd = vdiv(Dn, Dm) |
| 2445 // vcmp(Dd, Dm) | 2476 // vcmp(Dd, Dm) |
| 2446 // vmrs | 2477 // vmrs |
| 2447 // Dd = vsqrt(Dm) | 2478 // Dd = vsqrt(Dm) |
| 2448 void Simulator::DecodeTypeVFP(Instruction* instr) { | 2479 void Simulator::DecodeTypeVFP(Instruction* instr) { |
| 2449 ASSERT((instr->TypeValue() == 7) && (instr->Bit(24) == 0x0) ); | 2480 ASSERT((instr->TypeValue() == 7) && (instr->Bit(24) == 0x0) ); |
| 2450 ASSERT(instr->Bits(11, 9) == 0x5); | 2481 ASSERT(instr->Bits(11, 9) == 0x5); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2466 } else { | 2497 } else { |
| 2467 int m = instr->VFPMRegValue(kSinglePrecision); | 2498 int m = instr->VFPMRegValue(kSinglePrecision); |
| 2468 int d = instr->VFPDRegValue(kSinglePrecision); | 2499 int d = instr->VFPDRegValue(kSinglePrecision); |
| 2469 set_s_register_from_float(d, get_float_from_s_register(m)); | 2500 set_s_register_from_float(d, get_float_from_s_register(m)); |
| 2470 } | 2501 } |
| 2471 } else if ((instr->Opc2Value() == 0x0) && (instr->Opc3Value() == 0x3)) { | 2502 } else if ((instr->Opc2Value() == 0x0) && (instr->Opc3Value() == 0x3)) { |
| 2472 // vabs | 2503 // vabs |
| 2473 double dm_value = get_double_from_d_register(vm); | 2504 double dm_value = get_double_from_d_register(vm); |
| 2474 double dd_value = fabs(dm_value); | 2505 double dd_value = fabs(dm_value); |
| 2475 set_d_register_from_double(vd, dd_value); | 2506 set_d_register_from_double(vd, dd_value); |
| 2507 } else if ((instr->Opc2Value() == 0x1) && (instr->Opc3Value() == 0x1)) { |
| 2508 // vneg |
| 2509 double dm_value = get_double_from_d_register(vm); |
| 2510 double dd_value = -dm_value; |
| 2511 set_d_register_from_double(vd, dd_value); |
| 2476 } else if ((instr->Opc2Value() == 0x7) && (instr->Opc3Value() == 0x3)) { | 2512 } else if ((instr->Opc2Value() == 0x7) && (instr->Opc3Value() == 0x3)) { |
| 2477 DecodeVCVTBetweenDoubleAndSingle(instr); | 2513 DecodeVCVTBetweenDoubleAndSingle(instr); |
| 2478 } else if ((instr->Opc2Value() == 0x8) && (instr->Opc3Value() & 0x1)) { | 2514 } else if ((instr->Opc2Value() == 0x8) && (instr->Opc3Value() & 0x1)) { |
| 2479 DecodeVCVTBetweenFloatingPointAndInteger(instr); | 2515 DecodeVCVTBetweenFloatingPointAndInteger(instr); |
| 2480 } else if (((instr->Opc2Value() >> 1) == 0x6) && | 2516 } else if (((instr->Opc2Value() >> 1) == 0x6) && |
| 2481 (instr->Opc3Value() & 0x1)) { | 2517 (instr->Opc3Value() & 0x1)) { |
| 2482 DecodeVCVTBetweenFloatingPointAndInteger(instr); | 2518 DecodeVCVTBetweenFloatingPointAndInteger(instr); |
| 2483 } else if (((instr->Opc2Value() == 0x4) || (instr->Opc2Value() == 0x5)) && | 2519 } else if (((instr->Opc2Value() == 0x4) || (instr->Opc2Value() == 0x5)) && |
| 2484 (instr->Opc3Value() & 0x1)) { | 2520 (instr->Opc3Value() & 0x1)) { |
| 2485 DecodeVCMP(instr); | 2521 DecodeVCMP(instr); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2528 set_d_register_from_double(vd, dd_value); | 2564 set_d_register_from_double(vd, dd_value); |
| 2529 } else if ((instr->Opc1Value() == 0x4) && !(instr->Opc3Value() & 0x1)) { | 2565 } else if ((instr->Opc1Value() == 0x4) && !(instr->Opc3Value() & 0x1)) { |
| 2530 // vdiv | 2566 // vdiv |
| 2531 if (instr->SzValue() != 0x1) { | 2567 if (instr->SzValue() != 0x1) { |
| 2532 UNREACHABLE(); // Not used by V8. | 2568 UNREACHABLE(); // Not used by V8. |
| 2533 } | 2569 } |
| 2534 | 2570 |
| 2535 double dn_value = get_double_from_d_register(vn); | 2571 double dn_value = get_double_from_d_register(vn); |
| 2536 double dm_value = get_double_from_d_register(vm); | 2572 double dm_value = get_double_from_d_register(vm); |
| 2537 double dd_value = dn_value / dm_value; | 2573 double dd_value = dn_value / dm_value; |
| 2574 div_zero_vfp_flag_ = (dm_value == 0); |
| 2538 set_d_register_from_double(vd, dd_value); | 2575 set_d_register_from_double(vd, dd_value); |
| 2539 } else { | 2576 } else { |
| 2540 UNIMPLEMENTED(); // Not used by V8. | 2577 UNIMPLEMENTED(); // Not used by V8. |
| 2541 } | 2578 } |
| 2542 } else { | 2579 } else { |
| 2543 if ((instr->VCValue() == 0x0) && | 2580 if ((instr->VCValue() == 0x0) && |
| 2544 (instr->VAValue() == 0x0)) { | 2581 (instr->VAValue() == 0x0)) { |
| 2545 DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(instr); | 2582 DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(instr); |
| 2546 } else if ((instr->VLValue() == 0x1) && | 2583 } else if ((instr->VLValue() == 0x1) && |
| 2547 (instr->VCValue() == 0x0) && | 2584 (instr->VCValue() == 0x0) && |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2762 bool double_precision = (src_precision == kDoublePrecision); | 2799 bool double_precision = (src_precision == kDoublePrecision); |
| 2763 | 2800 |
| 2764 double val = double_precision ? get_double_from_d_register(src) | 2801 double val = double_precision ? get_double_from_d_register(src) |
| 2765 : get_float_from_s_register(src); | 2802 : get_float_from_s_register(src); |
| 2766 | 2803 |
| 2767 int temp = unsigned_integer ? static_cast<uint32_t>(val) | 2804 int temp = unsigned_integer ? static_cast<uint32_t>(val) |
| 2768 : static_cast<int32_t>(val); | 2805 : static_cast<int32_t>(val); |
| 2769 | 2806 |
| 2770 inv_op_vfp_flag_ = get_inv_op_vfp_flag(mode, val, unsigned_integer); | 2807 inv_op_vfp_flag_ = get_inv_op_vfp_flag(mode, val, unsigned_integer); |
| 2771 | 2808 |
| 2809 double abs_diff = |
| 2810 unsigned_integer ? fabs(val - static_cast<uint32_t>(temp)) |
| 2811 : fabs(val - temp); |
| 2812 |
| 2813 inexact_vfp_flag_ = (abs_diff != 0); |
| 2814 |
| 2772 if (inv_op_vfp_flag_) { | 2815 if (inv_op_vfp_flag_) { |
| 2773 temp = VFPConversionSaturate(val, unsigned_integer); | 2816 temp = VFPConversionSaturate(val, unsigned_integer); |
| 2774 } else { | 2817 } else { |
| 2775 switch (mode) { | 2818 switch (mode) { |
| 2776 case RN: { | 2819 case RN: { |
| 2777 double abs_diff = | |
| 2778 unsigned_integer ? fabs(val - static_cast<uint32_t>(temp)) | |
| 2779 : fabs(val - temp); | |
| 2780 int val_sign = (val > 0) ? 1 : -1; | 2820 int val_sign = (val > 0) ? 1 : -1; |
| 2781 if (abs_diff > 0.5) { | 2821 if (abs_diff > 0.5) { |
| 2782 temp += val_sign; | 2822 temp += val_sign; |
| 2783 } else if (abs_diff == 0.5) { | 2823 } else if (abs_diff == 0.5) { |
| 2784 // Round to even if exactly halfway. | 2824 // Round to even if exactly halfway. |
| 2785 temp = ((temp % 2) == 0) ? temp : temp + val_sign; | 2825 temp = ((temp % 2) == 0) ? temp : temp + val_sign; |
| 2786 } | 2826 } |
| 2787 break; | 2827 break; |
| 2788 } | 2828 } |
| 2789 | 2829 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3123 uintptr_t address = *stack_slot; | 3163 uintptr_t address = *stack_slot; |
| 3124 set_register(sp, current_sp + sizeof(uintptr_t)); | 3164 set_register(sp, current_sp + sizeof(uintptr_t)); |
| 3125 return address; | 3165 return address; |
| 3126 } | 3166 } |
| 3127 | 3167 |
| 3128 } } // namespace v8::internal | 3168 } } // namespace v8::internal |
| 3129 | 3169 |
| 3130 #endif // USE_SIMULATOR | 3170 #endif // USE_SIMULATOR |
| 3131 | 3171 |
| 3132 #endif // V8_TARGET_ARCH_ARM | 3172 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |