| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2731 // GetCodeFromTargetAddress might be called when marking objects during mark | 2731 // GetCodeFromTargetAddress might be called when marking objects during mark |
| 2732 // sweep. reinterpret_cast is therefore used instead of the more appropriate | 2732 // sweep. reinterpret_cast is therefore used instead of the more appropriate |
| 2733 // Code::cast. Code::cast does not work when the object's map is | 2733 // Code::cast. Code::cast does not work when the object's map is |
| 2734 // marked. | 2734 // marked. |
| 2735 Code* result = reinterpret_cast<Code*>(code); | 2735 Code* result = reinterpret_cast<Code*>(code); |
| 2736 return result; | 2736 return result; |
| 2737 } | 2737 } |
| 2738 | 2738 |
| 2739 | 2739 |
| 2740 Heap* Map::heap() { | 2740 Heap* Map::heap() { |
| 2741 Heap* heap = reinterpret_cast<Heap*>(READ_INTPTR_FIELD(this, kHeapOffset)); | 2741 // NOTE: address() helper is not used to save one instruction. |
| 2742 Heap* heap = Page::FromAddress(reinterpret_cast<Address>(this))->heap_; |
| 2742 ASSERT(heap != NULL); | 2743 ASSERT(heap != NULL); |
| 2743 ASSERT(heap->isolate() == Isolate::Current()); | 2744 ASSERT(heap->isolate() == Isolate::Current()); |
| 2744 return heap; | 2745 return heap; |
| 2745 } | 2746 } |
| 2746 | 2747 |
| 2747 | 2748 |
| 2748 void Map::set_heap(Heap* heap) { | |
| 2749 ASSERT(heap != NULL); | |
| 2750 ASSERT(heap->isolate() == Isolate::Current()); | |
| 2751 // WRITE_FIELD does not invoke write barrier, but there is no need here. | |
| 2752 WRITE_INTPTR_FIELD(this, kHeapOffset, reinterpret_cast<intptr_t>(heap)); | |
| 2753 } | |
| 2754 | |
| 2755 | |
| 2756 Object* Code::GetObjectFromEntryAddress(Address location_of_address) { | 2749 Object* Code::GetObjectFromEntryAddress(Address location_of_address) { |
| 2757 return HeapObject:: | 2750 return HeapObject:: |
| 2758 FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize); | 2751 FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize); |
| 2759 } | 2752 } |
| 2760 | 2753 |
| 2761 | 2754 |
| 2762 Object* Map::prototype() { | 2755 Object* Map::prototype() { |
| 2763 return READ_FIELD(this, kPrototypeOffset); | 2756 return READ_FIELD(this, kPrototypeOffset); |
| 2764 } | 2757 } |
| 2765 | 2758 |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4020 #undef WRITE_INT_FIELD | 4013 #undef WRITE_INT_FIELD |
| 4021 #undef READ_SHORT_FIELD | 4014 #undef READ_SHORT_FIELD |
| 4022 #undef WRITE_SHORT_FIELD | 4015 #undef WRITE_SHORT_FIELD |
| 4023 #undef READ_BYTE_FIELD | 4016 #undef READ_BYTE_FIELD |
| 4024 #undef WRITE_BYTE_FIELD | 4017 #undef WRITE_BYTE_FIELD |
| 4025 | 4018 |
| 4026 | 4019 |
| 4027 } } // namespace v8::internal | 4020 } } // namespace v8::internal |
| 4028 | 4021 |
| 4029 #endif // V8_OBJECTS_INL_H_ | 4022 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |