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/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); | 615 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); |
616 __ bind(&bytecode_array_loaded); | 616 __ bind(&bytecode_array_loaded); |
617 | 617 |
618 // Check whether we should continue to use the interpreter. | 618 // Check whether we should continue to use the interpreter. |
619 Label switch_to_different_code_kind; | 619 Label switch_to_different_code_kind; |
620 __ Move(rcx, masm->CodeObject()); // Self-reference to this code. | 620 __ Move(rcx, masm->CodeObject()); // Self-reference to this code. |
621 __ cmpp(rcx, FieldOperand(rax, SharedFunctionInfo::kCodeOffset)); | 621 __ cmpp(rcx, FieldOperand(rax, SharedFunctionInfo::kCodeOffset)); |
622 __ j(not_equal, &switch_to_different_code_kind); | 622 __ j(not_equal, &switch_to_different_code_kind); |
623 | 623 |
624 // Increment invocation count for the function. | 624 // Increment invocation count for the function. |
625 __ movp(rcx, FieldOperand(rdi, JSFunction::kLiteralsOffset)); | 625 __ movp(rcx, FieldOperand(rdi, JSFunction::kFeedbackVectorOffset)); |
626 __ movp(rcx, FieldOperand(rcx, LiteralsArray::kFeedbackVectorOffset)); | |
627 __ SmiAddConstant( | 626 __ SmiAddConstant( |
628 FieldOperand(rcx, | 627 FieldOperand(rcx, |
629 TypeFeedbackVector::kInvocationCountIndex * kPointerSize + | 628 TypeFeedbackVector::kInvocationCountIndex * kPointerSize + |
630 TypeFeedbackVector::kHeaderSize), | 629 TypeFeedbackVector::kHeaderSize), |
631 Smi::FromInt(1)); | 630 Smi::FromInt(1)); |
632 | 631 |
633 // Check function data field is actually a BytecodeArray object. | 632 // Check function data field is actually a BytecodeArray object. |
634 if (FLAG_debug_code) { | 633 if (FLAG_debug_code) { |
635 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); | 634 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); |
636 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, | 635 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 __ movp(native_context, NativeContextOperand()); | 1011 __ movp(native_context, NativeContextOperand()); |
1013 | 1012 |
1014 __ bind(&loop_top); | 1013 __ bind(&loop_top); |
1015 // Native context match? | 1014 // Native context match? |
1016 Register temp = r11; | 1015 Register temp = r11; |
1017 __ movp(temp, FieldOperand(map, index, times_pointer_size, | 1016 __ movp(temp, FieldOperand(map, index, times_pointer_size, |
1018 SharedFunctionInfo::kOffsetToPreviousContext)); | 1017 SharedFunctionInfo::kOffsetToPreviousContext)); |
1019 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 1018 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); |
1020 __ cmpp(temp, native_context); | 1019 __ cmpp(temp, native_context); |
1021 __ j(not_equal, &loop_bottom); | 1020 __ j(not_equal, &loop_bottom); |
1022 // Literals available? | 1021 // Feedback vector available? |
1023 __ movp(temp, FieldOperand(map, index, times_pointer_size, | 1022 __ movp(temp, FieldOperand(map, index, times_pointer_size, |
1024 SharedFunctionInfo::kOffsetToPreviousLiterals)); | 1023 SharedFunctionInfo::kOffsetToPreviousLiterals)); |
1025 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 1024 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); |
1026 __ JumpIfSmi(temp, &gotta_call_runtime); | 1025 __ JumpIfSmi(temp, &gotta_call_runtime); |
1027 | 1026 |
1028 // Save the literals in the closure. | 1027 // Save the feedback vector in the closure. |
1029 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp); | 1028 __ movp(FieldOperand(closure, JSFunction::kFeedbackVectorOffset), temp); |
1030 __ movp(r15, index); | 1029 __ movp(r15, index); |
1031 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15, | 1030 __ RecordWriteField(closure, JSFunction::kFeedbackVectorOffset, temp, r15, |
1032 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 1031 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
1033 | 1032 |
1034 // Code available? | 1033 // Code available? |
1035 Register entry = rcx; | 1034 Register entry = rcx; |
1036 __ movp(entry, FieldOperand(map, index, times_pointer_size, | 1035 __ movp(entry, FieldOperand(map, index, times_pointer_size, |
1037 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1036 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
1038 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); | 1037 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); |
1039 __ JumpIfSmi(entry, &try_shared); | 1038 __ JumpIfSmi(entry, &try_shared); |
1040 | 1039 |
1041 // Found literals and code. Get them into the closure and return. | 1040 // Found literals and code. Get them into the closure and return. |
(...skipping 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3265 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3264 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3266 Generate_OnStackReplacementHelper(masm, true); | 3265 Generate_OnStackReplacementHelper(masm, true); |
3267 } | 3266 } |
3268 | 3267 |
3269 #undef __ | 3268 #undef __ |
3270 | 3269 |
3271 } // namespace internal | 3270 } // namespace internal |
3272 } // namespace v8 | 3271 } // namespace v8 |
3273 | 3272 |
3274 #endif // V8_TARGET_ARCH_X64 | 3273 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |