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

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

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