| OLD | NEW | 
|---|
| 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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1022   // ----------------------------------- | 1022   // ----------------------------------- | 
| 1023   // First lookup code, maybe we don't need to compile! | 1023   // First lookup code, maybe we don't need to compile! | 
| 1024   Label gotta_call_runtime, gotta_call_runtime_no_stack; | 1024   Label gotta_call_runtime, gotta_call_runtime_no_stack; | 
| 1025   Label try_shared; | 1025   Label try_shared; | 
| 1026   Label loop_top, loop_bottom; | 1026   Label loop_top, loop_bottom; | 
| 1027 | 1027 | 
| 1028   Register closure = edi; | 1028   Register closure = edi; | 
| 1029   Register new_target = edx; | 1029   Register new_target = edx; | 
| 1030   Register argument_count = eax; | 1030   Register argument_count = eax; | 
| 1031 | 1031 | 
|  | 1032   // Do we have a valid feedback vector? | 
|  | 1033   __ mov(ebx, FieldOperand(closure, JSFunction::kFeedbackVectorOffset)); | 
|  | 1034   __ mov(ebx, FieldOperand(ebx, Cell::kValueOffset)); | 
|  | 1035   __ cmp(ebx, masm->isolate()->factory()->undefined_value()); | 
|  | 1036   __ j(equal, &gotta_call_runtime_no_stack); | 
|  | 1037 | 
| 1032   __ push(argument_count); | 1038   __ push(argument_count); | 
| 1033   __ push(new_target); | 1039   __ push(new_target); | 
| 1034   __ push(closure); | 1040   __ push(closure); | 
| 1035 | 1041 | 
| 1036   Register map = argument_count; | 1042   Register map = argument_count; | 
| 1037   Register index = ebx; | 1043   Register index = ebx; | 
| 1038   __ mov(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1044   __ mov(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 
| 1039   __ mov(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); | 1045   __ mov(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); | 
| 1040   __ mov(index, FieldOperand(map, FixedArray::kLengthOffset)); | 1046   __ mov(index, FieldOperand(map, FixedArray::kLengthOffset)); | 
| 1041   __ cmp(index, Immediate(Smi::FromInt(2))); | 1047   __ cmp(index, Immediate(Smi::FromInt(2))); | 
| 1042   __ j(less, &gotta_call_runtime); | 1048   __ j(less, &try_shared); | 
| 1043 | 1049 | 
| 1044   // Find literals. |  | 
| 1045   // edx : native context | 1050   // edx : native context | 
| 1046   // ebx : length / index | 1051   // ebx : length / index | 
| 1047   // eax : optimized code map | 1052   // eax : optimized code map | 
| 1048   // stack[0] : new target | 1053   // stack[0] : new target | 
| 1049   // stack[4] : closure | 1054   // stack[4] : closure | 
| 1050   Register native_context = edx; | 1055   Register native_context = edx; | 
| 1051   __ mov(native_context, NativeContextOperand()); | 1056   __ mov(native_context, NativeContextOperand()); | 
| 1052 | 1057 | 
| 1053   __ bind(&loop_top); | 1058   __ bind(&loop_top); | 
| 1054   Register temp = edi; | 1059   Register temp = edi; | 
| 1055 | 1060 | 
| 1056   // Does the native context match? | 1061   // Does the native context match? | 
| 1057   __ mov(temp, FieldOperand(map, index, times_half_pointer_size, | 1062   __ mov(temp, FieldOperand(map, index, times_half_pointer_size, | 
| 1058                             SharedFunctionInfo::kOffsetToPreviousContext)); | 1063                             SharedFunctionInfo::kOffsetToPreviousContext)); | 
| 1059   __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 1064   __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); | 
| 1060   __ cmp(temp, native_context); | 1065   __ cmp(temp, native_context); | 
| 1061   __ j(not_equal, &loop_bottom); | 1066   __ j(not_equal, &loop_bottom); | 
| 1062   // Literals available? |  | 
| 1063   __ mov(temp, FieldOperand(map, index, times_half_pointer_size, |  | 
| 1064                             SharedFunctionInfo::kOffsetToPreviousLiterals)); |  | 
| 1065   __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); |  | 
| 1066   __ JumpIfSmi(temp, &gotta_call_runtime); |  | 
| 1067 |  | 
| 1068   // Save the literals in the closure. |  | 
| 1069   __ mov(ecx, Operand(esp, 0)); |  | 
| 1070   __ mov(FieldOperand(ecx, JSFunction::kLiteralsOffset), temp); |  | 
| 1071   __ push(index); |  | 
| 1072   __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index, |  | 
| 1073                       kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |  | 
| 1074   __ pop(index); |  | 
| 1075 |  | 
| 1076   // Code available? | 1067   // Code available? | 
| 1077   Register entry = ecx; | 1068   Register entry = ecx; | 
| 1078   __ mov(entry, FieldOperand(map, index, times_half_pointer_size, | 1069   __ mov(entry, FieldOperand(map, index, times_half_pointer_size, | 
| 1079                              SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1070                              SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 
| 1080   __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset)); | 1071   __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset)); | 
| 1081   __ JumpIfSmi(entry, &try_shared); | 1072   __ JumpIfSmi(entry, &try_shared); | 
| 1082 | 1073 | 
| 1083   // Found literals and code. Get them into the closure and return. | 1074   // Found code. Get it into the closure and return. | 
| 1084   __ pop(closure); | 1075   __ pop(closure); | 
| 1085   // Store code entry in the closure. | 1076   // Store code entry in the closure. | 
| 1086   __ lea(entry, FieldOperand(entry, Code::kHeaderSize)); | 1077   __ lea(entry, FieldOperand(entry, Code::kHeaderSize)); | 
| 1087   __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); | 1078   __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); | 
| 1088   __ RecordWriteCodeEntryField(closure, entry, eax); | 1079   __ RecordWriteCodeEntryField(closure, entry, eax); | 
| 1089 | 1080 | 
| 1090   // Link the closure into the optimized function list. | 1081   // Link the closure into the optimized function list. | 
| 1091   // ecx : code entry | 1082   // ecx : code entry | 
| 1092   // edx : native context | 1083   // edx : native context | 
| 1093   // edi : closure | 1084   // edi : closure | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 1107   __ mov(closure, ebx); | 1098   __ mov(closure, ebx); | 
| 1108   __ pop(new_target); | 1099   __ pop(new_target); | 
| 1109   __ pop(argument_count); | 1100   __ pop(argument_count); | 
| 1110   __ jmp(entry); | 1101   __ jmp(entry); | 
| 1111 | 1102 | 
| 1112   __ bind(&loop_bottom); | 1103   __ bind(&loop_bottom); | 
| 1113   __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 1104   __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 
| 1114   __ cmp(index, Immediate(Smi::FromInt(1))); | 1105   __ cmp(index, Immediate(Smi::FromInt(1))); | 
| 1115   __ j(greater, &loop_top); | 1106   __ j(greater, &loop_top); | 
| 1116 | 1107 | 
| 1117   // We found neither literals nor code. | 1108   // We found no code. | 
| 1118   __ jmp(&gotta_call_runtime); | 1109   __ jmp(&gotta_call_runtime); | 
| 1119 | 1110 | 
| 1120   __ bind(&try_shared); | 1111   __ bind(&try_shared); | 
| 1121   __ pop(closure); | 1112   __ pop(closure); | 
| 1122   __ pop(new_target); | 1113   __ pop(new_target); | 
| 1123   __ pop(argument_count); | 1114   __ pop(argument_count); | 
| 1124   __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1115   __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 
| 1125   // Is the shared function marked for tier up? | 1116   // Is the shared function marked for tier up? | 
| 1126   __ test_b(FieldOperand(entry, SharedFunctionInfo::kMarkedForTierUpByteOffset), | 1117   __ test_b(FieldOperand(entry, SharedFunctionInfo::kMarkedForTierUpByteOffset), | 
| 1127             Immediate(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); | 1118             Immediate(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); | 
| (...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3343 | 3334 | 
| 3344 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3335 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 
| 3345   Generate_OnStackReplacementHelper(masm, true); | 3336   Generate_OnStackReplacementHelper(masm, true); | 
| 3346 } | 3337 } | 
| 3347 | 3338 | 
| 3348 #undef __ | 3339 #undef __ | 
| 3349 }  // namespace internal | 3340 }  // namespace internal | 
| 3350 }  // namespace v8 | 3341 }  // namespace v8 | 
| 3351 | 3342 | 
| 3352 #endif  // V8_TARGET_ARCH_X87 | 3343 #endif  // V8_TARGET_ARCH_X87 | 
| OLD | NEW | 
|---|