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

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

Issue 2642933003: Revert of Revert [TypeFeedbackVector] Root literal arrays in function literal slots (Closed)
Patch Set: Created 3 years, 11 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/s390/builtins-s390.cc ('k') | src/builtins/x87/builtins-x87.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 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 // -- rdi : target function (preserved for callee) 991 // -- rdi : target function (preserved for callee)
992 // ----------------------------------- 992 // -----------------------------------
993 // First lookup code, maybe we don't need to compile! 993 // First lookup code, maybe we don't need to compile!
994 Label gotta_call_runtime; 994 Label gotta_call_runtime;
995 Label try_shared; 995 Label try_shared;
996 Label loop_top, loop_bottom; 996 Label loop_top, loop_bottom;
997 997
998 Register closure = rdi; 998 Register closure = rdi;
999 Register map = r8; 999 Register map = r8;
1000 Register index = r9; 1000 Register index = r9;
1001
1002 // Do we have a valid feedback vector?
1003 __ movp(rbx, FieldOperand(closure, JSFunction::kLiteralsOffset));
1004 __ movp(rbx, FieldOperand(rbx, LiteralsArray::kFeedbackVectorOffset));
1005 __ JumpIfRoot(rbx, Heap::kUndefinedValueRootIndex, &gotta_call_runtime);
1006
1001 __ movp(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1007 __ movp(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1002 __ movp(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1008 __ movp(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1003 __ SmiToInteger32(index, FieldOperand(map, FixedArray::kLengthOffset)); 1009 __ SmiToInteger32(index, FieldOperand(map, FixedArray::kLengthOffset));
1004 __ cmpl(index, Immediate(2)); 1010 __ cmpl(index, Immediate(2));
1005 __ j(less, &gotta_call_runtime); 1011 __ j(less, &gotta_call_runtime);
1006 1012
1007 // Find literals.
1008 // r14 : native context 1013 // r14 : native context
1009 // r9 : length / index 1014 // r9 : length / index
1010 // r8 : optimized code map 1015 // r8 : optimized code map
1011 // rdx : new target 1016 // rdx : new target
1012 // rdi : closure 1017 // rdi : closure
1013 Register native_context = r14; 1018 Register native_context = r14;
1014 __ movp(native_context, NativeContextOperand()); 1019 __ movp(native_context, NativeContextOperand());
1015 1020
1016 __ bind(&loop_top); 1021 __ bind(&loop_top);
1017 // Native context match? 1022 // Native context match?
1018 Register temp = r11; 1023 Register temp = r11;
1019 __ movp(temp, FieldOperand(map, index, times_pointer_size, 1024 __ movp(temp, FieldOperand(map, index, times_pointer_size,
1020 SharedFunctionInfo::kOffsetToPreviousContext)); 1025 SharedFunctionInfo::kOffsetToPreviousContext));
1021 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); 1026 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset));
1022 __ cmpp(temp, native_context); 1027 __ cmpp(temp, native_context);
1023 __ j(not_equal, &loop_bottom); 1028 __ j(not_equal, &loop_bottom);
1024 // Literals available?
1025 __ movp(temp, FieldOperand(map, index, times_pointer_size,
1026 SharedFunctionInfo::kOffsetToPreviousLiterals));
1027 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset));
1028 __ JumpIfSmi(temp, &gotta_call_runtime);
1029
1030 // Save the literals in the closure.
1031 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp);
1032 __ movp(r15, index);
1033 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15,
1034 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
1035 1029
1036 // Code available? 1030 // Code available?
1037 Register entry = rcx; 1031 Register entry = rcx;
1038 __ movp(entry, FieldOperand(map, index, times_pointer_size, 1032 __ movp(entry, FieldOperand(map, index, times_pointer_size,
1039 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1033 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1040 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); 1034 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset));
1041 __ JumpIfSmi(entry, &try_shared); 1035 __ JumpIfSmi(entry, &try_shared);
1042 1036
1043 // Found literals and code. Get them into the closure and return. 1037 // Found code. Get it into the closure and return.
1044 __ leap(entry, FieldOperand(entry, Code::kHeaderSize)); 1038 __ leap(entry, FieldOperand(entry, Code::kHeaderSize));
1045 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); 1039 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry);
1046 __ RecordWriteCodeEntryField(closure, entry, r15); 1040 __ RecordWriteCodeEntryField(closure, entry, r15);
1047 1041
1048 // Link the closure into the optimized function list. 1042 // Link the closure into the optimized function list.
1049 // rcx : code entry (entry) 1043 // rcx : code entry (entry)
1050 // r14 : native context 1044 // r14 : native context
1051 // rdx : new target 1045 // rdx : new target
1052 // rdi : closure 1046 // rdi : closure
1053 __ movp(rbx, 1047 __ movp(rbx,
(...skipping 10 matching lines...) Expand all
1064 __ RecordWriteContextSlot(native_context, function_list_offset, closure, r15, 1058 __ RecordWriteContextSlot(native_context, function_list_offset, closure, r15,
1065 kDontSaveFPRegs); 1059 kDontSaveFPRegs);
1066 __ movp(closure, rbx); 1060 __ movp(closure, rbx);
1067 __ jmp(entry); 1061 __ jmp(entry);
1068 1062
1069 __ bind(&loop_bottom); 1063 __ bind(&loop_bottom);
1070 __ subl(index, Immediate(SharedFunctionInfo::kEntryLength)); 1064 __ subl(index, Immediate(SharedFunctionInfo::kEntryLength));
1071 __ cmpl(index, Immediate(1)); 1065 __ cmpl(index, Immediate(1));
1072 __ j(greater, &loop_top); 1066 __ j(greater, &loop_top);
1073 1067
1074 // We found neither literals nor code. 1068 // We found no code.
1075 __ jmp(&gotta_call_runtime); 1069 __ jmp(&gotta_call_runtime);
1076 1070
1077 __ bind(&try_shared); 1071 __ bind(&try_shared);
1078 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1072 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1079 // Is the shared function marked for tier up? 1073 // Is the shared function marked for tier up?
1080 __ testb(FieldOperand(entry, SharedFunctionInfo::kMarkedForTierUpByteOffset), 1074 __ testb(FieldOperand(entry, SharedFunctionInfo::kMarkedForTierUpByteOffset),
1081 Immediate(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); 1075 Immediate(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte));
1082 __ j(not_zero, &gotta_call_runtime); 1076 __ j(not_zero, &gotta_call_runtime);
1083 1077
1084 // If SFI points to anything other than CompileLazy, install that. 1078 // If SFI points to anything other than CompileLazy, install that.
(...skipping 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after
3182 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3176 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3183 Generate_OnStackReplacementHelper(masm, true); 3177 Generate_OnStackReplacementHelper(masm, true);
3184 } 3178 }
3185 3179
3186 #undef __ 3180 #undef __
3187 3181
3188 } // namespace internal 3182 } // namespace internal
3189 } // namespace v8 3183 } // namespace v8
3190 3184
3191 #endif // V8_TARGET_ARCH_X64 3185 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/builtins/s390/builtins-s390.cc ('k') | src/builtins/x87/builtins-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698