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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr); | 408 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr); |
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()) { |
oliv
2013/09/24 09:03:15
It would be nice to document the invariant this cl
Benedikt Meurer
2013/09/24 09:26:48
Done.
| |
419 __ VerifyX87StackDepth(x87_stack_.depth()); | 419 __ VerifyX87StackDepth(x87_stack_.depth()); |
420 } | 420 } |
421 } | 421 } |
422 } | 422 } |
423 EnsureSpaceForLazyDeopt(); | 423 EnsureSpaceForLazyDeopt(); |
424 return !is_aborted(); | 424 return !is_aborted(); |
425 } | 425 } |
426 | 426 |
427 | 427 |
428 bool LCodeGen::GenerateJumpTable() { | 428 bool LCodeGen::GenerateJumpTable() { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 } | 554 } |
555 | 555 |
556 | 556 |
557 void LCodeGen::X87LoadForUsage(X87Register reg) { | 557 void LCodeGen::X87LoadForUsage(X87Register reg) { |
558 ASSERT(x87_stack_.Contains(reg)); | 558 ASSERT(x87_stack_.Contains(reg)); |
559 x87_stack_.Fxch(reg); | 559 x87_stack_.Fxch(reg); |
560 x87_stack_.pop(); | 560 x87_stack_.pop(); |
561 } | 561 } |
562 | 562 |
563 | 563 |
564 void LCodeGen::X87LoadForUsage(X87Register reg1, X87Register reg2) { | |
565 ASSERT(x87_stack_.Contains(reg1)); | |
566 ASSERT(x87_stack_.Contains(reg2)); | |
567 x87_stack_.Fxch(reg1, 1); | |
568 x87_stack_.Fxch(reg2); | |
569 x87_stack_.pop(); | |
570 x87_stack_.pop(); | |
Toon Verwaest
2013/09/24 09:00:08
Pretty surprising that you first push values to th
Benedikt Meurer
2013/09/24 09:12:30
As discussed offline, we can fix this once the X87
| |
571 } | |
572 | |
573 | |
564 void LCodeGen::X87Stack::Fxch(X87Register reg, int other_slot) { | 574 void LCodeGen::X87Stack::Fxch(X87Register reg, int other_slot) { |
565 ASSERT(is_mutable_); | 575 ASSERT(is_mutable_); |
566 ASSERT(Contains(reg) && stack_depth_ > other_slot); | 576 ASSERT(Contains(reg) && stack_depth_ > other_slot); |
567 int i = ArrayIndex(reg); | 577 int i = ArrayIndex(reg); |
568 int st = st2idx(i); | 578 int st = st2idx(i); |
569 if (st != other_slot) { | 579 if (st != other_slot) { |
570 int other_i = st2idx(other_slot); | 580 int other_i = st2idx(other_slot); |
571 X87Register other = stack_[other_i]; | 581 X87Register other = stack_[other_i]; |
572 stack_[other_i] = reg; | 582 stack_[other_i] = reg; |
573 stack_[i] = other; | 583 stack_[i] = other; |
(...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2565 double right_val = ToDouble(LConstantOperand::cast(right)); | 2575 double right_val = ToDouble(LConstantOperand::cast(right)); |
2566 int next_block = EvalComparison(instr->op(), left_val, right_val) ? | 2576 int next_block = EvalComparison(instr->op(), left_val, right_val) ? |
2567 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_); | 2577 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_); |
2568 EmitGoto(next_block); | 2578 EmitGoto(next_block); |
2569 } else { | 2579 } else { |
2570 if (instr->is_double()) { | 2580 if (instr->is_double()) { |
2571 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { | 2581 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
2572 CpuFeatureScope scope(masm(), SSE2); | 2582 CpuFeatureScope scope(masm(), SSE2); |
2573 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right)); | 2583 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right)); |
2574 } else { | 2584 } else { |
2575 X87Fxch(ToX87Register(right)); | 2585 X87LoadForUsage(ToX87Register(right), ToX87Register(left)); |
2576 X87Fxch(ToX87Register(left), 1); | |
2577 __ fld(0); | |
2578 __ fld(2); | |
2579 __ FCmp(); | 2586 __ FCmp(); |
2580 } | 2587 } |
2581 // Don't base result on EFLAGS when a NaN is involved. Instead | 2588 // Don't base result on EFLAGS when a NaN is involved. Instead |
2582 // jump to the false block. | 2589 // jump to the false block. |
2583 __ j(parity_even, instr->FalseLabel(chunk_)); | 2590 __ j(parity_even, instr->FalseLabel(chunk_)); |
2584 } else { | 2591 } else { |
2585 if (right->IsConstantOperand()) { | 2592 if (right->IsConstantOperand()) { |
2586 __ cmp(ToOperand(left), | 2593 __ cmp(ToOperand(left), |
2587 ToImmediate(right, instr->hydrogen()->representation())); | 2594 ToImmediate(right, instr->hydrogen()->representation())); |
2588 } else if (left->IsConstantOperand()) { | 2595 } else if (left->IsConstantOperand()) { |
(...skipping 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6394 FixedArray::kHeaderSize - kPointerSize)); | 6401 FixedArray::kHeaderSize - kPointerSize)); |
6395 __ bind(&done); | 6402 __ bind(&done); |
6396 } | 6403 } |
6397 | 6404 |
6398 | 6405 |
6399 #undef __ | 6406 #undef __ |
6400 | 6407 |
6401 } } // namespace v8::internal | 6408 } } // namespace v8::internal |
6402 | 6409 |
6403 #endif // V8_TARGET_ARCH_IA32 | 6410 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |