| 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 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 bool Code::is_inline_cache_stub() { | 2256 bool Code::is_inline_cache_stub() { |
| 2257 Kind kind = this->kind(); | 2257 Kind kind = this->kind(); |
| 2258 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; | 2258 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; |
| 2259 } | 2259 } |
| 2260 | 2260 |
| 2261 | 2261 |
| 2262 Code::Flags Code::ComputeFlags(Kind kind, | 2262 Code::Flags Code::ComputeFlags(Kind kind, |
| 2263 InLoopFlag in_loop, | 2263 InLoopFlag in_loop, |
| 2264 InlineCacheState ic_state, | 2264 InlineCacheState ic_state, |
| 2265 PropertyType type, | 2265 PropertyType type, |
| 2266 int argc) { | 2266 int argc, |
| 2267 InlineCacheHolderFlag holder) { |
| 2267 // Compute the bit mask. | 2268 // Compute the bit mask. |
| 2268 int bits = kind << kFlagsKindShift; | 2269 int bits = kind << kFlagsKindShift; |
| 2269 if (in_loop) bits |= kFlagsICInLoopMask; | 2270 if (in_loop) bits |= kFlagsICInLoopMask; |
| 2270 bits |= ic_state << kFlagsICStateShift; | 2271 bits |= ic_state << kFlagsICStateShift; |
| 2271 bits |= type << kFlagsTypeShift; | 2272 bits |= type << kFlagsTypeShift; |
| 2272 bits |= argc << kFlagsArgumentsCountShift; | 2273 bits |= argc << kFlagsArgumentsCountShift; |
| 2274 if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask; |
| 2273 // Cast to flags and validate result before returning it. | 2275 // Cast to flags and validate result before returning it. |
| 2274 Flags result = static_cast<Flags>(bits); | 2276 Flags result = static_cast<Flags>(bits); |
| 2275 ASSERT(ExtractKindFromFlags(result) == kind); | 2277 ASSERT(ExtractKindFromFlags(result) == kind); |
| 2276 ASSERT(ExtractICStateFromFlags(result) == ic_state); | 2278 ASSERT(ExtractICStateFromFlags(result) == ic_state); |
| 2277 ASSERT(ExtractICInLoopFromFlags(result) == in_loop); | 2279 ASSERT(ExtractICInLoopFromFlags(result) == in_loop); |
| 2278 ASSERT(ExtractTypeFromFlags(result) == type); | 2280 ASSERT(ExtractTypeFromFlags(result) == type); |
| 2279 ASSERT(ExtractArgumentsCountFromFlags(result) == argc); | 2281 ASSERT(ExtractArgumentsCountFromFlags(result) == argc); |
| 2280 return result; | 2282 return result; |
| 2281 } | 2283 } |
| 2282 | 2284 |
| 2283 | 2285 |
| 2284 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 2286 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
| 2285 PropertyType type, | 2287 PropertyType type, |
| 2288 InlineCacheHolderFlag holder, |
| 2286 InLoopFlag in_loop, | 2289 InLoopFlag in_loop, |
| 2287 int argc) { | 2290 int argc) { |
| 2288 return ComputeFlags(kind, in_loop, MONOMORPHIC, type, argc); | 2291 return ComputeFlags(kind, in_loop, MONOMORPHIC, type, argc, holder); |
| 2289 } | 2292 } |
| 2290 | 2293 |
| 2291 | 2294 |
| 2292 Code::Kind Code::ExtractKindFromFlags(Flags flags) { | 2295 Code::Kind Code::ExtractKindFromFlags(Flags flags) { |
| 2293 int bits = (flags & kFlagsKindMask) >> kFlagsKindShift; | 2296 int bits = (flags & kFlagsKindMask) >> kFlagsKindShift; |
| 2294 return static_cast<Kind>(bits); | 2297 return static_cast<Kind>(bits); |
| 2295 } | 2298 } |
| 2296 | 2299 |
| 2297 | 2300 |
| 2298 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { | 2301 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2311 int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift; | 2314 int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift; |
| 2312 return static_cast<PropertyType>(bits); | 2315 return static_cast<PropertyType>(bits); |
| 2313 } | 2316 } |
| 2314 | 2317 |
| 2315 | 2318 |
| 2316 int Code::ExtractArgumentsCountFromFlags(Flags flags) { | 2319 int Code::ExtractArgumentsCountFromFlags(Flags flags) { |
| 2317 return (flags & kFlagsArgumentsCountMask) >> kFlagsArgumentsCountShift; | 2320 return (flags & kFlagsArgumentsCountMask) >> kFlagsArgumentsCountShift; |
| 2318 } | 2321 } |
| 2319 | 2322 |
| 2320 | 2323 |
| 2324 InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { |
| 2325 int bits = (flags & kFlagsCacheInPrototypeMapMask); |
| 2326 return bits != 0 ? PROTOTYPE_MAP : OWN_MAP; |
| 2327 } |
| 2328 |
| 2329 |
| 2321 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { | 2330 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { |
| 2322 int bits = flags & ~kFlagsTypeMask; | 2331 int bits = flags & ~kFlagsTypeMask; |
| 2323 return static_cast<Flags>(bits); | 2332 return static_cast<Flags>(bits); |
| 2324 } | 2333 } |
| 2325 | 2334 |
| 2326 | 2335 |
| 2327 Code* Code::GetCodeFromTargetAddress(Address address) { | 2336 Code* Code::GetCodeFromTargetAddress(Address address) { |
| 2328 HeapObject* code = HeapObject::FromAddress(address - Code::kHeaderSize); | 2337 HeapObject* code = HeapObject::FromAddress(address - Code::kHeaderSize); |
| 2329 // GetCodeFromTargetAddress might be called when marking objects during mark | 2338 // GetCodeFromTargetAddress might be called when marking objects during mark |
| 2330 // sweep. reinterpret_cast is therefore used instead of the more appropriate | 2339 // sweep. reinterpret_cast is therefore used instead of the more appropriate |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3254 #undef WRITE_INT_FIELD | 3263 #undef WRITE_INT_FIELD |
| 3255 #undef READ_SHORT_FIELD | 3264 #undef READ_SHORT_FIELD |
| 3256 #undef WRITE_SHORT_FIELD | 3265 #undef WRITE_SHORT_FIELD |
| 3257 #undef READ_BYTE_FIELD | 3266 #undef READ_BYTE_FIELD |
| 3258 #undef WRITE_BYTE_FIELD | 3267 #undef WRITE_BYTE_FIELD |
| 3259 | 3268 |
| 3260 | 3269 |
| 3261 } } // namespace v8::internal | 3270 } } // namespace v8::internal |
| 3262 | 3271 |
| 3263 #endif // V8_OBJECTS_INL_H_ | 3272 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |