| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 370 |
| 371 void FullCodeGenerator::StackValueContext::Plug(Slot* slot) const { | 371 void FullCodeGenerator::StackValueContext::Plug(Slot* slot) const { |
| 372 MemOperand slot_operand = codegen()->EmitSlotSearch(slot, result_register()); | 372 MemOperand slot_operand = codegen()->EmitSlotSearch(slot, result_register()); |
| 373 __ push(slot_operand); | 373 __ push(slot_operand); |
| 374 } | 374 } |
| 375 | 375 |
| 376 | 376 |
| 377 void FullCodeGenerator::TestContext::Plug(Slot* slot) const { | 377 void FullCodeGenerator::TestContext::Plug(Slot* slot) const { |
| 378 codegen()->Move(result_register(), slot); | 378 codegen()->Move(result_register(), slot); |
| 379 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 379 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
| 380 codegen()->DoTest(true_label_, false_label_, fall_through_); | 380 codegen()->DoTest(condition_, true_label_, false_label_, fall_through_); |
| 381 } | 381 } |
| 382 | 382 |
| 383 | 383 |
| 384 void FullCodeGenerator::EffectContext::Plug(Heap::RootListIndex index) const { | 384 void FullCodeGenerator::EffectContext::Plug(Heap::RootListIndex index) const { |
| 385 } | 385 } |
| 386 | 386 |
| 387 | 387 |
| 388 void FullCodeGenerator::AccumulatorValueContext::Plug( | 388 void FullCodeGenerator::AccumulatorValueContext::Plug( |
| 389 Heap::RootListIndex index) const { | 389 Heap::RootListIndex index) const { |
| 390 __ LoadRoot(result_register(), index); | 390 __ LoadRoot(result_register(), index); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 403 true_label_, | 403 true_label_, |
| 404 false_label_); | 404 false_label_); |
| 405 if (index == Heap::kUndefinedValueRootIndex || | 405 if (index == Heap::kUndefinedValueRootIndex || |
| 406 index == Heap::kNullValueRootIndex || | 406 index == Heap::kNullValueRootIndex || |
| 407 index == Heap::kFalseValueRootIndex) { | 407 index == Heap::kFalseValueRootIndex) { |
| 408 if (false_label_ != fall_through_) __ jmp(false_label_); | 408 if (false_label_ != fall_through_) __ jmp(false_label_); |
| 409 } else if (index == Heap::kTrueValueRootIndex) { | 409 } else if (index == Heap::kTrueValueRootIndex) { |
| 410 if (true_label_ != fall_through_) __ jmp(true_label_); | 410 if (true_label_ != fall_through_) __ jmp(true_label_); |
| 411 } else { | 411 } else { |
| 412 __ LoadRoot(result_register(), index); | 412 __ LoadRoot(result_register(), index); |
| 413 codegen()->DoTest(true_label_, false_label_, fall_through_); | 413 codegen()->DoTest(condition_, true_label_, false_label_, fall_through_); |
| 414 } | 414 } |
| 415 } | 415 } |
| 416 | 416 |
| 417 | 417 |
| 418 void FullCodeGenerator::EffectContext::Plug(Handle<Object> lit) const { | 418 void FullCodeGenerator::EffectContext::Plug(Handle<Object> lit) const { |
| 419 } | 419 } |
| 420 | 420 |
| 421 | 421 |
| 422 void FullCodeGenerator::AccumulatorValueContext::Plug( | 422 void FullCodeGenerator::AccumulatorValueContext::Plug( |
| 423 Handle<Object> lit) const { | 423 Handle<Object> lit) const { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 448 } | 448 } |
| 449 } else if (lit->IsSmi()) { | 449 } else if (lit->IsSmi()) { |
| 450 if (Smi::cast(*lit)->value() == 0) { | 450 if (Smi::cast(*lit)->value() == 0) { |
| 451 if (false_label_ != fall_through_) __ jmp(false_label_); | 451 if (false_label_ != fall_through_) __ jmp(false_label_); |
| 452 } else { | 452 } else { |
| 453 if (true_label_ != fall_through_) __ jmp(true_label_); | 453 if (true_label_ != fall_through_) __ jmp(true_label_); |
| 454 } | 454 } |
| 455 } else { | 455 } else { |
| 456 // For simplicity we always test the accumulator register. | 456 // For simplicity we always test the accumulator register. |
| 457 __ Move(result_register(), lit); | 457 __ Move(result_register(), lit); |
| 458 codegen()->DoTest(true_label_, false_label_, fall_through_); | 458 codegen()->DoTest(condition_, true_label_, false_label_, fall_through_); |
| 459 } | 459 } |
| 460 } | 460 } |
| 461 | 461 |
| 462 | 462 |
| 463 void FullCodeGenerator::EffectContext::DropAndPlug(int count, | 463 void FullCodeGenerator::EffectContext::DropAndPlug(int count, |
| 464 Register reg) const { | 464 Register reg) const { |
| 465 ASSERT(count > 0); | 465 ASSERT(count > 0); |
| 466 __ Drop(count); | 466 __ Drop(count); |
| 467 } | 467 } |
| 468 | 468 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 484 } | 484 } |
| 485 | 485 |
| 486 | 486 |
| 487 void FullCodeGenerator::TestContext::DropAndPlug(int count, | 487 void FullCodeGenerator::TestContext::DropAndPlug(int count, |
| 488 Register reg) const { | 488 Register reg) const { |
| 489 ASSERT(count > 0); | 489 ASSERT(count > 0); |
| 490 // For simplicity we always test the accumulator register. | 490 // For simplicity we always test the accumulator register. |
| 491 __ Drop(count); | 491 __ Drop(count); |
| 492 __ Move(result_register(), reg); | 492 __ Move(result_register(), reg); |
| 493 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 493 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
| 494 codegen()->DoTest(true_label_, false_label_, fall_through_); | 494 codegen()->DoTest(condition_, true_label_, false_label_, fall_through_); |
| 495 } | 495 } |
| 496 | 496 |
| 497 | 497 |
| 498 void FullCodeGenerator::EffectContext::Plug(Label* materialize_true, | 498 void FullCodeGenerator::EffectContext::Plug(Label* materialize_true, |
| 499 Label* materialize_false) const { | 499 Label* materialize_false) const { |
| 500 ASSERT(materialize_true == materialize_false); | 500 ASSERT(materialize_true == materialize_false); |
| 501 __ bind(materialize_true); | 501 __ bind(materialize_true); |
| 502 } | 502 } |
| 503 | 503 |
| 504 | 504 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 true_label_, | 559 true_label_, |
| 560 false_label_); | 560 false_label_); |
| 561 if (flag) { | 561 if (flag) { |
| 562 if (true_label_ != fall_through_) __ jmp(true_label_); | 562 if (true_label_ != fall_through_) __ jmp(true_label_); |
| 563 } else { | 563 } else { |
| 564 if (false_label_ != fall_through_) __ jmp(false_label_); | 564 if (false_label_ != fall_through_) __ jmp(false_label_); |
| 565 } | 565 } |
| 566 } | 566 } |
| 567 | 567 |
| 568 | 568 |
| 569 void FullCodeGenerator::DoTest(Label* if_true, | 569 void FullCodeGenerator::DoTest(Expression* condition, |
| 570 Label* if_true, |
| 570 Label* if_false, | 571 Label* if_false, |
| 571 Label* fall_through) { | 572 Label* fall_through) { |
| 572 ToBooleanStub stub; | 573 ToBooleanStub stub; |
| 573 __ push(result_register()); | 574 __ push(result_register()); |
| 574 __ CallStub(&stub); | 575 __ CallStub(&stub); |
| 575 __ testq(rax, rax); | 576 __ testq(rax, rax); |
| 576 // The stub returns nonzero for true. | 577 // The stub returns nonzero for true. |
| 577 Split(not_zero, if_true, if_false, fall_through); | 578 Split(not_zero, if_true, if_false, fall_through); |
| 578 } | 579 } |
| 579 | 580 |
| (...skipping 3731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4311 __ ret(0); | 4312 __ ret(0); |
| 4312 } | 4313 } |
| 4313 | 4314 |
| 4314 | 4315 |
| 4315 #undef __ | 4316 #undef __ |
| 4316 | 4317 |
| 4317 | 4318 |
| 4318 } } // namespace v8::internal | 4319 } } // namespace v8::internal |
| 4319 | 4320 |
| 4320 #endif // V8_TARGET_ARCH_X64 | 4321 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |