OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/counters.h" | 9 #include "src/counters.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 __ movp(rbx, FieldOperand(rdi, JSFunction::kFeedbackVectorOffset)); | 781 __ movp(rbx, FieldOperand(rdi, JSFunction::kFeedbackVectorOffset)); |
782 __ movp(rbx, FieldOperand(rbx, Cell::kValueOffset)); | 782 __ movp(rbx, FieldOperand(rbx, Cell::kValueOffset)); |
783 __ movp(rbx, | 783 __ movp(rbx, |
784 FieldOperand(rbx, FeedbackVector::kOptimizedCodeIndex * kPointerSize + | 784 FieldOperand(rbx, FeedbackVector::kOptimizedCodeIndex * kPointerSize + |
785 FeedbackVector::kHeaderSize)); | 785 FeedbackVector::kHeaderSize)); |
786 __ movp(optimized_code_entry, FieldOperand(rbx, WeakCell::kValueOffset)); | 786 __ movp(optimized_code_entry, FieldOperand(rbx, WeakCell::kValueOffset)); |
787 __ JumpIfNotSmi(optimized_code_entry, &switch_to_optimized_code); | 787 __ JumpIfNotSmi(optimized_code_entry, &switch_to_optimized_code); |
788 | 788 |
789 // Get the bytecode array from the function object (or from the DebugInfo if | 789 // Get the bytecode array from the function object (or from the DebugInfo if |
790 // it is present) and load it into kInterpreterBytecodeArrayRegister. | 790 // it is present) and load it into kInterpreterBytecodeArrayRegister. |
| 791 Label maybe_load_debug_bytecode_array, bytecode_array_loaded; |
791 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 792 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
792 Label load_debug_bytecode_array, bytecode_array_loaded; | |
793 __ JumpIfNotSmi(FieldOperand(rax, SharedFunctionInfo::kDebugInfoOffset), | |
794 &load_debug_bytecode_array); | |
795 __ movp(kInterpreterBytecodeArrayRegister, | 793 __ movp(kInterpreterBytecodeArrayRegister, |
796 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); | 794 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); |
| 795 __ JumpIfNotSmi(FieldOperand(rax, SharedFunctionInfo::kDebugInfoOffset), |
| 796 &maybe_load_debug_bytecode_array); |
797 __ bind(&bytecode_array_loaded); | 797 __ bind(&bytecode_array_loaded); |
798 | 798 |
799 // Check whether we should continue to use the interpreter. | 799 // Check whether we should continue to use the interpreter. |
800 // TODO(rmcilroy) Remove self healing once liveedit only has to deal with | 800 // TODO(rmcilroy) Remove self healing once liveedit only has to deal with |
801 // Ignition bytecode. | 801 // Ignition bytecode. |
802 Label switch_to_different_code_kind; | 802 Label switch_to_different_code_kind; |
803 __ Move(rcx, masm->CodeObject()); // Self-reference to this code. | 803 __ Move(rcx, masm->CodeObject()); // Self-reference to this code. |
804 __ cmpp(rcx, FieldOperand(rax, SharedFunctionInfo::kCodeOffset)); | 804 __ cmpp(rcx, FieldOperand(rax, SharedFunctionInfo::kCodeOffset)); |
805 __ j(not_equal, &switch_to_different_code_kind); | 805 __ j(not_equal, &switch_to_different_code_kind); |
806 | 806 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 874 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
875 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, | 875 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, |
876 times_pointer_size, 0)); | 876 times_pointer_size, 0)); |
877 __ call(rbx); | 877 __ call(rbx); |
878 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); | 878 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
879 | 879 |
880 // The return value is in rax. | 880 // The return value is in rax. |
881 LeaveInterpreterFrame(masm, rbx, rcx); | 881 LeaveInterpreterFrame(masm, rbx, rcx); |
882 __ ret(0); | 882 __ ret(0); |
883 | 883 |
884 // Load debug copy of the bytecode array. | 884 // Load debug copy of the bytecode array if it exists. |
885 __ bind(&load_debug_bytecode_array); | 885 // kInterpreterBytecodeArrayRegister is already loaded with |
886 Register debug_info = kInterpreterBytecodeArrayRegister; | 886 // SharedFunctionInfo::kFunctionDataOffset. |
887 __ movp(debug_info, FieldOperand(rax, SharedFunctionInfo::kDebugInfoOffset)); | 887 __ bind(&maybe_load_debug_bytecode_array); |
| 888 __ movp(rcx, FieldOperand(rax, SharedFunctionInfo::kDebugInfoOffset)); |
| 889 __ SmiToInteger32(kScratchRegister, |
| 890 FieldOperand(rcx, DebugInfo::kFlagsOffset)); |
| 891 __ testl(kScratchRegister, Immediate(DebugInfo::kHasBreakInfo)); |
| 892 __ j(zero, &bytecode_array_loaded); |
888 __ movp(kInterpreterBytecodeArrayRegister, | 893 __ movp(kInterpreterBytecodeArrayRegister, |
889 FieldOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex)); | 894 FieldOperand(rcx, DebugInfo::kDebugBytecodeArrayOffset)); |
890 __ jmp(&bytecode_array_loaded); | 895 __ jmp(&bytecode_array_loaded); |
891 | 896 |
892 // If the shared code is no longer this entry trampoline, then the underlying | 897 // If the shared code is no longer this entry trampoline, then the underlying |
893 // function has been switched to a different kind of code and we heal the | 898 // function has been switched to a different kind of code and we heal the |
894 // closure by switching the code entry field over to the new code as well. | 899 // closure by switching the code entry field over to the new code as well. |
895 __ bind(&switch_to_different_code_kind); | 900 __ bind(&switch_to_different_code_kind); |
896 __ leave(); // Leave the frame so we can tail call. | 901 __ leave(); // Leave the frame so we can tail call. |
897 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 902 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
898 __ movp(rcx, FieldOperand(rcx, SharedFunctionInfo::kCodeOffset)); | 903 __ movp(rcx, FieldOperand(rcx, SharedFunctionInfo::kCodeOffset)); |
899 __ leap(rcx, FieldOperand(rcx, Code::kHeaderSize)); | 904 __ leap(rcx, FieldOperand(rcx, Code::kHeaderSize)); |
(...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3235 // Now jump to the instructions of the returned code object. | 3240 // Now jump to the instructions of the returned code object. |
3236 __ jmp(r11); | 3241 __ jmp(r11); |
3237 } | 3242 } |
3238 | 3243 |
3239 #undef __ | 3244 #undef __ |
3240 | 3245 |
3241 } // namespace internal | 3246 } // namespace internal |
3242 } // namespace v8 | 3247 } // namespace v8 |
3243 | 3248 |
3244 #endif // V8_TARGET_ARCH_X64 | 3249 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |