Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: src/builtins/x64/builtins-x64.cc

Issue 2403453002: Revert of [turbofan] Discard the shared code entry in the optimized code map. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 } 1024 }
1025 1025
1026 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1026 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
1027 // ----------- S t a t e ------------- 1027 // ----------- S t a t e -------------
1028 // -- rax : argument count (preserved for callee) 1028 // -- rax : argument count (preserved for callee)
1029 // -- rdx : new target (preserved for callee) 1029 // -- rdx : new target (preserved for callee)
1030 // -- rdi : target function (preserved for callee) 1030 // -- rdi : target function (preserved for callee)
1031 // ----------------------------------- 1031 // -----------------------------------
1032 // First lookup code, maybe we don't need to compile! 1032 // First lookup code, maybe we don't need to compile!
1033 Label gotta_call_runtime; 1033 Label gotta_call_runtime;
1034 Label maybe_call_runtime;
1034 Label try_shared; 1035 Label try_shared;
1035 Label loop_top, loop_bottom; 1036 Label loop_top, loop_bottom;
1036 1037
1037 Register closure = rdi; 1038 Register closure = rdi;
1038 Register map = r8; 1039 Register map = r8;
1039 Register index = r9; 1040 Register index = r9;
1040 __ movp(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1041 __ movp(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1041 __ movp(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1042 __ movp(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1042 __ SmiToInteger32(index, FieldOperand(map, FixedArray::kLengthOffset)); 1043 __ SmiToInteger32(index, FieldOperand(map, FixedArray::kLengthOffset));
1043 __ cmpl(index, Immediate(2)); 1044 __ cmpl(index, Immediate(2));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp); 1078 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp);
1078 __ movp(r15, index); 1079 __ movp(r15, index);
1079 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15, 1080 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15,
1080 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 1081 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
1081 1082
1082 // Code available? 1083 // Code available?
1083 Register entry = rcx; 1084 Register entry = rcx;
1084 __ movp(entry, FieldOperand(map, index, times_pointer_size, 1085 __ movp(entry, FieldOperand(map, index, times_pointer_size,
1085 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1086 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1086 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); 1087 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset));
1087 __ JumpIfSmi(entry, &try_shared); 1088 __ JumpIfSmi(entry, &maybe_call_runtime);
1088 1089
1089 // Found literals and code. Get them into the closure and return. 1090 // Found literals and code. Get them into the closure and return.
1090 __ leap(entry, FieldOperand(entry, Code::kHeaderSize)); 1091 __ leap(entry, FieldOperand(entry, Code::kHeaderSize));
1092
1093 Label install_optimized_code_and_tailcall;
1094 __ bind(&install_optimized_code_and_tailcall);
1091 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); 1095 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry);
1092 __ RecordWriteCodeEntryField(closure, entry, r15); 1096 __ RecordWriteCodeEntryField(closure, entry, r15);
1093 1097
1094 // Link the closure into the optimized function list. 1098 // Link the closure into the optimized function list.
1095 // rcx : code entry (entry) 1099 // rcx : code entry (entry)
1096 // r14 : native context 1100 // r14 : native context
1097 // rdx : new target 1101 // rdx : new target
1098 // rdi : closure 1102 // rdi : closure
1099 __ movp(rbx, 1103 __ movp(rbx,
1100 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1104 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
(...skipping 12 matching lines...) Expand all
1113 __ jmp(entry); 1117 __ jmp(entry);
1114 1118
1115 __ bind(&loop_bottom); 1119 __ bind(&loop_bottom);
1116 __ subl(index, Immediate(SharedFunctionInfo::kEntryLength)); 1120 __ subl(index, Immediate(SharedFunctionInfo::kEntryLength));
1117 __ cmpl(index, Immediate(1)); 1121 __ cmpl(index, Immediate(1));
1118 __ j(greater, &loop_top); 1122 __ j(greater, &loop_top);
1119 1123
1120 // We found neither literals nor code. 1124 // We found neither literals nor code.
1121 __ jmp(&gotta_call_runtime); 1125 __ jmp(&gotta_call_runtime);
1122 1126
1127 __ bind(&maybe_call_runtime);
1128
1129 // Last possibility. Check the context free optimized code map entry.
1130 __ movp(entry, FieldOperand(map, FixedArray::kHeaderSize +
1131 SharedFunctionInfo::kSharedCodeIndex));
1132 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset));
1133 __ JumpIfSmi(entry, &try_shared);
1134
1135 // Store code entry in the closure.
1136 __ leap(entry, FieldOperand(entry, Code::kHeaderSize));
1137 __ jmp(&install_optimized_code_and_tailcall);
1138
1123 __ bind(&try_shared); 1139 __ bind(&try_shared);
1124 // Is the full code valid? 1140 // Is the full code valid?
1125 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1141 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1126 __ movp(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset)); 1142 __ movp(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset));
1127 __ movl(rbx, FieldOperand(entry, Code::kFlagsOffset)); 1143 __ movl(rbx, FieldOperand(entry, Code::kFlagsOffset));
1128 __ andl(rbx, Immediate(Code::KindField::kMask)); 1144 __ andl(rbx, Immediate(Code::KindField::kMask));
1129 __ shrl(rbx, Immediate(Code::KindField::kShift)); 1145 __ shrl(rbx, Immediate(Code::KindField::kShift));
1130 __ cmpl(rbx, Immediate(Code::BUILTIN)); 1146 __ cmpl(rbx, Immediate(Code::BUILTIN));
1131 __ j(equal, &gotta_call_runtime); 1147 __ j(equal, &gotta_call_runtime);
1132 // Yes, install the full code. 1148 // Yes, install the full code.
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after
3073 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3089 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3074 Generate_OnStackReplacementHelper(masm, true); 3090 Generate_OnStackReplacementHelper(masm, true);
3075 } 3091 }
3076 3092
3077 #undef __ 3093 #undef __
3078 3094
3079 } // namespace internal 3095 } // namespace internal
3080 } // namespace v8 3096 } // namespace v8
3081 3097
3082 #endif // V8_TARGET_ARCH_X64 3098 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698