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

Side by Side Diff: src/builtins/ia32/builtins-ia32.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/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;
1058 Label try_shared; 1059 Label try_shared;
1059 Label loop_top, loop_bottom; 1060 Label loop_top, loop_bottom;
1060 1061
1061 Register closure = edi; 1062 Register closure = edi;
1062 Register new_target = edx; 1063 Register new_target = edx;
1063 Register argument_count = eax; 1064 Register argument_count = eax;
1064 1065
1065 __ push(argument_count); 1066 __ push(argument_count);
1066 __ push(new_target); 1067 __ push(new_target);
1067 __ push(closure); 1068 __ push(closure);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 __ push(index); 1111 __ push(index);
1111 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index, 1112 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index,
1112 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 1113 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
1113 __ pop(index); 1114 __ pop(index);
1114 1115
1115 // Code available? 1116 // Code available?
1116 Register entry = ecx; 1117 Register entry = ecx;
1117 __ mov(entry, FieldOperand(map, index, times_half_pointer_size, 1118 __ mov(entry, FieldOperand(map, index, times_half_pointer_size,
1118 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1119 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1119 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset)); 1120 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset));
1120 __ JumpIfSmi(entry, &try_shared); 1121 __ JumpIfSmi(entry, &maybe_call_runtime);
1121 1122
1122 // Found literals and code. Get them into the closure and return. 1123 // Found literals and code. Get them into the closure and return.
1123 __ pop(closure); 1124 __ pop(closure);
1124 // Store code entry in the closure. 1125 // Store code entry in the closure.
1125 __ lea(entry, FieldOperand(entry, Code::kHeaderSize)); 1126 __ lea(entry, FieldOperand(entry, Code::kHeaderSize));
1127
1128 Label install_optimized_code_and_tailcall;
1129 __ bind(&install_optimized_code_and_tailcall);
1126 __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); 1130 __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry);
1127 __ RecordWriteCodeEntryField(closure, entry, eax); 1131 __ RecordWriteCodeEntryField(closure, entry, eax);
1128 1132
1129 // Link the closure into the optimized function list. 1133 // Link the closure into the optimized function list.
1130 // ecx : code entry 1134 // ecx : code entry
1131 // edx : native context 1135 // edx : native context
1132 // edi : closure 1136 // edi : closure
1133 __ mov(ebx, 1137 __ mov(ebx,
1134 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1138 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1135 __ mov(FieldOperand(closure, JSFunction::kNextFunctionLinkOffset), ebx); 1139 __ mov(FieldOperand(closure, JSFunction::kNextFunctionLinkOffset), ebx);
(...skipping 13 matching lines...) Expand all
1149 __ jmp(entry); 1153 __ jmp(entry);
1150 1154
1151 __ bind(&loop_bottom); 1155 __ bind(&loop_bottom);
1152 __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength))); 1156 __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1153 __ cmp(index, Immediate(Smi::FromInt(1))); 1157 __ cmp(index, Immediate(Smi::FromInt(1)));
1154 __ j(greater, &loop_top); 1158 __ j(greater, &loop_top);
1155 1159
1156 // We found neither literals nor code. 1160 // We found neither literals nor code.
1157 __ jmp(&gotta_call_runtime); 1161 __ jmp(&gotta_call_runtime);
1158 1162
1163 __ bind(&maybe_call_runtime);
1164 __ 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
1159 __ bind(&try_shared); 1176 __ bind(&try_shared);
1160 __ pop(closure);
1161 __ pop(new_target); 1177 __ pop(new_target);
1162 __ pop(argument_count); 1178 __ pop(argument_count);
1163 // Is the full code valid? 1179 // Is the full code valid?
1164 __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1180 __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1165 __ mov(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset)); 1181 __ mov(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset));
1166 __ mov(ebx, FieldOperand(entry, Code::kFlagsOffset)); 1182 __ mov(ebx, FieldOperand(entry, Code::kFlagsOffset));
1167 __ and_(ebx, Code::KindField::kMask); 1183 __ and_(ebx, Code::KindField::kMask);
1168 __ shr(ebx, Code::KindField::kShift); 1184 __ shr(ebx, Code::KindField::kShift);
1169 __ cmp(ebx, Immediate(Code::BUILTIN)); 1185 __ cmp(ebx, Immediate(Code::BUILTIN));
1170 __ j(equal, &gotta_call_runtime_no_stack); 1186 __ j(equal, &gotta_call_runtime_no_stack);
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
3126 3142
3127 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3143 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3128 Generate_OnStackReplacementHelper(masm, true); 3144 Generate_OnStackReplacementHelper(masm, true);
3129 } 3145 }
3130 3146
3131 #undef __ 3147 #undef __
3132 } // namespace internal 3148 } // namespace internal
3133 } // namespace v8 3149 } // namespace v8
3134 3150
3135 #endif // V8_TARGET_ARCH_IA32 3151 #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