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 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 void CopyFrom(const CodeDesc& desc); | 2251 void CopyFrom(const CodeDesc& desc); |
2252 | 2252 |
2253 // Returns the object size for a given body and sinfo size (Used for | 2253 // Returns the object size for a given body and sinfo size (Used for |
2254 // allocation). | 2254 // allocation). |
2255 static int SizeFor(int body_size, int sinfo_size) { | 2255 static int SizeFor(int body_size, int sinfo_size) { |
2256 ASSERT_SIZE_TAG_ALIGNED(body_size); | 2256 ASSERT_SIZE_TAG_ALIGNED(body_size); |
2257 ASSERT_SIZE_TAG_ALIGNED(sinfo_size); | 2257 ASSERT_SIZE_TAG_ALIGNED(sinfo_size); |
2258 return RoundUp(kHeaderSize + body_size + sinfo_size, kCodeAlignment); | 2258 return RoundUp(kHeaderSize + body_size + sinfo_size, kCodeAlignment); |
2259 } | 2259 } |
2260 | 2260 |
| 2261 // Calculate the size of the code object to report for log events. This takes |
| 2262 // the layout of the code object into account. |
| 2263 int ExecutableSize() { |
| 2264 // Check that the assumptions about the layout of the code object holds. |
| 2265 ASSERT_EQ(reinterpret_cast<unsigned int>(instruction_start()) - |
| 2266 reinterpret_cast<unsigned int>(address()), |
| 2267 Code::kHeaderSize); |
| 2268 return instruction_size() + Code::kHeaderSize; |
| 2269 } |
| 2270 |
2261 // Locating source position. | 2271 // Locating source position. |
2262 int SourcePosition(Address pc); | 2272 int SourcePosition(Address pc); |
2263 int SourceStatementPosition(Address pc); | 2273 int SourceStatementPosition(Address pc); |
2264 | 2274 |
2265 // Casting. | 2275 // Casting. |
2266 static inline Code* cast(Object* obj); | 2276 static inline Code* cast(Object* obj); |
2267 | 2277 |
2268 // Dispatched behavior. | 2278 // Dispatched behavior. |
2269 int CodeSize() { return SizeFor(body_size(), sinfo_size()); } | 2279 int CodeSize() { return SizeFor(body_size(), sinfo_size()); } |
2270 void CodeIterateBody(ObjectVisitor* v); | 2280 void CodeIterateBody(ObjectVisitor* v); |
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4279 } else { | 4289 } else { |
4280 value &= ~(1 << bit_position); | 4290 value &= ~(1 << bit_position); |
4281 } | 4291 } |
4282 return value; | 4292 return value; |
4283 } | 4293 } |
4284 }; | 4294 }; |
4285 | 4295 |
4286 } } // namespace v8::internal | 4296 } } // namespace v8::internal |
4287 | 4297 |
4288 #endif // V8_OBJECTS_H_ | 4298 #endif // V8_OBJECTS_H_ |
OLD | NEW |