| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 | 409 |
| 410 RecordAndUpdatePosition(instr->position()); | 410 RecordAndUpdatePosition(instr->position()); |
| 411 | 411 |
| 412 instr->CompileToNative(this); | 412 instr->CompileToNative(this); |
| 413 | 413 |
| 414 if (!CpuFeatures::IsSupported(SSE2)) { | 414 if (!CpuFeatures::IsSupported(SSE2)) { |
| 415 if (instr->IsGoto()) { | 415 if (instr->IsGoto()) { |
| 416 x87_stack_.LeavingBlock(current_block_, LGoto::cast(instr)); | 416 x87_stack_.LeavingBlock(current_block_, LGoto::cast(instr)); |
| 417 } else if (FLAG_debug_code && FLAG_enable_slow_asserts && | 417 } else if (FLAG_debug_code && FLAG_enable_slow_asserts && |
| 418 !instr->IsGap() && !instr->IsReturn()) { | 418 !instr->IsGap() && !instr->IsReturn()) { |
| 419 if (instr->ClobbersDoubleRegisters()) { |
| 420 if (instr->HasDoubleRegisterResult()) { |
| 421 ASSERT_EQ(1, x87_stack_.depth()); |
| 422 } else { |
| 423 ASSERT_EQ(0, x87_stack_.depth()); |
| 424 } |
| 425 } |
| 419 __ VerifyX87StackDepth(x87_stack_.depth()); | 426 __ VerifyX87StackDepth(x87_stack_.depth()); |
| 420 } | 427 } |
| 421 } | 428 } |
| 422 } | 429 } |
| 423 EnsureSpaceForLazyDeopt(); | 430 EnsureSpaceForLazyDeopt(); |
| 424 return !is_aborted(); | 431 return !is_aborted(); |
| 425 } | 432 } |
| 426 | 433 |
| 427 | 434 |
| 428 bool LCodeGen::GenerateJumpTable() { | 435 bool LCodeGen::GenerateJumpTable() { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 } | 561 } |
| 555 | 562 |
| 556 | 563 |
| 557 void LCodeGen::X87LoadForUsage(X87Register reg) { | 564 void LCodeGen::X87LoadForUsage(X87Register reg) { |
| 558 ASSERT(x87_stack_.Contains(reg)); | 565 ASSERT(x87_stack_.Contains(reg)); |
| 559 x87_stack_.Fxch(reg); | 566 x87_stack_.Fxch(reg); |
| 560 x87_stack_.pop(); | 567 x87_stack_.pop(); |
| 561 } | 568 } |
| 562 | 569 |
| 563 | 570 |
| 571 void LCodeGen::X87LoadForUsage(X87Register reg1, X87Register reg2) { |
| 572 ASSERT(x87_stack_.Contains(reg1)); |
| 573 ASSERT(x87_stack_.Contains(reg2)); |
| 574 x87_stack_.Fxch(reg1, 1); |
| 575 x87_stack_.Fxch(reg2); |
| 576 x87_stack_.pop(); |
| 577 x87_stack_.pop(); |
| 578 } |
| 579 |
| 580 |
| 564 void LCodeGen::X87Stack::Fxch(X87Register reg, int other_slot) { | 581 void LCodeGen::X87Stack::Fxch(X87Register reg, int other_slot) { |
| 565 ASSERT(is_mutable_); | 582 ASSERT(is_mutable_); |
| 566 ASSERT(Contains(reg) && stack_depth_ > other_slot); | 583 ASSERT(Contains(reg) && stack_depth_ > other_slot); |
| 567 int i = ArrayIndex(reg); | 584 int i = ArrayIndex(reg); |
| 568 int st = st2idx(i); | 585 int st = st2idx(i); |
| 569 if (st != other_slot) { | 586 if (st != other_slot) { |
| 570 int other_i = st2idx(other_slot); | 587 int other_i = st2idx(other_slot); |
| 571 X87Register other = stack_[other_i]; | 588 X87Register other = stack_[other_i]; |
| 572 stack_[other_i] = reg; | 589 stack_[other_i] = reg; |
| 573 stack_[i] = other; | 590 stack_[i] = other; |
| (...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2565 double right_val = ToDouble(LConstantOperand::cast(right)); | 2582 double right_val = ToDouble(LConstantOperand::cast(right)); |
| 2566 int next_block = EvalComparison(instr->op(), left_val, right_val) ? | 2583 int next_block = EvalComparison(instr->op(), left_val, right_val) ? |
| 2567 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_); | 2584 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_); |
| 2568 EmitGoto(next_block); | 2585 EmitGoto(next_block); |
| 2569 } else { | 2586 } else { |
| 2570 if (instr->is_double()) { | 2587 if (instr->is_double()) { |
| 2571 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { | 2588 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
| 2572 CpuFeatureScope scope(masm(), SSE2); | 2589 CpuFeatureScope scope(masm(), SSE2); |
| 2573 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right)); | 2590 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right)); |
| 2574 } else { | 2591 } else { |
| 2575 X87Fxch(ToX87Register(right)); | 2592 X87LoadForUsage(ToX87Register(right), ToX87Register(left)); |
| 2576 X87Fxch(ToX87Register(left), 1); | |
| 2577 __ fld(0); | |
| 2578 __ fld(2); | |
| 2579 __ FCmp(); | 2593 __ FCmp(); |
| 2580 } | 2594 } |
| 2581 // Don't base result on EFLAGS when a NaN is involved. Instead | 2595 // Don't base result on EFLAGS when a NaN is involved. Instead |
| 2582 // jump to the false block. | 2596 // jump to the false block. |
| 2583 __ j(parity_even, instr->FalseLabel(chunk_)); | 2597 __ j(parity_even, instr->FalseLabel(chunk_)); |
| 2584 } else { | 2598 } else { |
| 2585 if (right->IsConstantOperand()) { | 2599 if (right->IsConstantOperand()) { |
| 2586 __ cmp(ToOperand(left), | 2600 __ cmp(ToOperand(left), |
| 2587 ToImmediate(right, instr->hydrogen()->representation())); | 2601 ToImmediate(right, instr->hydrogen()->representation())); |
| 2588 } else if (left->IsConstantOperand()) { | 2602 } else if (left->IsConstantOperand()) { |
| (...skipping 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6394 FixedArray::kHeaderSize - kPointerSize)); | 6408 FixedArray::kHeaderSize - kPointerSize)); |
| 6395 __ bind(&done); | 6409 __ bind(&done); |
| 6396 } | 6410 } |
| 6397 | 6411 |
| 6398 | 6412 |
| 6399 #undef __ | 6413 #undef __ |
| 6400 | 6414 |
| 6401 } } // namespace v8::internal | 6415 } } // namespace v8::internal |
| 6402 | 6416 |
| 6403 #endif // V8_TARGET_ARCH_IA32 | 6417 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |