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

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

Issue 2627973007: X87: [TypeFeedbackVector] Root literal arrays in function literals 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 | « no previous file | no next file » | 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_X87 5 #if V8_TARGET_ARCH_X87
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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 // ----------------------------------- 1019 // -----------------------------------
1020 // First lookup code, maybe we don't need to compile! 1020 // First lookup code, maybe we don't need to compile!
1021 Label gotta_call_runtime, gotta_call_runtime_no_stack; 1021 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1022 Label try_shared; 1022 Label try_shared;
1023 Label loop_top, loop_bottom; 1023 Label loop_top, loop_bottom;
1024 1024
1025 Register closure = edi; 1025 Register closure = edi;
1026 Register new_target = edx; 1026 Register new_target = edx;
1027 Register argument_count = eax; 1027 Register argument_count = eax;
1028 1028
1029 // Do we have a valid feedback vector?
1030 __ mov(ebx, FieldOperand(closure, JSFunction::kLiteralsOffset));
1031 __ mov(ebx, FieldOperand(ebx, LiteralsArray::kFeedbackVectorOffset));
1032 __ cmp(ebx, masm->isolate()->factory()->undefined_value());
1033 __ j(equal, &gotta_call_runtime_no_stack);
1034
1029 __ push(argument_count); 1035 __ push(argument_count);
1030 __ push(new_target); 1036 __ push(new_target);
1031 __ push(closure); 1037 __ push(closure);
1032 1038
1033 Register map = argument_count; 1039 Register map = argument_count;
1034 Register index = ebx; 1040 Register index = ebx;
1035 __ mov(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1041 __ mov(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1036 __ mov(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1042 __ mov(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1037 __ mov(index, FieldOperand(map, FixedArray::kLengthOffset)); 1043 __ mov(index, FieldOperand(map, FixedArray::kLengthOffset));
1038 __ cmp(index, Immediate(Smi::FromInt(2))); 1044 __ cmp(index, Immediate(Smi::FromInt(2)));
1039 __ j(less, &gotta_call_runtime); 1045 __ j(less, &gotta_call_runtime);
1040 1046
1041 // Find literals.
1042 // edx : native context 1047 // edx : native context
1043 // ebx : length / index 1048 // ebx : length / index
1044 // eax : optimized code map 1049 // eax : optimized code map
1045 // stack[0] : new target 1050 // stack[0] : new target
1046 // stack[4] : closure 1051 // stack[4] : closure
1047 Register native_context = edx; 1052 Register native_context = edx;
1048 __ mov(native_context, NativeContextOperand()); 1053 __ mov(native_context, NativeContextOperand());
1049 1054
1050 __ bind(&loop_top); 1055 __ bind(&loop_top);
1051 Register temp = edi; 1056 Register temp = edi;
1052 1057
1053 // Does the native context match? 1058 // Does the native context match?
1054 __ mov(temp, FieldOperand(map, index, times_half_pointer_size, 1059 __ mov(temp, FieldOperand(map, index, times_half_pointer_size,
1055 SharedFunctionInfo::kOffsetToPreviousContext)); 1060 SharedFunctionInfo::kOffsetToPreviousContext));
1056 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); 1061 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset));
1057 __ cmp(temp, native_context); 1062 __ cmp(temp, native_context);
1058 __ j(not_equal, &loop_bottom); 1063 __ j(not_equal, &loop_bottom);
1059 // Literals available?
1060 __ mov(temp, FieldOperand(map, index, times_half_pointer_size,
1061 SharedFunctionInfo::kOffsetToPreviousLiterals));
1062 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset));
1063 __ JumpIfSmi(temp, &gotta_call_runtime);
1064
1065 // Save the literals in the closure.
1066 __ mov(ecx, Operand(esp, 0));
1067 __ mov(FieldOperand(ecx, JSFunction::kLiteralsOffset), temp);
1068 __ push(index);
1069 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index,
1070 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
1071 __ pop(index);
1072
1073 // Code available? 1064 // Code available?
1074 Register entry = ecx; 1065 Register entry = ecx;
1075 __ mov(entry, FieldOperand(map, index, times_half_pointer_size, 1066 __ mov(entry, FieldOperand(map, index, times_half_pointer_size,
1076 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1067 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1077 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset)); 1068 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset));
1078 __ JumpIfSmi(entry, &try_shared); 1069 __ JumpIfSmi(entry, &try_shared);
1079 1070
1080 // Found literals and code. Get them into the closure and return. 1071 // Found code. Get it into the closure and return.
1081 __ pop(closure); 1072 __ pop(closure);
1082 // Store code entry in the closure. 1073 // Store code entry in the closure.
1083 __ lea(entry, FieldOperand(entry, Code::kHeaderSize)); 1074 __ lea(entry, FieldOperand(entry, Code::kHeaderSize));
1084 __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); 1075 __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry);
1085 __ RecordWriteCodeEntryField(closure, entry, eax); 1076 __ RecordWriteCodeEntryField(closure, entry, eax);
1086 1077
1087 // Link the closure into the optimized function list. 1078 // Link the closure into the optimized function list.
1088 // ecx : code entry 1079 // ecx : code entry
1089 // edx : native context 1080 // edx : native context
1090 // edi : closure 1081 // edi : closure
(...skipping 13 matching lines...) Expand all
1104 __ mov(closure, ebx); 1095 __ mov(closure, ebx);
1105 __ pop(new_target); 1096 __ pop(new_target);
1106 __ pop(argument_count); 1097 __ pop(argument_count);
1107 __ jmp(entry); 1098 __ jmp(entry);
1108 1099
1109 __ bind(&loop_bottom); 1100 __ bind(&loop_bottom);
1110 __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength))); 1101 __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1111 __ cmp(index, Immediate(Smi::FromInt(1))); 1102 __ cmp(index, Immediate(Smi::FromInt(1)));
1112 __ j(greater, &loop_top); 1103 __ j(greater, &loop_top);
1113 1104
1114 // We found neither literals nor code. 1105 // We found no code.
1115 __ jmp(&gotta_call_runtime); 1106 __ jmp(&gotta_call_runtime);
1116 1107
1117 __ bind(&try_shared); 1108 __ bind(&try_shared);
1118 __ pop(closure); 1109 __ pop(closure);
1119 __ pop(new_target); 1110 __ pop(new_target);
1120 __ pop(argument_count); 1111 __ pop(argument_count);
1121 __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1112 __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1122 // Is the shared function marked for tier up? 1113 // Is the shared function marked for tier up?
1123 __ test_b(FieldOperand(entry, SharedFunctionInfo::kMarkedForTierUpByteOffset), 1114 __ test_b(FieldOperand(entry, SharedFunctionInfo::kMarkedForTierUpByteOffset),
1124 Immediate(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); 1115 Immediate(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte));
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after
3137 3128
3138 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3129 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3139 Generate_OnStackReplacementHelper(masm, true); 3130 Generate_OnStackReplacementHelper(masm, true);
3140 } 3131 }
3141 3132
3142 #undef __ 3133 #undef __
3143 } // namespace internal 3134 } // namespace internal
3144 } // namespace v8 3135 } // namespace v8
3145 3136
3146 #endif // V8_TARGET_ARCH_X87 3137 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698