OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // Perform map transition for the receiver if necessary. | 414 // Perform map transition for the receiver if necessary. |
415 if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) { | 415 if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) { |
416 // The properties must be extended before we can store the value. | 416 // The properties must be extended before we can store the value. |
417 // We jump to a runtime call that extends the propeties array. | 417 // We jump to a runtime call that extends the propeties array. |
418 __ mov(r2, Operand(Handle<Map>(transition))); | 418 __ mov(r2, Operand(Handle<Map>(transition))); |
419 // Please note, if we implement keyed store for arm we need | 419 // Please note, if we implement keyed store for arm we need |
420 // to call the Builtins::KeyedStoreIC_ExtendStorage. | 420 // to call the Builtins::KeyedStoreIC_ExtendStorage. |
421 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_ExtendStorage)); | 421 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_ExtendStorage)); |
422 __ Jump(ic, RelocInfo::CODE_TARGET); | 422 __ Jump(ic, RelocInfo::CODE_TARGET); |
423 } else { | 423 } else { |
424 // Get the properties array | 424 // Adjust for the number of properties stored in the object. Even in the |
425 __ ldr(r1, FieldMemOperand(r3, JSObject::kPropertiesOffset)); | 425 // face of a transition we can use the old map here because the size of the |
| 426 // object and the number of in-object properties is not going to change. |
| 427 index -= object->map()->inobject_properties(); |
| 428 |
| 429 if (index >= 0) { |
| 430 // Get the properties array |
| 431 __ ldr(r1, FieldMemOperand(r3, JSObject::kPropertiesOffset)); |
| 432 } |
426 | 433 |
427 if (transition != NULL) { | 434 if (transition != NULL) { |
428 // Update the map of the object; no write barrier updating is | 435 // Update the map of the object; no write barrier updating is |
429 // needed because the map is never in new space. | 436 // needed because the map is never in new space. |
430 __ mov(ip, Operand(Handle<Map>(transition))); | 437 __ mov(ip, Operand(Handle<Map>(transition))); |
431 __ str(ip, FieldMemOperand(r3, HeapObject::kMapOffset)); | 438 __ str(ip, FieldMemOperand(r3, HeapObject::kMapOffset)); |
432 } | 439 } |
433 | 440 |
434 // Write to the properties array. | 441 if (index < 0) { |
435 int offset = index * kPointerSize + Array::kHeaderSize; | 442 // Set the property straight into the object. |
436 __ str(r0, FieldMemOperand(r1, offset)); | 443 int offset = object->map()->instance_size() + (index * kPointerSize); |
| 444 __ str(r0, FieldMemOperand(r3, offset)); |
| 445 |
| 446 // Skip updating write barrier if storing a smi. |
| 447 __ tst(r0, Operand(kSmiTagMask)); |
| 448 __ b(eq, &exit); |
| 449 |
| 450 // Update the write barrier for the array address. |
| 451 __ mov(r1, Operand(offset)); |
| 452 __ RecordWrite(r3, r1, r2); |
| 453 } else { |
| 454 // Write to the properties array. |
| 455 int offset = index * kPointerSize + Array::kHeaderSize; |
| 456 __ str(r0, FieldMemOperand(r1, offset)); |
437 | 457 |
438 // Skip updating write barrier if storing a smi. | 458 // Skip updating write barrier if storing a smi. |
439 __ tst(r0, Operand(kSmiTagMask)); | 459 __ tst(r0, Operand(kSmiTagMask)); |
440 __ b(eq, &exit); | 460 __ b(eq, &exit); |
441 | 461 |
442 // Update the write barrier for the array address. | 462 // Update the write barrier for the array address. |
443 __ mov(r3, Operand(offset)); | 463 __ mov(r3, Operand(offset)); |
444 __ RecordWrite(r1, r3, r2); // OK to clobber r2, since we return | 464 __ RecordWrite(r1, r3, r2); // OK to clobber r2, since we return |
| 465 } |
445 | 466 |
446 // Return the value (register r0). | 467 // Return the value (register r0). |
447 __ bind(&exit); | 468 __ bind(&exit); |
448 __ Ret(); | 469 __ Ret(); |
449 } | 470 } |
450 // Handle store cache miss. | 471 // Handle store cache miss. |
451 __ bind(&miss); | 472 __ bind(&miss); |
452 __ mov(r2, Operand(Handle<String>(name))); // restore name | 473 __ mov(r2, Operand(Handle<String>(name))); // restore name |
453 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 474 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
454 __ Jump(ic, RelocInfo::CODE_TARGET); | 475 __ Jump(ic, RelocInfo::CODE_TARGET); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 604 |
584 __ ldr(r0, MemOperand(sp, 0)); | 605 __ ldr(r0, MemOperand(sp, 0)); |
585 | 606 |
586 // Check that the receiver isn't a smi. | 607 // Check that the receiver isn't a smi. |
587 __ tst(r0, Operand(kSmiTagMask)); | 608 __ tst(r0, Operand(kSmiTagMask)); |
588 __ b(eq, &miss); | 609 __ b(eq, &miss); |
589 | 610 |
590 // Check that the maps haven't changed. | 611 // Check that the maps haven't changed. |
591 Register reg = __ CheckMaps(object, r0, holder, r3, r1, &miss); | 612 Register reg = __ CheckMaps(object, r0, holder, r3, r1, &miss); |
592 | 613 |
593 // Get the properties array of the holder. | 614 // Adjust for the number of properties stored in the holder. |
594 __ ldr(r3, FieldMemOperand(reg, JSObject::kPropertiesOffset)); | 615 index -= holder->map()->inobject_properties(); |
595 | 616 if (index < 0) { |
596 // Return the value from the properties array. | 617 // Get the property straight out of the holder. |
597 int offset = index * kPointerSize + Array::kHeaderSize; | 618 int offset = holder->map()->instance_size() + (index * kPointerSize); |
598 __ ldr(r0, FieldMemOperand(r3, offset)); | 619 __ ldr(r0, FieldMemOperand(reg, offset)); |
| 620 } else { |
| 621 // Get the properties array of the holder. |
| 622 __ ldr(r3, FieldMemOperand(reg, JSObject::kPropertiesOffset)); |
| 623 // Return the value from the properties array. |
| 624 int offset = index * kPointerSize + Array::kHeaderSize; |
| 625 __ ldr(r0, FieldMemOperand(r3, offset)); |
| 626 } |
599 __ Ret(); | 627 __ Ret(); |
600 | 628 |
601 // Handle load cache miss. | 629 // Handle load cache miss. |
602 __ bind(&miss); | 630 __ bind(&miss); |
603 __ ldr(r0, MemOperand(sp)); // restore receiver | 631 __ ldr(r0, MemOperand(sp)); // restore receiver |
604 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); | 632 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); |
605 __ Jump(ic, RelocInfo::CODE_TARGET); | 633 __ Jump(ic, RelocInfo::CODE_TARGET); |
606 | 634 |
607 // Return the generated code. | 635 // Return the generated code. |
608 return GetCode(FIELD); | 636 return GetCode(FIELD); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 String* name) { | 826 String* name) { |
799 UNIMPLEMENTED(); | 827 UNIMPLEMENTED(); |
800 return Heap::undefined_value(); | 828 return Heap::undefined_value(); |
801 } | 829 } |
802 | 830 |
803 | 831 |
804 | 832 |
805 #undef __ | 833 #undef __ |
806 | 834 |
807 } } // namespace v8::internal | 835 } } // namespace v8::internal |
OLD | NEW |