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

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

Issue 2504153002: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: REBASE. Created 3 years, 12 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/code-stubs.h » ('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 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 995
996 Register closure = rdi; 996 Register closure = rdi;
997 Register map = r8; 997 Register map = r8;
998 Register index = r9; 998 Register index = r9;
999 __ movp(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 999 __ movp(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1000 __ movp(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1000 __ movp(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1001 __ SmiToInteger32(index, FieldOperand(map, FixedArray::kLengthOffset)); 1001 __ SmiToInteger32(index, FieldOperand(map, FixedArray::kLengthOffset));
1002 __ cmpl(index, Immediate(2)); 1002 __ cmpl(index, Immediate(2));
1003 __ j(less, &gotta_call_runtime); 1003 __ j(less, &gotta_call_runtime);
1004 1004
1005 // Find literals.
1006 // r14 : native context 1005 // r14 : native context
1007 // r9 : length / index 1006 // r9 : length / index
1008 // r8 : optimized code map 1007 // r8 : optimized code map
1009 // rdx : new target 1008 // rdx : new target
1010 // rdi : closure 1009 // rdi : closure
1011 Register native_context = r14; 1010 Register native_context = r14;
1012 __ movp(native_context, NativeContextOperand()); 1011 __ movp(native_context, NativeContextOperand());
1013 1012
1014 __ bind(&loop_top); 1013 __ bind(&loop_top);
1015 // Native context match? 1014 // Native context match?
1016 Register temp = r11; 1015 Register temp = r11;
1017 __ movp(temp, FieldOperand(map, index, times_pointer_size, 1016 __ movp(temp, FieldOperand(map, index, times_pointer_size,
1018 SharedFunctionInfo::kOffsetToPreviousContext)); 1017 SharedFunctionInfo::kOffsetToPreviousContext));
1019 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset)); 1018 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset));
1020 __ cmpp(temp, native_context); 1019 __ cmpp(temp, native_context);
1021 __ j(not_equal, &loop_bottom); 1020 __ j(not_equal, &loop_bottom);
1022 // Literals available?
1023 __ movp(temp, FieldOperand(map, index, times_pointer_size,
1024 SharedFunctionInfo::kOffsetToPreviousLiterals));
1025 __ movp(temp, FieldOperand(temp, WeakCell::kValueOffset));
1026 __ JumpIfSmi(temp, &gotta_call_runtime);
1027
1028 // Save the literals in the closure.
1029 __ movp(FieldOperand(closure, JSFunction::kLiteralsOffset), temp);
1030 __ movp(r15, index);
1031 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r15,
1032 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
1033 1021
1034 // Code available? 1022 // Code available?
1035 Register entry = rcx; 1023 Register entry = rcx;
1036 __ movp(entry, FieldOperand(map, index, times_pointer_size, 1024 __ movp(entry, FieldOperand(map, index, times_pointer_size,
1037 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1025 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1038 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); 1026 __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset));
1039 __ JumpIfSmi(entry, &try_shared); 1027 __ JumpIfSmi(entry, &try_shared);
1040 1028
1041 // Found literals and code. Get them into the closure and return. 1029 // Found code. Get it into the closure and return.
1042 __ leap(entry, FieldOperand(entry, Code::kHeaderSize)); 1030 __ leap(entry, FieldOperand(entry, Code::kHeaderSize));
1043 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); 1031 __ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry);
1044 __ RecordWriteCodeEntryField(closure, entry, r15); 1032 __ RecordWriteCodeEntryField(closure, entry, r15);
1045 1033
1046 // Link the closure into the optimized function list. 1034 // Link the closure into the optimized function list.
1047 // rcx : code entry (entry) 1035 // rcx : code entry (entry)
1048 // r14 : native context 1036 // r14 : native context
1049 // rdx : new target 1037 // rdx : new target
1050 // rdi : closure 1038 // rdi : closure
1051 __ movp(rbx, 1039 __ movp(rbx,
(...skipping 10 matching lines...) Expand all
1062 __ RecordWriteContextSlot(native_context, function_list_offset, closure, r15, 1050 __ RecordWriteContextSlot(native_context, function_list_offset, closure, r15,
1063 kDontSaveFPRegs); 1051 kDontSaveFPRegs);
1064 __ movp(closure, rbx); 1052 __ movp(closure, rbx);
1065 __ jmp(entry); 1053 __ jmp(entry);
1066 1054
1067 __ bind(&loop_bottom); 1055 __ bind(&loop_bottom);
1068 __ subl(index, Immediate(SharedFunctionInfo::kEntryLength)); 1056 __ subl(index, Immediate(SharedFunctionInfo::kEntryLength));
1069 __ cmpl(index, Immediate(1)); 1057 __ cmpl(index, Immediate(1));
1070 __ j(greater, &loop_top); 1058 __ j(greater, &loop_top);
1071 1059
1072 // We found neither literals nor code. 1060 // We found no code.
1073 __ jmp(&gotta_call_runtime); 1061 __ jmp(&gotta_call_runtime);
1074 1062
1075 __ bind(&try_shared); 1063 __ bind(&try_shared);
1076 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1064 __ movp(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1077 // Is the shared function marked for tier up? 1065 // Is the shared function marked for tier up?
1078 __ testb(FieldOperand(entry, SharedFunctionInfo::kMarkedForTierUpByteOffset), 1066 __ testb(FieldOperand(entry, SharedFunctionInfo::kMarkedForTierUpByteOffset),
1079 Immediate(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); 1067 Immediate(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte));
1080 __ j(not_zero, &gotta_call_runtime); 1068 __ j(not_zero, &gotta_call_runtime);
1081 // Is the full code valid? 1069 // Is the full code valid?
1082 __ movp(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset)); 1070 __ movp(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset));
(...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after
3048 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3036 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3049 Generate_OnStackReplacementHelper(masm, true); 3037 Generate_OnStackReplacementHelper(masm, true);
3050 } 3038 }
3051 3039
3052 #undef __ 3040 #undef __
3053 3041
3054 } // namespace internal 3042 } // namespace internal
3055 } // namespace v8 3043 } // namespace v8
3056 3044
3057 #endif // V8_TARGET_ARCH_X64 3045 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698