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 if (instr->IsGoto()) { | 386 FLAG_debug_code && FLAG_enable_slow_asserts) { |
387 x87_stack_.LeavingBlock(current_block_, LGoto::cast(instr)); | |
388 } else if (FLAG_debug_code && FLAG_enable_slow_asserts && | |
389 !instr->IsGap() && !instr->IsReturn()) { | |
390 __ VerifyX87StackDepth(x87_stack_.depth()); | 387 __ VerifyX87StackDepth(x87_stack_.depth()); |
391 } | |
392 } | 388 } |
393 } | 389 } |
394 EnsureSpaceForLazyDeopt(); | 390 EnsureSpaceForLazyDeopt(); |
395 return !is_aborted(); | 391 return !is_aborted(); |
396 } | 392 } |
397 | 393 |
398 | 394 |
399 bool LCodeGen::GenerateJumpTable() { | 395 bool LCodeGen::GenerateJumpTable() { |
400 Label needs_frame; | 396 Label needs_frame; |
401 if (jump_table_.length() > 0) { | 397 if (jump_table_.length() > 0) { |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 } | 675 } |
680 Free(reg); | 676 Free(reg); |
681 if (i < stack_depth_-1) i++; | 677 if (i < stack_depth_-1) i++; |
682 } | 678 } |
683 } | 679 } |
684 if (instr->IsReturn()) { | 680 if (instr->IsReturn()) { |
685 while (stack_depth_ > 0) { | 681 while (stack_depth_ > 0) { |
686 __ fstp(0); | 682 __ fstp(0); |
687 stack_depth_--; | 683 stack_depth_--; |
688 } | 684 } |
689 __ VerifyX87StackDepth(0); | |
690 } | 685 } |
691 } | 686 } |
692 | 687 |
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 | |
707 | 688 |
708 void LCodeGen::EmitFlushX87ForDeopt() { | 689 void LCodeGen::EmitFlushX87ForDeopt() { |
709 // The deoptimizer does not support X87 Registers. But as long as we | 690 // The deoptimizer does not support X87 Registers. But as long as we |
710 // deopt from a stub its not a problem, since we will re-materialize the | 691 // deopt from a stub its not a problem, since we will re-materialize the |
711 // original stub inputs, which can't be double registers. | 692 // original stub inputs, which can't be double registers. |
712 ASSERT(info()->IsStub()); | 693 ASSERT(info()->IsStub()); |
713 if (FLAG_debug_code && FLAG_enable_slow_asserts) { | 694 if (FLAG_debug_code && FLAG_enable_slow_asserts) { |
714 __ pushfd(); | 695 __ pushfd(); |
715 __ VerifyX87StackDepth(x87_stack_.depth()); | 696 __ VerifyX87StackDepth(x87_stack_.depth()); |
716 __ popfd(); | 697 __ popfd(); |
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 } | 2479 } |
2499 | 2480 |
2500 | 2481 |
2501 void LCodeGen::EmitGoto(int block) { | 2482 void LCodeGen::EmitGoto(int block) { |
2502 if (!IsNextEmittedBlock(block)) { | 2483 if (!IsNextEmittedBlock(block)) { |
2503 __ jmp(chunk_->GetAssemblyLabel(LookupDestination(block))); | 2484 __ jmp(chunk_->GetAssemblyLabel(LookupDestination(block))); |
2504 } | 2485 } |
2505 } | 2486 } |
2506 | 2487 |
2507 | 2488 |
2508 void LCodeGen::DoClobberDoubles(LClobberDoubles* instr) { | |
2509 } | |
2510 | |
2511 | |
2512 void LCodeGen::DoGoto(LGoto* instr) { | 2489 void LCodeGen::DoGoto(LGoto* instr) { |
2513 EmitGoto(instr->block_id()); | 2490 EmitGoto(instr->block_id()); |
2514 } | 2491 } |
2515 | 2492 |
2516 | 2493 |
2517 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { | 2494 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { |
2518 Condition cond = no_condition; | 2495 Condition cond = no_condition; |
2519 switch (op) { | 2496 switch (op) { |
2520 case Token::EQ: | 2497 case Token::EQ: |
2521 case Token::EQ_STRICT: | 2498 case Token::EQ_STRICT: |
(...skipping 3851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6373 FixedArray::kHeaderSize - kPointerSize)); | 6350 FixedArray::kHeaderSize - kPointerSize)); |
6374 __ bind(&done); | 6351 __ bind(&done); |
6375 } | 6352 } |
6376 | 6353 |
6377 | 6354 |
6378 #undef __ | 6355 #undef __ |
6379 | 6356 |
6380 } } // namespace v8::internal | 6357 } } // namespace v8::internal |
6381 | 6358 |
6382 #endif // V8_TARGET_ARCH_IA32 | 6359 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |