OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 // rsp[n]: Argument 1 | 663 // rsp[n]: Argument 1 |
664 // rsp[n+1]: Receiver (function to call) | 664 // rsp[n+1]: Receiver (function to call) |
665 // | 665 // |
666 // rax contains the number of arguments, n, not counting the receiver. | 666 // rax contains the number of arguments, n, not counting the receiver. |
667 // | 667 // |
668 // 1. Make sure we have at least one argument. | 668 // 1. Make sure we have at least one argument. |
669 { Label done; | 669 { Label done; |
670 __ testq(rax, rax); | 670 __ testq(rax, rax); |
671 __ j(not_zero, &done); | 671 __ j(not_zero, &done); |
672 __ pop(rbx); | 672 __ pop(rbx); |
673 __ Push(FACTORY->undefined_value()); | 673 __ Push(masm->isolate()->factory()->undefined_value()); |
674 __ push(rbx); | 674 __ push(rbx); |
675 __ incq(rax); | 675 __ incq(rax); |
676 __ bind(&done); | 676 __ bind(&done); |
677 } | 677 } |
678 | 678 |
679 // 2. Get the function to call (passed as receiver) from the stack, check | 679 // 2. Get the function to call (passed as receiver) from the stack, check |
680 // if it is a function. | 680 // if it is a function. |
681 Label slow, non_function; | 681 Label slow, non_function; |
682 // The function to call is at position n+1 on the stack. | 682 // The function to call is at position n+1 on the stack. |
683 __ movq(rdi, Operand(rsp, rax, times_pointer_size, 1 * kPointerSize)); | 683 __ movq(rdi, Operand(rsp, rax, times_pointer_size, 1 * kPointerSize)); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); | 986 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); |
987 __ call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 987 __ call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
988 RelocInfo::CODE_TARGET); | 988 RelocInfo::CODE_TARGET); |
989 | 989 |
990 // Leave internal frame. | 990 // Leave internal frame. |
991 } | 991 } |
992 __ ret(3 * kPointerSize); // remove this, receiver, and arguments | 992 __ ret(3 * kPointerSize); // remove this, receiver, and arguments |
993 } | 993 } |
994 | 994 |
995 | 995 |
996 // Number of empty elements to allocate for an empty array. | |
997 static const int kPreallocatedArrayElements = 4; | |
998 | |
999 | |
1000 // Allocate an empty JSArray. The allocated array is put into the result | 996 // Allocate an empty JSArray. The allocated array is put into the result |
1001 // register. If the parameter initial_capacity is larger than zero an elements | 997 // register. If the parameter initial_capacity is larger than zero an elements |
1002 // backing store is allocated with this size and filled with the hole values. | 998 // backing store is allocated with this size and filled with the hole values. |
1003 // Otherwise the elements backing store is set to the empty FixedArray. | 999 // Otherwise the elements backing store is set to the empty FixedArray. |
1004 static void AllocateEmptyJSArray(MacroAssembler* masm, | 1000 static void AllocateEmptyJSArray(MacroAssembler* masm, |
1005 Register array_function, | 1001 Register array_function, |
1006 Register result, | 1002 Register result, |
1007 Register scratch1, | 1003 Register scratch1, |
1008 Register scratch2, | 1004 Register scratch2, |
1009 Register scratch3, | 1005 Register scratch3, |
1010 int initial_capacity, | |
1011 Label* gc_required) { | 1006 Label* gc_required) { |
1012 ASSERT(initial_capacity >= 0); | 1007 const int initial_capacity = JSArray::kPreallocatedArrayElements; |
| 1008 STATIC_ASSERT(initial_capacity >= 0); |
1013 | 1009 |
1014 // Load the initial map from the array function. | 1010 // Load the initial map from the array function. |
1015 __ movq(scratch1, FieldOperand(array_function, | 1011 __ movq(scratch1, FieldOperand(array_function, |
1016 JSFunction::kPrototypeOrInitialMapOffset)); | 1012 JSFunction::kPrototypeOrInitialMapOffset)); |
1017 | 1013 |
1018 // Allocate the JSArray object together with space for a fixed array with the | 1014 // Allocate the JSArray object together with space for a fixed array with the |
1019 // requested elements. | 1015 // requested elements. |
1020 int size = JSArray::kSize; | 1016 int size = JSArray::kSize; |
1021 if (initial_capacity > 0) { | 1017 if (initial_capacity > 0) { |
1022 size += FixedArray::SizeFor(initial_capacity); | 1018 size += FixedArray::SizeFor(initial_capacity); |
1023 } | 1019 } |
1024 __ AllocateInNewSpace(size, | 1020 __ AllocateInNewSpace(size, |
1025 result, | 1021 result, |
1026 scratch2, | 1022 scratch2, |
1027 scratch3, | 1023 scratch3, |
1028 gc_required, | 1024 gc_required, |
1029 TAG_OBJECT); | 1025 TAG_OBJECT); |
1030 | 1026 |
1031 // Allocated the JSArray. Now initialize the fields except for the elements | 1027 // Allocated the JSArray. Now initialize the fields except for the elements |
1032 // array. | 1028 // array. |
1033 // result: JSObject | 1029 // result: JSObject |
1034 // scratch1: initial map | 1030 // scratch1: initial map |
1035 // scratch2: start of next object | 1031 // scratch2: start of next object |
| 1032 Factory* factory = masm->isolate()->factory(); |
1036 __ movq(FieldOperand(result, JSObject::kMapOffset), scratch1); | 1033 __ movq(FieldOperand(result, JSObject::kMapOffset), scratch1); |
1037 __ Move(FieldOperand(result, JSArray::kPropertiesOffset), | 1034 __ Move(FieldOperand(result, JSArray::kPropertiesOffset), |
1038 FACTORY->empty_fixed_array()); | 1035 factory->empty_fixed_array()); |
1039 // Field JSArray::kElementsOffset is initialized later. | 1036 // Field JSArray::kElementsOffset is initialized later. |
1040 __ Move(FieldOperand(result, JSArray::kLengthOffset), Smi::FromInt(0)); | 1037 __ Move(FieldOperand(result, JSArray::kLengthOffset), Smi::FromInt(0)); |
1041 | 1038 |
1042 // If no storage is requested for the elements array just set the empty | 1039 // If no storage is requested for the elements array just set the empty |
1043 // fixed array. | 1040 // fixed array. |
1044 if (initial_capacity == 0) { | 1041 if (initial_capacity == 0) { |
1045 __ Move(FieldOperand(result, JSArray::kElementsOffset), | 1042 __ Move(FieldOperand(result, JSArray::kElementsOffset), |
1046 FACTORY->empty_fixed_array()); | 1043 factory->empty_fixed_array()); |
1047 return; | 1044 return; |
1048 } | 1045 } |
1049 | 1046 |
1050 // Calculate the location of the elements array and set elements array member | 1047 // Calculate the location of the elements array and set elements array member |
1051 // of the JSArray. | 1048 // of the JSArray. |
1052 // result: JSObject | 1049 // result: JSObject |
1053 // scratch2: start of next object | 1050 // scratch2: start of next object |
1054 __ lea(scratch1, Operand(result, JSArray::kSize)); | 1051 __ lea(scratch1, Operand(result, JSArray::kSize)); |
1055 __ movq(FieldOperand(result, JSArray::kElementsOffset), scratch1); | 1052 __ movq(FieldOperand(result, JSArray::kElementsOffset), scratch1); |
1056 | 1053 |
1057 // Initialize the FixedArray and fill it with holes. FixedArray length is | 1054 // Initialize the FixedArray and fill it with holes. FixedArray length is |
1058 // stored as a smi. | 1055 // stored as a smi. |
1059 // result: JSObject | 1056 // result: JSObject |
1060 // scratch1: elements array | 1057 // scratch1: elements array |
1061 // scratch2: start of next object | 1058 // scratch2: start of next object |
1062 __ Move(FieldOperand(scratch1, HeapObject::kMapOffset), | 1059 __ Move(FieldOperand(scratch1, HeapObject::kMapOffset), |
1063 FACTORY->fixed_array_map()); | 1060 factory->fixed_array_map()); |
1064 __ Move(FieldOperand(scratch1, FixedArray::kLengthOffset), | 1061 __ Move(FieldOperand(scratch1, FixedArray::kLengthOffset), |
1065 Smi::FromInt(initial_capacity)); | 1062 Smi::FromInt(initial_capacity)); |
1066 | 1063 |
1067 // Fill the FixedArray with the hole value. Inline the code if short. | 1064 // Fill the FixedArray with the hole value. Inline the code if short. |
1068 // Reconsider loop unfolding if kPreallocatedArrayElements gets changed. | 1065 // Reconsider loop unfolding if kPreallocatedArrayElements gets changed. |
1069 static const int kLoopUnfoldLimit = 4; | 1066 static const int kLoopUnfoldLimit = 4; |
1070 ASSERT(kPreallocatedArrayElements <= kLoopUnfoldLimit); | 1067 __ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex); |
1071 __ Move(scratch3, FACTORY->the_hole_value()); | |
1072 if (initial_capacity <= kLoopUnfoldLimit) { | 1068 if (initial_capacity <= kLoopUnfoldLimit) { |
1073 // Use a scratch register here to have only one reloc info when unfolding | 1069 // Use a scratch register here to have only one reloc info when unfolding |
1074 // the loop. | 1070 // the loop. |
1075 for (int i = 0; i < initial_capacity; i++) { | 1071 for (int i = 0; i < initial_capacity; i++) { |
1076 __ movq(FieldOperand(scratch1, | 1072 __ movq(FieldOperand(scratch1, |
1077 FixedArray::kHeaderSize + i * kPointerSize), | 1073 FixedArray::kHeaderSize + i * kPointerSize), |
1078 scratch3); | 1074 scratch3); |
1079 } | 1075 } |
1080 } else { | 1076 } else { |
1081 Label loop, entry; | 1077 Label loop, entry; |
(...skipping 12 matching lines...) Expand all Loading... |
1094 // register array_function holds the built-in Array function and the register | 1090 // register array_function holds the built-in Array function and the register |
1095 // array_size holds the size of the array as a smi. The allocated array is put | 1091 // array_size holds the size of the array as a smi. The allocated array is put |
1096 // into the result register and beginning and end of the FixedArray elements | 1092 // into the result register and beginning and end of the FixedArray elements |
1097 // storage is put into registers elements_array and elements_array_end (see | 1093 // storage is put into registers elements_array and elements_array_end (see |
1098 // below for when that is not the case). If the parameter fill_with_holes is | 1094 // below for when that is not the case). If the parameter fill_with_holes is |
1099 // true the allocated elements backing store is filled with the hole values | 1095 // true the allocated elements backing store is filled with the hole values |
1100 // otherwise it is left uninitialized. When the backing store is filled the | 1096 // otherwise it is left uninitialized. When the backing store is filled the |
1101 // register elements_array is scratched. | 1097 // register elements_array is scratched. |
1102 static void AllocateJSArray(MacroAssembler* masm, | 1098 static void AllocateJSArray(MacroAssembler* masm, |
1103 Register array_function, // Array function. | 1099 Register array_function, // Array function. |
1104 Register array_size, // As a smi. | 1100 Register array_size, // As a smi, cannot be 0. |
1105 Register result, | 1101 Register result, |
1106 Register elements_array, | 1102 Register elements_array, |
1107 Register elements_array_end, | 1103 Register elements_array_end, |
1108 Register scratch, | 1104 Register scratch, |
1109 bool fill_with_hole, | 1105 bool fill_with_hole, |
1110 Label* gc_required) { | 1106 Label* gc_required) { |
1111 Label not_empty, allocated; | |
1112 | |
1113 // Load the initial map from the array function. | 1107 // Load the initial map from the array function. |
1114 __ movq(elements_array, | 1108 __ movq(elements_array, |
1115 FieldOperand(array_function, | 1109 FieldOperand(array_function, |
1116 JSFunction::kPrototypeOrInitialMapOffset)); | 1110 JSFunction::kPrototypeOrInitialMapOffset)); |
1117 | 1111 |
1118 // Check whether an empty sized array is requested. | 1112 if (FLAG_debug_code) { // Assert that array size is not zero. |
1119 __ testq(array_size, array_size); | 1113 __ testq(array_size, array_size); |
1120 __ j(not_zero, ¬_empty); | 1114 __ Assert(not_zero, "array size is unexpectedly 0"); |
1121 | 1115 } |
1122 // If an empty array is requested allocate a small elements array anyway. This | |
1123 // keeps the code below free of special casing for the empty array. | |
1124 int size = JSArray::kSize + FixedArray::SizeFor(kPreallocatedArrayElements); | |
1125 __ AllocateInNewSpace(size, | |
1126 result, | |
1127 elements_array_end, | |
1128 scratch, | |
1129 gc_required, | |
1130 TAG_OBJECT); | |
1131 __ jmp(&allocated); | |
1132 | 1116 |
1133 // Allocate the JSArray object together with space for a FixedArray with the | 1117 // Allocate the JSArray object together with space for a FixedArray with the |
1134 // requested elements. | 1118 // requested elements. |
1135 __ bind(¬_empty); | |
1136 SmiIndex index = | 1119 SmiIndex index = |
1137 masm->SmiToIndex(kScratchRegister, array_size, kPointerSizeLog2); | 1120 masm->SmiToIndex(kScratchRegister, array_size, kPointerSizeLog2); |
1138 __ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize, | 1121 __ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize, |
1139 index.scale, | 1122 index.scale, |
1140 index.reg, | 1123 index.reg, |
1141 result, | 1124 result, |
1142 elements_array_end, | 1125 elements_array_end, |
1143 scratch, | 1126 scratch, |
1144 gc_required, | 1127 gc_required, |
1145 TAG_OBJECT); | 1128 TAG_OBJECT); |
1146 | 1129 |
1147 // Allocated the JSArray. Now initialize the fields except for the elements | 1130 // Allocated the JSArray. Now initialize the fields except for the elements |
1148 // array. | 1131 // array. |
1149 // result: JSObject | 1132 // result: JSObject |
1150 // elements_array: initial map | 1133 // elements_array: initial map |
1151 // elements_array_end: start of next object | 1134 // elements_array_end: start of next object |
1152 // array_size: size of array (smi) | 1135 // array_size: size of array (smi) |
1153 __ bind(&allocated); | 1136 Factory* factory = masm->isolate()->factory(); |
1154 __ movq(FieldOperand(result, JSObject::kMapOffset), elements_array); | 1137 __ movq(FieldOperand(result, JSObject::kMapOffset), elements_array); |
1155 __ Move(elements_array, FACTORY->empty_fixed_array()); | 1138 __ Move(elements_array, factory->empty_fixed_array()); |
1156 __ movq(FieldOperand(result, JSArray::kPropertiesOffset), elements_array); | 1139 __ movq(FieldOperand(result, JSArray::kPropertiesOffset), elements_array); |
1157 // Field JSArray::kElementsOffset is initialized later. | 1140 // Field JSArray::kElementsOffset is initialized later. |
1158 __ movq(FieldOperand(result, JSArray::kLengthOffset), array_size); | 1141 __ movq(FieldOperand(result, JSArray::kLengthOffset), array_size); |
1159 | 1142 |
1160 // Calculate the location of the elements array and set elements array member | 1143 // Calculate the location of the elements array and set elements array member |
1161 // of the JSArray. | 1144 // of the JSArray. |
1162 // result: JSObject | 1145 // result: JSObject |
1163 // elements_array_end: start of next object | 1146 // elements_array_end: start of next object |
1164 // array_size: size of array (smi) | 1147 // array_size: size of array (smi) |
1165 __ lea(elements_array, Operand(result, JSArray::kSize)); | 1148 __ lea(elements_array, Operand(result, JSArray::kSize)); |
1166 __ movq(FieldOperand(result, JSArray::kElementsOffset), elements_array); | 1149 __ movq(FieldOperand(result, JSArray::kElementsOffset), elements_array); |
1167 | 1150 |
1168 // Initialize the fixed array. FixedArray length is stored as a smi. | 1151 // Initialize the fixed array. FixedArray length is stored as a smi. |
1169 // result: JSObject | 1152 // result: JSObject |
1170 // elements_array: elements array | 1153 // elements_array: elements array |
1171 // elements_array_end: start of next object | 1154 // elements_array_end: start of next object |
1172 // array_size: size of array (smi) | 1155 // array_size: size of array (smi) |
1173 __ Move(FieldOperand(elements_array, JSObject::kMapOffset), | 1156 __ Move(FieldOperand(elements_array, JSObject::kMapOffset), |
1174 FACTORY->fixed_array_map()); | 1157 factory->fixed_array_map()); |
1175 Label not_empty_2, fill_array; | |
1176 __ SmiTest(array_size); | |
1177 __ j(not_zero, ¬_empty_2); | |
1178 // Length of the FixedArray is the number of pre-allocated elements even | |
1179 // though the actual JSArray has length 0. | |
1180 __ Move(FieldOperand(elements_array, FixedArray::kLengthOffset), | |
1181 Smi::FromInt(kPreallocatedArrayElements)); | |
1182 __ jmp(&fill_array); | |
1183 __ bind(¬_empty_2); | |
1184 // For non-empty JSArrays the length of the FixedArray and the JSArray is the | 1158 // For non-empty JSArrays the length of the FixedArray and the JSArray is the |
1185 // same. | 1159 // same. |
1186 __ movq(FieldOperand(elements_array, FixedArray::kLengthOffset), array_size); | 1160 __ movq(FieldOperand(elements_array, FixedArray::kLengthOffset), array_size); |
1187 | 1161 |
1188 // Fill the allocated FixedArray with the hole value if requested. | 1162 // Fill the allocated FixedArray with the hole value if requested. |
1189 // result: JSObject | 1163 // result: JSObject |
1190 // elements_array: elements array | 1164 // elements_array: elements array |
1191 // elements_array_end: start of next object | 1165 // elements_array_end: start of next object |
1192 __ bind(&fill_array); | |
1193 if (fill_with_hole) { | 1166 if (fill_with_hole) { |
1194 Label loop, entry; | 1167 Label loop, entry; |
1195 __ Move(scratch, FACTORY->the_hole_value()); | 1168 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
1196 __ lea(elements_array, Operand(elements_array, | 1169 __ lea(elements_array, Operand(elements_array, |
1197 FixedArray::kHeaderSize - kHeapObjectTag)); | 1170 FixedArray::kHeaderSize - kHeapObjectTag)); |
1198 __ jmp(&entry); | 1171 __ jmp(&entry); |
1199 __ bind(&loop); | 1172 __ bind(&loop); |
1200 __ movq(Operand(elements_array, 0), scratch); | 1173 __ movq(Operand(elements_array, 0), scratch); |
1201 __ addq(elements_array, Immediate(kPointerSize)); | 1174 __ addq(elements_array, Immediate(kPointerSize)); |
1202 __ bind(&entry); | 1175 __ bind(&entry); |
1203 __ cmpq(elements_array, elements_array_end); | 1176 __ cmpq(elements_array, elements_array_end); |
1204 __ j(below, &loop); | 1177 __ j(below, &loop); |
1205 } | 1178 } |
1206 } | 1179 } |
1207 | 1180 |
1208 | 1181 |
1209 // Create a new array for the built-in Array function. This function allocates | 1182 // Create a new array for the built-in Array function. This function allocates |
1210 // the JSArray object and the FixedArray elements array and initializes these. | 1183 // the JSArray object and the FixedArray elements array and initializes these. |
1211 // If the Array cannot be constructed in native code the runtime is called. This | 1184 // If the Array cannot be constructed in native code the runtime is called. This |
1212 // function assumes the following state: | 1185 // function assumes the following state: |
1213 // rdi: constructor (built-in Array function) | 1186 // rdi: constructor (built-in Array function) |
1214 // rax: argc | 1187 // rax: argc |
1215 // rsp[0]: return address | 1188 // rsp[0]: return address |
1216 // rsp[8]: last argument | 1189 // rsp[8]: last argument |
1217 // This function is used for both construct and normal calls of Array. The only | 1190 // This function is used for both construct and normal calls of Array. The only |
1218 // difference between handling a construct call and a normal call is that for a | 1191 // difference between handling a construct call and a normal call is that for a |
1219 // construct call the constructor function in rdi needs to be preserved for | 1192 // construct call the constructor function in rdi needs to be preserved for |
1220 // entering the generic code. In both cases argc in rax needs to be preserved. | 1193 // entering the generic code. In both cases argc in rax needs to be preserved. |
1221 // Both registers are preserved by this code so no need to differentiate between | 1194 // Both registers are preserved by this code so no need to differentiate between |
1222 // a construct call and a normal call. | 1195 // a construct call and a normal call. |
1223 static void ArrayNativeCode(MacroAssembler* masm, | 1196 static void ArrayNativeCode(MacroAssembler* masm, |
1224 Label *call_generic_code) { | 1197 Label *call_generic_code) { |
1225 Label argc_one_or_more, argc_two_or_more; | 1198 Label argc_one_or_more, argc_two_or_more, empty_array, not_empty_array; |
1226 | 1199 |
1227 // Check for array construction with zero arguments. | 1200 // Check for array construction with zero arguments. |
1228 __ testq(rax, rax); | 1201 __ testq(rax, rax); |
1229 __ j(not_zero, &argc_one_or_more); | 1202 __ j(not_zero, &argc_one_or_more); |
1230 | 1203 |
| 1204 __ bind(&empty_array); |
1231 // Handle construction of an empty array. | 1205 // Handle construction of an empty array. |
1232 AllocateEmptyJSArray(masm, | 1206 AllocateEmptyJSArray(masm, |
1233 rdi, | 1207 rdi, |
1234 rbx, | 1208 rbx, |
1235 rcx, | 1209 rcx, |
1236 rdx, | 1210 rdx, |
1237 r8, | 1211 r8, |
1238 kPreallocatedArrayElements, | |
1239 call_generic_code); | 1212 call_generic_code); |
1240 Counters* counters = masm->isolate()->counters(); | 1213 Counters* counters = masm->isolate()->counters(); |
1241 __ IncrementCounter(counters->array_function_native(), 1); | 1214 __ IncrementCounter(counters->array_function_native(), 1); |
1242 __ movq(rax, rbx); | 1215 __ movq(rax, rbx); |
1243 __ ret(kPointerSize); | 1216 __ ret(kPointerSize); |
1244 | 1217 |
1245 // Check for one argument. Bail out if argument is not smi or if it is | 1218 // Check for one argument. Bail out if argument is not smi or if it is |
1246 // negative. | 1219 // negative. |
1247 __ bind(&argc_one_or_more); | 1220 __ bind(&argc_one_or_more); |
1248 __ cmpq(rax, Immediate(1)); | 1221 __ cmpq(rax, Immediate(1)); |
1249 __ j(not_equal, &argc_two_or_more); | 1222 __ j(not_equal, &argc_two_or_more); |
1250 __ movq(rdx, Operand(rsp, kPointerSize)); // Get the argument from the stack. | 1223 __ movq(rdx, Operand(rsp, kPointerSize)); // Get the argument from the stack. |
| 1224 |
| 1225 __ SmiTest(rdx); |
| 1226 __ j(not_zero, ¬_empty_array); |
| 1227 __ pop(r8); // Adjust stack. |
| 1228 __ Drop(1); |
| 1229 __ push(r8); |
| 1230 __ movq(rax, Immediate(0)); // Treat this as a call with argc of zero. |
| 1231 __ jmp(&empty_array); |
| 1232 |
| 1233 __ bind(¬_empty_array); |
1251 __ JumpUnlessNonNegativeSmi(rdx, call_generic_code); | 1234 __ JumpUnlessNonNegativeSmi(rdx, call_generic_code); |
1252 | 1235 |
1253 // Handle construction of an empty array of a certain size. Bail out if size | 1236 // Handle construction of an empty array of a certain size. Bail out if size |
1254 // is to large to actually allocate an elements array. | 1237 // is to large to actually allocate an elements array. |
1255 __ SmiCompare(rdx, Smi::FromInt(JSObject::kInitialMaxFastElementArray)); | 1238 __ SmiCompare(rdx, Smi::FromInt(JSObject::kInitialMaxFastElementArray)); |
1256 __ j(greater_equal, call_generic_code); | 1239 __ j(greater_equal, call_generic_code); |
1257 | 1240 |
1258 // rax: argc | 1241 // rax: argc |
1259 // rdx: array_size (smi) | 1242 // rdx: array_size (smi) |
1260 // rdi: constructor | 1243 // rdi: constructor |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1569 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1587 generator.Generate(); | 1570 generator.Generate(); |
1588 } | 1571 } |
1589 | 1572 |
1590 | 1573 |
1591 #undef __ | 1574 #undef __ |
1592 | 1575 |
1593 } } // namespace v8::internal | 1576 } } // namespace v8::internal |
1594 | 1577 |
1595 #endif // V8_TARGET_ARCH_X64 | 1578 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |