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

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

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE. Created 3 years, 10 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
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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 // -- rdi : target function (preserved for callee) 988 // -- rdi : target function (preserved for callee)
989 // ----------------------------------- 989 // -----------------------------------
990 // First lookup code, maybe we don't need to compile! 990 // First lookup code, maybe we don't need to compile!
991 Label gotta_call_runtime; 991 Label gotta_call_runtime;
992 Label try_shared; 992 Label try_shared;
993 Label loop_top, loop_bottom; 993 Label loop_top, loop_bottom;
994 994
995 Register closure = rdi; 995 Register closure = rdi;
996 Register map = r8; 996 Register map = r8;
997 Register index = r9; 997 Register index = r9;
998
999 // Do we have a valid feedback vector?
1000 __ movp(rbx, FieldOperand(closure, JSFunction::kFeedbackVectorOffset));
1001 __ movp(rbx, FieldOperand(rbx, Cell::kValueOffset));
1002 __ JumpIfRoot(rbx, Heap::kUndefinedValueRootIndex, &gotta_call_runtime);
1003
998 __ movp(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1004 __ movp(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
999 __ movp(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1005 __ movp(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1000 __ SmiToInteger32(index, FieldOperand(map, FixedArray::kLengthOffset)); 1006 __ SmiToInteger32(index, FieldOperand(map, FixedArray::kLengthOffset));
1001 __ cmpl(index, Immediate(2)); 1007 __ cmpl(index, Immediate(2));
1002 __ j(less, &gotta_call_runtime); 1008 __ j(less, &try_shared);
1003 1009
1004 // Find literals.
1005 // r14 : native context 1010 // r14 : native context
1006 // r9 : length / index 1011 // r9 : length / index
1007 // r8 : optimized code map 1012 // r8 : optimized code map
1008 // rdx : new target 1013 // rdx : new target
1009 // rdi : closure 1014 // rdi : closure
1010 Register native_context = r14; 1015 Register native_context = r14;
1011 __ movp(native_context, NativeContextOperand()); 1016 __ movp(native_context, NativeContextOperand());
1012 1017
1013 __ bind(&loop_top); 1018 __ bind(&loop_top);
1014 // Native context match? 1019 // Native context match?
1015 Register temp = r11; 1020 Register temp = r11;
1016 __ movp(temp, FieldOperand(map, index, times_pointer_size, 1021 __ movp(temp, FieldOperand(map, index, times_pointer_size,
1017 SharedFunctionInfo::kOffsetToPreviousContext)); 1022 SharedFunctionInfo::kOffsetToPreviousContext));
1018 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); 1023 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset));
1019 __ cmpp(temp, native_context); 1024 __ cmpp(temp, native_context);
1020 __ j(not_equal, &loop_bottom); 1025 __ j(not_equal, &loop_bottom);
1021 // Feedback vector available?
1022 __ movp(temp, FieldOperand(map, index, times_pointer_size,
1023 SharedFunctionInfo::kOffsetToPreviousLiterals));
1024 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset));
1025 __ JumpIfSmi(temp, &gotta_call_runtime);
1026
1027 // Save the feedback vector in the closure.
1028 __ movp(FieldOperand(closure, JSFunction::kFeedbackVectorOffset), temp);
1029 __ movp(r15, index);
1030 __ RecordWriteField(closure, JSFunction::kFeedbackVectorOffset, temp, r15,
1031 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
1032 1026
1033 // Code available? 1027 // Code available?
1034 Register entry = rcx; 1028 Register entry = rcx;
1035 __ movp(entry, FieldOperand(map, index, times_pointer_size, 1029 __ movp(entry, FieldOperand(map, index, times_pointer_size,
1036 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1030 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1037 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); 1031 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset));
1038 __ JumpIfSmi(entry, &try_shared); 1032 __ JumpIfSmi(entry, &try_shared);
1039 1033
1040 // Found literals and code. Get them into the closure and return. 1034 // Found code. Get it into the closure and return.
1041 __ leap(entry, FieldOperand(entry, Code::kHeaderSize)); 1035 __ leap(entry, FieldOperand(entry, Code::kHeaderSize));
1042 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); 1036 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry);
1043 __ RecordWriteCodeEntryField(closure, entry, r15); 1037 __ RecordWriteCodeEntryField(closure, entry, r15);
1044 1038
1045 // Link the closure into the optimized function list. 1039 // Link the closure into the optimized function list.
1046 // rcx : code entry (entry) 1040 // rcx : code entry (entry)
1047 // r14 : native context 1041 // r14 : native context
1048 // rdx : new target 1042 // rdx : new target
1049 // rdi : closure 1043 // rdi : closure
1050 __ movp(rbx, 1044 __ movp(rbx,
(...skipping 10 matching lines...) Expand all
1061 __ RecordWriteContextSlot(native_context, function_list_offset, closure, r15, 1055 __ RecordWriteContextSlot(native_context, function_list_offset, closure, r15,
1062 kDontSaveFPRegs); 1056 kDontSaveFPRegs);
1063 __ movp(closure, rbx); 1057 __ movp(closure, rbx);
1064 __ jmp(entry); 1058 __ jmp(entry);
1065 1059
1066 __ bind(&loop_bottom); 1060 __ bind(&loop_bottom);
1067 __ subl(index, Immediate(SharedFunctionInfo::kEntryLength)); 1061 __ subl(index, Immediate(SharedFunctionInfo::kEntryLength));
1068 __ cmpl(index, Immediate(1)); 1062 __ cmpl(index, Immediate(1));
1069 __ j(greater, &loop_top); 1063 __ j(greater, &loop_top);
1070 1064
1071 // We found neither literals nor code. 1065 // We found no code.
1072 __ jmp(&gotta_call_runtime);
1073
1074 __ bind(&try_shared); 1066 __ bind(&try_shared);
1075 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1067 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1076 // Is the shared function marked for tier up? 1068 // Is the shared function marked for tier up?
1077 __ testb(FieldOperand(entry, SharedFunctionInfo::kMarkedForTierUpByteOffset), 1069 __ testb(FieldOperand(entry, SharedFunctionInfo::kMarkedForTierUpByteOffset),
1078 Immediate(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); 1070 Immediate(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte));
1079 __ j(not_zero, &gotta_call_runtime); 1071 __ j(not_zero, &gotta_call_runtime);
1080 1072
1081 // If SFI points to anything other than CompileLazy, install that. 1073 // If SFI points to anything other than CompileLazy, install that.
1082 __ movp(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset)); 1074 __ movp(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset));
1083 __ Move(rbx, masm->CodeObject()); 1075 __ Move(rbx, masm->CodeObject());
(...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3264 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3256 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3265 Generate_OnStackReplacementHelper(masm, true); 3257 Generate_OnStackReplacementHelper(masm, true);
3266 } 3258 }
3267 3259
3268 #undef __ 3260 #undef __
3269 3261
3270 } // namespace internal 3262 } // namespace internal
3271 } // namespace v8 3263 } // namespace v8
3272 3264
3273 #endif // V8_TARGET_ARCH_X64 3265 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698