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

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

Powered by Google App Engine
This is Rietveld 408576698