| 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 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2874 ExtractArgumentsCountFromFlags(flags) >= 0); | 2874 ExtractArgumentsCountFromFlags(flags) >= 0); |
| 2875 WRITE_INT_FIELD(this, kFlagsOffset, flags); | 2875 WRITE_INT_FIELD(this, kFlagsOffset, flags); |
| 2876 } | 2876 } |
| 2877 | 2877 |
| 2878 | 2878 |
| 2879 Code::Kind Code::kind() { | 2879 Code::Kind Code::kind() { |
| 2880 return ExtractKindFromFlags(flags()); | 2880 return ExtractKindFromFlags(flags()); |
| 2881 } | 2881 } |
| 2882 | 2882 |
| 2883 | 2883 |
| 2884 InLoopFlag Code::ic_in_loop() { | |
| 2885 return ExtractICInLoopFromFlags(flags()); | |
| 2886 } | |
| 2887 | |
| 2888 | |
| 2889 InlineCacheState Code::ic_state() { | 2884 InlineCacheState Code::ic_state() { |
| 2890 InlineCacheState result = ExtractICStateFromFlags(flags()); | 2885 InlineCacheState result = ExtractICStateFromFlags(flags()); |
| 2891 // Only allow uninitialized or debugger states for non-IC code | 2886 // Only allow uninitialized or debugger states for non-IC code |
| 2892 // objects. This is used in the debugger to determine whether or not | 2887 // objects. This is used in the debugger to determine whether or not |
| 2893 // a call to code object has been replaced with a debug break call. | 2888 // a call to code object has been replaced with a debug break call. |
| 2894 ASSERT(is_inline_cache_stub() || | 2889 ASSERT(is_inline_cache_stub() || |
| 2895 result == UNINITIALIZED || | 2890 result == UNINITIALIZED || |
| 2896 result == DEBUG_BREAK || | 2891 result == DEBUG_BREAK || |
| 2897 result == DEBUG_PREPARE_STEP_IN); | 2892 result == DEBUG_PREPARE_STEP_IN); |
| 2898 return result; | 2893 return result; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3084 WRITE_BYTE_FIELD(this, kToBooleanTypeOffset, value); | 3079 WRITE_BYTE_FIELD(this, kToBooleanTypeOffset, value); |
| 3085 } | 3080 } |
| 3086 | 3081 |
| 3087 bool Code::is_inline_cache_stub() { | 3082 bool Code::is_inline_cache_stub() { |
| 3088 Kind kind = this->kind(); | 3083 Kind kind = this->kind(); |
| 3089 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; | 3084 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; |
| 3090 } | 3085 } |
| 3091 | 3086 |
| 3092 | 3087 |
| 3093 Code::Flags Code::ComputeFlags(Kind kind, | 3088 Code::Flags Code::ComputeFlags(Kind kind, |
| 3094 InLoopFlag in_loop, | |
| 3095 InlineCacheState ic_state, | 3089 InlineCacheState ic_state, |
| 3096 ExtraICState extra_ic_state, | 3090 ExtraICState extra_ic_state, |
| 3097 PropertyType type, | 3091 PropertyType type, |
| 3098 int argc, | 3092 int argc, |
| 3099 InlineCacheHolderFlag holder) { | 3093 InlineCacheHolderFlag holder) { |
| 3100 // Extra IC state is only allowed for call IC stubs or for store IC | 3094 // Extra IC state is only allowed for call IC stubs or for store IC |
| 3101 // stubs. | 3095 // stubs. |
| 3102 ASSERT(extra_ic_state == kNoExtraICState || | 3096 ASSERT(extra_ic_state == kNoExtraICState || |
| 3103 (kind == CALL_IC) || | 3097 kind == CALL_IC || |
| 3104 (kind == STORE_IC) || | 3098 kind == STORE_IC || |
| 3105 (kind == KEYED_STORE_IC)); | 3099 kind == KEYED_STORE_IC); |
| 3106 // Compute the bit mask. | 3100 // Compute the bit mask. |
| 3107 int bits = KindField::encode(kind) | 3101 int bits = KindField::encode(kind) |
| 3108 | ICInLoopField::encode(in_loop) | |
| 3109 | ICStateField::encode(ic_state) | 3102 | ICStateField::encode(ic_state) |
| 3110 | TypeField::encode(type) | 3103 | TypeField::encode(type) |
| 3111 | ExtraICStateField::encode(extra_ic_state) | 3104 | ExtraICStateField::encode(extra_ic_state) |
| 3112 | (argc << kFlagsArgumentsCountShift) | 3105 | (argc << kArgumentsCountShift) |
| 3113 | CacheHolderField::encode(holder); | 3106 | CacheHolderField::encode(holder); |
| 3114 return static_cast<Flags>(bits); | 3107 return static_cast<Flags>(bits); |
| 3115 } | 3108 } |
| 3116 | 3109 |
| 3117 | 3110 |
| 3118 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 3111 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
| 3119 PropertyType type, | 3112 PropertyType type, |
| 3120 ExtraICState extra_ic_state, | 3113 ExtraICState extra_ic_state, |
| 3121 InlineCacheHolderFlag holder, | 3114 InlineCacheHolderFlag holder, |
| 3122 InLoopFlag in_loop, | |
| 3123 int argc) { | 3115 int argc) { |
| 3124 return ComputeFlags( | 3116 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, argc, holder); |
| 3125 kind, in_loop, MONOMORPHIC, extra_ic_state, type, argc, holder); | |
| 3126 } | 3117 } |
| 3127 | 3118 |
| 3128 | 3119 |
| 3129 Code::Kind Code::ExtractKindFromFlags(Flags flags) { | 3120 Code::Kind Code::ExtractKindFromFlags(Flags flags) { |
| 3130 return KindField::decode(flags); | 3121 return KindField::decode(flags); |
| 3131 } | 3122 } |
| 3132 | 3123 |
| 3133 | 3124 |
| 3134 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { | 3125 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { |
| 3135 return ICStateField::decode(flags); | 3126 return ICStateField::decode(flags); |
| 3136 } | 3127 } |
| 3137 | 3128 |
| 3138 | 3129 |
| 3139 Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { | 3130 Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { |
| 3140 return ExtraICStateField::decode(flags); | 3131 return ExtraICStateField::decode(flags); |
| 3141 } | 3132 } |
| 3142 | 3133 |
| 3143 | 3134 |
| 3144 InLoopFlag Code::ExtractICInLoopFromFlags(Flags flags) { | |
| 3145 return ICInLoopField::decode(flags); | |
| 3146 } | |
| 3147 | |
| 3148 | |
| 3149 PropertyType Code::ExtractTypeFromFlags(Flags flags) { | 3135 PropertyType Code::ExtractTypeFromFlags(Flags flags) { |
| 3150 return TypeField::decode(flags); | 3136 return TypeField::decode(flags); |
| 3151 } | 3137 } |
| 3152 | 3138 |
| 3153 | 3139 |
| 3154 int Code::ExtractArgumentsCountFromFlags(Flags flags) { | 3140 int Code::ExtractArgumentsCountFromFlags(Flags flags) { |
| 3155 return (flags & kFlagsArgumentsCountMask) >> kFlagsArgumentsCountShift; | 3141 return (flags & kArgumentsCountMask) >> kArgumentsCountShift; |
| 3156 } | 3142 } |
| 3157 | 3143 |
| 3158 | 3144 |
| 3159 InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { | 3145 InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { |
| 3160 return CacheHolderField::decode(flags); | 3146 return CacheHolderField::decode(flags); |
| 3161 } | 3147 } |
| 3162 | 3148 |
| 3163 | 3149 |
| 3164 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { | 3150 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { |
| 3165 int bits = flags & ~TypeField::kMask; | 3151 int bits = flags & ~TypeField::kMask; |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4669 #undef WRITE_INT_FIELD | 4655 #undef WRITE_INT_FIELD |
| 4670 #undef READ_SHORT_FIELD | 4656 #undef READ_SHORT_FIELD |
| 4671 #undef WRITE_SHORT_FIELD | 4657 #undef WRITE_SHORT_FIELD |
| 4672 #undef READ_BYTE_FIELD | 4658 #undef READ_BYTE_FIELD |
| 4673 #undef WRITE_BYTE_FIELD | 4659 #undef WRITE_BYTE_FIELD |
| 4674 | 4660 |
| 4675 | 4661 |
| 4676 } } // namespace v8::internal | 4662 } } // namespace v8::internal |
| 4677 | 4663 |
| 4678 #endif // V8_OBJECTS_INL_H_ | 4664 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |