OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 MemOperand slot_operand = codegen()->EmitSlotSearch(slot, result_register()); | 367 MemOperand slot_operand = codegen()->EmitSlotSearch(slot, result_register()); |
368 // Memory operands can be pushed directly. | 368 // Memory operands can be pushed directly. |
369 __ push(slot_operand); | 369 __ push(slot_operand); |
370 } | 370 } |
371 | 371 |
372 | 372 |
373 void FullCodeGenerator::TestContext::Plug(Slot* slot) const { | 373 void FullCodeGenerator::TestContext::Plug(Slot* slot) const { |
374 // For simplicity we always test the accumulator register. | 374 // For simplicity we always test the accumulator register. |
375 codegen()->Move(result_register(), slot); | 375 codegen()->Move(result_register(), slot); |
376 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 376 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
377 codegen()->DoTest(true_label_, false_label_, fall_through_); | 377 codegen()->DoTest(this); |
378 } | 378 } |
379 | 379 |
380 | 380 |
381 void FullCodeGenerator::EffectContext::Plug(Heap::RootListIndex index) const { | 381 void FullCodeGenerator::EffectContext::Plug(Heap::RootListIndex index) const { |
382 UNREACHABLE(); // Not used on IA32. | 382 UNREACHABLE(); // Not used on IA32. |
383 } | 383 } |
384 | 384 |
385 | 385 |
386 void FullCodeGenerator::AccumulatorValueContext::Plug( | 386 void FullCodeGenerator::AccumulatorValueContext::Plug( |
387 Heap::RootListIndex index) const { | 387 Heap::RootListIndex index) const { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 } | 441 } |
442 } else if (lit->IsSmi()) { | 442 } else if (lit->IsSmi()) { |
443 if (Smi::cast(*lit)->value() == 0) { | 443 if (Smi::cast(*lit)->value() == 0) { |
444 if (false_label_ != fall_through_) __ jmp(false_label_); | 444 if (false_label_ != fall_through_) __ jmp(false_label_); |
445 } else { | 445 } else { |
446 if (true_label_ != fall_through_) __ jmp(true_label_); | 446 if (true_label_ != fall_through_) __ jmp(true_label_); |
447 } | 447 } |
448 } else { | 448 } else { |
449 // For simplicity we always test the accumulator register. | 449 // For simplicity we always test the accumulator register. |
450 __ mov(result_register(), lit); | 450 __ mov(result_register(), lit); |
451 codegen()->DoTest(true_label_, false_label_, fall_through_); | 451 codegen()->DoTest(this); |
452 } | 452 } |
453 } | 453 } |
454 | 454 |
455 | 455 |
456 void FullCodeGenerator::EffectContext::DropAndPlug(int count, | 456 void FullCodeGenerator::EffectContext::DropAndPlug(int count, |
457 Register reg) const { | 457 Register reg) const { |
458 ASSERT(count > 0); | 458 ASSERT(count > 0); |
459 __ Drop(count); | 459 __ Drop(count); |
460 } | 460 } |
461 | 461 |
(...skipping 15 matching lines...) Expand all Loading... |
477 } | 477 } |
478 | 478 |
479 | 479 |
480 void FullCodeGenerator::TestContext::DropAndPlug(int count, | 480 void FullCodeGenerator::TestContext::DropAndPlug(int count, |
481 Register reg) const { | 481 Register reg) const { |
482 ASSERT(count > 0); | 482 ASSERT(count > 0); |
483 // For simplicity we always test the accumulator register. | 483 // For simplicity we always test the accumulator register. |
484 __ Drop(count); | 484 __ Drop(count); |
485 __ Move(result_register(), reg); | 485 __ Move(result_register(), reg); |
486 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 486 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
487 codegen()->DoTest(true_label_, false_label_, fall_through_); | 487 codegen()->DoTest(this); |
488 } | 488 } |
489 | 489 |
490 | 490 |
491 void FullCodeGenerator::EffectContext::Plug(Label* materialize_true, | 491 void FullCodeGenerator::EffectContext::Plug(Label* materialize_true, |
492 Label* materialize_false) const { | 492 Label* materialize_false) const { |
493 ASSERT(materialize_true == materialize_false); | 493 ASSERT(materialize_true == materialize_false); |
494 __ bind(materialize_true); | 494 __ bind(materialize_true); |
495 } | 495 } |
496 | 496 |
497 | 497 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 true_label_, | 554 true_label_, |
555 false_label_); | 555 false_label_); |
556 if (flag) { | 556 if (flag) { |
557 if (true_label_ != fall_through_) __ jmp(true_label_); | 557 if (true_label_ != fall_through_) __ jmp(true_label_); |
558 } else { | 558 } else { |
559 if (false_label_ != fall_through_) __ jmp(false_label_); | 559 if (false_label_ != fall_through_) __ jmp(false_label_); |
560 } | 560 } |
561 } | 561 } |
562 | 562 |
563 | 563 |
564 void FullCodeGenerator::DoTest(Label* if_true, | 564 void FullCodeGenerator::DoTest(Expression* condition, |
| 565 Label* if_true, |
565 Label* if_false, | 566 Label* if_false, |
566 Label* fall_through) { | 567 Label* fall_through) { |
567 ToBooleanStub stub; | 568 ToBooleanStub stub; |
568 __ push(result_register()); | 569 __ push(result_register()); |
569 __ CallStub(&stub); | 570 __ CallStub(&stub); |
570 __ test(eax, Operand(eax)); | 571 __ test(eax, Operand(eax)); |
571 // The stub returns nonzero for true. | 572 // The stub returns nonzero for true. |
572 Split(not_zero, if_true, if_false, fall_through); | 573 Split(not_zero, if_true, if_false, fall_through); |
573 } | 574 } |
574 | 575 |
(...skipping 3752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4327 // And return. | 4328 // And return. |
4328 __ ret(0); | 4329 __ ret(0); |
4329 } | 4330 } |
4330 | 4331 |
4331 | 4332 |
4332 #undef __ | 4333 #undef __ |
4333 | 4334 |
4334 } } // namespace v8::internal | 4335 } } // namespace v8::internal |
4335 | 4336 |
4336 #endif // V8_TARGET_ARCH_IA32 | 4337 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |