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 2789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2800 | 2800 |
2801 | 2801 |
2802 JSValue* JSValue::cast(Object* obj) { | 2802 JSValue* JSValue::cast(Object* obj) { |
2803 ASSERT(obj->IsJSValue()); | 2803 ASSERT(obj->IsJSValue()); |
2804 ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize); | 2804 ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize); |
2805 return reinterpret_cast<JSValue*>(obj); | 2805 return reinterpret_cast<JSValue*>(obj); |
2806 } | 2806 } |
2807 | 2807 |
2808 | 2808 |
2809 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 2809 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
2810 INT_ACCESSORS(Code, relocation_size, kRelocationSizeOffset) | 2810 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) |
2811 INT_ACCESSORS(Code, sinfo_size, kSInfoSizeOffset) | 2811 INT_ACCESSORS(Code, sinfo_size, kSInfoSizeOffset) |
2812 | 2812 |
2813 | 2813 |
2814 byte* Code::instruction_start() { | 2814 byte* Code::instruction_start() { |
2815 return FIELD_ADDR(this, kHeaderSize); | 2815 return FIELD_ADDR(this, kHeaderSize); |
2816 } | 2816 } |
2817 | 2817 |
2818 | 2818 |
| 2819 byte* Code::instruction_end() { |
| 2820 return instruction_start() + instruction_size(); |
| 2821 } |
| 2822 |
| 2823 |
2819 int Code::body_size() { | 2824 int Code::body_size() { |
2820 return RoundUp(instruction_size() + relocation_size(), kObjectAlignment); | 2825 return RoundUp(instruction_size(), kObjectAlignment); |
| 2826 } |
| 2827 |
| 2828 |
| 2829 ByteArray* Code::unchecked_relocation_info() { |
| 2830 return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset)); |
2821 } | 2831 } |
2822 | 2832 |
2823 | 2833 |
2824 byte* Code::relocation_start() { | 2834 byte* Code::relocation_start() { |
2825 return FIELD_ADDR(this, kHeaderSize + instruction_size()); | 2835 return unchecked_relocation_info()->GetDataStartAddress(); |
| 2836 } |
| 2837 |
| 2838 |
| 2839 int Code::relocation_size() { |
| 2840 return unchecked_relocation_info()->length(); |
2826 } | 2841 } |
2827 | 2842 |
2828 | 2843 |
2829 byte* Code::entry() { | 2844 byte* Code::entry() { |
2830 return instruction_start(); | 2845 return instruction_start(); |
2831 } | 2846 } |
2832 | 2847 |
2833 | 2848 |
2834 bool Code::contains(byte* pc) { | 2849 bool Code::contains(byte* pc) { |
2835 return (instruction_start() <= pc) && | 2850 return (instruction_start() <= pc) && |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3287 #undef WRITE_INT_FIELD | 3302 #undef WRITE_INT_FIELD |
3288 #undef READ_SHORT_FIELD | 3303 #undef READ_SHORT_FIELD |
3289 #undef WRITE_SHORT_FIELD | 3304 #undef WRITE_SHORT_FIELD |
3290 #undef READ_BYTE_FIELD | 3305 #undef READ_BYTE_FIELD |
3291 #undef WRITE_BYTE_FIELD | 3306 #undef WRITE_BYTE_FIELD |
3292 | 3307 |
3293 | 3308 |
3294 } } // namespace v8::internal | 3309 } } // namespace v8::internal |
3295 | 3310 |
3296 #endif // V8_OBJECTS_INL_H_ | 3311 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |