OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2938 | 2938 |
2939 | 2939 |
2940 void Code::set_optimizable(bool value) { | 2940 void Code::set_optimizable(bool value) { |
2941 ASSERT(kind() == FUNCTION); | 2941 ASSERT(kind() == FUNCTION); |
2942 WRITE_BYTE_FIELD(this, kOptimizableOffset, value ? 1 : 0); | 2942 WRITE_BYTE_FIELD(this, kOptimizableOffset, value ? 1 : 0); |
2943 } | 2943 } |
2944 | 2944 |
2945 | 2945 |
2946 bool Code::has_deoptimization_support() { | 2946 bool Code::has_deoptimization_support() { |
2947 ASSERT(kind() == FUNCTION); | 2947 ASSERT(kind() == FUNCTION); |
2948 return READ_BYTE_FIELD(this, kHasDeoptimizationSupportOffset) == 1; | 2948 return ((READ_BYTE_FIELD(this, kFullCodeFlags) & |
2949 kFullCodeFlagsHasDeoptimizationSupportMask) >> | |
2950 kFullCodeFlagsHasDeoptimizationSupportShift) == 1; | |
Sven Panne
2011/09/08 08:07:59
Why do we need both a mask and a shift? A single b
Søren Thygesen Gjesse
2011/09/13 07:31:19
This pattern is used for all the other flags (at l
Sven Panne
2011/09/13 07:51:51
I think Kevin changed Code to use BitField for fla
Søren Thygesen Gjesse
2011/09/13 08:06:29
I also noticed that after the rebase. This has now
| |
2949 } | 2951 } |
2950 | 2952 |
2951 | 2953 |
2952 void Code::set_has_deoptimization_support(bool value) { | 2954 void Code::set_has_deoptimization_support(bool value) { |
2953 ASSERT(kind() == FUNCTION); | 2955 ASSERT(kind() == FUNCTION); |
2954 WRITE_BYTE_FIELD(this, kHasDeoptimizationSupportOffset, value ? 1 : 0); | 2956 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); |
2957 flags = (flags & ~kFullCodeFlagsHasDeoptimizationSupportMask) | | |
2958 ((value ? 1 : 0) << kFullCodeFlagsHasDeoptimizationSupportShift); | |
2959 WRITE_BYTE_FIELD(this, kFullCodeFlags, flags); | |
2955 } | 2960 } |
2956 | 2961 |
2957 | 2962 |
2963 bool Code::has_debug_break_slots() { | |
2964 ASSERT(kind() == FUNCTION); | |
2965 return ((READ_BYTE_FIELD(this, kFullCodeFlags) & | |
2966 kFullCodeFlagsHasDebugBreakSlotsMask) >> | |
2967 kFullCodeFlagsHasDebugBreakSlotsShift) == 1; | |
2968 } | |
2969 | |
2970 | |
2971 void Code::set_has_debug_break_slots(bool value) { | |
2972 ASSERT(kind() == FUNCTION); | |
2973 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); | |
2974 flags = (flags & ~kFullCodeFlagsHasDebugBreakSlotsMask) | | |
2975 ((value ? 1 : 0) << kFullCodeFlagsHasDebugBreakSlotsShift); | |
2976 WRITE_BYTE_FIELD(this, kFullCodeFlags, flags); | |
2977 } | |
2978 | |
2979 | |
2958 int Code::allow_osr_at_loop_nesting_level() { | 2980 int Code::allow_osr_at_loop_nesting_level() { |
2959 ASSERT(kind() == FUNCTION); | 2981 ASSERT(kind() == FUNCTION); |
2960 return READ_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset); | 2982 return READ_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset); |
2961 } | 2983 } |
2962 | 2984 |
2963 | 2985 |
2964 void Code::set_allow_osr_at_loop_nesting_level(int level) { | 2986 void Code::set_allow_osr_at_loop_nesting_level(int level) { |
2965 ASSERT(kind() == FUNCTION); | 2987 ASSERT(kind() == FUNCTION); |
2966 ASSERT(level >= 0 && level <= kMaxLoopNestingMarker); | 2988 ASSERT(level >= 0 && level <= kMaxLoopNestingMarker); |
2967 WRITE_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset, level); | 2989 WRITE_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset, level); |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4679 #undef WRITE_INT_FIELD | 4701 #undef WRITE_INT_FIELD |
4680 #undef READ_SHORT_FIELD | 4702 #undef READ_SHORT_FIELD |
4681 #undef WRITE_SHORT_FIELD | 4703 #undef WRITE_SHORT_FIELD |
4682 #undef READ_BYTE_FIELD | 4704 #undef READ_BYTE_FIELD |
4683 #undef WRITE_BYTE_FIELD | 4705 #undef WRITE_BYTE_FIELD |
4684 | 4706 |
4685 | 4707 |
4686 } } // namespace v8::internal | 4708 } } // namespace v8::internal |
4687 | 4709 |
4688 #endif // V8_OBJECTS_INL_H_ | 4710 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |