| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 instr->hydrogen_value()->id(), | 375 instr->hydrogen_value()->id(), |
| 376 instr->Mnemonic()); | 376 instr->Mnemonic()); |
| 377 } | 377 } |
| 378 | 378 |
| 379 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr); | 379 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr); |
| 380 | 380 |
| 381 RecordAndUpdatePosition(instr->position()); | 381 RecordAndUpdatePosition(instr->position()); |
| 382 | 382 |
| 383 instr->CompileToNative(this); | 383 instr->CompileToNative(this); |
| 384 | 384 |
| 385 if (!CpuFeatures::IsSupported(SSE2) && | 385 if (!CpuFeatures::IsSupported(SSE2)) { |
| 386 FLAG_debug_code && FLAG_enable_slow_asserts) { | 386 if (instr->IsGoto()) { |
| 387 x87_stack_.LeavingBlock(current_block_, LGoto::cast(instr)); |
| 388 } else if (FLAG_debug_code && FLAG_enable_slow_asserts && |
| 389 !instr->IsGap() && !instr->IsReturn()) { |
| 387 __ VerifyX87StackDepth(x87_stack_.depth()); | 390 __ VerifyX87StackDepth(x87_stack_.depth()); |
| 391 } |
| 388 } | 392 } |
| 389 } | 393 } |
| 390 EnsureSpaceForLazyDeopt(); | 394 EnsureSpaceForLazyDeopt(); |
| 391 return !is_aborted(); | 395 return !is_aborted(); |
| 392 } | 396 } |
| 393 | 397 |
| 394 | 398 |
| 395 bool LCodeGen::GenerateJumpTable() { | 399 bool LCodeGen::GenerateJumpTable() { |
| 396 Label needs_frame; | 400 Label needs_frame; |
| 397 if (jump_table_.length() > 0) { | 401 if (jump_table_.length() > 0) { |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 } | 679 } |
| 676 Free(reg); | 680 Free(reg); |
| 677 if (i < stack_depth_-1) i++; | 681 if (i < stack_depth_-1) i++; |
| 678 } | 682 } |
| 679 } | 683 } |
| 680 if (instr->IsReturn()) { | 684 if (instr->IsReturn()) { |
| 681 while (stack_depth_ > 0) { | 685 while (stack_depth_ > 0) { |
| 682 __ fstp(0); | 686 __ fstp(0); |
| 683 stack_depth_--; | 687 stack_depth_--; |
| 684 } | 688 } |
| 689 __ VerifyX87StackDepth(0); |
| 685 } | 690 } |
| 686 } | 691 } |
| 687 | 692 |
| 693 |
| 694 void LCodeGen::X87Stack::LeavingBlock(int current_block_id, LGoto* goto_instr) { |
| 695 ASSERT(stack_depth_ <= 1); |
| 696 // If ever used for new stubs producing two pairs of doubles joined into two |
| 697 // phis this assert hits. That situation is not handled, since the two stacks |
| 698 // might have st0 and st1 swapped. |
| 699 if (current_block_id + 1 != goto_instr->block_id()) { |
| 700 // If we have a value on the x87 stack on leaving a block, it must be a |
| 701 // phi input. If the next block we compile is not the join block, we have |
| 702 // to discard the stack state. |
| 703 stack_depth_ = 0; |
| 704 } |
| 705 } |
| 706 |
| 688 | 707 |
| 689 void LCodeGen::EmitFlushX87ForDeopt() { | 708 void LCodeGen::EmitFlushX87ForDeopt() { |
| 690 // The deoptimizer does not support X87 Registers. But as long as we | 709 // The deoptimizer does not support X87 Registers. But as long as we |
| 691 // deopt from a stub its not a problem, since we will re-materialize the | 710 // deopt from a stub its not a problem, since we will re-materialize the |
| 692 // original stub inputs, which can't be double registers. | 711 // original stub inputs, which can't be double registers. |
| 693 ASSERT(info()->IsStub()); | 712 ASSERT(info()->IsStub()); |
| 694 if (FLAG_debug_code && FLAG_enable_slow_asserts) { | 713 if (FLAG_debug_code && FLAG_enable_slow_asserts) { |
| 695 __ pushfd(); | 714 __ pushfd(); |
| 696 __ VerifyX87StackDepth(x87_stack_.depth()); | 715 __ VerifyX87StackDepth(x87_stack_.depth()); |
| 697 __ popfd(); | 716 __ popfd(); |
| (...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 } | 2498 } |
| 2480 | 2499 |
| 2481 | 2500 |
| 2482 void LCodeGen::EmitGoto(int block) { | 2501 void LCodeGen::EmitGoto(int block) { |
| 2483 if (!IsNextEmittedBlock(block)) { | 2502 if (!IsNextEmittedBlock(block)) { |
| 2484 __ jmp(chunk_->GetAssemblyLabel(LookupDestination(block))); | 2503 __ jmp(chunk_->GetAssemblyLabel(LookupDestination(block))); |
| 2485 } | 2504 } |
| 2486 } | 2505 } |
| 2487 | 2506 |
| 2488 | 2507 |
| 2508 void LCodeGen::DoClobberDoubles(LClobberDoubles* instr) { |
| 2509 } |
| 2510 |
| 2511 |
| 2489 void LCodeGen::DoGoto(LGoto* instr) { | 2512 void LCodeGen::DoGoto(LGoto* instr) { |
| 2490 EmitGoto(instr->block_id()); | 2513 EmitGoto(instr->block_id()); |
| 2491 } | 2514 } |
| 2492 | 2515 |
| 2493 | 2516 |
| 2494 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { | 2517 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { |
| 2495 Condition cond = no_condition; | 2518 Condition cond = no_condition; |
| 2496 switch (op) { | 2519 switch (op) { |
| 2497 case Token::EQ: | 2520 case Token::EQ: |
| 2498 case Token::EQ_STRICT: | 2521 case Token::EQ_STRICT: |
| (...skipping 3851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6350 FixedArray::kHeaderSize - kPointerSize)); | 6373 FixedArray::kHeaderSize - kPointerSize)); |
| 6351 __ bind(&done); | 6374 __ bind(&done); |
| 6352 } | 6375 } |
| 6353 | 6376 |
| 6354 | 6377 |
| 6355 #undef __ | 6378 #undef __ |
| 6356 | 6379 |
| 6357 } } // namespace v8::internal | 6380 } } // namespace v8::internal |
| 6358 | 6381 |
| 6359 #endif // V8_TARGET_ARCH_IA32 | 6382 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |