Chromium Code Reviews| 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 4187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4198 // objects. This is used in the debugger to determine whether or not | 4198 // objects. This is used in the debugger to determine whether or not |
| 4199 // a call to code object has been replaced with a debug break call. | 4199 // a call to code object has been replaced with a debug break call. |
| 4200 ASSERT(is_inline_cache_stub() || | 4200 ASSERT(is_inline_cache_stub() || |
| 4201 result == UNINITIALIZED || | 4201 result == UNINITIALIZED || |
| 4202 result == DEBUG_STUB); | 4202 result == DEBUG_STUB); |
| 4203 return result; | 4203 return result; |
| 4204 } | 4204 } |
| 4205 | 4205 |
| 4206 | 4206 |
| 4207 ExtraICState Code::extra_ic_state() { | 4207 ExtraICState Code::extra_ic_state() { |
| 4208 ASSERT((is_inline_cache_stub() && !needs_extended_extra_ic_state(kind())) | 4208 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); |
| 4209 || ic_state() == DEBUG_STUB); | |
| 4210 return ExtractExtraICStateFromFlags(flags()); | 4209 return ExtractExtraICStateFromFlags(flags()); |
| 4211 } | 4210 } |
| 4212 | 4211 |
| 4213 | 4212 |
| 4214 ExtraICState Code::extended_extra_ic_state() { | |
| 4215 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); | |
| 4216 ASSERT(needs_extended_extra_ic_state(kind())); | |
| 4217 return ExtractExtendedExtraICStateFromFlags(flags()); | |
| 4218 } | |
| 4219 | |
| 4220 | |
| 4221 Code::StubType Code::type() { | 4213 Code::StubType Code::type() { |
| 4222 return ExtractTypeFromFlags(flags()); | 4214 return ExtractTypeFromFlags(flags()); |
| 4223 } | 4215 } |
| 4224 | 4216 |
| 4225 | 4217 |
| 4226 int Code::arguments_count() { | 4218 int Code::arguments_count() { |
| 4227 ASSERT(kind() == STUB || is_handler()); | 4219 ASSERT(kind() == STUB || is_handler()); |
| 4228 return ExtractArgumentsCountFromFlags(flags()); | 4220 return ExtractArgumentsCountFromFlags(flags()); |
| 4229 } | 4221 } |
| 4230 | 4222 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4425 void Code::set_back_edges_patched_for_osr(bool value) { | 4417 void Code::set_back_edges_patched_for_osr(bool value) { |
| 4426 ASSERT_EQ(FUNCTION, kind()); | 4418 ASSERT_EQ(FUNCTION, kind()); |
| 4427 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4419 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
| 4428 int updated = BackEdgesPatchedForOSRField::update(previous, value); | 4420 int updated = BackEdgesPatchedForOSRField::update(previous, value); |
| 4429 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4421 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
| 4430 } | 4422 } |
| 4431 | 4423 |
| 4432 | 4424 |
| 4433 | 4425 |
| 4434 byte Code::to_boolean_state() { | 4426 byte Code::to_boolean_state() { |
| 4435 return extended_extra_ic_state(); | 4427 return extra_ic_state(); |
| 4436 } | 4428 } |
| 4437 | 4429 |
| 4438 | 4430 |
| 4439 bool Code::has_function_cache() { | 4431 bool Code::has_function_cache() { |
| 4440 ASSERT(kind() == STUB); | 4432 ASSERT(kind() == STUB); |
| 4441 return HasFunctionCacheField::decode( | 4433 return HasFunctionCacheField::decode( |
| 4442 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 4434 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
| 4443 } | 4435 } |
| 4444 | 4436 |
| 4445 | 4437 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4496 ASSERT(value->IsConstantPoolArray()); | 4488 ASSERT(value->IsConstantPoolArray()); |
| 4497 WRITE_FIELD(this, kConstantPoolOffset, value); | 4489 WRITE_FIELD(this, kConstantPoolOffset, value); |
| 4498 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value); | 4490 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value); |
| 4499 } | 4491 } |
| 4500 | 4492 |
| 4501 | 4493 |
| 4502 Code::Flags Code::ComputeFlags(Kind kind, | 4494 Code::Flags Code::ComputeFlags(Kind kind, |
| 4503 InlineCacheState ic_state, | 4495 InlineCacheState ic_state, |
| 4504 ExtraICState extra_ic_state, | 4496 ExtraICState extra_ic_state, |
| 4505 StubType type, | 4497 StubType type, |
| 4506 int argc, | 4498 Kind handler_kind, |
| 4507 InlineCacheHolderFlag holder) { | 4499 InlineCacheHolderFlag holder) { |
| 4508 ASSERT(argc <= Code::kMaxArguments); | |
| 4509 // Compute the bit mask. | 4500 // Compute the bit mask. |
| 4510 unsigned int bits = KindField::encode(kind) | 4501 unsigned int bits = KindField::encode(kind) |
| 4511 | ICStateField::encode(ic_state) | 4502 | ICStateField::encode(ic_state) |
| 4512 | TypeField::encode(type) | 4503 | TypeField::encode(type) |
| 4513 | ExtendedExtraICStateField::encode(extra_ic_state) | 4504 | ExtraICStateField::encode(extra_ic_state) |
| 4514 | CacheHolderField::encode(holder); | 4505 | CacheHolderField::encode(holder); |
| 4515 if (!Code::needs_extended_extra_ic_state(kind)) { | 4506 if (handler_kind != STUB) { |
| 4516 bits |= (argc << kArgumentsCountShift); | 4507 bits |= (handler_kind << kArgumentsCountShift); |
|
Igor Sheludko
2014/02/11 10:35:28
Probably it is worth renaming kArgumentsCountShift
| |
| 4517 } | 4508 } |
| 4518 return static_cast<Flags>(bits); | 4509 return static_cast<Flags>(bits); |
| 4519 } | 4510 } |
| 4520 | 4511 |
| 4521 | 4512 |
| 4522 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 4513 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
| 4523 ExtraICState extra_ic_state, | 4514 ExtraICState extra_ic_state, |
| 4524 InlineCacheHolderFlag holder, | 4515 InlineCacheHolderFlag holder, |
| 4525 StubType type, | 4516 StubType type, |
| 4526 int argc) { | 4517 Kind handler_kind) { |
| 4527 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, argc, holder); | 4518 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, |
| 4519 handler_kind, holder); | |
| 4528 } | 4520 } |
| 4529 | 4521 |
| 4530 | 4522 |
| 4531 Code::Kind Code::ExtractKindFromFlags(Flags flags) { | 4523 Code::Kind Code::ExtractKindFromFlags(Flags flags) { |
| 4532 return KindField::decode(flags); | 4524 return KindField::decode(flags); |
| 4533 } | 4525 } |
| 4534 | 4526 |
| 4535 | 4527 |
| 4536 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { | 4528 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { |
| 4537 return ICStateField::decode(flags); | 4529 return ICStateField::decode(flags); |
| 4538 } | 4530 } |
| 4539 | 4531 |
| 4540 | 4532 |
| 4541 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { | 4533 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { |
| 4542 return ExtraICStateField::decode(flags); | 4534 return ExtraICStateField::decode(flags); |
| 4543 } | 4535 } |
| 4544 | 4536 |
| 4545 | 4537 |
| 4546 ExtraICState Code::ExtractExtendedExtraICStateFromFlags( | |
| 4547 Flags flags) { | |
| 4548 return ExtendedExtraICStateField::decode(flags); | |
| 4549 } | |
| 4550 | |
| 4551 | |
| 4552 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { | 4538 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { |
| 4553 return TypeField::decode(flags); | 4539 return TypeField::decode(flags); |
| 4554 } | 4540 } |
| 4555 | 4541 |
| 4556 | 4542 |
| 4557 int Code::ExtractArgumentsCountFromFlags(Flags flags) { | 4543 int Code::ExtractArgumentsCountFromFlags(Flags flags) { |
| 4558 return (flags & kArgumentsCountMask) >> kArgumentsCountShift; | 4544 return (flags & kArgumentsCountMask) >> kArgumentsCountShift; |
| 4559 } | 4545 } |
| 4560 | 4546 |
| 4561 | 4547 |
| (...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6790 #undef READ_UINT32_FIELD | 6776 #undef READ_UINT32_FIELD |
| 6791 #undef WRITE_UINT32_FIELD | 6777 #undef WRITE_UINT32_FIELD |
| 6792 #undef READ_SHORT_FIELD | 6778 #undef READ_SHORT_FIELD |
| 6793 #undef WRITE_SHORT_FIELD | 6779 #undef WRITE_SHORT_FIELD |
| 6794 #undef READ_BYTE_FIELD | 6780 #undef READ_BYTE_FIELD |
| 6795 #undef WRITE_BYTE_FIELD | 6781 #undef WRITE_BYTE_FIELD |
| 6796 | 6782 |
| 6797 } } // namespace v8::internal | 6783 } } // namespace v8::internal |
| 6798 | 6784 |
| 6799 #endif // V8_OBJECTS_INL_H_ | 6785 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |