| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "objects-visiting.h" | 52 #include "objects-visiting.h" |
| 53 | 53 |
| 54 namespace v8 { | 54 namespace v8 { |
| 55 namespace internal { | 55 namespace internal { |
| 56 | 56 |
| 57 PropertyDetails::PropertyDetails(Smi* smi) { | 57 PropertyDetails::PropertyDetails(Smi* smi) { |
| 58 value_ = smi->value(); | 58 value_ = smi->value(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 Smi* PropertyDetails::AsSmi() const { | 62 Smi* PropertyDetails::AsSmi() { |
| 63 // Ensure the upper 2 bits have the same value by sign extending it. This is | 63 // Ensure the upper 2 bits have the same value by sign extending it. This is |
| 64 // necessary to be able to use the 31st bit of the property details. | 64 // necessary to be able to use the 31st bit of the property details. |
| 65 int value = value_ << 1; | 65 int value = value_ << 1; |
| 66 return Smi::FromInt(value >> 1); | 66 return Smi::FromInt(value >> 1); |
| 67 } | 67 } |
| 68 | 68 |
| 69 | 69 |
| 70 PropertyDetails PropertyDetails::AsDeleted() const { | 70 PropertyDetails PropertyDetails::AsDeleted() { |
| 71 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1)); | 71 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1)); |
| 72 return PropertyDetails(smi); | 72 return PropertyDetails(smi); |
| 73 } | 73 } |
| 74 | 74 |
| 75 | 75 |
| 76 #define TYPE_CHECKER(type, instancetype) \ | 76 #define TYPE_CHECKER(type, instancetype) \ |
| 77 bool Object::Is##type() { \ | 77 bool Object::Is##type() { \ |
| 78 return Object::IsHeapObject() && \ | 78 return Object::IsHeapObject() && \ |
| 79 HeapObject::cast(this)->map()->instance_type() == instancetype; \ | 79 HeapObject::cast(this)->map()->instance_type() == instancetype; \ |
| 80 } | 80 } |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 | 753 |
| 754 | 754 |
| 755 bool Object::IsDependentCode() { | 755 bool Object::IsDependentCode() { |
| 756 if (!IsFixedArray()) return false; | 756 if (!IsFixedArray()) return false; |
| 757 // There's actually no way to see the difference between a fixed array and | 757 // There's actually no way to see the difference between a fixed array and |
| 758 // a dependent codes array. | 758 // a dependent codes array. |
| 759 return true; | 759 return true; |
| 760 } | 760 } |
| 761 | 761 |
| 762 | 762 |
| 763 bool Object::IsTypeFeedbackCells() { |
| 764 if (!IsFixedArray()) return false; |
| 765 // There's actually no way to see the difference between a fixed array and |
| 766 // a cache cells array. Since this is used for asserts we can check that |
| 767 // the length is plausible though. |
| 768 if (FixedArray::cast(this)->length() % 2 != 0) return false; |
| 769 return true; |
| 770 } |
| 771 |
| 772 |
| 763 bool Object::IsContext() { | 773 bool Object::IsContext() { |
| 764 if (!Object::IsHeapObject()) return false; | 774 if (!Object::IsHeapObject()) return false; |
| 765 Map* map = HeapObject::cast(this)->map(); | 775 Map* map = HeapObject::cast(this)->map(); |
| 766 Heap* heap = map->GetHeap(); | 776 Heap* heap = map->GetHeap(); |
| 767 return (map == heap->function_context_map() || | 777 return (map == heap->function_context_map() || |
| 768 map == heap->catch_context_map() || | 778 map == heap->catch_context_map() || |
| 769 map == heap->with_context_map() || | 779 map == heap->with_context_map() || |
| 770 map == heap->native_context_map() || | 780 map == heap->native_context_map() || |
| 771 map == heap->block_context_map() || | 781 map == heap->block_context_map() || |
| 772 map == heap->module_context_map() || | 782 map == heap->module_context_map() || |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 static_cast<double>(found_count) / create_count : 0.0; | 1557 static_cast<double>(found_count) / create_count : 0.0; |
| 1548 PretenureFlag current_mode = GetPretenureMode(); | 1558 PretenureFlag current_mode = GetPretenureMode(); |
| 1549 | 1559 |
| 1550 if (minimum_mementos_created) { | 1560 if (minimum_mementos_created) { |
| 1551 PretenureDecision result = ratio >= kPretenureRatio | 1561 PretenureDecision result = ratio >= kPretenureRatio |
| 1552 ? kTenure | 1562 ? kTenure |
| 1553 : kDontTenure; | 1563 : kDontTenure; |
| 1554 set_pretenure_decision(result); | 1564 set_pretenure_decision(result); |
| 1555 if (current_mode != GetPretenureMode()) { | 1565 if (current_mode != GetPretenureMode()) { |
| 1556 decision_changed = true; | 1566 decision_changed = true; |
| 1557 set_deopt_dependent_code(true); | 1567 dependent_code()->MarkCodeForDeoptimization( |
| 1568 GetIsolate(), |
| 1569 DependentCode::kAllocationSiteTenuringChangedGroup); |
| 1558 } | 1570 } |
| 1559 } | 1571 } |
| 1560 | 1572 |
| 1561 if (FLAG_trace_pretenuring_statistics) { | 1573 if (FLAG_trace_pretenuring_statistics) { |
| 1562 PrintF( | 1574 PrintF( |
| 1563 "AllocationSite(%p): (created, found, ratio) (%d, %d, %f) %s => %s\n", | 1575 "AllocationSite(%p): (created, found, ratio) (%d, %d, %f) %s => %s\n", |
| 1564 static_cast<void*>(this), create_count, found_count, ratio, | 1576 static_cast<void*>(this), create_count, found_count, ratio, |
| 1565 current_mode == TENURED ? "tenured" : "not tenured", | 1577 current_mode == TENURED ? "tenured" : "not tenured", |
| 1566 GetPretenureMode() == TENURED ? "tenured" : "not tenured"); | 1578 GetPretenureMode() == TENURED ? "tenured" : "not tenured"); |
| 1567 } | 1579 } |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2778 | 2790 |
| 2779 | 2791 |
| 2780 CAST_ACCESSOR(FixedArray) | 2792 CAST_ACCESSOR(FixedArray) |
| 2781 CAST_ACCESSOR(FixedDoubleArray) | 2793 CAST_ACCESSOR(FixedDoubleArray) |
| 2782 CAST_ACCESSOR(FixedTypedArrayBase) | 2794 CAST_ACCESSOR(FixedTypedArrayBase) |
| 2783 CAST_ACCESSOR(ConstantPoolArray) | 2795 CAST_ACCESSOR(ConstantPoolArray) |
| 2784 CAST_ACCESSOR(DescriptorArray) | 2796 CAST_ACCESSOR(DescriptorArray) |
| 2785 CAST_ACCESSOR(DeoptimizationInputData) | 2797 CAST_ACCESSOR(DeoptimizationInputData) |
| 2786 CAST_ACCESSOR(DeoptimizationOutputData) | 2798 CAST_ACCESSOR(DeoptimizationOutputData) |
| 2787 CAST_ACCESSOR(DependentCode) | 2799 CAST_ACCESSOR(DependentCode) |
| 2800 CAST_ACCESSOR(TypeFeedbackCells) |
| 2788 CAST_ACCESSOR(StringTable) | 2801 CAST_ACCESSOR(StringTable) |
| 2789 CAST_ACCESSOR(JSFunctionResultCache) | 2802 CAST_ACCESSOR(JSFunctionResultCache) |
| 2790 CAST_ACCESSOR(NormalizedMapCache) | 2803 CAST_ACCESSOR(NormalizedMapCache) |
| 2791 CAST_ACCESSOR(ScopeInfo) | 2804 CAST_ACCESSOR(ScopeInfo) |
| 2792 CAST_ACCESSOR(CompilationCacheTable) | 2805 CAST_ACCESSOR(CompilationCacheTable) |
| 2793 CAST_ACCESSOR(CodeCacheHashTable) | 2806 CAST_ACCESSOR(CodeCacheHashTable) |
| 2794 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) | 2807 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) |
| 2795 CAST_ACCESSOR(MapCache) | 2808 CAST_ACCESSOR(MapCache) |
| 2796 CAST_ACCESSOR(String) | 2809 CAST_ACCESSOR(String) |
| 2797 CAST_ACCESSOR(SeqString) | 2810 CAST_ACCESSOR(SeqString) |
| (...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4191 // objects. This is used in the debugger to determine whether or not | 4204 // objects. This is used in the debugger to determine whether or not |
| 4192 // a call to code object has been replaced with a debug break call. | 4205 // a call to code object has been replaced with a debug break call. |
| 4193 ASSERT(is_inline_cache_stub() || | 4206 ASSERT(is_inline_cache_stub() || |
| 4194 result == UNINITIALIZED || | 4207 result == UNINITIALIZED || |
| 4195 result == DEBUG_STUB); | 4208 result == DEBUG_STUB); |
| 4196 return result; | 4209 return result; |
| 4197 } | 4210 } |
| 4198 | 4211 |
| 4199 | 4212 |
| 4200 ExtraICState Code::extra_ic_state() { | 4213 ExtraICState Code::extra_ic_state() { |
| 4214 ASSERT((is_inline_cache_stub() && !needs_extended_extra_ic_state(kind())) |
| 4215 || ic_state() == DEBUG_STUB); |
| 4216 return ExtractExtraICStateFromFlags(flags()); |
| 4217 } |
| 4218 |
| 4219 |
| 4220 ExtraICState Code::extended_extra_ic_state() { |
| 4201 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); | 4221 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); |
| 4202 return ExtractExtraICStateFromFlags(flags()); | 4222 ASSERT(needs_extended_extra_ic_state(kind())); |
| 4223 return ExtractExtendedExtraICStateFromFlags(flags()); |
| 4203 } | 4224 } |
| 4204 | 4225 |
| 4205 | 4226 |
| 4206 Code::StubType Code::type() { | 4227 Code::StubType Code::type() { |
| 4207 return ExtractTypeFromFlags(flags()); | 4228 return ExtractTypeFromFlags(flags()); |
| 4208 } | 4229 } |
| 4209 | 4230 |
| 4210 | 4231 |
| 4232 int Code::arguments_count() { |
| 4233 ASSERT(kind() == STUB || is_handler()); |
| 4234 return ExtractArgumentsCountFromFlags(flags()); |
| 4235 } |
| 4236 |
| 4237 |
| 4211 // For initialization. | 4238 // For initialization. |
| 4212 void Code::set_raw_kind_specific_flags1(int value) { | 4239 void Code::set_raw_kind_specific_flags1(int value) { |
| 4213 WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value); | 4240 WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value); |
| 4214 } | 4241 } |
| 4215 | 4242 |
| 4216 | 4243 |
| 4217 void Code::set_raw_kind_specific_flags2(int value) { | 4244 void Code::set_raw_kind_specific_flags2(int value) { |
| 4218 WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value); | 4245 WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value); |
| 4219 } | 4246 } |
| 4220 | 4247 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4404 void Code::set_back_edges_patched_for_osr(bool value) { | 4431 void Code::set_back_edges_patched_for_osr(bool value) { |
| 4405 ASSERT_EQ(FUNCTION, kind()); | 4432 ASSERT_EQ(FUNCTION, kind()); |
| 4406 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4433 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
| 4407 int updated = BackEdgesPatchedForOSRField::update(previous, value); | 4434 int updated = BackEdgesPatchedForOSRField::update(previous, value); |
| 4408 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4435 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
| 4409 } | 4436 } |
| 4410 | 4437 |
| 4411 | 4438 |
| 4412 | 4439 |
| 4413 byte Code::to_boolean_state() { | 4440 byte Code::to_boolean_state() { |
| 4414 return extra_ic_state(); | 4441 return extended_extra_ic_state(); |
| 4415 } | 4442 } |
| 4416 | 4443 |
| 4417 | 4444 |
| 4418 bool Code::has_function_cache() { | 4445 bool Code::has_function_cache() { |
| 4419 ASSERT(kind() == STUB); | 4446 ASSERT(kind() == STUB); |
| 4420 return HasFunctionCacheField::decode( | 4447 return HasFunctionCacheField::decode( |
| 4421 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 4448 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
| 4422 } | 4449 } |
| 4423 | 4450 |
| 4424 | 4451 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4475 ASSERT(value->IsConstantPoolArray()); | 4502 ASSERT(value->IsConstantPoolArray()); |
| 4476 WRITE_FIELD(this, kConstantPoolOffset, value); | 4503 WRITE_FIELD(this, kConstantPoolOffset, value); |
| 4477 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value); | 4504 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value); |
| 4478 } | 4505 } |
| 4479 | 4506 |
| 4480 | 4507 |
| 4481 Code::Flags Code::ComputeFlags(Kind kind, | 4508 Code::Flags Code::ComputeFlags(Kind kind, |
| 4482 InlineCacheState ic_state, | 4509 InlineCacheState ic_state, |
| 4483 ExtraICState extra_ic_state, | 4510 ExtraICState extra_ic_state, |
| 4484 StubType type, | 4511 StubType type, |
| 4512 int argc, |
| 4485 InlineCacheHolderFlag holder) { | 4513 InlineCacheHolderFlag holder) { |
| 4514 ASSERT(argc <= Code::kMaxArguments); |
| 4486 // Compute the bit mask. | 4515 // Compute the bit mask. |
| 4487 unsigned int bits = KindField::encode(kind) | 4516 unsigned int bits = KindField::encode(kind) |
| 4488 | ICStateField::encode(ic_state) | 4517 | ICStateField::encode(ic_state) |
| 4489 | TypeField::encode(type) | 4518 | TypeField::encode(type) |
| 4490 | ExtraICStateField::encode(extra_ic_state) | 4519 | ExtendedExtraICStateField::encode(extra_ic_state) |
| 4491 | CacheHolderField::encode(holder); | 4520 | CacheHolderField::encode(holder); |
| 4521 if (!Code::needs_extended_extra_ic_state(kind)) { |
| 4522 bits |= (argc << kArgumentsCountShift); |
| 4523 } |
| 4492 return static_cast<Flags>(bits); | 4524 return static_cast<Flags>(bits); |
| 4493 } | 4525 } |
| 4494 | 4526 |
| 4495 | 4527 |
| 4496 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 4528 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
| 4497 ExtraICState extra_ic_state, | 4529 ExtraICState extra_ic_state, |
| 4498 InlineCacheHolderFlag holder, | 4530 InlineCacheHolderFlag holder, |
| 4499 StubType type) { | 4531 StubType type, |
| 4500 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, holder); | 4532 int argc) { |
| 4533 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, argc, holder); |
| 4501 } | 4534 } |
| 4502 | 4535 |
| 4503 | 4536 |
| 4504 Code::Flags Code::ComputeHandlerFlags(Kind handler_kind, | |
| 4505 StubType type, | |
| 4506 InlineCacheHolderFlag holder) { | |
| 4507 return ComputeFlags(Code::HANDLER, MONOMORPHIC, handler_kind, type, holder); | |
| 4508 } | |
| 4509 | |
| 4510 | |
| 4511 Code::Kind Code::ExtractKindFromFlags(Flags flags) { | 4537 Code::Kind Code::ExtractKindFromFlags(Flags flags) { |
| 4512 return KindField::decode(flags); | 4538 return KindField::decode(flags); |
| 4513 } | 4539 } |
| 4514 | 4540 |
| 4515 | 4541 |
| 4516 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { | 4542 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { |
| 4517 return ICStateField::decode(flags); | 4543 return ICStateField::decode(flags); |
| 4518 } | 4544 } |
| 4519 | 4545 |
| 4520 | 4546 |
| 4521 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { | 4547 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { |
| 4522 return ExtraICStateField::decode(flags); | 4548 return ExtraICStateField::decode(flags); |
| 4523 } | 4549 } |
| 4524 | 4550 |
| 4525 | 4551 |
| 4552 ExtraICState Code::ExtractExtendedExtraICStateFromFlags( |
| 4553 Flags flags) { |
| 4554 return ExtendedExtraICStateField::decode(flags); |
| 4555 } |
| 4556 |
| 4557 |
| 4526 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { | 4558 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { |
| 4527 return TypeField::decode(flags); | 4559 return TypeField::decode(flags); |
| 4528 } | 4560 } |
| 4529 | 4561 |
| 4530 | 4562 |
| 4563 int Code::ExtractArgumentsCountFromFlags(Flags flags) { |
| 4564 return (flags & kArgumentsCountMask) >> kArgumentsCountShift; |
| 4565 } |
| 4566 |
| 4567 |
| 4531 InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { | 4568 InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { |
| 4532 return CacheHolderField::decode(flags); | 4569 return CacheHolderField::decode(flags); |
| 4533 } | 4570 } |
| 4534 | 4571 |
| 4535 | 4572 |
| 4536 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { | 4573 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { |
| 4537 int bits = flags & ~TypeField::kMask; | 4574 int bits = flags & ~TypeField::kMask; |
| 4538 return static_cast<Flags>(bits); | 4575 return static_cast<Flags>(bits); |
| 4539 } | 4576 } |
| 4540 | 4577 |
| 4541 | 4578 |
| 4542 Code* Code::GetCodeFromTargetAddress(Address address) { | 4579 Code* Code::GetCodeFromTargetAddress(Address address) { |
| 4543 HeapObject* code = HeapObject::FromAddress(address - Code::kHeaderSize); | 4580 HeapObject* code = HeapObject::FromAddress(address - Code::kHeaderSize); |
| 4544 // GetCodeFromTargetAddress might be called when marking objects during mark | 4581 // GetCodeFromTargetAddress might be called when marking objects during mark |
| 4545 // sweep. reinterpret_cast is therefore used instead of the more appropriate | 4582 // sweep. reinterpret_cast is therefore used instead of the more appropriate |
| 4546 // Code::cast. Code::cast does not work when the object's map is | 4583 // Code::cast. Code::cast does not work when the object's map is |
| 4547 // marked. | 4584 // marked. |
| 4548 Code* result = reinterpret_cast<Code*>(code); | 4585 Code* result = reinterpret_cast<Code*>(code); |
| 4549 return result; | 4586 return result; |
| 4550 } | 4587 } |
| 4551 | 4588 |
| 4552 | 4589 |
| 4553 Object* Code::GetObjectFromEntryAddress(Address location_of_address) { | 4590 Object* Code::GetObjectFromEntryAddress(Address location_of_address) { |
| 4554 return HeapObject:: | 4591 return HeapObject:: |
| 4555 FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize); | 4592 FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize); |
| 4556 } | 4593 } |
| 4557 | 4594 |
| 4558 | 4595 |
| 4559 bool Code::IsWeakObjectInOptimizedCode(Object* object) { | |
| 4560 ASSERT(is_optimized_code()); | |
| 4561 if (object->IsMap()) { | |
| 4562 return Map::cast(object)->CanTransition() && | |
| 4563 FLAG_collect_maps && | |
| 4564 FLAG_weak_embedded_maps_in_optimized_code; | |
| 4565 } | |
| 4566 if (object->IsJSObject() || | |
| 4567 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) { | |
| 4568 return FLAG_weak_embedded_objects_in_optimized_code; | |
| 4569 } | |
| 4570 return false; | |
| 4571 } | |
| 4572 | |
| 4573 | |
| 4574 Object* Map::prototype() { | 4596 Object* Map::prototype() { |
| 4575 return READ_FIELD(this, kPrototypeOffset); | 4597 return READ_FIELD(this, kPrototypeOffset); |
| 4576 } | 4598 } |
| 4577 | 4599 |
| 4578 | 4600 |
| 4579 void Map::set_prototype(Object* value, WriteBarrierMode mode) { | 4601 void Map::set_prototype(Object* value, WriteBarrierMode mode) { |
| 4580 ASSERT(value->IsNull() || value->IsJSReceiver()); | 4602 ASSERT(value->IsNull() || value->IsJSReceiver()); |
| 4581 WRITE_FIELD(this, kPrototypeOffset, value); | 4603 WRITE_FIELD(this, kPrototypeOffset, value); |
| 4582 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); | 4604 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); |
| 4583 } | 4605 } |
| (...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5657 JSDate* JSDate::cast(Object* obj) { | 5679 JSDate* JSDate::cast(Object* obj) { |
| 5658 ASSERT(obj->IsJSDate()); | 5680 ASSERT(obj->IsJSDate()); |
| 5659 ASSERT(HeapObject::cast(obj)->Size() == JSDate::kSize); | 5681 ASSERT(HeapObject::cast(obj)->Size() == JSDate::kSize); |
| 5660 return reinterpret_cast<JSDate*>(obj); | 5682 return reinterpret_cast<JSDate*>(obj); |
| 5661 } | 5683 } |
| 5662 | 5684 |
| 5663 | 5685 |
| 5664 ACCESSORS(JSMessageObject, type, String, kTypeOffset) | 5686 ACCESSORS(JSMessageObject, type, String, kTypeOffset) |
| 5665 ACCESSORS(JSMessageObject, arguments, JSArray, kArgumentsOffset) | 5687 ACCESSORS(JSMessageObject, arguments, JSArray, kArgumentsOffset) |
| 5666 ACCESSORS(JSMessageObject, script, Object, kScriptOffset) | 5688 ACCESSORS(JSMessageObject, script, Object, kScriptOffset) |
| 5689 ACCESSORS(JSMessageObject, stack_trace, Object, kStackTraceOffset) |
| 5667 ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset) | 5690 ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset) |
| 5668 SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset) | 5691 SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset) |
| 5669 SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset) | 5692 SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset) |
| 5670 | 5693 |
| 5671 | 5694 |
| 5672 JSMessageObject* JSMessageObject::cast(Object* obj) { | 5695 JSMessageObject* JSMessageObject::cast(Object* obj) { |
| 5673 ASSERT(obj->IsJSMessageObject()); | 5696 ASSERT(obj->IsJSMessageObject()); |
| 5674 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); | 5697 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); |
| 5675 return reinterpret_cast<JSMessageObject*>(obj); | 5698 return reinterpret_cast<JSMessageObject*>(obj); |
| 5676 } | 5699 } |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6539 return GetHeap()->CopyFixedDoubleArray(this); | 6562 return GetHeap()->CopyFixedDoubleArray(this); |
| 6540 } | 6563 } |
| 6541 | 6564 |
| 6542 | 6565 |
| 6543 MaybeObject* ConstantPoolArray::Copy() { | 6566 MaybeObject* ConstantPoolArray::Copy() { |
| 6544 if (length() == 0) return this; | 6567 if (length() == 0) return this; |
| 6545 return GetHeap()->CopyConstantPoolArray(this); | 6568 return GetHeap()->CopyConstantPoolArray(this); |
| 6546 } | 6569 } |
| 6547 | 6570 |
| 6548 | 6571 |
| 6549 Handle<Object> TypeFeedbackInfo::UninitializedSentinel(Isolate* isolate) { | 6572 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) { |
| 6573 set(1 + index * 2, Smi::FromInt(id.ToInt())); |
| 6574 } |
| 6575 |
| 6576 |
| 6577 TypeFeedbackId TypeFeedbackCells::AstId(int index) { |
| 6578 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value()); |
| 6579 } |
| 6580 |
| 6581 |
| 6582 void TypeFeedbackCells::SetCell(int index, Cell* cell) { |
| 6583 set(index * 2, cell); |
| 6584 } |
| 6585 |
| 6586 |
| 6587 Cell* TypeFeedbackCells::GetCell(int index) { |
| 6588 return Cell::cast(get(index * 2)); |
| 6589 } |
| 6590 |
| 6591 |
| 6592 Handle<Object> TypeFeedbackCells::UninitializedSentinel(Isolate* isolate) { |
| 6550 return isolate->factory()->the_hole_value(); | 6593 return isolate->factory()->the_hole_value(); |
| 6551 } | 6594 } |
| 6552 | 6595 |
| 6553 | 6596 |
| 6554 Handle<Object> TypeFeedbackInfo::MegamorphicSentinel(Isolate* isolate) { | 6597 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { |
| 6555 return isolate->factory()->undefined_value(); | 6598 return isolate->factory()->undefined_value(); |
| 6556 } | 6599 } |
| 6557 | 6600 |
| 6558 | 6601 |
| 6559 Handle<Object> TypeFeedbackInfo::MonomorphicArraySentinel(Isolate* isolate, | 6602 Handle<Object> TypeFeedbackCells::MonomorphicArraySentinel(Isolate* isolate, |
| 6560 ElementsKind elements_kind) { | 6603 ElementsKind elements_kind) { |
| 6561 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); | 6604 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); |
| 6562 } | 6605 } |
| 6563 | 6606 |
| 6564 | 6607 |
| 6565 Object* TypeFeedbackInfo::RawUninitializedSentinel(Heap* heap) { | 6608 Object* TypeFeedbackCells::RawUninitializedSentinel(Heap* heap) { |
| 6566 return heap->the_hole_value(); | 6609 return heap->the_hole_value(); |
| 6567 } | 6610 } |
| 6568 | 6611 |
| 6569 | 6612 |
| 6570 int TypeFeedbackInfo::ic_total_count() { | 6613 int TypeFeedbackInfo::ic_total_count() { |
| 6571 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 6614 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); |
| 6572 return ICTotalCountField::decode(current); | 6615 return ICTotalCountField::decode(current); |
| 6573 } | 6616 } |
| 6574 | 6617 |
| 6575 | 6618 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6638 } | 6681 } |
| 6639 | 6682 |
| 6640 | 6683 |
| 6641 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { | 6684 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { |
| 6642 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); | 6685 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); |
| 6643 int mask = (1 << kTypeChangeChecksumBits) - 1; | 6686 int mask = (1 << kTypeChangeChecksumBits) - 1; |
| 6644 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); | 6687 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); |
| 6645 } | 6688 } |
| 6646 | 6689 |
| 6647 | 6690 |
| 6648 ACCESSORS(TypeFeedbackInfo, feedback_vector, FixedArray, | 6691 ACCESSORS(TypeFeedbackInfo, type_feedback_cells, TypeFeedbackCells, |
| 6649 kFeedbackVectorOffset) | 6692 kTypeFeedbackCellsOffset) |
| 6650 | 6693 |
| 6651 | 6694 |
| 6652 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) | 6695 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) |
| 6653 | 6696 |
| 6654 | 6697 |
| 6655 Relocatable::Relocatable(Isolate* isolate) { | 6698 Relocatable::Relocatable(Isolate* isolate) { |
| 6656 isolate_ = isolate; | 6699 isolate_ = isolate; |
| 6657 prev_ = isolate->relocatable_top(); | 6700 prev_ = isolate->relocatable_top(); |
| 6658 isolate->set_relocatable_top(this); | 6701 isolate->set_relocatable_top(this); |
| 6659 } | 6702 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6753 #undef READ_UINT32_FIELD | 6796 #undef READ_UINT32_FIELD |
| 6754 #undef WRITE_UINT32_FIELD | 6797 #undef WRITE_UINT32_FIELD |
| 6755 #undef READ_SHORT_FIELD | 6798 #undef READ_SHORT_FIELD |
| 6756 #undef WRITE_SHORT_FIELD | 6799 #undef WRITE_SHORT_FIELD |
| 6757 #undef READ_BYTE_FIELD | 6800 #undef READ_BYTE_FIELD |
| 6758 #undef WRITE_BYTE_FIELD | 6801 #undef WRITE_BYTE_FIELD |
| 6759 | 6802 |
| 6760 } } // namespace v8::internal | 6803 } } // namespace v8::internal |
| 6761 | 6804 |
| 6762 #endif // V8_OBJECTS_INL_H_ | 6805 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |