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 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 } else { | 2229 } else { |
2230 __ j(cc, chunk_->GetAssemblyLabel(left_block)); | 2230 __ j(cc, chunk_->GetAssemblyLabel(left_block)); |
2231 __ jmp(chunk_->GetAssemblyLabel(right_block)); | 2231 __ jmp(chunk_->GetAssemblyLabel(right_block)); |
2232 } | 2232 } |
2233 } | 2233 } |
2234 | 2234 |
2235 | 2235 |
2236 template<class InstrType> | 2236 template<class InstrType> |
2237 void LCodeGen::EmitFalseBranch(InstrType instr, Condition cc) { | 2237 void LCodeGen::EmitFalseBranch(InstrType instr, Condition cc) { |
2238 int false_block = instr->FalseDestination(chunk_); | 2238 int false_block = instr->FalseDestination(chunk_); |
2239 __ j(cc, chunk_->GetAssemblyLabel(false_block)); | 2239 if (cc == no_condition) { |
| 2240 __ jmp(chunk_->GetAssemblyLabel(false_block)); |
| 2241 } else { |
| 2242 __ j(cc, chunk_->GetAssemblyLabel(false_block)); |
| 2243 } |
2240 } | 2244 } |
2241 | 2245 |
2242 | 2246 |
2243 void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) { | 2247 void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) { |
2244 Representation r = instr->hydrogen()->value()->representation(); | 2248 Representation r = instr->hydrogen()->value()->representation(); |
2245 if (r.IsSmiOrInteger32() || r.IsDouble()) { | 2249 if (r.IsSmiOrInteger32() || r.IsDouble()) { |
2246 EmitBranch(instr, no_condition); | 2250 EmitBranch(instr, no_condition); |
2247 } else { | 2251 } else { |
2248 ASSERT(r.IsTagged()); | 2252 ASSERT(r.IsTagged()); |
2249 Register reg = ToRegister(instr->value()); | 2253 Register reg = ToRegister(instr->value()); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 __ cmp(input_reg, factory()->the_hole_value()); | 2500 __ cmp(input_reg, factory()->the_hole_value()); |
2497 EmitBranch(instr, equal); | 2501 EmitBranch(instr, equal); |
2498 return; | 2502 return; |
2499 } | 2503 } |
2500 | 2504 |
2501 bool use_sse2 = CpuFeatures::IsSupported(SSE2); | 2505 bool use_sse2 = CpuFeatures::IsSupported(SSE2); |
2502 if (use_sse2) { | 2506 if (use_sse2) { |
2503 CpuFeatureScope scope(masm(), SSE2); | 2507 CpuFeatureScope scope(masm(), SSE2); |
2504 XMMRegister input_reg = ToDoubleRegister(instr->object()); | 2508 XMMRegister input_reg = ToDoubleRegister(instr->object()); |
2505 __ ucomisd(input_reg, input_reg); | 2509 __ ucomisd(input_reg, input_reg); |
| 2510 EmitFalseBranch(instr, parity_odd); |
2506 } else { | 2511 } else { |
2507 // Put the value to the top of stack | 2512 // Put the value to the top of stack |
2508 X87Register src = ToX87Register(instr->object()); | 2513 X87Register src = ToX87Register(instr->object()); |
2509 X87LoadForUsage(src); | 2514 X87LoadForUsage(src); |
2510 __ fld(0); | 2515 __ fld(0); |
2511 __ fld(0); | 2516 __ fld(0); |
2512 __ FCmp(); | 2517 __ FCmp(); |
| 2518 Label ok; |
| 2519 __ j(parity_even, &ok); |
| 2520 __ fstp(0); |
| 2521 EmitFalseBranch(instr, no_condition); |
| 2522 __ bind(&ok); |
2513 } | 2523 } |
2514 | 2524 |
2515 EmitFalseBranch(instr, parity_odd); | |
2516 | 2525 |
2517 __ sub(esp, Immediate(kDoubleSize)); | 2526 __ sub(esp, Immediate(kDoubleSize)); |
2518 if (use_sse2) { | 2527 if (use_sse2) { |
2519 CpuFeatureScope scope(masm(), SSE2); | 2528 CpuFeatureScope scope(masm(), SSE2); |
2520 XMMRegister input_reg = ToDoubleRegister(instr->object()); | 2529 XMMRegister input_reg = ToDoubleRegister(instr->object()); |
2521 __ movdbl(MemOperand(esp, 0), input_reg); | 2530 __ movdbl(MemOperand(esp, 0), input_reg); |
2522 } else { | 2531 } else { |
2523 __ fld(0); | |
2524 __ fstp_d(MemOperand(esp, 0)); | 2532 __ fstp_d(MemOperand(esp, 0)); |
2525 } | 2533 } |
2526 | 2534 |
2527 __ add(esp, Immediate(kDoubleSize)); | 2535 __ add(esp, Immediate(kDoubleSize)); |
2528 __ cmp(MemOperand(esp, -sizeof(kHoleNanUpper32)), Immediate(kHoleNanUpper32)); | 2536 __ cmp(MemOperand(esp, -sizeof(kHoleNanUpper32)), Immediate(kHoleNanUpper32)); |
2529 EmitBranch(instr, equal); | 2537 EmitBranch(instr, equal); |
2530 } | 2538 } |
2531 | 2539 |
2532 | 2540 |
2533 Condition LCodeGen::EmitIsObject(Register input, | 2541 Condition LCodeGen::EmitIsObject(Register input, |
(...skipping 3909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6443 FixedArray::kHeaderSize - kPointerSize)); | 6451 FixedArray::kHeaderSize - kPointerSize)); |
6444 __ bind(&done); | 6452 __ bind(&done); |
6445 } | 6453 } |
6446 | 6454 |
6447 | 6455 |
6448 #undef __ | 6456 #undef __ |
6449 | 6457 |
6450 } } // namespace v8::internal | 6458 } } // namespace v8::internal |
6451 | 6459 |
6452 #endif // V8_TARGET_ARCH_IA32 | 6460 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |