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 2766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2777 | 2777 |
2778 | 2778 |
2779 JSValue* JSValue::cast(Object* obj) { | 2779 JSValue* JSValue::cast(Object* obj) { |
2780 ASSERT(obj->IsJSValue()); | 2780 ASSERT(obj->IsJSValue()); |
2781 ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize); | 2781 ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize); |
2782 return reinterpret_cast<JSValue*>(obj); | 2782 return reinterpret_cast<JSValue*>(obj); |
2783 } | 2783 } |
2784 | 2784 |
2785 | 2785 |
2786 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 2786 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
2787 INT_ACCESSORS(Code, relocation_size, kRelocationSizeOffset) | 2787 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) |
2788 INT_ACCESSORS(Code, sinfo_size, kSInfoSizeOffset) | 2788 INT_ACCESSORS(Code, sinfo_size, kSInfoSizeOffset) |
2789 | 2789 |
2790 | 2790 |
2791 byte* Code::instruction_start() { | 2791 byte* Code::instruction_start() { |
2792 return FIELD_ADDR(this, kHeaderSize); | 2792 return FIELD_ADDR(this, kHeaderSize); |
2793 } | 2793 } |
2794 | 2794 |
2795 | 2795 |
| 2796 byte* Code::instruction_end() { |
| 2797 return instruction_start() + instruction_size(); |
| 2798 } |
| 2799 |
| 2800 |
2796 int Code::body_size() { | 2801 int Code::body_size() { |
2797 return RoundUp(instruction_size() + relocation_size(), kObjectAlignment); | 2802 return RoundUp(instruction_size(), kObjectAlignment); |
| 2803 } |
| 2804 |
| 2805 |
| 2806 ByteArray* Code::unchecked_relocation_info() { |
| 2807 return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset)); |
2798 } | 2808 } |
2799 | 2809 |
2800 | 2810 |
2801 byte* Code::relocation_start() { | 2811 byte* Code::relocation_start() { |
2802 return FIELD_ADDR(this, kHeaderSize + instruction_size()); | 2812 return unchecked_relocation_info()->GetDataStartAddress(); |
| 2813 } |
| 2814 |
| 2815 |
| 2816 int Code::relocation_size() { |
| 2817 return unchecked_relocation_info()->length(); |
2803 } | 2818 } |
2804 | 2819 |
2805 | 2820 |
2806 byte* Code::entry() { | 2821 byte* Code::entry() { |
2807 return instruction_start(); | 2822 return instruction_start(); |
2808 } | 2823 } |
2809 | 2824 |
2810 | 2825 |
2811 bool Code::contains(byte* pc) { | 2826 bool Code::contains(byte* pc) { |
2812 return (instruction_start() <= pc) && | 2827 return (instruction_start() <= pc) && |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3264 #undef WRITE_INT_FIELD | 3279 #undef WRITE_INT_FIELD |
3265 #undef READ_SHORT_FIELD | 3280 #undef READ_SHORT_FIELD |
3266 #undef WRITE_SHORT_FIELD | 3281 #undef WRITE_SHORT_FIELD |
3267 #undef READ_BYTE_FIELD | 3282 #undef READ_BYTE_FIELD |
3268 #undef WRITE_BYTE_FIELD | 3283 #undef WRITE_BYTE_FIELD |
3269 | 3284 |
3270 | 3285 |
3271 } } // namespace v8::internal | 3286 } } // namespace v8::internal |
3272 | 3287 |
3273 #endif // V8_OBJECTS_INL_H_ | 3288 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |