| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 465 |
| 466 if (index < 0) { | 466 if (index < 0) { |
| 467 // Set the property straight into the object. | 467 // Set the property straight into the object. |
| 468 int offset = object->map()->instance_size() + (index * kPointerSize); | 468 int offset = object->map()->instance_size() + (index * kPointerSize); |
| 469 __ str(r0, FieldMemOperand(receiver_reg, offset)); | 469 __ str(r0, FieldMemOperand(receiver_reg, offset)); |
| 470 | 470 |
| 471 // Skip updating write barrier if storing a smi. | 471 // Skip updating write barrier if storing a smi. |
| 472 __ tst(r0, Operand(kSmiTagMask)); | 472 __ tst(r0, Operand(kSmiTagMask)); |
| 473 __ b(eq, &exit); | 473 __ b(eq, &exit); |
| 474 | 474 |
| 475 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 475 // Update the write barrier for the array address. | 476 // Update the write barrier for the array address. |
| 476 // Pass the now unused name_reg as a scratch register. | 477 // Pass the now unused name_reg as a scratch register. |
| 477 __ RecordWrite(receiver_reg, Operand(offset), name_reg, scratch); | 478 __ RecordWrite(receiver_reg, Operand(offset), name_reg, scratch); |
| 479 #endif |
| 478 } else { | 480 } else { |
| 479 // Write to the properties array. | 481 // Write to the properties array. |
| 480 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 482 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
| 481 // Get the properties array | 483 // Get the properties array |
| 482 __ ldr(scratch, FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | 484 __ ldr(scratch, FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
| 483 __ str(r0, FieldMemOperand(scratch, offset)); | 485 __ str(r0, FieldMemOperand(scratch, offset)); |
| 484 | 486 |
| 485 // Skip updating write barrier if storing a smi. | 487 // Skip updating write barrier if storing a smi. |
| 486 __ tst(r0, Operand(kSmiTagMask)); | 488 __ tst(r0, Operand(kSmiTagMask)); |
| 487 __ b(eq, &exit); | 489 __ b(eq, &exit); |
| 488 | 490 |
| 491 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 489 // Update the write barrier for the array address. | 492 // Update the write barrier for the array address. |
| 490 // Ok to clobber receiver_reg and name_reg, since we return. | 493 // Ok to clobber receiver_reg and name_reg, since we return. |
| 491 __ RecordWrite(scratch, Operand(offset), name_reg, receiver_reg); | 494 __ RecordWrite(scratch, Operand(offset), name_reg, receiver_reg); |
| 495 #endif |
| 492 } | 496 } |
| 493 | 497 |
| 494 // Return the value (register r0). | 498 // Return the value (register r0). |
| 495 __ bind(&exit); | 499 __ bind(&exit); |
| 496 __ Ret(); | 500 __ Ret(); |
| 497 } | 501 } |
| 498 | 502 |
| 499 | 503 |
| 500 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { | 504 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { |
| 501 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); | 505 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 Register end_elements = r5; | 1429 Register end_elements = r5; |
| 1426 | 1430 |
| 1427 // Get the elements array of the object. | 1431 // Get the elements array of the object. |
| 1428 __ ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); | 1432 __ ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); |
| 1429 | 1433 |
| 1430 // Check that the elements are in fast mode and writable. | 1434 // Check that the elements are in fast mode and writable. |
| 1431 __ CheckMap(elements, r0, | 1435 __ CheckMap(elements, r0, |
| 1432 Heap::kFixedArrayMapRootIndex, &call_builtin, true); | 1436 Heap::kFixedArrayMapRootIndex, &call_builtin, true); |
| 1433 | 1437 |
| 1434 if (argc == 1) { // Otherwise fall through to call the builtin. | 1438 if (argc == 1) { // Otherwise fall through to call the builtin. |
| 1435 Label exit, with_write_barrier, attempt_to_grow_elements; | 1439 Label exit, attempt_to_grow_elements; |
| 1440 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 1441 Label with_write_barrier; |
| 1442 #endif |
| 1436 | 1443 |
| 1437 // Get the array's length into r0 and calculate new length. | 1444 // Get the array's length into r0 and calculate new length. |
| 1438 __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 1445 __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 1439 STATIC_ASSERT(kSmiTagSize == 1); | 1446 STATIC_ASSERT(kSmiTagSize == 1); |
| 1440 STATIC_ASSERT(kSmiTag == 0); | 1447 STATIC_ASSERT(kSmiTag == 0); |
| 1441 __ add(r0, r0, Operand(Smi::FromInt(argc))); | 1448 __ add(r0, r0, Operand(Smi::FromInt(argc))); |
| 1442 | 1449 |
| 1443 // Get the element's length. | 1450 // Get the element's length. |
| 1444 __ ldr(r4, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 1451 __ ldr(r4, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
| 1445 | 1452 |
| 1446 // Check if we could survive without allocation. | 1453 // Check if we could survive without allocation. |
| 1447 __ cmp(r0, r4); | 1454 __ cmp(r0, r4); |
| 1448 __ b(gt, &attempt_to_grow_elements); | 1455 __ b(gt, &attempt_to_grow_elements); |
| 1449 | 1456 |
| 1450 // Save new length. | 1457 // Save new length. |
| 1451 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 1458 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 1452 | 1459 |
| 1453 // Push the element. | 1460 // Push the element. |
| 1454 __ ldr(r4, MemOperand(sp, (argc - 1) * kPointerSize)); | 1461 __ ldr(r4, MemOperand(sp, (argc - 1) * kPointerSize)); |
| 1455 // We may need a register containing the address end_elements below, | 1462 // We may need a register containing the address end_elements below, |
| 1456 // so write back the value in end_elements. | 1463 // so write back the value in end_elements. |
| 1457 __ add(end_elements, elements, | 1464 __ add(end_elements, elements, |
| 1458 Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); | 1465 Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 1459 const int kEndElementsOffset = | 1466 const int kEndElementsOffset = |
| 1460 FixedArray::kHeaderSize - kHeapObjectTag - argc * kPointerSize; | 1467 FixedArray::kHeaderSize - kHeapObjectTag - argc * kPointerSize; |
| 1461 __ str(r4, MemOperand(end_elements, kEndElementsOffset, PreIndex)); | 1468 __ str(r4, MemOperand(end_elements, kEndElementsOffset, PreIndex)); |
| 1462 | 1469 |
| 1463 // Check for a smi. | 1470 // Check for a smi. |
| 1471 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 1464 __ BranchOnNotSmi(r4, &with_write_barrier); | 1472 __ BranchOnNotSmi(r4, &with_write_barrier); |
| 1473 #endif |
| 1465 __ bind(&exit); | 1474 __ bind(&exit); |
| 1466 __ Drop(argc + 1); | 1475 __ Drop(argc + 1); |
| 1467 __ Ret(); | 1476 __ Ret(); |
| 1468 | 1477 |
| 1478 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 1469 __ bind(&with_write_barrier); | 1479 __ bind(&with_write_barrier); |
| 1470 __ InNewSpace(elements, r4, eq, &exit); | 1480 __ InNewSpace(elements, r4, eq, &exit); |
| 1471 __ RecordWriteHelper(elements, end_elements, r4); | 1481 __ RecordWriteHelper(elements, end_elements, r4); |
| 1472 __ Drop(argc + 1); | 1482 __ Drop(argc + 1); |
| 1473 __ Ret(); | 1483 __ Ret(); |
| 1484 #endif |
| 1474 | 1485 |
| 1475 __ bind(&attempt_to_grow_elements); | 1486 __ bind(&attempt_to_grow_elements); |
| 1476 // r0: array's length + 1. | 1487 // r0: array's length + 1. |
| 1477 // r4: elements' length. | 1488 // r4: elements' length. |
| 1478 | 1489 |
| 1479 if (!FLAG_inline_new) { | 1490 if (!FLAG_inline_new) { |
| 1480 __ b(&call_builtin); | 1491 __ b(&call_builtin); |
| 1481 } | 1492 } |
| 1482 | 1493 |
| 1483 ExternalReference new_space_allocation_top = | 1494 ExternalReference new_space_allocation_top = |
| (...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3034 } | 3045 } |
| 3035 // Compare smis. | 3046 // Compare smis. |
| 3036 __ cmp(key_reg, scratch); | 3047 __ cmp(key_reg, scratch); |
| 3037 __ b(hs, &miss); | 3048 __ b(hs, &miss); |
| 3038 | 3049 |
| 3039 __ add(scratch, | 3050 __ add(scratch, |
| 3040 elements_reg, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 3051 elements_reg, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 3041 ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); | 3052 ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); |
| 3042 __ str(value_reg, | 3053 __ str(value_reg, |
| 3043 MemOperand(scratch, key_reg, LSL, kPointerSizeLog2 - kSmiTagSize)); | 3054 MemOperand(scratch, key_reg, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 3055 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 3044 __ RecordWrite(scratch, | 3056 __ RecordWrite(scratch, |
| 3045 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize), | 3057 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize), |
| 3046 receiver_reg , elements_reg); | 3058 receiver_reg , elements_reg); |
| 3059 #endif |
| 3047 | 3060 |
| 3048 // value_reg (r0) is preserved. | 3061 // value_reg (r0) is preserved. |
| 3049 // Done. | 3062 // Done. |
| 3050 __ Ret(); | 3063 __ Ret(); |
| 3051 | 3064 |
| 3052 __ bind(&miss); | 3065 __ bind(&miss); |
| 3053 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); | 3066 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); |
| 3054 __ Jump(ic, RelocInfo::CODE_TARGET); | 3067 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 3055 | 3068 |
| 3056 // Return the generated code. | 3069 // Return the generated code. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3200 // Return the generated code. | 3213 // Return the generated code. |
| 3201 return GetCode(); | 3214 return GetCode(); |
| 3202 } | 3215 } |
| 3203 | 3216 |
| 3204 | 3217 |
| 3205 #undef __ | 3218 #undef __ |
| 3206 | 3219 |
| 3207 } } // namespace v8::internal | 3220 } } // namespace v8::internal |
| 3208 | 3221 |
| 3209 #endif // V8_TARGET_ARCH_ARM | 3222 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |