| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 4464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4475 } | 4475 } |
| 4476 case Token::BIT_OR: | 4476 case Token::BIT_OR: |
| 4477 case Token::BIT_AND: | 4477 case Token::BIT_AND: |
| 4478 case Token::BIT_XOR: | 4478 case Token::BIT_XOR: |
| 4479 case Token::SAR: | 4479 case Token::SAR: |
| 4480 case Token::SHL: | 4480 case Token::SHL: |
| 4481 case Token::SHR: { | 4481 case Token::SHR: { |
| 4482 FloatingPointHelper::CheckFloatOperands(masm, &call_runtime, ebx); | 4482 FloatingPointHelper::CheckFloatOperands(masm, &call_runtime, ebx); |
| 4483 FloatingPointHelper::LoadFloatOperands(masm, ecx); | 4483 FloatingPointHelper::LoadFloatOperands(masm, ecx); |
| 4484 | 4484 |
| 4485 Label non_smi_result, skip_allocation, operands_failed_conversion; | 4485 Label non_int32_operands, non_smi_result, skip_allocation; |
| 4486 // Reserve space for converted numbers. |
| 4487 __ sub(Operand(esp), Immediate(2 * kPointerSize)); |
| 4486 | 4488 |
| 4487 // Reserve space for converted numbers. | 4489 // Check if right operand is int32. |
| 4488 __ sub(Operand(esp), Immediate(4 * kPointerSize)); | 4490 __ fist_s(Operand(esp, 1 * kPointerSize)); |
| 4491 __ fild_s(Operand(esp, 1 * kPointerSize)); |
| 4492 __ fucompp(); |
| 4493 __ fnstsw_ax(); |
| 4494 __ sahf(); |
| 4495 __ j(not_zero, &non_int32_operands); |
| 4496 __ j(parity_even, &non_int32_operands); |
| 4489 | 4497 |
| 4490 // Convert right operand to int32. | 4498 // Check if left operand is int32. |
| 4491 __ fnclex(); | 4499 __ fist_s(Operand(esp, 0 * kPointerSize)); |
| 4492 __ fisttp_d(Operand(esp, 2 * kPointerSize)); | 4500 __ fild_s(Operand(esp, 0 * kPointerSize)); |
| 4501 __ fucompp(); |
| 4493 __ fnstsw_ax(); | 4502 __ fnstsw_ax(); |
| 4494 __ test(eax, Immediate(1)); | 4503 __ sahf(); |
| 4495 __ j(not_zero, &operands_failed_conversion); | 4504 __ j(not_zero, &non_int32_operands); |
| 4496 | 4505 __ j(parity_even, &non_int32_operands); |
| 4497 // Convert left operand to int32. | |
| 4498 __ fisttp_d(Operand(esp, 0 * kPointerSize)); | |
| 4499 __ fnstsw_ax(); | |
| 4500 __ test(eax, Immediate(1)); | |
| 4501 __ j(not_zero, &operands_failed_conversion); | |
| 4502 | 4506 |
| 4503 // Get int32 operands and perform bitop. | 4507 // Get int32 operands and perform bitop. |
| 4504 __ pop(eax); | 4508 __ pop(eax); |
| 4505 __ add(Operand(esp), Immediate(kPointerSize)); | |
| 4506 __ pop(ecx); | 4509 __ pop(ecx); |
| 4507 __ add(Operand(esp), Immediate(kPointerSize)); | |
| 4508 switch (op_) { | 4510 switch (op_) { |
| 4509 case Token::BIT_OR: __ or_(eax, Operand(ecx)); break; | 4511 case Token::BIT_OR: __ or_(eax, Operand(ecx)); break; |
| 4510 case Token::BIT_AND: __ and_(eax, Operand(ecx)); break; | 4512 case Token::BIT_AND: __ and_(eax, Operand(ecx)); break; |
| 4511 case Token::BIT_XOR: __ xor_(eax, Operand(ecx)); break; | 4513 case Token::BIT_XOR: __ xor_(eax, Operand(ecx)); break; |
| 4512 case Token::SAR: __ sar(eax); break; | 4514 case Token::SAR: __ sar(eax); break; |
| 4513 case Token::SHL: __ shl(eax); break; | 4515 case Token::SHL: __ shl(eax); break; |
| 4514 case Token::SHR: __ shr(eax); break; | 4516 case Token::SHR: __ shr(eax); break; |
| 4515 default: UNREACHABLE(); | 4517 default: UNREACHABLE(); |
| 4516 } | 4518 } |
| 4517 | 4519 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4545 __ bind(&skip_allocation); | 4547 __ bind(&skip_allocation); |
| 4546 break; | 4548 break; |
| 4547 default: UNREACHABLE(); | 4549 default: UNREACHABLE(); |
| 4548 } | 4550 } |
| 4549 // Store the result in the HeapNumber and return. | 4551 // Store the result in the HeapNumber and return. |
| 4550 __ mov(Operand(esp, 1 * kPointerSize), ebx); | 4552 __ mov(Operand(esp, 1 * kPointerSize), ebx); |
| 4551 __ fild_s(Operand(esp, 1 * kPointerSize)); | 4553 __ fild_s(Operand(esp, 1 * kPointerSize)); |
| 4552 __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset)); | 4554 __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset)); |
| 4553 __ ret(2 * kPointerSize); | 4555 __ ret(2 * kPointerSize); |
| 4554 } | 4556 } |
| 4555 | 4557 __ bind(&non_int32_operands); |
| 4556 // Free ST(0) before calling runtime. | 4558 // Restore stacks and operands before calling runtime. |
| 4557 __ bind(&operands_failed_conversion); | |
| 4558 __ add(Operand(esp), Immediate(4 * kPointerSize)); | |
| 4559 __ ffree(0); | 4559 __ ffree(0); |
| 4560 __ add(Operand(esp), Immediate(2 * kPointerSize)); |
| 4560 | 4561 |
| 4561 // SHR should return uint32 - go to runtime for non-smi/negative result. | 4562 // SHR should return uint32 - go to runtime for non-smi/negative result. |
| 4562 if (op_ == Token::SHR) __ bind(&non_smi_result); | 4563 if (op_ == Token::SHR) __ bind(&non_smi_result); |
| 4563 __ mov(eax, Operand(esp, 1 * kPointerSize)); | 4564 __ mov(eax, Operand(esp, 1 * kPointerSize)); |
| 4564 __ mov(edx, Operand(esp, 2 * kPointerSize)); | 4565 __ mov(edx, Operand(esp, 2 * kPointerSize)); |
| 4565 break; | 4566 break; |
| 4566 } | 4567 } |
| 4567 default: UNREACHABLE(); break; | 4568 default: UNREACHABLE(); break; |
| 4568 } | 4569 } |
| 4569 | 4570 |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5421 | 5422 |
| 5422 // Slow-case: Go through the JavaScript implementation. | 5423 // Slow-case: Go through the JavaScript implementation. |
| 5423 __ bind(&slow); | 5424 __ bind(&slow); |
| 5424 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 5425 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 5425 } | 5426 } |
| 5426 | 5427 |
| 5427 | 5428 |
| 5428 #undef __ | 5429 #undef __ |
| 5429 | 5430 |
| 5430 } } // namespace v8::internal | 5431 } } // namespace v8::internal |
| OLD | NEW |