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

Side by Side Diff: src/builtins/x64/builtins-x64.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/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;
1035 Label try_shared; 1034 Label try_shared;
1036 Label loop_top, loop_bottom; 1035 Label loop_top, loop_bottom;
1037 1036
1038 Register closure = rdi; 1037 Register closure = rdi;
1039 Register map = r8; 1038 Register map = r8;
1040 Register index = r9; 1039 Register index = r9;
1041 __ movp(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1040 __ movp(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1042 __ movp(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1041 __ movp(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1043 __ SmiToInteger32(index, FieldOperand(map, FixedArray::kLengthOffset)); 1042 __ SmiToInteger32(index, FieldOperand(map, FixedArray::kLengthOffset));
1044 __ cmpl(index, Immediate(2)); 1043 __ cmpl(index, Immediate(2));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp); 1077 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp);
1079 __ movp(r15, index); 1078 __ movp(r15, index);
1080 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15, 1079 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15,
1081 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 1080 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
1082 1081
1083 // Code available? 1082 // Code available?
1084 Register entry = rcx; 1083 Register entry = rcx;
1085 __ movp(entry, FieldOperand(map, index, times_pointer_size, 1084 __ movp(entry, FieldOperand(map, index, times_pointer_size,
1086 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1085 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1087 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); 1086 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset));
1088 __ JumpIfSmi(entry, &maybe_call_runtime); 1087 __ JumpIfSmi(entry, &try_shared);
1089 1088
1090 // Found literals and code. Get them into the closure and return. 1089 // Found literals and code. Get them into the closure and return.
1091 __ leap(entry, FieldOperand(entry, Code::kHeaderSize)); 1090 __ leap(entry, FieldOperand(entry, Code::kHeaderSize));
1092
1093 Label install_optimized_code_and_tailcall;
1094 __ bind(&install_optimized_code_and_tailcall);
1095 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); 1091 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry);
1096 __ RecordWriteCodeEntryField(closure, entry, r15); 1092 __ RecordWriteCodeEntryField(closure, entry, r15);
1097 1093
1098 // Link the closure into the optimized function list. 1094 // Link the closure into the optimized function list.
1099 // rcx : code entry (entry) 1095 // rcx : code entry (entry)
1100 // r14 : native context 1096 // r14 : native context
1101 // rdx : new target 1097 // rdx : new target
1102 // rdi : closure 1098 // rdi : closure
1103 __ movp(rbx, 1099 __ movp(rbx,
1104 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1100 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
(...skipping 12 matching lines...) Expand all
1117 __ jmp(entry); 1113 __ jmp(entry);
1118 1114
1119 __ bind(&loop_bottom); 1115 __ bind(&loop_bottom);
1120 __ subl(index, Immediate(SharedFunctionInfo::kEntryLength)); 1116 __ subl(index, Immediate(SharedFunctionInfo::kEntryLength));
1121 __ cmpl(index, Immediate(1)); 1117 __ cmpl(index, Immediate(1));
1122 __ j(greater, &loop_top); 1118 __ j(greater, &loop_top);
1123 1119
1124 // We found neither literals nor code. 1120 // We found neither literals nor code.
1125 __ jmp(&gotta_call_runtime); 1121 __ jmp(&gotta_call_runtime);
1126 1122
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
1139 __ bind(&try_shared); 1123 __ bind(&try_shared);
1140 // Is the full code valid? 1124 // Is the full code valid?
1141 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1125 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1142 __ movp(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset)); 1126 __ movp(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset));
1143 __ movl(rbx, FieldOperand(entry, Code::kFlagsOffset)); 1127 __ movl(rbx, FieldOperand(entry, Code::kFlagsOffset));
1144 __ andl(rbx, Immediate(Code::KindField::kMask)); 1128 __ andl(rbx, Immediate(Code::KindField::kMask));
1145 __ shrl(rbx, Immediate(Code::KindField::kShift)); 1129 __ shrl(rbx, Immediate(Code::KindField::kShift));
1146 __ cmpl(rbx, Immediate(Code::BUILTIN)); 1130 __ cmpl(rbx, Immediate(Code::BUILTIN));
1147 __ j(equal, &gotta_call_runtime); 1131 __ j(equal, &gotta_call_runtime);
1148 // Yes, install the full code. 1132 // Yes, install the full code.
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after
3089 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3073 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3090 Generate_OnStackReplacementHelper(masm, true); 3074 Generate_OnStackReplacementHelper(masm, true);
3091 } 3075 }
3092 3076
3093 #undef __ 3077 #undef __
3094 3078
3095 } // namespace internal 3079 } // namespace internal
3096 } // namespace v8 3080 } // namespace v8
3097 3081
3098 #endif // V8_TARGET_ARCH_X64 3082 #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