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 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2248 void Relocate(int delta); | 2248 void Relocate(int delta); |
2249 | 2249 |
2250 // Migrate code described by desc. | 2250 // Migrate code described by desc. |
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 kHeaderSize + body_size + sinfo_size; | 2258 return RoundUp(kHeaderSize + body_size + sinfo_size, kCodeAlignment); |
2259 } | 2259 } |
2260 | 2260 |
2261 // Locating source position. | 2261 // Locating source position. |
2262 int SourcePosition(Address pc); | 2262 int SourcePosition(Address pc); |
2263 int SourceStatementPosition(Address pc); | 2263 int SourceStatementPosition(Address pc); |
2264 | 2264 |
2265 // Casting. | 2265 // Casting. |
2266 static inline Code* cast(Object* obj); | 2266 static inline Code* cast(Object* obj); |
2267 | 2267 |
2268 // Dispatched behavior. | 2268 // Dispatched behavior. |
2269 int CodeSize() { return SizeFor(body_size(), sinfo_size()); } | 2269 int CodeSize() { return SizeFor(body_size(), sinfo_size()); } |
2270 void CodeIterateBody(ObjectVisitor* v); | 2270 void CodeIterateBody(ObjectVisitor* v); |
2271 #ifdef DEBUG | 2271 #ifdef DEBUG |
2272 void CodePrint(); | 2272 void CodePrint(); |
2273 void CodeVerify(); | 2273 void CodeVerify(); |
2274 #endif | 2274 #endif |
2275 | 2275 |
2276 // Layout description. | 2276 // Layout description. |
2277 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 2277 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
2278 static const int kRelocationSizeOffset = kInstructionSizeOffset + kIntSize; | 2278 static const int kRelocationSizeOffset = kInstructionSizeOffset + kIntSize; |
2279 static const int kSInfoSizeOffset = kRelocationSizeOffset + kIntSize; | 2279 static const int kSInfoSizeOffset = kRelocationSizeOffset + kIntSize; |
2280 static const int kFlagsOffset = kSInfoSizeOffset + kIntSize; | 2280 static const int kFlagsOffset = kSInfoSizeOffset + kIntSize; |
2281 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; | 2281 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; |
2282 static const int kHeaderSize = kKindSpecificFlagsOffset + kIntSize; | 2282 static const int kFiller6Offset = kKindSpecificFlagsOffset + kIntSize; |
Kasper Lund
2009/02/27 10:32:11
Comment on why you need fillers here?
iposva
2009/02/27 11:08:28
Done.
| |
2283 static const int kFiller7Offset = kFiller6Offset + kIntSize; | |
2284 static const int kHeaderSize = kFiller7Offset + kIntSize; | |
2285 | |
2286 // Code entry points are aligned to 32 bytes. | |
2287 static const int kCodeAlignment = 32; | |
2283 | 2288 |
2284 // Byte offsets within kKindSpecificFlagsOffset. | 2289 // Byte offsets within kKindSpecificFlagsOffset. |
2285 static const int kICFlagOffset = kKindSpecificFlagsOffset + 0; | 2290 static const int kICFlagOffset = kKindSpecificFlagsOffset + 0; |
2286 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset + 1; | 2291 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset + 1; |
2287 | 2292 |
2288 // Flags layout. | 2293 // Flags layout. |
2289 static const int kFlagsICStateShift = 0; | 2294 static const int kFlagsICStateShift = 0; |
2290 static const int kFlagsKindShift = 3; | 2295 static const int kFlagsKindShift = 3; |
2291 static const int kFlagsTypeShift = 6; | 2296 static const int kFlagsTypeShift = 6; |
2292 static const int kFlagsArgumentsCountShift = 9; | 2297 static const int kFlagsArgumentsCountShift = 9; |
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4238 } else { | 4243 } else { |
4239 value &= ~(1 << bit_position); | 4244 value &= ~(1 << bit_position); |
4240 } | 4245 } |
4241 return value; | 4246 return value; |
4242 } | 4247 } |
4243 }; | 4248 }; |
4244 | 4249 |
4245 } } // namespace v8::internal | 4250 } } // namespace v8::internal |
4246 | 4251 |
4247 #endif // V8_OBJECTS_H_ | 4252 #endif // V8_OBJECTS_H_ |
OLD | NEW |