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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 697 |
698 | 698 |
699 Object* Object::GetProperty(String* key, PropertyAttributes* attributes) { | 699 Object* Object::GetProperty(String* key, PropertyAttributes* attributes) { |
700 return GetPropertyWithReceiver(this, key, attributes); | 700 return GetPropertyWithReceiver(this, key, attributes); |
701 } | 701 } |
702 | 702 |
703 | 703 |
704 #define FIELD_ADDR(p, offset) \ | 704 #define FIELD_ADDR(p, offset) \ |
705 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | 705 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
706 | 706 |
| 707 #define FIELD_ADDR_ALIGNED_8(p, offset) \ |
| 708 (reinterpret_cast<byte*>((reinterpret_cast<intptr_t>(p) + offset - kHeapObject
Tag + 4) & -8)) |
| 709 |
707 #define READ_FIELD(p, offset) \ | 710 #define READ_FIELD(p, offset) \ |
708 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) | 711 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) |
709 | 712 |
710 #define WRITE_FIELD(p, offset, value) \ | 713 #define WRITE_FIELD(p, offset, value) \ |
711 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) | 714 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) |
712 | 715 |
713 | |
714 #define WRITE_BARRIER(object, offset) \ | 716 #define WRITE_BARRIER(object, offset) \ |
715 Heap::RecordWrite(object->address(), offset); | 717 Heap::RecordWrite(object->address(), offset); |
716 | 718 |
717 // CONDITIONAL_WRITE_BARRIER must be issued after the actual | 719 // CONDITIONAL_WRITE_BARRIER must be issued after the actual |
718 // write due to the assert validating the written value. | 720 // write due to the assert validating the written value. |
719 #define CONDITIONAL_WRITE_BARRIER(object, offset, mode) \ | 721 #define CONDITIONAL_WRITE_BARRIER(object, offset, mode) \ |
720 if (mode == UPDATE_WRITE_BARRIER) { \ | 722 if (mode == UPDATE_WRITE_BARRIER) { \ |
721 Heap::RecordWrite(object->address(), offset); \ | 723 Heap::RecordWrite(object->address(), offset); \ |
722 } else { \ | 724 } else { \ |
723 ASSERT(mode == SKIP_WRITE_BARRIER); \ | 725 ASSERT(mode == SKIP_WRITE_BARRIER); \ |
724 ASSERT(Heap::InNewSpace(object) || \ | 726 ASSERT(Heap::InNewSpace(object) || \ |
725 !Heap::InNewSpace(READ_FIELD(object, offset))); \ | 727 !Heap::InNewSpace(READ_FIELD(object, offset))); \ |
726 } | 728 } |
727 | 729 |
728 #define READ_DOUBLE_FIELD(p, offset) \ | 730 #define READ_HEAP_NUMBER_FIELD(p, offset) \ |
729 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset))) | 731 (*reinterpret_cast<double*>(FIELD_ADDR_ALIGNED_8(p, offset))) |
730 | 732 |
731 #define WRITE_DOUBLE_FIELD(p, offset, value) \ | 733 #define WRITE_HEAP_NUMBER_FIELD(p, offset, value) \ |
732 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset)) = value) | 734 (*reinterpret_cast<double*>(FIELD_ADDR_ALIGNED_8(p, offset)) = value) |
733 | 735 |
734 #define READ_INT_FIELD(p, offset) \ | 736 #define READ_INT_FIELD(p, offset) \ |
735 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset))) | 737 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset))) |
736 | 738 |
737 #define WRITE_INT_FIELD(p, offset, value) \ | 739 #define WRITE_INT_FIELD(p, offset, value) \ |
738 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value) | 740 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value) |
739 | 741 |
740 #define READ_INTPTR_FIELD(p, offset) \ | 742 #define READ_INTPTR_FIELD(p, offset) \ |
741 (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset))) | 743 (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset))) |
742 | 744 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 | 1094 |
1093 void HeapObject::ClearOverflow() { | 1095 void HeapObject::ClearOverflow() { |
1094 ASSERT(IsOverflowed()); | 1096 ASSERT(IsOverflowed()); |
1095 MapWord first_word = map_word(); | 1097 MapWord first_word = map_word(); |
1096 first_word.ClearOverflow(); | 1098 first_word.ClearOverflow(); |
1097 set_map_word(first_word); | 1099 set_map_word(first_word); |
1098 } | 1100 } |
1099 | 1101 |
1100 | 1102 |
1101 double HeapNumber::value() { | 1103 double HeapNumber::value() { |
1102 return READ_DOUBLE_FIELD(this, kValueOffset); | 1104 return READ_HEAP_NUMBER_FIELD(this, kValueMinimumOffset); |
1103 } | 1105 } |
1104 | 1106 |
1105 | 1107 |
1106 void HeapNumber::set_value(double value) { | 1108 void HeapNumber::set_value(double value) { |
1107 WRITE_DOUBLE_FIELD(this, kValueOffset, value); | 1109 WRITE_HEAP_NUMBER_FIELD(this, kValueMinimumOffset, value); |
1108 } | 1110 } |
1109 | 1111 |
1110 | 1112 |
1111 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) | 1113 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) |
1112 | 1114 |
1113 | 1115 |
1114 Array* JSObject::elements() { | 1116 Array* JSObject::elements() { |
1115 Object* array = READ_FIELD(this, kElementsOffset); | 1117 Object* array = READ_FIELD(this, kElementsOffset); |
1116 // In the assert below Dictionary is covered under FixedArray. | 1118 // In the assert below Dictionary is covered under FixedArray. |
1117 ASSERT(array->IsFixedArray() || array->IsPixelArray() || | 1119 ASSERT(array->IsFixedArray() || array->IsPixelArray() || |
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3013 } | 3015 } |
3014 | 3016 |
3015 | 3017 |
3016 #undef CAST_ACCESSOR | 3018 #undef CAST_ACCESSOR |
3017 #undef INT_ACCESSORS | 3019 #undef INT_ACCESSORS |
3018 #undef SMI_ACCESSORS | 3020 #undef SMI_ACCESSORS |
3019 #undef ACCESSORS | 3021 #undef ACCESSORS |
3020 #undef FIELD_ADDR | 3022 #undef FIELD_ADDR |
3021 #undef READ_FIELD | 3023 #undef READ_FIELD |
3022 #undef WRITE_FIELD | 3024 #undef WRITE_FIELD |
| 3025 #undef FIELD_ADDR_ALIGNED_8 |
3023 #undef WRITE_BARRIER | 3026 #undef WRITE_BARRIER |
3024 #undef CONDITIONAL_WRITE_BARRIER | 3027 #undef CONDITIONAL_WRITE_BARRIER |
3025 #undef READ_MEMADDR_FIELD | 3028 #undef READ_MEMADDR_FIELD |
3026 #undef WRITE_MEMADDR_FIELD | 3029 #undef WRITE_MEMADDR_FIELD |
3027 #undef READ_DOUBLE_FIELD | 3030 #undef READ_HEAP_NUMBER_FIELD |
3028 #undef WRITE_DOUBLE_FIELD | 3031 #undef WRITE_HEAP_NUMBER_FIELD |
3029 #undef READ_INT_FIELD | 3032 #undef READ_INT_FIELD |
3030 #undef WRITE_INT_FIELD | 3033 #undef WRITE_INT_FIELD |
3031 #undef READ_SHORT_FIELD | 3034 #undef READ_SHORT_FIELD |
3032 #undef WRITE_SHORT_FIELD | 3035 #undef WRITE_SHORT_FIELD |
3033 #undef READ_BYTE_FIELD | 3036 #undef READ_BYTE_FIELD |
3034 #undef WRITE_BYTE_FIELD | 3037 #undef WRITE_BYTE_FIELD |
3035 | 3038 |
3036 | 3039 |
3037 } } // namespace v8::internal | 3040 } } // namespace v8::internal |
3038 | 3041 |
3039 #endif // V8_OBJECTS_INL_H_ | 3042 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |