| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 653 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 654 | 654 |
| 655 // Do not transform the receiver for strict mode functions. | 655 // Do not transform the receiver for strict mode functions. |
| 656 __ movq(rbx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 656 __ movq(rbx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
| 657 __ testb(FieldOperand(rbx, SharedFunctionInfo::kStrictModeByteOffset), | 657 __ testb(FieldOperand(rbx, SharedFunctionInfo::kStrictModeByteOffset), |
| 658 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); | 658 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); |
| 659 __ j(not_equal, &shift_arguments); | 659 __ j(not_equal, &shift_arguments); |
| 660 | 660 |
| 661 // Do not transform the receiver for natives. | 661 // Do not transform the receiver for natives. |
| 662 // SharedFunctionInfo is already loaded into rbx. | 662 // SharedFunctionInfo is already loaded into rbx. |
| 663 __ movq(rbx, FieldOperand(rbx, SharedFunctionInfo::kScriptOffset)); | 663 __ testb(FieldOperand(rbx, SharedFunctionInfo::kES5NativeByteOffset), |
| 664 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 664 Immediate(1 << SharedFunctionInfo::kES5NativeBitWithinByte)); |
| 665 __ j(equal, &shift_arguments); | 665 __ j(not_zero, &shift_arguments); |
| 666 __ SmiCompare(FieldOperand(rbx, Script::kTypeOffset), | |
| 667 Smi::FromInt(Script::TYPE_NATIVE)); | |
| 668 __ j(equal, &shift_arguments); | |
| 669 | 666 |
| 670 // Compute the receiver in non-strict mode. | 667 // Compute the receiver in non-strict mode. |
| 671 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); | 668 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); |
| 672 __ JumpIfSmi(rbx, &convert_to_object); | 669 __ JumpIfSmi(rbx, &convert_to_object); |
| 673 | 670 |
| 674 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 671 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
| 675 __ j(equal, &use_global_receiver); | 672 __ j(equal, &use_global_receiver); |
| 676 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 673 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
| 677 __ j(equal, &use_global_receiver); | 674 __ j(equal, &use_global_receiver); |
| 678 | 675 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 Label call_to_object, use_global_receiver, push_receiver; | 822 Label call_to_object, use_global_receiver, push_receiver; |
| 826 __ movq(rbx, Operand(rbp, kReceiverOffset)); | 823 __ movq(rbx, Operand(rbp, kReceiverOffset)); |
| 827 | 824 |
| 828 // Do not transform the receiver for strict mode functions. | 825 // Do not transform the receiver for strict mode functions. |
| 829 __ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 826 __ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
| 830 __ testb(FieldOperand(rdx, SharedFunctionInfo::kStrictModeByteOffset), | 827 __ testb(FieldOperand(rdx, SharedFunctionInfo::kStrictModeByteOffset), |
| 831 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); | 828 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); |
| 832 __ j(not_equal, &push_receiver); | 829 __ j(not_equal, &push_receiver); |
| 833 | 830 |
| 834 // Do not transform the receiver for natives. | 831 // Do not transform the receiver for natives. |
| 835 // SharedFunctionInfo is already loaded into rdx. | 832 __ testb(FieldOperand(rdx, SharedFunctionInfo::kES5NativeByteOffset), |
| 836 __ movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kScriptOffset)); | 833 Immediate(1 << SharedFunctionInfo::kES5NativeBitWithinByte)); |
| 837 __ CompareRoot(rdx, Heap::kUndefinedValueRootIndex); | 834 __ j(not_zero, &push_receiver); |
| 838 __ j(equal, &push_receiver); | |
| 839 __ SmiCompare(FieldOperand(rdx, Script::kTypeOffset), | |
| 840 Smi::FromInt(Script::TYPE_NATIVE)); | |
| 841 __ j(equal, &push_receiver); | |
| 842 | 835 |
| 843 // Compute the receiver in non-strict mode. | 836 // Compute the receiver in non-strict mode. |
| 844 __ JumpIfSmi(rbx, &call_to_object); | 837 __ JumpIfSmi(rbx, &call_to_object); |
| 845 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 838 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
| 846 __ j(equal, &use_global_receiver); | 839 __ j(equal, &use_global_receiver); |
| 847 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 840 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
| 848 __ j(equal, &use_global_receiver); | 841 __ j(equal, &use_global_receiver); |
| 849 | 842 |
| 850 // If given receiver is already a JavaScript object then there's no | 843 // If given receiver is already a JavaScript object then there's no |
| 851 // reason for converting it. | 844 // reason for converting it. |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 | 1460 |
| 1468 // Pass the function to optimize as the argument to the on-stack | 1461 // Pass the function to optimize as the argument to the on-stack |
| 1469 // replacement runtime function. | 1462 // replacement runtime function. |
| 1470 __ EnterInternalFrame(); | 1463 __ EnterInternalFrame(); |
| 1471 __ push(rax); | 1464 __ push(rax); |
| 1472 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); | 1465 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
| 1473 __ LeaveInternalFrame(); | 1466 __ LeaveInternalFrame(); |
| 1474 | 1467 |
| 1475 // If the result was -1 it means that we couldn't optimize the | 1468 // If the result was -1 it means that we couldn't optimize the |
| 1476 // function. Just return and continue in the unoptimized version. | 1469 // function. Just return and continue in the unoptimized version. |
| 1477 NearLabel skip; | 1470 Label skip; |
| 1478 __ SmiCompare(rax, Smi::FromInt(-1)); | 1471 __ SmiCompare(rax, Smi::FromInt(-1)); |
| 1479 __ j(not_equal, &skip); | 1472 __ j(not_equal, &skip, Label::kNear); |
| 1480 __ ret(0); | 1473 __ ret(0); |
| 1481 | 1474 |
| 1482 // If we decide not to perform on-stack replacement we perform a | 1475 // If we decide not to perform on-stack replacement we perform a |
| 1483 // stack guard check to enable interrupts. | 1476 // stack guard check to enable interrupts. |
| 1484 __ bind(&stack_check); | 1477 __ bind(&stack_check); |
| 1485 NearLabel ok; | 1478 Label ok; |
| 1486 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | 1479 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
| 1487 __ j(above_equal, &ok); | 1480 __ j(above_equal, &ok, Label::kNear); |
| 1488 | 1481 |
| 1489 StackCheckStub stub; | 1482 StackCheckStub stub; |
| 1490 __ TailCallStub(&stub); | 1483 __ TailCallStub(&stub); |
| 1491 __ Abort("Unreachable code: returned from tail call."); | 1484 __ Abort("Unreachable code: returned from tail call."); |
| 1492 __ bind(&ok); | 1485 __ bind(&ok); |
| 1493 __ ret(0); | 1486 __ ret(0); |
| 1494 | 1487 |
| 1495 __ bind(&skip); | 1488 __ bind(&skip); |
| 1496 // Untag the AST id and push it on the stack. | 1489 // Untag the AST id and push it on the stack. |
| 1497 __ SmiToInteger32(rax, rax); | 1490 __ SmiToInteger32(rax, rax); |
| 1498 __ push(rax); | 1491 __ push(rax); |
| 1499 | 1492 |
| 1500 // Generate the code for doing the frame-to-frame translation using | 1493 // Generate the code for doing the frame-to-frame translation using |
| 1501 // the deoptimizer infrastructure. | 1494 // the deoptimizer infrastructure. |
| 1502 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1495 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1503 generator.Generate(); | 1496 generator.Generate(); |
| 1504 } | 1497 } |
| 1505 | 1498 |
| 1506 | 1499 |
| 1507 #undef __ | 1500 #undef __ |
| 1508 | 1501 |
| 1509 } } // namespace v8::internal | 1502 } } // namespace v8::internal |
| 1510 | 1503 |
| 1511 #endif // V8_TARGET_ARCH_X64 | 1504 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |