OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 // objects. This is used in the debugger to determine whether or not | 2389 // objects. This is used in the debugger to determine whether or not |
2390 // a call to code object has been replaced with a debug break call. | 2390 // a call to code object has been replaced with a debug break call. |
2391 ASSERT(is_inline_cache_stub() || | 2391 ASSERT(is_inline_cache_stub() || |
2392 result == UNINITIALIZED || | 2392 result == UNINITIALIZED || |
2393 result == DEBUG_BREAK || | 2393 result == DEBUG_BREAK || |
2394 result == DEBUG_PREPARE_STEP_IN); | 2394 result == DEBUG_PREPARE_STEP_IN); |
2395 return result; | 2395 return result; |
2396 } | 2396 } |
2397 | 2397 |
2398 | 2398 |
| 2399 Code::ExtraICState Code::extra_ic_state() { |
| 2400 ASSERT(is_inline_cache_stub()); |
| 2401 return ExtractExtraICStateFromFlags(flags()); |
| 2402 } |
| 2403 |
| 2404 |
2399 PropertyType Code::type() { | 2405 PropertyType Code::type() { |
2400 ASSERT(ic_state() == MONOMORPHIC); | 2406 ASSERT(ic_state() == MONOMORPHIC); |
2401 return ExtractTypeFromFlags(flags()); | 2407 return ExtractTypeFromFlags(flags()); |
2402 } | 2408 } |
2403 | 2409 |
2404 | 2410 |
2405 int Code::arguments_count() { | 2411 int Code::arguments_count() { |
2406 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); | 2412 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); |
2407 return ExtractArgumentsCountFromFlags(flags()); | 2413 return ExtractArgumentsCountFromFlags(flags()); |
2408 } | 2414 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2565 | 2571 |
2566 bool Code::is_inline_cache_stub() { | 2572 bool Code::is_inline_cache_stub() { |
2567 Kind kind = this->kind(); | 2573 Kind kind = this->kind(); |
2568 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; | 2574 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; |
2569 } | 2575 } |
2570 | 2576 |
2571 | 2577 |
2572 Code::Flags Code::ComputeFlags(Kind kind, | 2578 Code::Flags Code::ComputeFlags(Kind kind, |
2573 InLoopFlag in_loop, | 2579 InLoopFlag in_loop, |
2574 InlineCacheState ic_state, | 2580 InlineCacheState ic_state, |
| 2581 ExtraICState extra_ic_state, |
2575 PropertyType type, | 2582 PropertyType type, |
2576 int argc, | 2583 int argc, |
2577 InlineCacheHolderFlag holder) { | 2584 InlineCacheHolderFlag holder) { |
| 2585 // Extra IC state is only allowed for monomorphic call IC stubs. |
| 2586 ASSERT(extra_ic_state == kNoExtraICState || |
| 2587 (kind == CALL_IC && (ic_state == MONOMORPHIC || |
| 2588 ic_state == MONOMORPHIC_PROTOTYPE_FAILURE))); |
2578 // Compute the bit mask. | 2589 // Compute the bit mask. |
2579 int bits = kind << kFlagsKindShift; | 2590 int bits = kind << kFlagsKindShift; |
2580 if (in_loop) bits |= kFlagsICInLoopMask; | 2591 if (in_loop) bits |= kFlagsICInLoopMask; |
2581 bits |= ic_state << kFlagsICStateShift; | 2592 bits |= ic_state << kFlagsICStateShift; |
2582 bits |= type << kFlagsTypeShift; | 2593 bits |= type << kFlagsTypeShift; |
| 2594 bits |= extra_ic_state << kFlagsExtraICStateShift; |
2583 bits |= argc << kFlagsArgumentsCountShift; | 2595 bits |= argc << kFlagsArgumentsCountShift; |
2584 if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask; | 2596 if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask; |
2585 // Cast to flags and validate result before returning it. | 2597 // Cast to flags and validate result before returning it. |
2586 Flags result = static_cast<Flags>(bits); | 2598 Flags result = static_cast<Flags>(bits); |
2587 ASSERT(ExtractKindFromFlags(result) == kind); | 2599 ASSERT(ExtractKindFromFlags(result) == kind); |
2588 ASSERT(ExtractICStateFromFlags(result) == ic_state); | 2600 ASSERT(ExtractICStateFromFlags(result) == ic_state); |
2589 ASSERT(ExtractICInLoopFromFlags(result) == in_loop); | 2601 ASSERT(ExtractICInLoopFromFlags(result) == in_loop); |
2590 ASSERT(ExtractTypeFromFlags(result) == type); | 2602 ASSERT(ExtractTypeFromFlags(result) == type); |
| 2603 ASSERT(ExtractExtraICStateFromFlags(result) == extra_ic_state); |
2591 ASSERT(ExtractArgumentsCountFromFlags(result) == argc); | 2604 ASSERT(ExtractArgumentsCountFromFlags(result) == argc); |
2592 return result; | 2605 return result; |
2593 } | 2606 } |
2594 | 2607 |
2595 | 2608 |
2596 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 2609 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
2597 PropertyType type, | 2610 PropertyType type, |
| 2611 ExtraICState extra_ic_state, |
2598 InlineCacheHolderFlag holder, | 2612 InlineCacheHolderFlag holder, |
2599 InLoopFlag in_loop, | 2613 InLoopFlag in_loop, |
2600 int argc) { | 2614 int argc) { |
2601 return ComputeFlags(kind, in_loop, MONOMORPHIC, type, argc, holder); | 2615 return ComputeFlags( |
| 2616 kind, in_loop, MONOMORPHIC, extra_ic_state, type, argc, holder); |
2602 } | 2617 } |
2603 | 2618 |
2604 | 2619 |
2605 Code::Kind Code::ExtractKindFromFlags(Flags flags) { | 2620 Code::Kind Code::ExtractKindFromFlags(Flags flags) { |
2606 int bits = (flags & kFlagsKindMask) >> kFlagsKindShift; | 2621 int bits = (flags & kFlagsKindMask) >> kFlagsKindShift; |
2607 return static_cast<Kind>(bits); | 2622 return static_cast<Kind>(bits); |
2608 } | 2623 } |
2609 | 2624 |
2610 | 2625 |
2611 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { | 2626 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { |
2612 int bits = (flags & kFlagsICStateMask) >> kFlagsICStateShift; | 2627 int bits = (flags & kFlagsICStateMask) >> kFlagsICStateShift; |
2613 return static_cast<InlineCacheState>(bits); | 2628 return static_cast<InlineCacheState>(bits); |
2614 } | 2629 } |
2615 | 2630 |
2616 | 2631 |
| 2632 Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { |
| 2633 int bits = (flags & kFlagsExtraICStateMask) >> kFlagsExtraICStateShift; |
| 2634 return static_cast<ExtraICState>(bits); |
| 2635 } |
| 2636 |
| 2637 |
2617 InLoopFlag Code::ExtractICInLoopFromFlags(Flags flags) { | 2638 InLoopFlag Code::ExtractICInLoopFromFlags(Flags flags) { |
2618 int bits = (flags & kFlagsICInLoopMask); | 2639 int bits = (flags & kFlagsICInLoopMask); |
2619 return bits != 0 ? IN_LOOP : NOT_IN_LOOP; | 2640 return bits != 0 ? IN_LOOP : NOT_IN_LOOP; |
2620 } | 2641 } |
2621 | 2642 |
2622 | 2643 |
2623 PropertyType Code::ExtractTypeFromFlags(Flags flags) { | 2644 PropertyType Code::ExtractTypeFromFlags(Flags flags) { |
2624 int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift; | 2645 int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift; |
2625 return static_cast<PropertyType>(bits); | 2646 return static_cast<PropertyType>(bits); |
2626 } | 2647 } |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3849 #undef WRITE_INT_FIELD | 3870 #undef WRITE_INT_FIELD |
3850 #undef READ_SHORT_FIELD | 3871 #undef READ_SHORT_FIELD |
3851 #undef WRITE_SHORT_FIELD | 3872 #undef WRITE_SHORT_FIELD |
3852 #undef READ_BYTE_FIELD | 3873 #undef READ_BYTE_FIELD |
3853 #undef WRITE_BYTE_FIELD | 3874 #undef WRITE_BYTE_FIELD |
3854 | 3875 |
3855 | 3876 |
3856 } } // namespace v8::internal | 3877 } } // namespace v8::internal |
3857 | 3878 |
3858 #endif // V8_OBJECTS_INL_H_ | 3879 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |