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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 | 744 |
745 | 745 |
746 bool Object::IsDependentCode() { | 746 bool Object::IsDependentCode() { |
747 if (!IsFixedArray()) return false; | 747 if (!IsFixedArray()) return false; |
748 // There's actually no way to see the difference between a fixed array and | 748 // There's actually no way to see the difference between a fixed array and |
749 // a dependent codes array. | 749 // a dependent codes array. |
750 return true; | 750 return true; |
751 } | 751 } |
752 | 752 |
753 | 753 |
754 bool Object::IsTypeFeedbackCells() { | |
755 if (!IsFixedArray()) return false; | |
756 // There's actually no way to see the difference between a fixed array and | |
757 // a cache cells array. Since this is used for asserts we can check that | |
758 // the length is plausible though. | |
759 if (FixedArray::cast(this)->length() % 2 != 0) return false; | |
760 return true; | |
761 } | |
762 | |
763 | |
764 bool Object::IsContext() { | 754 bool Object::IsContext() { |
765 if (!Object::IsHeapObject()) return false; | 755 if (!Object::IsHeapObject()) return false; |
766 Map* map = HeapObject::cast(this)->map(); | 756 Map* map = HeapObject::cast(this)->map(); |
767 Heap* heap = map->GetHeap(); | 757 Heap* heap = map->GetHeap(); |
768 return (map == heap->function_context_map() || | 758 return (map == heap->function_context_map() || |
769 map == heap->catch_context_map() || | 759 map == heap->catch_context_map() || |
770 map == heap->with_context_map() || | 760 map == heap->with_context_map() || |
771 map == heap->native_context_map() || | 761 map == heap->native_context_map() || |
772 map == heap->block_context_map() || | 762 map == heap->block_context_map() || |
773 map == heap->module_context_map() || | 763 map == heap->module_context_map() || |
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2775 | 2765 |
2776 | 2766 |
2777 CAST_ACCESSOR(FixedArray) | 2767 CAST_ACCESSOR(FixedArray) |
2778 CAST_ACCESSOR(FixedDoubleArray) | 2768 CAST_ACCESSOR(FixedDoubleArray) |
2779 CAST_ACCESSOR(FixedTypedArrayBase) | 2769 CAST_ACCESSOR(FixedTypedArrayBase) |
2780 CAST_ACCESSOR(ConstantPoolArray) | 2770 CAST_ACCESSOR(ConstantPoolArray) |
2781 CAST_ACCESSOR(DescriptorArray) | 2771 CAST_ACCESSOR(DescriptorArray) |
2782 CAST_ACCESSOR(DeoptimizationInputData) | 2772 CAST_ACCESSOR(DeoptimizationInputData) |
2783 CAST_ACCESSOR(DeoptimizationOutputData) | 2773 CAST_ACCESSOR(DeoptimizationOutputData) |
2784 CAST_ACCESSOR(DependentCode) | 2774 CAST_ACCESSOR(DependentCode) |
2785 CAST_ACCESSOR(TypeFeedbackCells) | |
2786 CAST_ACCESSOR(StringTable) | 2775 CAST_ACCESSOR(StringTable) |
2787 CAST_ACCESSOR(JSFunctionResultCache) | 2776 CAST_ACCESSOR(JSFunctionResultCache) |
2788 CAST_ACCESSOR(NormalizedMapCache) | 2777 CAST_ACCESSOR(NormalizedMapCache) |
2789 CAST_ACCESSOR(ScopeInfo) | 2778 CAST_ACCESSOR(ScopeInfo) |
2790 CAST_ACCESSOR(CompilationCacheTable) | 2779 CAST_ACCESSOR(CompilationCacheTable) |
2791 CAST_ACCESSOR(CodeCacheHashTable) | 2780 CAST_ACCESSOR(CodeCacheHashTable) |
2792 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) | 2781 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) |
2793 CAST_ACCESSOR(MapCache) | 2782 CAST_ACCESSOR(MapCache) |
2794 CAST_ACCESSOR(String) | 2783 CAST_ACCESSOR(String) |
2795 CAST_ACCESSOR(SeqString) | 2784 CAST_ACCESSOR(SeqString) |
(...skipping 3748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6544 return GetHeap()->CopyFixedDoubleArray(this); | 6533 return GetHeap()->CopyFixedDoubleArray(this); |
6545 } | 6534 } |
6546 | 6535 |
6547 | 6536 |
6548 MaybeObject* ConstantPoolArray::Copy() { | 6537 MaybeObject* ConstantPoolArray::Copy() { |
6549 if (length() == 0) return this; | 6538 if (length() == 0) return this; |
6550 return GetHeap()->CopyConstantPoolArray(this); | 6539 return GetHeap()->CopyConstantPoolArray(this); |
6551 } | 6540 } |
6552 | 6541 |
6553 | 6542 |
6554 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) { | 6543 Handle<Object> TypeFeedbackInfo::UninitializedSentinel(Isolate* isolate) { |
6555 set(1 + index * 2, Smi::FromInt(id.ToInt())); | |
6556 } | |
6557 | |
6558 | |
6559 TypeFeedbackId TypeFeedbackCells::AstId(int index) { | |
6560 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value()); | |
6561 } | |
6562 | |
6563 | |
6564 void TypeFeedbackCells::SetCell(int index, Cell* cell) { | |
6565 set(index * 2, cell); | |
6566 } | |
6567 | |
6568 | |
6569 Cell* TypeFeedbackCells::GetCell(int index) { | |
6570 return Cell::cast(get(index * 2)); | |
6571 } | |
6572 | |
6573 | |
6574 Handle<Object> TypeFeedbackCells::UninitializedSentinel(Isolate* isolate) { | |
6575 return isolate->factory()->the_hole_value(); | 6544 return isolate->factory()->the_hole_value(); |
6576 } | 6545 } |
6577 | 6546 |
6578 | 6547 |
6579 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { | 6548 Handle<Object> TypeFeedbackInfo::MegamorphicSentinel(Isolate* isolate) { |
6580 return isolate->factory()->undefined_value(); | 6549 return isolate->factory()->undefined_value(); |
6581 } | 6550 } |
6582 | 6551 |
6583 | 6552 |
6584 Handle<Object> TypeFeedbackCells::MonomorphicArraySentinel(Isolate* isolate, | 6553 Handle<Object> TypeFeedbackInfo::MonomorphicArraySentinel(Isolate* isolate, |
6585 ElementsKind elements_kind) { | 6554 ElementsKind elements_kind) { |
6586 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); | 6555 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); |
6587 } | 6556 } |
6588 | 6557 |
6589 | 6558 |
6590 Object* TypeFeedbackCells::RawUninitializedSentinel(Heap* heap) { | 6559 Object* TypeFeedbackInfo::RawUninitializedSentinel(Heap* heap) { |
6591 return heap->the_hole_value(); | 6560 return heap->the_hole_value(); |
6592 } | 6561 } |
6593 | 6562 |
6594 | 6563 |
6595 int TypeFeedbackInfo::ic_total_count() { | 6564 int TypeFeedbackInfo::ic_total_count() { |
6596 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 6565 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); |
6597 return ICTotalCountField::decode(current); | 6566 return ICTotalCountField::decode(current); |
6598 } | 6567 } |
6599 | 6568 |
6600 | 6569 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6663 } | 6632 } |
6664 | 6633 |
6665 | 6634 |
6666 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { | 6635 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { |
6667 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); | 6636 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); |
6668 int mask = (1 << kTypeChangeChecksumBits) - 1; | 6637 int mask = (1 << kTypeChangeChecksumBits) - 1; |
6669 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); | 6638 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); |
6670 } | 6639 } |
6671 | 6640 |
6672 | 6641 |
6673 ACCESSORS(TypeFeedbackInfo, type_feedback_cells, TypeFeedbackCells, | 6642 ACCESSORS(TypeFeedbackInfo, feedback_vector, FixedArray, |
6674 kTypeFeedbackCellsOffset) | 6643 kFeedbackVectorOffset) |
6675 | 6644 |
6676 | 6645 |
6677 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) | 6646 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) |
6678 | 6647 |
6679 | 6648 |
6680 Relocatable::Relocatable(Isolate* isolate) { | 6649 Relocatable::Relocatable(Isolate* isolate) { |
6681 isolate_ = isolate; | 6650 isolate_ = isolate; |
6682 prev_ = isolate->relocatable_top(); | 6651 prev_ = isolate->relocatable_top(); |
6683 isolate->set_relocatable_top(this); | 6652 isolate->set_relocatable_top(this); |
6684 } | 6653 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6778 #undef READ_UINT32_FIELD | 6747 #undef READ_UINT32_FIELD |
6779 #undef WRITE_UINT32_FIELD | 6748 #undef WRITE_UINT32_FIELD |
6780 #undef READ_SHORT_FIELD | 6749 #undef READ_SHORT_FIELD |
6781 #undef WRITE_SHORT_FIELD | 6750 #undef WRITE_SHORT_FIELD |
6782 #undef READ_BYTE_FIELD | 6751 #undef READ_BYTE_FIELD |
6783 #undef WRITE_BYTE_FIELD | 6752 #undef WRITE_BYTE_FIELD |
6784 | 6753 |
6785 } } // namespace v8::internal | 6754 } } // namespace v8::internal |
6786 | 6755 |
6787 #endif // V8_OBJECTS_INL_H_ | 6756 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |