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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 SharedFunctionInfo::OffsetToPreviousCachedCode())); | 975 SharedFunctionInfo::OffsetToPreviousCachedCode())); |
976 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); | 976 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); |
977 __ JumpIfSmi(entry, &maybe_call_runtime); | 977 __ JumpIfSmi(entry, &maybe_call_runtime); |
978 | 978 |
979 // Found literals and code. Get them into the closure and return. | 979 // Found literals and code. Get them into the closure and return. |
980 __ leap(entry, FieldOperand(entry, Code::kHeaderSize)); | 980 __ leap(entry, FieldOperand(entry, Code::kHeaderSize)); |
981 | 981 |
982 Label install_optimized_code_and_tailcall; | 982 Label install_optimized_code_and_tailcall; |
983 __ bind(&install_optimized_code_and_tailcall); | 983 __ bind(&install_optimized_code_and_tailcall); |
984 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); | 984 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); |
| 985 __ movp(rbx, entry); |
| 986 __ RecordWriteCodeEntryField(closure, rbx, rax); |
985 | 987 |
986 // Link the closure into the optimized function list. | 988 // Link the closure into the optimized function list. |
987 // rcx : code entry (entry) | 989 // rcx : code entry (entry) |
988 // r14 : native context | 990 // r14 : native context |
989 // rdx : new target | 991 // rdx : new target |
990 // rdi : closure | 992 // rdi : closure |
991 __ movp(rbx, | 993 __ movp(rbx, |
992 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); | 994 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); |
993 __ movp(FieldOperand(closure, JSFunction::kNextFunctionLinkOffset), rbx); | 995 __ movp(FieldOperand(closure, JSFunction::kNextFunctionLinkOffset), rbx); |
994 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, rbx, rax, | 996 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, rbx, rax, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1031 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
1030 __ movp(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset)); | 1032 __ movp(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset)); |
1031 __ movl(rbx, FieldOperand(entry, Code::kFlagsOffset)); | 1033 __ movl(rbx, FieldOperand(entry, Code::kFlagsOffset)); |
1032 __ andl(rbx, Immediate(Code::KindField::kMask)); | 1034 __ andl(rbx, Immediate(Code::KindField::kMask)); |
1033 __ shrl(rbx, Immediate(Code::KindField::kShift)); | 1035 __ shrl(rbx, Immediate(Code::KindField::kShift)); |
1034 __ cmpl(rbx, Immediate(Code::BUILTIN)); | 1036 __ cmpl(rbx, Immediate(Code::BUILTIN)); |
1035 __ j(equal, &gotta_call_runtime); | 1037 __ j(equal, &gotta_call_runtime); |
1036 // Yes, install the full code. | 1038 // Yes, install the full code. |
1037 __ leap(entry, FieldOperand(entry, Code::kHeaderSize)); | 1039 __ leap(entry, FieldOperand(entry, Code::kHeaderSize)); |
1038 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); | 1040 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); |
| 1041 __ movp(rbx, entry); |
| 1042 __ RecordWriteCodeEntryField(closure, rbx, rax); |
1039 __ jmp(entry); | 1043 __ jmp(entry); |
1040 | 1044 |
1041 __ bind(&gotta_call_runtime); | 1045 __ bind(&gotta_call_runtime); |
1042 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1046 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
1043 GenerateTailCallToReturnedCode(masm); | 1047 GenerateTailCallToReturnedCode(masm); |
1044 } | 1048 } |
1045 | 1049 |
1046 | 1050 |
1047 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1051 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
1048 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); | 1052 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); |
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2878 __ ret(0); | 2882 __ ret(0); |
2879 } | 2883 } |
2880 | 2884 |
2881 | 2885 |
2882 #undef __ | 2886 #undef __ |
2883 | 2887 |
2884 } // namespace internal | 2888 } // namespace internal |
2885 } // namespace v8 | 2889 } // namespace v8 |
2886 | 2890 |
2887 #endif // V8_TARGET_ARCH_X64 | 2891 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |