| 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 __ Push(Smi::FromInt(static_cast<int>(type))); | 569 __ Push(Smi::FromInt(static_cast<int>(type))); |
| 570 | 570 |
| 571 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); | 571 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 572 // Tear down temporary frame. | 572 // Tear down temporary frame. |
| 573 __ LeaveInternalFrame(); | 573 __ LeaveInternalFrame(); |
| 574 | 574 |
| 575 // Get the full codegen state from the stack and untag it. | 575 // Get the full codegen state from the stack and untag it. |
| 576 __ SmiToInteger32(rcx, Operand(rsp, 1 * kPointerSize)); | 576 __ SmiToInteger32(rcx, Operand(rsp, 1 * kPointerSize)); |
| 577 | 577 |
| 578 // Switch on the state. | 578 // Switch on the state. |
| 579 NearLabel not_no_registers, not_tos_rax; | 579 Label not_no_registers, not_tos_rax; |
| 580 __ cmpq(rcx, Immediate(FullCodeGenerator::NO_REGISTERS)); | 580 __ cmpq(rcx, Immediate(FullCodeGenerator::NO_REGISTERS)); |
| 581 __ j(not_equal, ¬_no_registers); | 581 __ j(not_equal, ¬_no_registers, Label::kNear); |
| 582 __ ret(1 * kPointerSize); // Remove state. | 582 __ ret(1 * kPointerSize); // Remove state. |
| 583 | 583 |
| 584 __ bind(¬_no_registers); | 584 __ bind(¬_no_registers); |
| 585 __ movq(rax, Operand(rsp, 2 * kPointerSize)); | 585 __ movq(rax, Operand(rsp, 2 * kPointerSize)); |
| 586 __ cmpq(rcx, Immediate(FullCodeGenerator::TOS_REG)); | 586 __ cmpq(rcx, Immediate(FullCodeGenerator::TOS_REG)); |
| 587 __ j(not_equal, ¬_tos_rax); | 587 __ j(not_equal, ¬_tos_rax, Label::kNear); |
| 588 __ ret(2 * kPointerSize); // Remove state, rax. | 588 __ ret(2 * kPointerSize); // Remove state, rax. |
| 589 | 589 |
| 590 __ bind(¬_tos_rax); | 590 __ bind(¬_tos_rax); |
| 591 __ Abort("no cases left"); | 591 __ Abort("no cases left"); |
| 592 } | 592 } |
| 593 | 593 |
| 594 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { | 594 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { |
| 595 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); | 595 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
| 596 } | 596 } |
| 597 | 597 |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 | 1467 |
| 1468 // Pass the function to optimize as the argument to the on-stack | 1468 // Pass the function to optimize as the argument to the on-stack |
| 1469 // replacement runtime function. | 1469 // replacement runtime function. |
| 1470 __ EnterInternalFrame(); | 1470 __ EnterInternalFrame(); |
| 1471 __ push(rax); | 1471 __ push(rax); |
| 1472 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); | 1472 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
| 1473 __ LeaveInternalFrame(); | 1473 __ LeaveInternalFrame(); |
| 1474 | 1474 |
| 1475 // If the result was -1 it means that we couldn't optimize the | 1475 // If the result was -1 it means that we couldn't optimize the |
| 1476 // function. Just return and continue in the unoptimized version. | 1476 // function. Just return and continue in the unoptimized version. |
| 1477 NearLabel skip; | 1477 Label skip; |
| 1478 __ SmiCompare(rax, Smi::FromInt(-1)); | 1478 __ SmiCompare(rax, Smi::FromInt(-1)); |
| 1479 __ j(not_equal, &skip); | 1479 __ j(not_equal, &skip, Label::kNear); |
| 1480 __ ret(0); | 1480 __ ret(0); |
| 1481 | 1481 |
| 1482 // If we decide not to perform on-stack replacement we perform a | 1482 // If we decide not to perform on-stack replacement we perform a |
| 1483 // stack guard check to enable interrupts. | 1483 // stack guard check to enable interrupts. |
| 1484 __ bind(&stack_check); | 1484 __ bind(&stack_check); |
| 1485 NearLabel ok; | 1485 Label ok; |
| 1486 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | 1486 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
| 1487 __ j(above_equal, &ok); | 1487 __ j(above_equal, &ok, Label::kNear); |
| 1488 | 1488 |
| 1489 StackCheckStub stub; | 1489 StackCheckStub stub; |
| 1490 __ TailCallStub(&stub); | 1490 __ TailCallStub(&stub); |
| 1491 __ Abort("Unreachable code: returned from tail call."); | 1491 __ Abort("Unreachable code: returned from tail call."); |
| 1492 __ bind(&ok); | 1492 __ bind(&ok); |
| 1493 __ ret(0); | 1493 __ ret(0); |
| 1494 | 1494 |
| 1495 __ bind(&skip); | 1495 __ bind(&skip); |
| 1496 // Untag the AST id and push it on the stack. | 1496 // Untag the AST id and push it on the stack. |
| 1497 __ SmiToInteger32(rax, rax); | 1497 __ SmiToInteger32(rax, rax); |
| 1498 __ push(rax); | 1498 __ push(rax); |
| 1499 | 1499 |
| 1500 // Generate the code for doing the frame-to-frame translation using | 1500 // Generate the code for doing the frame-to-frame translation using |
| 1501 // the deoptimizer infrastructure. | 1501 // the deoptimizer infrastructure. |
| 1502 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1502 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1503 generator.Generate(); | 1503 generator.Generate(); |
| 1504 } | 1504 } |
| 1505 | 1505 |
| 1506 | 1506 |
| 1507 #undef __ | 1507 #undef __ |
| 1508 | 1508 |
| 1509 } } // namespace v8::internal | 1509 } } // namespace v8::internal |
| 1510 | 1510 |
| 1511 #endif // V8_TARGET_ARCH_X64 | 1511 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |