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 4186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4197 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); | 4197 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); |
4198 return ExtractExtraICStateFromFlags(flags()); | 4198 return ExtractExtraICStateFromFlags(flags()); |
4199 } | 4199 } |
4200 | 4200 |
4201 | 4201 |
4202 Code::StubType Code::type() { | 4202 Code::StubType Code::type() { |
4203 return ExtractTypeFromFlags(flags()); | 4203 return ExtractTypeFromFlags(flags()); |
4204 } | 4204 } |
4205 | 4205 |
4206 | 4206 |
4207 int Code::arguments_count() { | |
4208 ASSERT(kind() == STUB || is_handler()); | |
4209 return ExtractArgumentsCountFromFlags(flags()); | |
4210 } | |
4211 | |
4212 | |
4213 // For initialization. | 4207 // For initialization. |
4214 void Code::set_raw_kind_specific_flags1(int value) { | 4208 void Code::set_raw_kind_specific_flags1(int value) { |
4215 WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value); | 4209 WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value); |
4216 } | 4210 } |
4217 | 4211 |
4218 | 4212 |
4219 void Code::set_raw_kind_specific_flags2(int value) { | 4213 void Code::set_raw_kind_specific_flags2(int value) { |
4220 WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value); | 4214 WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value); |
4221 } | 4215 } |
4222 | 4216 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4477 ASSERT(value->IsConstantPoolArray()); | 4471 ASSERT(value->IsConstantPoolArray()); |
4478 WRITE_FIELD(this, kConstantPoolOffset, value); | 4472 WRITE_FIELD(this, kConstantPoolOffset, value); |
4479 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value); | 4473 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value); |
4480 } | 4474 } |
4481 | 4475 |
4482 | 4476 |
4483 Code::Flags Code::ComputeFlags(Kind kind, | 4477 Code::Flags Code::ComputeFlags(Kind kind, |
4484 InlineCacheState ic_state, | 4478 InlineCacheState ic_state, |
4485 ExtraICState extra_ic_state, | 4479 ExtraICState extra_ic_state, |
4486 StubType type, | 4480 StubType type, |
4487 Kind handler_kind, | |
4488 InlineCacheHolderFlag holder) { | 4481 InlineCacheHolderFlag holder) { |
4489 // Compute the bit mask. | 4482 // Compute the bit mask. |
4490 unsigned int bits = KindField::encode(kind) | 4483 unsigned int bits = KindField::encode(kind) |
4491 | ICStateField::encode(ic_state) | 4484 | ICStateField::encode(ic_state) |
4492 | TypeField::encode(type) | 4485 | TypeField::encode(type) |
4493 | ExtraICStateField::encode(extra_ic_state) | 4486 | ExtraICStateField::encode(extra_ic_state) |
4494 | CacheHolderField::encode(holder); | 4487 | CacheHolderField::encode(holder); |
4495 if (handler_kind != STUB) { | |
4496 bits |= (handler_kind << kArgumentsCountShift); | |
4497 } | |
4498 return static_cast<Flags>(bits); | 4488 return static_cast<Flags>(bits); |
4499 } | 4489 } |
4500 | 4490 |
4501 | 4491 |
4502 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 4492 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
4503 ExtraICState extra_ic_state, | 4493 ExtraICState extra_ic_state, |
4504 InlineCacheHolderFlag holder, | 4494 InlineCacheHolderFlag holder, |
4505 StubType type, | 4495 StubType type) { |
4506 Kind handler_kind) { | 4496 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, holder); |
4507 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, | |
4508 handler_kind, holder); | |
4509 } | 4497 } |
4510 | 4498 |
4511 | 4499 |
| 4500 Code::Flags Code::ComputeHandlerFlags(Kind handler_kind, |
| 4501 ExtraICState extra_ic_state, |
| 4502 StubType type, |
| 4503 InlineCacheHolderFlag holder) { |
| 4504 ExtraICState extra = HandlerKindField::encode(handler_kind) | extra_ic_state; |
| 4505 return ComputeFlags(Code::HANDLER, MONOMORPHIC, extra, type, holder); |
| 4506 } |
| 4507 |
| 4508 |
4512 Code::Kind Code::ExtractKindFromFlags(Flags flags) { | 4509 Code::Kind Code::ExtractKindFromFlags(Flags flags) { |
4513 return KindField::decode(flags); | 4510 return KindField::decode(flags); |
4514 } | 4511 } |
4515 | 4512 |
4516 | 4513 |
4517 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { | 4514 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { |
4518 return ICStateField::decode(flags); | 4515 return ICStateField::decode(flags); |
4519 } | 4516 } |
4520 | 4517 |
4521 | 4518 |
4522 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { | 4519 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { |
4523 return ExtraICStateField::decode(flags); | 4520 return ExtraICStateField::decode(flags); |
4524 } | 4521 } |
4525 | 4522 |
4526 | 4523 |
4527 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { | 4524 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { |
4528 return TypeField::decode(flags); | 4525 return TypeField::decode(flags); |
4529 } | 4526 } |
4530 | 4527 |
4531 | 4528 |
4532 int Code::ExtractArgumentsCountFromFlags(Flags flags) { | |
4533 return (flags & kArgumentsCountMask) >> kArgumentsCountShift; | |
4534 } | |
4535 | |
4536 | |
4537 InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { | 4529 InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { |
4538 return CacheHolderField::decode(flags); | 4530 return CacheHolderField::decode(flags); |
4539 } | 4531 } |
4540 | 4532 |
4541 | 4533 |
4542 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { | 4534 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { |
4543 int bits = flags & ~TypeField::kMask; | 4535 int bits = flags & ~TypeField::kMask; |
4544 return static_cast<Flags>(bits); | 4536 return static_cast<Flags>(bits); |
4545 } | 4537 } |
4546 | 4538 |
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6744 #undef READ_UINT32_FIELD | 6736 #undef READ_UINT32_FIELD |
6745 #undef WRITE_UINT32_FIELD | 6737 #undef WRITE_UINT32_FIELD |
6746 #undef READ_SHORT_FIELD | 6738 #undef READ_SHORT_FIELD |
6747 #undef WRITE_SHORT_FIELD | 6739 #undef WRITE_SHORT_FIELD |
6748 #undef READ_BYTE_FIELD | 6740 #undef READ_BYTE_FIELD |
6749 #undef WRITE_BYTE_FIELD | 6741 #undef WRITE_BYTE_FIELD |
6750 | 6742 |
6751 } } // namespace v8::internal | 6743 } } // namespace v8::internal |
6752 | 6744 |
6753 #endif // V8_OBJECTS_INL_H_ | 6745 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |