OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 Register scratch); | 606 Register scratch); |
607 | 607 |
608 // Takes the operands in edx and eax and loads them as integers in eax | 608 // Takes the operands in edx and eax and loads them as integers in eax |
609 // and ecx. | 609 // and ecx. |
610 static void LoadUnknownsAsIntegers(MacroAssembler* masm, | 610 static void LoadUnknownsAsIntegers(MacroAssembler* masm, |
611 bool use_sse3, | 611 bool use_sse3, |
612 BinaryOpIC::TypeInfo left_type, | 612 BinaryOpIC::TypeInfo left_type, |
613 BinaryOpIC::TypeInfo right_type, | 613 BinaryOpIC::TypeInfo right_type, |
614 Label* operand_conversion_failure); | 614 Label* operand_conversion_failure); |
615 | 615 |
616 // Assumes that operands are smis or heap numbers and loads them | |
617 // into xmm0 and xmm1. Operands are in edx and eax. | |
618 // Leaves operands unchanged. | |
619 static void LoadSSE2Operands(MacroAssembler* masm); | |
620 | |
621 // Test if operands are numbers (smi or HeapNumber objects), and load | 616 // Test if operands are numbers (smi or HeapNumber objects), and load |
622 // them into xmm0 and xmm1 if they are. Jump to label not_numbers if | 617 // them into xmm0 and xmm1 if they are. Jump to label not_numbers if |
623 // either operand is not a number. Operands are in edx and eax. | 618 // either operand is not a number. Operands are in edx and eax. |
624 // Leaves operands unchanged. | 619 // Leaves operands unchanged. |
625 static void LoadSSE2Operands(MacroAssembler* masm, Label* not_numbers); | 620 static void LoadSSE2Operands(MacroAssembler* masm, Label* not_numbers); |
626 | 621 |
627 // Similar to LoadSSE2Operands but assumes that both operands are smis. | 622 // Similar to LoadSSE2Operands but assumes that both operands are smis. |
628 // Expects operands in edx, eax. | 623 // Expects operands in edx, eax. |
629 static void LoadSSE2Smis(MacroAssembler* masm, Register scratch); | 624 static void LoadSSE2Smis(MacroAssembler* masm, Register scratch); |
630 | 625 |
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 __ bind(&load_smi); | 2449 __ bind(&load_smi); |
2455 __ SmiUntag(number); | 2450 __ SmiUntag(number); |
2456 __ push(number); | 2451 __ push(number); |
2457 __ fild_s(Operand(esp, 0)); | 2452 __ fild_s(Operand(esp, 0)); |
2458 __ pop(number); | 2453 __ pop(number); |
2459 | 2454 |
2460 __ bind(&done); | 2455 __ bind(&done); |
2461 } | 2456 } |
2462 | 2457 |
2463 | 2458 |
2464 void FloatingPointHelper::LoadSSE2Operands(MacroAssembler* masm) { | |
2465 Label load_smi_edx, load_eax, load_smi_eax, done; | |
2466 // Load operand in edx into xmm0. | |
2467 __ JumpIfSmi(edx, &load_smi_edx, Label::kNear); | |
2468 __ movdbl(xmm0, FieldOperand(edx, HeapNumber::kValueOffset)); | |
2469 | |
2470 __ bind(&load_eax); | |
2471 // Load operand in eax into xmm1. | |
2472 __ JumpIfSmi(eax, &load_smi_eax, Label::kNear); | |
2473 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset)); | |
2474 __ jmp(&done, Label::kNear); | |
2475 | |
2476 __ bind(&load_smi_edx); | |
2477 __ SmiUntag(edx); // Untag smi before converting to float. | |
2478 __ cvtsi2sd(xmm0, edx); | |
2479 __ SmiTag(edx); // Retag smi for heap number overwriting test. | |
2480 __ jmp(&load_eax); | |
2481 | |
2482 __ bind(&load_smi_eax); | |
2483 __ SmiUntag(eax); // Untag smi before converting to float. | |
2484 __ cvtsi2sd(xmm1, eax); | |
2485 __ SmiTag(eax); // Retag smi for heap number overwriting test. | |
2486 | |
2487 __ bind(&done); | |
2488 } | |
2489 | |
2490 | |
2491 void FloatingPointHelper::LoadSSE2Operands(MacroAssembler* masm, | 2459 void FloatingPointHelper::LoadSSE2Operands(MacroAssembler* masm, |
2492 Label* not_numbers) { | 2460 Label* not_numbers) { |
2493 Label load_smi_edx, load_eax, load_smi_eax, load_float_eax, done; | 2461 Label load_smi_edx, load_eax, load_smi_eax, load_float_eax, done; |
2494 // Load operand in edx into xmm0, or branch to not_numbers. | 2462 // Load operand in edx into xmm0, or branch to not_numbers. |
2495 __ JumpIfSmi(edx, &load_smi_edx, Label::kNear); | 2463 __ JumpIfSmi(edx, &load_smi_edx, Label::kNear); |
2496 Factory* factory = masm->isolate()->factory(); | 2464 Factory* factory = masm->isolate()->factory(); |
2497 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), factory->heap_number_map()); | 2465 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), factory->heap_number_map()); |
2498 __ j(not_equal, not_numbers); // Argument in edx is not a number. | 2466 __ j(not_equal, not_numbers); // Argument in edx is not a number. |
2499 __ movdbl(xmm0, FieldOperand(edx, HeapNumber::kValueOffset)); | 2467 __ movdbl(xmm0, FieldOperand(edx, HeapNumber::kValueOffset)); |
2500 __ bind(&load_eax); | 2468 __ bind(&load_eax); |
(...skipping 5213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7714 __ bind(&fast_elements_case); | 7682 __ bind(&fast_elements_case); |
7715 GenerateCase(masm, FAST_ELEMENTS); | 7683 GenerateCase(masm, FAST_ELEMENTS); |
7716 } | 7684 } |
7717 | 7685 |
7718 | 7686 |
7719 #undef __ | 7687 #undef __ |
7720 | 7688 |
7721 } } // namespace v8::internal | 7689 } } // namespace v8::internal |
7722 | 7690 |
7723 #endif // V8_TARGET_ARCH_IA32 | 7691 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |