OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3022 return result; | 3022 return result; |
3023 } | 3023 } |
3024 | 3024 |
3025 | 3025 |
3026 Code::ExtraICState Code::extra_ic_state() { | 3026 Code::ExtraICState Code::extra_ic_state() { |
3027 ASSERT(is_inline_cache_stub()); | 3027 ASSERT(is_inline_cache_stub()); |
3028 return ExtractExtraICStateFromFlags(flags()); | 3028 return ExtractExtraICStateFromFlags(flags()); |
3029 } | 3029 } |
3030 | 3030 |
3031 | 3031 |
3032 PropertyType Code::type() { | 3032 Code::StubType Code::type() { |
3033 return ExtractTypeFromFlags(flags()); | 3033 return ExtractTypeFromFlags(flags()); |
3034 } | 3034 } |
3035 | 3035 |
3036 | 3036 |
3037 int Code::arguments_count() { | 3037 int Code::arguments_count() { |
3038 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); | 3038 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); |
3039 return ExtractArgumentsCountFromFlags(flags()); | 3039 return ExtractArgumentsCountFromFlags(flags()); |
3040 } | 3040 } |
3041 | 3041 |
3042 | 3042 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3294 | 3294 |
3295 bool Code::is_inline_cache_stub() { | 3295 bool Code::is_inline_cache_stub() { |
3296 Kind kind = this->kind(); | 3296 Kind kind = this->kind(); |
3297 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; | 3297 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; |
3298 } | 3298 } |
3299 | 3299 |
3300 | 3300 |
3301 Code::Flags Code::ComputeFlags(Kind kind, | 3301 Code::Flags Code::ComputeFlags(Kind kind, |
3302 InlineCacheState ic_state, | 3302 InlineCacheState ic_state, |
3303 ExtraICState extra_ic_state, | 3303 ExtraICState extra_ic_state, |
3304 PropertyType type, | 3304 StubType type, |
3305 int argc, | 3305 int argc, |
3306 InlineCacheHolderFlag holder) { | 3306 InlineCacheHolderFlag holder) { |
3307 // Extra IC state is only allowed for call IC stubs or for store IC | 3307 // Extra IC state is only allowed for call IC stubs or for store IC |
3308 // stubs. | 3308 // stubs. |
3309 ASSERT(extra_ic_state == kNoExtraICState || | 3309 ASSERT(extra_ic_state == kNoExtraICState || |
3310 kind == CALL_IC || | 3310 kind == CALL_IC || |
3311 kind == STORE_IC || | 3311 kind == STORE_IC || |
3312 kind == KEYED_STORE_IC); | 3312 kind == KEYED_STORE_IC); |
3313 // Compute the bit mask. | 3313 // Compute the bit mask. |
3314 int bits = KindField::encode(kind) | 3314 int bits = KindField::encode(kind) |
3315 | ICStateField::encode(ic_state) | 3315 | ICStateField::encode(ic_state) |
3316 | TypeField::encode(type) | 3316 | TypeField::encode(type) |
3317 | ExtraICStateField::encode(extra_ic_state) | 3317 | ExtraICStateField::encode(extra_ic_state) |
3318 | (argc << kArgumentsCountShift) | 3318 | (argc << kArgumentsCountShift) |
3319 | CacheHolderField::encode(holder); | 3319 | CacheHolderField::encode(holder); |
3320 return static_cast<Flags>(bits); | 3320 return static_cast<Flags>(bits); |
3321 } | 3321 } |
3322 | 3322 |
3323 | 3323 |
3324 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 3324 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
3325 PropertyType type, | 3325 StubType type, |
3326 ExtraICState extra_ic_state, | 3326 ExtraICState extra_ic_state, |
3327 InlineCacheHolderFlag holder, | 3327 InlineCacheHolderFlag holder, |
3328 int argc) { | 3328 int argc) { |
3329 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, argc, holder); | 3329 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, argc, holder); |
3330 } | 3330 } |
3331 | 3331 |
3332 | 3332 |
3333 Code::Kind Code::ExtractKindFromFlags(Flags flags) { | 3333 Code::Kind Code::ExtractKindFromFlags(Flags flags) { |
3334 return KindField::decode(flags); | 3334 return KindField::decode(flags); |
3335 } | 3335 } |
3336 | 3336 |
3337 | 3337 |
3338 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { | 3338 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { |
3339 return ICStateField::decode(flags); | 3339 return ICStateField::decode(flags); |
3340 } | 3340 } |
3341 | 3341 |
3342 | 3342 |
3343 Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { | 3343 Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { |
3344 return ExtraICStateField::decode(flags); | 3344 return ExtraICStateField::decode(flags); |
3345 } | 3345 } |
3346 | 3346 |
3347 | 3347 |
3348 PropertyType Code::ExtractTypeFromFlags(Flags flags) { | 3348 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { |
3349 return TypeField::decode(flags); | 3349 return TypeField::decode(flags); |
3350 } | 3350 } |
3351 | 3351 |
3352 | 3352 |
3353 int Code::ExtractArgumentsCountFromFlags(Flags flags) { | 3353 int Code::ExtractArgumentsCountFromFlags(Flags flags) { |
3354 return (flags & kArgumentsCountMask) >> kArgumentsCountShift; | 3354 return (flags & kArgumentsCountMask) >> kArgumentsCountShift; |
3355 } | 3355 } |
3356 | 3356 |
3357 | 3357 |
3358 InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { | 3358 InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { |
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5185 #undef WRITE_UINT32_FIELD | 5185 #undef WRITE_UINT32_FIELD |
5186 #undef READ_SHORT_FIELD | 5186 #undef READ_SHORT_FIELD |
5187 #undef WRITE_SHORT_FIELD | 5187 #undef WRITE_SHORT_FIELD |
5188 #undef READ_BYTE_FIELD | 5188 #undef READ_BYTE_FIELD |
5189 #undef WRITE_BYTE_FIELD | 5189 #undef WRITE_BYTE_FIELD |
5190 | 5190 |
5191 | 5191 |
5192 } } // namespace v8::internal | 5192 } } // namespace v8::internal |
5193 | 5193 |
5194 #endif // V8_OBJECTS_INL_H_ | 5194 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |