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

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

Issue 2402663002: Reland "[turbofan] Discard the shared code entry in the optimized code map." (Closed)
Patch Set: Patch failure(?) 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/arm64/builtins-arm64.cc ('k') | src/builtins/mips/builtins-mips.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_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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 } 1048 }
1049 1049
1050 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1050 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
1051 // ----------- S t a t e ------------- 1051 // ----------- S t a t e -------------
1052 // -- eax : argument count (preserved for callee) 1052 // -- eax : argument count (preserved for callee)
1053 // -- edx : new target (preserved for callee) 1053 // -- edx : new target (preserved for callee)
1054 // -- edi : target function (preserved for callee) 1054 // -- edi : target function (preserved for callee)
1055 // ----------------------------------- 1055 // -----------------------------------
1056 // First lookup code, maybe we don't need to compile! 1056 // First lookup code, maybe we don't need to compile!
1057 Label gotta_call_runtime, gotta_call_runtime_no_stack; 1057 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1058 Label maybe_call_runtime;
1059 Label try_shared; 1058 Label try_shared;
1060 Label loop_top, loop_bottom; 1059 Label loop_top, loop_bottom;
1061 1060
1062 Register closure = edi; 1061 Register closure = edi;
1063 Register new_target = edx; 1062 Register new_target = edx;
1064 Register argument_count = eax; 1063 Register argument_count = eax;
1065 1064
1066 __ push(argument_count); 1065 __ push(argument_count);
1067 __ push(new_target); 1066 __ push(new_target);
1068 __ push(closure); 1067 __ push(closure);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 __ push(index); 1110 __ push(index);
1112 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index, 1111 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index,
1113 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 1112 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
1114 __ pop(index); 1113 __ pop(index);
1115 1114
1116 // Code available? 1115 // Code available?
1117 Register entry = ecx; 1116 Register entry = ecx;
1118 __ mov(entry, FieldOperand(map, index, times_half_pointer_size, 1117 __ mov(entry, FieldOperand(map, index, times_half_pointer_size,
1119 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1118 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1120 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset)); 1119 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset));
1121 __ JumpIfSmi(entry, &maybe_call_runtime); 1120 __ JumpIfSmi(entry, &try_shared);
1122 1121
1123 // Found literals and code. Get them into the closure and return. 1122 // Found literals and code. Get them into the closure and return.
1124 __ pop(closure); 1123 __ pop(closure);
1125 // Store code entry in the closure. 1124 // Store code entry in the closure.
1126 __ lea(entry, FieldOperand(entry, Code::kHeaderSize)); 1125 __ lea(entry, FieldOperand(entry, Code::kHeaderSize));
1127
1128 Label install_optimized_code_and_tailcall;
1129 __ bind(&install_optimized_code_and_tailcall);
1130 __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); 1126 __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry);
1131 __ RecordWriteCodeEntryField(closure, entry, eax); 1127 __ RecordWriteCodeEntryField(closure, entry, eax);
1132 1128
1133 // Link the closure into the optimized function list. 1129 // Link the closure into the optimized function list.
1134 // ecx : code entry 1130 // ecx : code entry
1135 // edx : native context 1131 // edx : native context
1136 // edi : closure 1132 // edi : closure
1137 __ mov(ebx, 1133 __ mov(ebx,
1138 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1134 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1139 __ mov(FieldOperand(closure, JSFunction::kNextFunctionLinkOffset), ebx); 1135 __ mov(FieldOperand(closure, JSFunction::kNextFunctionLinkOffset), ebx);
(...skipping 13 matching lines...) Expand all
1153 __ jmp(entry); 1149 __ jmp(entry);
1154 1150
1155 __ bind(&loop_bottom); 1151 __ bind(&loop_bottom);
1156 __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength))); 1152 __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1157 __ cmp(index, Immediate(Smi::FromInt(1))); 1153 __ cmp(index, Immediate(Smi::FromInt(1)));
1158 __ j(greater, &loop_top); 1154 __ j(greater, &loop_top);
1159 1155
1160 // We found neither literals nor code. 1156 // We found neither literals nor code.
1161 __ jmp(&gotta_call_runtime); 1157 __ jmp(&gotta_call_runtime);
1162 1158
1163 __ bind(&maybe_call_runtime); 1159 __ bind(&try_shared);
1164 __ pop(closure); 1160 __ pop(closure);
1165
1166 // Last possibility. Check the context free optimized code map entry.
1167 __ mov(entry, FieldOperand(map, FixedArray::kHeaderSize +
1168 SharedFunctionInfo::kSharedCodeIndex));
1169 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset));
1170 __ JumpIfSmi(entry, &try_shared);
1171
1172 // Store code entry in the closure.
1173 __ lea(entry, FieldOperand(entry, Code::kHeaderSize));
1174 __ jmp(&install_optimized_code_and_tailcall);
1175
1176 __ bind(&try_shared);
1177 __ pop(new_target); 1161 __ pop(new_target);
1178 __ pop(argument_count); 1162 __ pop(argument_count);
1179 // Is the full code valid? 1163 // Is the full code valid?
1180 __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1164 __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1181 __ mov(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset)); 1165 __ mov(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset));
1182 __ mov(ebx, FieldOperand(entry, Code::kFlagsOffset)); 1166 __ mov(ebx, FieldOperand(entry, Code::kFlagsOffset));
1183 __ and_(ebx, Code::KindField::kMask); 1167 __ and_(ebx, Code::KindField::kMask);
1184 __ shr(ebx, Code::KindField::kShift); 1168 __ shr(ebx, Code::KindField::kShift);
1185 __ cmp(ebx, Immediate(Code::BUILTIN)); 1169 __ cmp(ebx, Immediate(Code::BUILTIN));
1186 __ j(equal, &gotta_call_runtime_no_stack); 1170 __ j(equal, &gotta_call_runtime_no_stack);
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
3142 3126
3143 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3127 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3144 Generate_OnStackReplacementHelper(masm, true); 3128 Generate_OnStackReplacementHelper(masm, true);
3145 } 3129 }
3146 3130
3147 #undef __ 3131 #undef __
3148 } // namespace internal 3132 } // namespace internal
3149 } // namespace v8 3133 } // namespace v8
3150 3134
3151 #endif // V8_TARGET_ARCH_IA32 3135 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/builtins/arm64/builtins-arm64.cc ('k') | src/builtins/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698