| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 if (argc == 0) { | 1240 if (argc == 0) { |
| 1241 // Noop, return the length. | 1241 // Noop, return the length. |
| 1242 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); | 1242 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
| 1243 __ ret((argc + 1) * kPointerSize); | 1243 __ ret((argc + 1) * kPointerSize); |
| 1244 } else { | 1244 } else { |
| 1245 // Get the elements array of the object. | 1245 // Get the elements array of the object. |
| 1246 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); | 1246 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); |
| 1247 | 1247 |
| 1248 // Check that the elements are in fast mode (not dictionary). | 1248 // Check that the elements are in fast mode (not dictionary). |
| 1249 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), | 1249 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), |
| 1250 Immediate(Factory::fixed_array_map())); | 1250 Immediate(Factory::fixed_array_map())); |
| 1251 __ j(not_equal, &miss); | 1251 __ j(not_equal, &miss); |
| 1252 | 1252 |
| 1253 if (argc == 1) { // Otherwise fall through to call builtin. | 1253 if (argc == 1) { // Otherwise fall through to call builtin. |
| 1254 Label call_builtin, exit, with_rset_update; | 1254 Label call_builtin, exit, with_rset_update; |
| 1255 | 1255 |
| 1256 // Get the array's length into eax and calculate new length. | 1256 // Get the array's length into eax and calculate new length. |
| 1257 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); | 1257 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
| 1258 STATIC_ASSERT(kSmiTagSize == 1); | 1258 STATIC_ASSERT(kSmiTagSize == 1); |
| 1259 STATIC_ASSERT(kSmiTag == 0); | 1259 STATIC_ASSERT(kSmiTag == 0); |
| 1260 __ add(Operand(eax), Immediate(argc << 1)); | 1260 __ add(Operand(eax), Immediate(argc << 1)); |
| 1261 | 1261 |
| 1262 // Get the element's length into ecx. | 1262 // Get the element's length into ecx. |
| 1263 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); | 1263 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); |
| 1264 __ SmiTag(ecx); | 1264 __ SmiTag(ecx); |
| 1265 | 1265 |
| 1266 // Check if we could survive without allocation, go to builtin otherwise. | 1266 // Check if we could survive without allocation, go to builtin otherwise. |
| 1267 __ cmp(eax, Operand(ecx)); | 1267 __ cmp(eax, Operand(ecx)); |
| 1268 __ j(greater, &call_builtin); | 1268 __ j(greater, &call_builtin); |
| 1269 | 1269 |
| 1270 // Save new length. | 1270 // Save new length. |
| 1271 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); | 1271 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
| 1272 | 1272 |
| 1273 // Push the element. | 1273 // Push the element. |
| 1274 __ lea(edx, FieldOperand(ebx, | 1274 __ lea(edx, FieldOperand(ebx, |
| 1275 eax, times_half_pointer_size, | 1275 eax, times_half_pointer_size, |
| 1276 FixedArray::kHeaderSize - argc * kPointerSize)); | 1276 FixedArray::kHeaderSize - argc * kPointerSize)); |
| 1277 __ mov(ecx, Operand(esp, argc * kPointerSize)); | 1277 __ mov(ecx, Operand(esp, argc * kPointerSize)); |
| 1278 __ mov(Operand(edx, 0), ecx); | 1278 __ mov(Operand(edx, 0), ecx); |
| 1279 | 1279 |
| 1280 // Check if wrote not a smi. | 1280 // Check if value is a smi. |
| 1281 __ test(ecx, Immediate(kSmiTagMask)); | 1281 __ test(ecx, Immediate(kSmiTagMask)); |
| 1282 __ j(not_zero, &with_rset_update); | 1282 __ j(not_zero, &with_rset_update); |
| 1283 | 1283 |
| 1284 __ bind(&exit); | 1284 __ bind(&exit); |
| 1285 __ ret((argc + 1) * kPointerSize); | 1285 __ ret((argc + 1) * kPointerSize); |
| 1286 | 1286 |
| 1287 __ bind(&with_rset_update); | 1287 __ bind(&with_rset_update); |
| 1288 | 1288 |
| 1289 __ InNewSpace(ebx, ecx, equal, &exit); | 1289 __ InNewSpace(ebx, ecx, equal, &exit); |
| 1290 | 1290 |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2382 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 2382 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 2383 | 2383 |
| 2384 // Return the generated code. | 2384 // Return the generated code. |
| 2385 return GetCode(); | 2385 return GetCode(); |
| 2386 } | 2386 } |
| 2387 | 2387 |
| 2388 | 2388 |
| 2389 #undef __ | 2389 #undef __ |
| 2390 | 2390 |
| 2391 } } // namespace v8::internal | 2391 } } // namespace v8::internal |
| OLD | NEW |