| 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); | 513 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 514 | 514 |
| 515 // Tear down temporary frame. | 515 // Tear down temporary frame. |
| 516 __ LeaveInternalFrame(); | 516 __ LeaveInternalFrame(); |
| 517 | 517 |
| 518 // Get the full codegen state from the stack and untag it. | 518 // Get the full codegen state from the stack and untag it. |
| 519 __ mov(ecx, Operand(esp, 1 * kPointerSize)); | 519 __ mov(ecx, Operand(esp, 1 * kPointerSize)); |
| 520 __ SmiUntag(ecx); | 520 __ SmiUntag(ecx); |
| 521 | 521 |
| 522 // Switch on the state. | 522 // Switch on the state. |
| 523 NearLabel not_no_registers, not_tos_eax; | 523 Label not_no_registers, not_tos_eax; |
| 524 __ cmp(ecx, FullCodeGenerator::NO_REGISTERS); | 524 __ cmp(ecx, FullCodeGenerator::NO_REGISTERS); |
| 525 __ j(not_equal, ¬_no_registers); | 525 __ j(not_equal, ¬_no_registers, Label::kNear); |
| 526 __ ret(1 * kPointerSize); // Remove state. | 526 __ ret(1 * kPointerSize); // Remove state. |
| 527 | 527 |
| 528 __ bind(¬_no_registers); | 528 __ bind(¬_no_registers); |
| 529 __ mov(eax, Operand(esp, 2 * kPointerSize)); | 529 __ mov(eax, Operand(esp, 2 * kPointerSize)); |
| 530 __ cmp(ecx, FullCodeGenerator::TOS_REG); | 530 __ cmp(ecx, FullCodeGenerator::TOS_REG); |
| 531 __ j(not_equal, ¬_tos_eax); | 531 __ j(not_equal, ¬_tos_eax, Label::kNear); |
| 532 __ ret(2 * kPointerSize); // Remove state, eax. | 532 __ ret(2 * kPointerSize); // Remove state, eax. |
| 533 | 533 |
| 534 __ bind(¬_tos_eax); | 534 __ bind(¬_tos_eax); |
| 535 __ Abort("no cases left"); | 535 __ Abort("no cases left"); |
| 536 } | 536 } |
| 537 | 537 |
| 538 | 538 |
| 539 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { | 539 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { |
| 540 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); | 540 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
| 541 } | 541 } |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 | 1570 |
| 1571 // Pass the function to optimize as the argument to the on-stack | 1571 // Pass the function to optimize as the argument to the on-stack |
| 1572 // replacement runtime function. | 1572 // replacement runtime function. |
| 1573 __ EnterInternalFrame(); | 1573 __ EnterInternalFrame(); |
| 1574 __ push(eax); | 1574 __ push(eax); |
| 1575 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); | 1575 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
| 1576 __ LeaveInternalFrame(); | 1576 __ LeaveInternalFrame(); |
| 1577 | 1577 |
| 1578 // If the result was -1 it means that we couldn't optimize the | 1578 // If the result was -1 it means that we couldn't optimize the |
| 1579 // function. Just return and continue in the unoptimized version. | 1579 // function. Just return and continue in the unoptimized version. |
| 1580 NearLabel skip; | 1580 Label skip; |
| 1581 __ cmp(Operand(eax), Immediate(Smi::FromInt(-1))); | 1581 __ cmp(Operand(eax), Immediate(Smi::FromInt(-1))); |
| 1582 __ j(not_equal, &skip); | 1582 __ j(not_equal, &skip, Label::kNear); |
| 1583 __ ret(0); | 1583 __ ret(0); |
| 1584 | 1584 |
| 1585 // If we decide not to perform on-stack replacement we perform a | 1585 // If we decide not to perform on-stack replacement we perform a |
| 1586 // stack guard check to enable interrupts. | 1586 // stack guard check to enable interrupts. |
| 1587 __ bind(&stack_check); | 1587 __ bind(&stack_check); |
| 1588 NearLabel ok; | 1588 Label ok; |
| 1589 ExternalReference stack_limit = | 1589 ExternalReference stack_limit = |
| 1590 ExternalReference::address_of_stack_limit(masm->isolate()); | 1590 ExternalReference::address_of_stack_limit(masm->isolate()); |
| 1591 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 1591 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 1592 __ j(above_equal, &ok, taken); | 1592 __ j(above_equal, &ok, taken, Label::kNear); |
| 1593 StackCheckStub stub; | 1593 StackCheckStub stub; |
| 1594 __ TailCallStub(&stub); | 1594 __ TailCallStub(&stub); |
| 1595 __ Abort("Unreachable code: returned from tail call."); | 1595 __ Abort("Unreachable code: returned from tail call."); |
| 1596 __ bind(&ok); | 1596 __ bind(&ok); |
| 1597 __ ret(0); | 1597 __ ret(0); |
| 1598 | 1598 |
| 1599 __ bind(&skip); | 1599 __ bind(&skip); |
| 1600 // Untag the AST id and push it on the stack. | 1600 // Untag the AST id and push it on the stack. |
| 1601 __ SmiUntag(eax); | 1601 __ SmiUntag(eax); |
| 1602 __ push(eax); | 1602 __ push(eax); |
| 1603 | 1603 |
| 1604 // Generate the code for doing the frame-to-frame translation using | 1604 // Generate the code for doing the frame-to-frame translation using |
| 1605 // the deoptimizer infrastructure. | 1605 // the deoptimizer infrastructure. |
| 1606 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1606 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1607 generator.Generate(); | 1607 generator.Generate(); |
| 1608 } | 1608 } |
| 1609 | 1609 |
| 1610 | 1610 |
| 1611 #undef __ | 1611 #undef __ |
| 1612 } | 1612 } |
| 1613 } // namespace v8::internal | 1613 } // namespace v8::internal |
| 1614 | 1614 |
| 1615 #endif // V8_TARGET_ARCH_IA32 | 1615 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |