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

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

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