| 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 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/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 __ mov(ebx, FieldOperand(ebx, Cell::kValueOffset)); | 703 __ mov(ebx, FieldOperand(ebx, Cell::kValueOffset)); |
| 704 __ mov(optimized_code_entry, | 704 __ mov(optimized_code_entry, |
| 705 FieldOperand(ebx, FeedbackVector::kOptimizedCodeIndex * kPointerSize + | 705 FieldOperand(ebx, FeedbackVector::kOptimizedCodeIndex * kPointerSize + |
| 706 FeedbackVector::kHeaderSize)); | 706 FeedbackVector::kHeaderSize)); |
| 707 __ mov(optimized_code_entry, | 707 __ mov(optimized_code_entry, |
| 708 FieldOperand(optimized_code_entry, WeakCell::kValueOffset)); | 708 FieldOperand(optimized_code_entry, WeakCell::kValueOffset)); |
| 709 __ JumpIfNotSmi(optimized_code_entry, &switch_to_optimized_code); | 709 __ JumpIfNotSmi(optimized_code_entry, &switch_to_optimized_code); |
| 710 | 710 |
| 711 // Get the bytecode array from the function object (or from the DebugInfo if | 711 // Get the bytecode array from the function object (or from the DebugInfo if |
| 712 // it is present) and load it into kInterpreterBytecodeArrayRegister. | 712 // it is present) and load it into kInterpreterBytecodeArrayRegister. |
| 713 Label maybe_load_debug_bytecode_array, bytecode_array_loaded; |
| 713 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 714 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 714 Label load_debug_bytecode_array, bytecode_array_loaded; | |
| 715 __ JumpIfNotSmi(FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset), | |
| 716 &load_debug_bytecode_array); | |
| 717 __ mov(kInterpreterBytecodeArrayRegister, | 715 __ mov(kInterpreterBytecodeArrayRegister, |
| 718 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); | 716 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); |
| 717 __ JumpIfNotSmi(FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset), |
| 718 &maybe_load_debug_bytecode_array); |
| 719 __ bind(&bytecode_array_loaded); | 719 __ bind(&bytecode_array_loaded); |
| 720 | 720 |
| 721 // Check whether we should continue to use the interpreter. | 721 // Check whether we should continue to use the interpreter. |
| 722 // TODO(rmcilroy) Remove self healing once liveedit only has to deal with | 722 // TODO(rmcilroy) Remove self healing once liveedit only has to deal with |
| 723 // Ignition bytecode. | 723 // Ignition bytecode. |
| 724 Label switch_to_different_code_kind; | 724 Label switch_to_different_code_kind; |
| 725 __ Move(ecx, masm->CodeObject()); // Self-reference to this code. | 725 __ Move(ecx, masm->CodeObject()); // Self-reference to this code. |
| 726 __ cmp(ecx, FieldOperand(eax, SharedFunctionInfo::kCodeOffset)); | 726 __ cmp(ecx, FieldOperand(eax, SharedFunctionInfo::kCodeOffset)); |
| 727 __ j(not_equal, &switch_to_different_code_kind); | 727 __ j(not_equal, &switch_to_different_code_kind); |
| 728 | 728 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 795 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
| 796 __ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx, | 796 __ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx, |
| 797 times_pointer_size, 0)); | 797 times_pointer_size, 0)); |
| 798 __ call(ebx); | 798 __ call(ebx); |
| 799 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); | 799 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
| 800 | 800 |
| 801 // The return value is in eax. | 801 // The return value is in eax. |
| 802 LeaveInterpreterFrame(masm, ebx, ecx); | 802 LeaveInterpreterFrame(masm, ebx, ecx); |
| 803 __ ret(0); | 803 __ ret(0); |
| 804 | 804 |
| 805 // Load debug copy of the bytecode array. | 805 // Load debug copy of the bytecode array if it exists. |
| 806 __ bind(&load_debug_bytecode_array); | 806 // kInterpreterBytecodeArrayRegister is already loaded with |
| 807 Register debug_info = kInterpreterBytecodeArrayRegister; | 807 // SharedFunctionInfo::kFunctionDataOffset. |
| 808 __ mov(debug_info, FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset)); | 808 __ bind(&maybe_load_debug_bytecode_array); |
| 809 __ mov(ecx, FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset)); |
| 810 __ mov(ebx, FieldOperand(ecx, DebugInfo::kFlagsOffset)); |
| 811 __ SmiUntag(ebx); |
| 812 __ test(ebx, Immediate(DebugInfo::kHasBreakInfo)); |
| 813 __ j(zero, &bytecode_array_loaded); |
| 809 __ mov(kInterpreterBytecodeArrayRegister, | 814 __ mov(kInterpreterBytecodeArrayRegister, |
| 810 FieldOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex)); | 815 FieldOperand(ecx, DebugInfo::kDebugBytecodeArrayOffset)); |
| 811 __ jmp(&bytecode_array_loaded); | 816 __ jmp(&bytecode_array_loaded); |
| 812 | 817 |
| 813 // If the shared code is no longer this entry trampoline, then the underlying | 818 // If the shared code is no longer this entry trampoline, then the underlying |
| 814 // function has been switched to a different kind of code and we heal the | 819 // function has been switched to a different kind of code and we heal the |
| 815 // closure by switching the code entry field over to the new code as well. | 820 // closure by switching the code entry field over to the new code as well. |
| 816 __ bind(&switch_to_different_code_kind); | 821 __ bind(&switch_to_different_code_kind); |
| 817 __ pop(edx); // Callee's new target. | 822 __ pop(edx); // Callee's new target. |
| 818 __ pop(edi); // Callee's JS function. | 823 __ pop(edi); // Callee's JS function. |
| 819 __ pop(esi); // Callee's context. | 824 __ pop(esi); // Callee's context. |
| 820 __ leave(); // Leave the frame so we can tail call. | 825 __ leave(); // Leave the frame so we can tail call. |
| (...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3325 } | 3330 } |
| 3326 // Now jump to the instructions of the returned code object. | 3331 // Now jump to the instructions of the returned code object. |
| 3327 __ jmp(edi); | 3332 __ jmp(edi); |
| 3328 } | 3333 } |
| 3329 | 3334 |
| 3330 #undef __ | 3335 #undef __ |
| 3331 } // namespace internal | 3336 } // namespace internal |
| 3332 } // namespace v8 | 3337 } // namespace v8 |
| 3333 | 3338 |
| 3334 #endif // V8_TARGET_ARCH_IA32 | 3339 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |