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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 private: | 361 private: |
362 Major MajorKey() { return DirectCEntry; } | 362 Major MajorKey() { return DirectCEntry; } |
363 int MinorKey() { return 0; } | 363 int MinorKey() { return 0; } |
364 | 364 |
365 bool NeedsImmovableCode() { return true; } | 365 bool NeedsImmovableCode() { return true; } |
366 | 366 |
367 const char* GetName() { return "DirectCEntryStub"; } | 367 const char* GetName() { return "DirectCEntryStub"; } |
368 }; | 368 }; |
369 | 369 |
370 | 370 |
| 371 class FloatingPointHelper : public AllStatic { |
| 372 public: |
| 373 |
| 374 enum Destination { |
| 375 kVFPRegisters, |
| 376 kCoreRegisters |
| 377 }; |
| 378 |
| 379 |
| 380 // Loads smis from r0 and r1 (right and left in binary operations) into |
| 381 // floating point registers. Depending on the destination the values ends up |
| 382 // either d7 and d6 or in r2/r3 and r0/r1 respectively. If the destination is |
| 383 // floating point registers VFP3 must be supported. If core registers are |
| 384 // requested when VFP3 is supported d6 and d7 will be scratched. |
| 385 static void LoadSmis(MacroAssembler* masm, |
| 386 Destination destination, |
| 387 Register scratch1, |
| 388 Register scratch2); |
| 389 |
| 390 // Loads objects from r0 and r1 (right and left in binary operations) into |
| 391 // floating point registers. Depending on the destination the values ends up |
| 392 // either d7 and d6 or in r2/r3 and r0/r1 respectively. If the destination is |
| 393 // floating point registers VFP3 must be supported. If core registers are |
| 394 // requested when VFP3 is supported d6 and d7 will still be scratched. If |
| 395 // either r0 or r1 is not a number (not smi and not heap number object) the |
| 396 // not_number label is jumped to with r0 and r1 intact. |
| 397 static void LoadOperands(MacroAssembler* masm, |
| 398 FloatingPointHelper::Destination destination, |
| 399 Register heap_number_map, |
| 400 Register scratch1, |
| 401 Register scratch2, |
| 402 Label* not_number); |
| 403 |
| 404 // Convert the smi or heap number in object to an int32 using the rules |
| 405 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated |
| 406 // and brought into the range -2^31 .. +2^31 - 1. |
| 407 static void ConvertNumberToInt32(MacroAssembler* masm, |
| 408 Register object, |
| 409 Register dst, |
| 410 Register heap_number_map, |
| 411 Register scratch1, |
| 412 Register scratch2, |
| 413 Register scratch3, |
| 414 DwVfpRegister double_scratch, |
| 415 Label* not_int32); |
| 416 |
| 417 // Converts the smi in |smi_scratch| to a double, storing the result either |
| 418 // in |double_dst| or |dst2:dst1|, depending on |destination|. |
| 419 // Warning: The value in |smi_scratch| will be changed in the process! |
| 420 static void ConvertSmiToDouble(MacroAssembler* masm, |
| 421 Register smi_scratch, |
| 422 Destination destination, |
| 423 DwVfpRegister double_dst, |
| 424 Register dst1, |
| 425 Register dst2, |
| 426 Register scratch2, |
| 427 SwVfpRegister single_scratch); |
| 428 |
| 429 // Load the number from object into double_dst in the double format. |
| 430 // Control will jump to not_int32 if the value cannot be exactly represented |
| 431 // by a 32-bit integer. |
| 432 // Floating point value in the 32-bit integer range that are not exact integer |
| 433 // won't be loaded. |
| 434 static void LoadNumberAsInt32Double(MacroAssembler* masm, |
| 435 Register object, |
| 436 Destination destination, |
| 437 DwVfpRegister double_dst, |
| 438 Register dst1, |
| 439 Register dst2, |
| 440 Register heap_number_map, |
| 441 Register scratch1, |
| 442 Register scratch2, |
| 443 SwVfpRegister single_scratch, |
| 444 Label* not_int32); |
| 445 |
| 446 // Loads the number from object into dst as a 32-bit integer. |
| 447 // Control will jump to not_int32 if the object cannot be exactly represented |
| 448 // by a 32-bit integer. |
| 449 // Floating point value in the 32-bit integer range that are not exact integer |
| 450 // won't be converted. |
| 451 // scratch3 is not used when VFP3 is supported. |
| 452 static void LoadNumberAsInt32(MacroAssembler* masm, |
| 453 Register object, |
| 454 Register dst, |
| 455 Register heap_number_map, |
| 456 Register scratch1, |
| 457 Register scratch2, |
| 458 Register scratch3, |
| 459 DwVfpRegister double_scratch, |
| 460 Label* not_int32); |
| 461 |
| 462 // Generate non VFP3 code to check if a double can be exactly represented by a |
| 463 // 32-bit integer. This does not check for 0 or -0, which need |
| 464 // to be checked for separately. |
| 465 // Control jumps to not_int32 if the value is not a 32-bit integer, and falls |
| 466 // through otherwise. |
| 467 // src1 and src2 will be cloberred. |
| 468 // |
| 469 // Expected input: |
| 470 // - src1: higher (exponent) part of the double value. |
| 471 // - src2: lower (mantissa) part of the double value. |
| 472 // Output status: |
| 473 // - dst: 32 higher bits of the mantissa. (mantissa[51:20]) |
| 474 // - src2: contains 1. |
| 475 // - other registers are clobbered. |
| 476 static void DoubleIs32BitInteger(MacroAssembler* masm, |
| 477 Register src1, |
| 478 Register src2, |
| 479 Register dst, |
| 480 Register scratch, |
| 481 Label* not_int32); |
| 482 |
| 483 // Generates code to call a C function to do a double operation using core |
| 484 // registers. (Used when VFP3 is not supported.) |
| 485 // This code never falls through, but returns with a heap number containing |
| 486 // the result in r0. |
| 487 // Register heapnumber_result must be a heap number in which the |
| 488 // result of the operation will be stored. |
| 489 // Requires the following layout on entry: |
| 490 // r0: Left value (least significant part of mantissa). |
| 491 // r1: Left value (sign, exponent, top of mantissa). |
| 492 // r2: Right value (least significant part of mantissa). |
| 493 // r3: Right value (sign, exponent, top of mantissa). |
| 494 static void CallCCodeForDoubleOperation(MacroAssembler* masm, |
| 495 Token::Value op, |
| 496 Register heap_number_result, |
| 497 Register scratch); |
| 498 |
| 499 private: |
| 500 static void LoadNumber(MacroAssembler* masm, |
| 501 FloatingPointHelper::Destination destination, |
| 502 Register object, |
| 503 DwVfpRegister dst, |
| 504 Register dst1, |
| 505 Register dst2, |
| 506 Register heap_number_map, |
| 507 Register scratch1, |
| 508 Register scratch2, |
| 509 Label* not_number); |
| 510 }; |
| 511 |
| 512 |
371 } } // namespace v8::internal | 513 } } // namespace v8::internal |
372 | 514 |
373 #endif // V8_ARM_CODE_STUBS_ARM_H_ | 515 #endif // V8_ARM_CODE_STUBS_ARM_H_ |
OLD | NEW |