Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: src/objects-inl.h

Issue 6344005: Introduce extra IC state to record additional feedback from IC-s. (Closed)
Patch Set: Use the extra state in string IC stubs Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/ic.cc ('K') | « src/objects.h ('k') | src/stub-cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2554 matching lines...) Expand 10 before | Expand all | Expand 10 after
2565 2565
2566 bool Code::is_inline_cache_stub() { 2566 bool Code::is_inline_cache_stub() {
2567 Kind kind = this->kind(); 2567 Kind kind = this->kind();
2568 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; 2568 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND;
2569 } 2569 }
2570 2570
2571 2571
2572 Code::Flags Code::ComputeFlags(Kind kind, 2572 Code::Flags Code::ComputeFlags(Kind kind,
2573 InLoopFlag in_loop, 2573 InLoopFlag in_loop,
2574 InlineCacheState ic_state, 2574 InlineCacheState ic_state,
2575 ExtraICState extra_ic_state,
2575 PropertyType type, 2576 PropertyType type,
2576 int argc, 2577 int argc,
2577 InlineCacheHolderFlag holder) { 2578 InlineCacheHolderFlag holder) {
2579 // Extra IC state is only allowed for monomorphic call IC stubs.
2580 ASSERT(extra_ic_state == kNoExtraICState ||
2581 (kind == CALL_IC && (ic_state == MONOMORPHIC ||
2582 ic_state == MONOMORPHIC_PROTOTYPE_FAILURE)));
2578 // Compute the bit mask. 2583 // Compute the bit mask.
2579 int bits = kind << kFlagsKindShift; 2584 int bits = kind << kFlagsKindShift;
2580 if (in_loop) bits |= kFlagsICInLoopMask; 2585 if (in_loop) bits |= kFlagsICInLoopMask;
2581 bits |= ic_state << kFlagsICStateShift; 2586 bits |= ic_state << kFlagsICStateShift;
2582 bits |= type << kFlagsTypeShift; 2587 bits |= type << kFlagsTypeShift;
2588 bits |= extra_ic_state << kFlagsExtraICStateShift;
2583 bits |= argc << kFlagsArgumentsCountShift; 2589 bits |= argc << kFlagsArgumentsCountShift;
2584 if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask; 2590 if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask;
2585 // Cast to flags and validate result before returning it. 2591 // Cast to flags and validate result before returning it.
2586 Flags result = static_cast<Flags>(bits); 2592 Flags result = static_cast<Flags>(bits);
2587 ASSERT(ExtractKindFromFlags(result) == kind); 2593 ASSERT(ExtractKindFromFlags(result) == kind);
2588 ASSERT(ExtractICStateFromFlags(result) == ic_state); 2594 ASSERT(ExtractICStateFromFlags(result) == ic_state);
2589 ASSERT(ExtractICInLoopFromFlags(result) == in_loop); 2595 ASSERT(ExtractICInLoopFromFlags(result) == in_loop);
2590 ASSERT(ExtractTypeFromFlags(result) == type); 2596 ASSERT(ExtractTypeFromFlags(result) == type);
2597 ASSERT(ExtractExtraICStateFromFlags(result) == extra_ic_state);
2591 ASSERT(ExtractArgumentsCountFromFlags(result) == argc); 2598 ASSERT(ExtractArgumentsCountFromFlags(result) == argc);
2592 return result; 2599 return result;
2593 } 2600 }
2594 2601
2595 2602
2596 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, 2603 Code::Flags Code::ComputeMonomorphicFlags(Kind kind,
2597 PropertyType type, 2604 PropertyType type,
2605 ExtraICState extra_ic_state,
2598 InlineCacheHolderFlag holder, 2606 InlineCacheHolderFlag holder,
2599 InLoopFlag in_loop, 2607 InLoopFlag in_loop,
2600 int argc) { 2608 int argc) {
2601 return ComputeFlags(kind, in_loop, MONOMORPHIC, type, argc, holder); 2609 return ComputeFlags(
2610 kind, in_loop, MONOMORPHIC, extra_ic_state, type, argc, holder);
2602 } 2611 }
2603 2612
2604 2613
2605 Code::Kind Code::ExtractKindFromFlags(Flags flags) { 2614 Code::Kind Code::ExtractKindFromFlags(Flags flags) {
2606 int bits = (flags & kFlagsKindMask) >> kFlagsKindShift; 2615 int bits = (flags & kFlagsKindMask) >> kFlagsKindShift;
2607 return static_cast<Kind>(bits); 2616 return static_cast<Kind>(bits);
2608 } 2617 }
2609 2618
2610 2619
2611 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { 2620 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) {
2612 int bits = (flags & kFlagsICStateMask) >> kFlagsICStateShift; 2621 int bits = (flags & kFlagsICStateMask) >> kFlagsICStateShift;
2613 return static_cast<InlineCacheState>(bits); 2622 return static_cast<InlineCacheState>(bits);
2614 } 2623 }
2615 2624
2616 2625
2626 Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
2627 int bits = (flags & kFlagsExtraICStateMask) >> kFlagsExtraICStateShift;
2628 return static_cast<ExtraICState>(bits);
2629 }
2630
2631
2617 InLoopFlag Code::ExtractICInLoopFromFlags(Flags flags) { 2632 InLoopFlag Code::ExtractICInLoopFromFlags(Flags flags) {
2618 int bits = (flags & kFlagsICInLoopMask); 2633 int bits = (flags & kFlagsICInLoopMask);
2619 return bits != 0 ? IN_LOOP : NOT_IN_LOOP; 2634 return bits != 0 ? IN_LOOP : NOT_IN_LOOP;
2620 } 2635 }
2621 2636
2622 2637
2623 PropertyType Code::ExtractTypeFromFlags(Flags flags) { 2638 PropertyType Code::ExtractTypeFromFlags(Flags flags) {
2624 int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift; 2639 int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift;
2625 return static_cast<PropertyType>(bits); 2640 return static_cast<PropertyType>(bits);
2626 } 2641 }
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
3849 #undef WRITE_INT_FIELD 3864 #undef WRITE_INT_FIELD
3850 #undef READ_SHORT_FIELD 3865 #undef READ_SHORT_FIELD
3851 #undef WRITE_SHORT_FIELD 3866 #undef WRITE_SHORT_FIELD
3852 #undef READ_BYTE_FIELD 3867 #undef READ_BYTE_FIELD
3853 #undef WRITE_BYTE_FIELD 3868 #undef WRITE_BYTE_FIELD
3854 3869
3855 3870
3856 } } // namespace v8::internal 3871 } } // namespace v8::internal
3857 3872
3858 #endif // V8_OBJECTS_INL_H_ 3873 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/ic.cc ('K') | « src/objects.h ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698