OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3722 | 3722 |
3723 | 3723 |
3724 Code::ExtraICState Code::extra_ic_state() { | 3724 Code::ExtraICState Code::extra_ic_state() { |
3725 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); | 3725 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); |
3726 return ExtractExtraICStateFromFlags(flags()); | 3726 return ExtractExtraICStateFromFlags(flags()); |
3727 } | 3727 } |
3728 | 3728 |
3729 | 3729 |
3730 Code::ExtraICState Code::extended_extra_ic_state() { | 3730 Code::ExtraICState Code::extended_extra_ic_state() { |
3731 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); | 3731 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); |
| 3732 ASSERT(needs_extended_extra_ic_state(kind())); |
3732 return ExtractExtendedExtraICStateFromFlags(flags()); | 3733 return ExtractExtendedExtraICStateFromFlags(flags()); |
3733 } | 3734 } |
3734 | 3735 |
3735 | 3736 |
3736 Code::StubType Code::type() { | 3737 Code::StubType Code::type() { |
3737 return ExtractTypeFromFlags(flags()); | 3738 return ExtractTypeFromFlags(flags()); |
3738 } | 3739 } |
3739 | 3740 |
3740 | 3741 |
3741 int Code::arguments_count() { | 3742 int Code::arguments_count() { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3972 | 3973 |
3973 void Code::set_unary_op_type(byte value) { | 3974 void Code::set_unary_op_type(byte value) { |
3974 ASSERT(is_unary_op_stub()); | 3975 ASSERT(is_unary_op_stub()); |
3975 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 3976 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
3976 int updated = UnaryOpTypeField::update(previous, value); | 3977 int updated = UnaryOpTypeField::update(previous, value); |
3977 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | 3978 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); |
3978 } | 3979 } |
3979 | 3980 |
3980 | 3981 |
3981 byte Code::to_boolean_state() { | 3982 byte Code::to_boolean_state() { |
3982 ASSERT(is_to_boolean_ic_stub()); | 3983 return extended_extra_ic_state(); |
3983 return ToBooleanStateField::decode( | |
3984 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | |
3985 } | 3984 } |
3986 | 3985 |
3987 | 3986 |
3988 void Code::set_to_boolean_state(byte value) { | |
3989 ASSERT(is_to_boolean_ic_stub()); | |
3990 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | |
3991 int updated = ToBooleanStateField::update(previous, value); | |
3992 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | |
3993 } | |
3994 | |
3995 | |
3996 bool Code::has_function_cache() { | 3987 bool Code::has_function_cache() { |
3997 ASSERT(kind() == STUB); | 3988 ASSERT(kind() == STUB); |
3998 return HasFunctionCacheField::decode( | 3989 return HasFunctionCacheField::decode( |
3999 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 3990 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
4000 } | 3991 } |
4001 | 3992 |
4002 | 3993 |
4003 void Code::set_has_function_cache(bool flag) { | 3994 void Code::set_has_function_cache(bool flag) { |
4004 ASSERT(kind() == STUB); | 3995 ASSERT(kind() == STUB); |
4005 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 3996 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4045 // for CALL_ICs, do so checks to make sure that they don't interfere. | 4036 // for CALL_ICs, do so checks to make sure that they don't interfere. |
4046 ASSERT((kind != Code::CALL_IC && | 4037 ASSERT((kind != Code::CALL_IC && |
4047 kind != Code::KEYED_CALL_IC) || | 4038 kind != Code::KEYED_CALL_IC) || |
4048 (ExtraICStateField::encode(extra_ic_state) | true)); | 4039 (ExtraICStateField::encode(extra_ic_state) | true)); |
4049 // Compute the bit mask. | 4040 // Compute the bit mask. |
4050 unsigned int bits = KindField::encode(kind) | 4041 unsigned int bits = KindField::encode(kind) |
4051 | ICStateField::encode(ic_state) | 4042 | ICStateField::encode(ic_state) |
4052 | TypeField::encode(type) | 4043 | TypeField::encode(type) |
4053 | ExtendedExtraICStateField::encode(extra_ic_state) | 4044 | ExtendedExtraICStateField::encode(extra_ic_state) |
4054 | CacheHolderField::encode(holder); | 4045 | CacheHolderField::encode(holder); |
4055 // TODO(danno): This is a bit of a hack right now since there are still | 4046 if (!Code::needs_extended_extra_ic_state(kind)) { |
4056 // clients of this API that pass "extra" values in for argc. These clients | |
4057 // should be retrofitted to used ExtendedExtraICState. | |
4058 if (kind != Code::COMPARE_NIL_IC) { | |
4059 bits |= (argc << kArgumentsCountShift); | 4047 bits |= (argc << kArgumentsCountShift); |
4060 } | 4048 } |
4061 return static_cast<Flags>(bits); | 4049 return static_cast<Flags>(bits); |
4062 } | 4050 } |
4063 | 4051 |
4064 | 4052 |
4065 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 4053 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
4066 ExtraICState extra_ic_state, | 4054 ExtraICState extra_ic_state, |
4067 StubType type, | 4055 StubType type, |
4068 int argc, | 4056 int argc, |
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6229 #undef WRITE_UINT32_FIELD | 6217 #undef WRITE_UINT32_FIELD |
6230 #undef READ_SHORT_FIELD | 6218 #undef READ_SHORT_FIELD |
6231 #undef WRITE_SHORT_FIELD | 6219 #undef WRITE_SHORT_FIELD |
6232 #undef READ_BYTE_FIELD | 6220 #undef READ_BYTE_FIELD |
6233 #undef WRITE_BYTE_FIELD | 6221 #undef WRITE_BYTE_FIELD |
6234 | 6222 |
6235 | 6223 |
6236 } } // namespace v8::internal | 6224 } } // namespace v8::internal |
6237 | 6225 |
6238 #endif // V8_OBJECTS_INL_H_ | 6226 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |