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

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

Issue 6344005: Introduce extra IC state to record additional feedback from IC-s. (Closed)
Patch Set: Last fixes and ports to arm and x64 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
« no previous file with comments | « 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 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after
2409 // objects. This is used in the debugger to determine whether or not 2409 // objects. This is used in the debugger to determine whether or not
2410 // a call to code object has been replaced with a debug break call. 2410 // a call to code object has been replaced with a debug break call.
2411 ASSERT(is_inline_cache_stub() || 2411 ASSERT(is_inline_cache_stub() ||
2412 result == UNINITIALIZED || 2412 result == UNINITIALIZED ||
2413 result == DEBUG_BREAK || 2413 result == DEBUG_BREAK ||
2414 result == DEBUG_PREPARE_STEP_IN); 2414 result == DEBUG_PREPARE_STEP_IN);
2415 return result; 2415 return result;
2416 } 2416 }
2417 2417
2418 2418
2419 Code::ExtraICState Code::extra_ic_state() {
2420 ASSERT(is_inline_cache_stub());
2421 return ExtractExtraICStateFromFlags(flags());
2422 }
2423
2424
2419 PropertyType Code::type() { 2425 PropertyType Code::type() {
2420 ASSERT(ic_state() == MONOMORPHIC); 2426 ASSERT(ic_state() == MONOMORPHIC);
2421 return ExtractTypeFromFlags(flags()); 2427 return ExtractTypeFromFlags(flags());
2422 } 2428 }
2423 2429
2424 2430
2425 int Code::arguments_count() { 2431 int Code::arguments_count() {
2426 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); 2432 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB);
2427 return ExtractArgumentsCountFromFlags(flags()); 2433 return ExtractArgumentsCountFromFlags(flags());
2428 } 2434 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 2591
2586 bool Code::is_inline_cache_stub() { 2592 bool Code::is_inline_cache_stub() {
2587 Kind kind = this->kind(); 2593 Kind kind = this->kind();
2588 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; 2594 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND;
2589 } 2595 }
2590 2596
2591 2597
2592 Code::Flags Code::ComputeFlags(Kind kind, 2598 Code::Flags Code::ComputeFlags(Kind kind,
2593 InLoopFlag in_loop, 2599 InLoopFlag in_loop,
2594 InlineCacheState ic_state, 2600 InlineCacheState ic_state,
2601 ExtraICState extra_ic_state,
2595 PropertyType type, 2602 PropertyType type,
2596 int argc, 2603 int argc,
2597 InlineCacheHolderFlag holder) { 2604 InlineCacheHolderFlag holder) {
2605 // Extra IC state is only allowed for monomorphic call IC stubs.
2606 ASSERT(extra_ic_state == kNoExtraICState ||
2607 (kind == CALL_IC && (ic_state == MONOMORPHIC ||
2608 ic_state == MONOMORPHIC_PROTOTYPE_FAILURE)));
2598 // Compute the bit mask. 2609 // Compute the bit mask.
2599 int bits = kind << kFlagsKindShift; 2610 int bits = kind << kFlagsKindShift;
2600 if (in_loop) bits |= kFlagsICInLoopMask; 2611 if (in_loop) bits |= kFlagsICInLoopMask;
2601 bits |= ic_state << kFlagsICStateShift; 2612 bits |= ic_state << kFlagsICStateShift;
2602 bits |= type << kFlagsTypeShift; 2613 bits |= type << kFlagsTypeShift;
2614 bits |= extra_ic_state << kFlagsExtraICStateShift;
2603 bits |= argc << kFlagsArgumentsCountShift; 2615 bits |= argc << kFlagsArgumentsCountShift;
2604 if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask; 2616 if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask;
2605 // Cast to flags and validate result before returning it. 2617 // Cast to flags and validate result before returning it.
2606 Flags result = static_cast<Flags>(bits); 2618 Flags result = static_cast<Flags>(bits);
2607 ASSERT(ExtractKindFromFlags(result) == kind); 2619 ASSERT(ExtractKindFromFlags(result) == kind);
2608 ASSERT(ExtractICStateFromFlags(result) == ic_state); 2620 ASSERT(ExtractICStateFromFlags(result) == ic_state);
2609 ASSERT(ExtractICInLoopFromFlags(result) == in_loop); 2621 ASSERT(ExtractICInLoopFromFlags(result) == in_loop);
2610 ASSERT(ExtractTypeFromFlags(result) == type); 2622 ASSERT(ExtractTypeFromFlags(result) == type);
2623 ASSERT(ExtractExtraICStateFromFlags(result) == extra_ic_state);
2611 ASSERT(ExtractArgumentsCountFromFlags(result) == argc); 2624 ASSERT(ExtractArgumentsCountFromFlags(result) == argc);
2612 return result; 2625 return result;
2613 } 2626 }
2614 2627
2615 2628
2616 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, 2629 Code::Flags Code::ComputeMonomorphicFlags(Kind kind,
2617 PropertyType type, 2630 PropertyType type,
2631 ExtraICState extra_ic_state,
2618 InlineCacheHolderFlag holder, 2632 InlineCacheHolderFlag holder,
2619 InLoopFlag in_loop, 2633 InLoopFlag in_loop,
2620 int argc) { 2634 int argc) {
2621 return ComputeFlags(kind, in_loop, MONOMORPHIC, type, argc, holder); 2635 return ComputeFlags(
2636 kind, in_loop, MONOMORPHIC, extra_ic_state, type, argc, holder);
2622 } 2637 }
2623 2638
2624 2639
2625 Code::Kind Code::ExtractKindFromFlags(Flags flags) { 2640 Code::Kind Code::ExtractKindFromFlags(Flags flags) {
2626 int bits = (flags & kFlagsKindMask) >> kFlagsKindShift; 2641 int bits = (flags & kFlagsKindMask) >> kFlagsKindShift;
2627 return static_cast<Kind>(bits); 2642 return static_cast<Kind>(bits);
2628 } 2643 }
2629 2644
2630 2645
2631 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { 2646 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) {
2632 int bits = (flags & kFlagsICStateMask) >> kFlagsICStateShift; 2647 int bits = (flags & kFlagsICStateMask) >> kFlagsICStateShift;
2633 return static_cast<InlineCacheState>(bits); 2648 return static_cast<InlineCacheState>(bits);
2634 } 2649 }
2635 2650
2636 2651
2652 Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
2653 int bits = (flags & kFlagsExtraICStateMask) >> kFlagsExtraICStateShift;
2654 return static_cast<ExtraICState>(bits);
2655 }
2656
2657
2637 InLoopFlag Code::ExtractICInLoopFromFlags(Flags flags) { 2658 InLoopFlag Code::ExtractICInLoopFromFlags(Flags flags) {
2638 int bits = (flags & kFlagsICInLoopMask); 2659 int bits = (flags & kFlagsICInLoopMask);
2639 return bits != 0 ? IN_LOOP : NOT_IN_LOOP; 2660 return bits != 0 ? IN_LOOP : NOT_IN_LOOP;
2640 } 2661 }
2641 2662
2642 2663
2643 PropertyType Code::ExtractTypeFromFlags(Flags flags) { 2664 PropertyType Code::ExtractTypeFromFlags(Flags flags) {
2644 int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift; 2665 int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift;
2645 return static_cast<PropertyType>(bits); 2666 return static_cast<PropertyType>(bits);
2646 } 2667 }
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
3862 #undef WRITE_INT_FIELD 3883 #undef WRITE_INT_FIELD
3863 #undef READ_SHORT_FIELD 3884 #undef READ_SHORT_FIELD
3864 #undef WRITE_SHORT_FIELD 3885 #undef WRITE_SHORT_FIELD
3865 #undef READ_BYTE_FIELD 3886 #undef READ_BYTE_FIELD
3866 #undef WRITE_BYTE_FIELD 3887 #undef WRITE_BYTE_FIELD
3867 3888
3868 3889
3869 } } // namespace v8::internal 3890 } } // namespace v8::internal
3870 3891
3871 #endif // V8_OBJECTS_INL_H_ 3892 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698