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 742 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 | |
773 bool Object::IsContext() { | 763 bool Object::IsContext() { |
774 if (!Object::IsHeapObject()) return false; | 764 if (!Object::IsHeapObject()) return false; |
775 Map* map = HeapObject::cast(this)->map(); | 765 Map* map = HeapObject::cast(this)->map(); |
776 Heap* heap = map->GetHeap(); | 766 Heap* heap = map->GetHeap(); |
777 return (map == heap->function_context_map() || | 767 return (map == heap->function_context_map() || |
778 map == heap->catch_context_map() || | 768 map == heap->catch_context_map() || |
779 map == heap->with_context_map() || | 769 map == heap->with_context_map() || |
780 map == heap->native_context_map() || | 770 map == heap->native_context_map() || |
781 map == heap->block_context_map() || | 771 map == heap->block_context_map() || |
782 map == heap->module_context_map() || | 772 map == heap->module_context_map() || |
(...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2776 | 2766 |
2777 | 2767 |
2778 CAST_ACCESSOR(FixedArray) | 2768 CAST_ACCESSOR(FixedArray) |
2779 CAST_ACCESSOR(FixedDoubleArray) | 2769 CAST_ACCESSOR(FixedDoubleArray) |
2780 CAST_ACCESSOR(FixedTypedArrayBase) | 2770 CAST_ACCESSOR(FixedTypedArrayBase) |
2781 CAST_ACCESSOR(ConstantPoolArray) | 2771 CAST_ACCESSOR(ConstantPoolArray) |
2782 CAST_ACCESSOR(DescriptorArray) | 2772 CAST_ACCESSOR(DescriptorArray) |
2783 CAST_ACCESSOR(DeoptimizationInputData) | 2773 CAST_ACCESSOR(DeoptimizationInputData) |
2784 CAST_ACCESSOR(DeoptimizationOutputData) | 2774 CAST_ACCESSOR(DeoptimizationOutputData) |
2785 CAST_ACCESSOR(DependentCode) | 2775 CAST_ACCESSOR(DependentCode) |
2786 CAST_ACCESSOR(TypeFeedbackCells) | |
2787 CAST_ACCESSOR(StringTable) | 2776 CAST_ACCESSOR(StringTable) |
2788 CAST_ACCESSOR(JSFunctionResultCache) | 2777 CAST_ACCESSOR(JSFunctionResultCache) |
2789 CAST_ACCESSOR(NormalizedMapCache) | 2778 CAST_ACCESSOR(NormalizedMapCache) |
2790 CAST_ACCESSOR(ScopeInfo) | 2779 CAST_ACCESSOR(ScopeInfo) |
2791 CAST_ACCESSOR(CompilationCacheTable) | 2780 CAST_ACCESSOR(CompilationCacheTable) |
2792 CAST_ACCESSOR(CodeCacheHashTable) | 2781 CAST_ACCESSOR(CodeCacheHashTable) |
2793 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) | 2782 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) |
2794 CAST_ACCESSOR(MapCache) | 2783 CAST_ACCESSOR(MapCache) |
2795 CAST_ACCESSOR(String) | 2784 CAST_ACCESSOR(String) |
2796 CAST_ACCESSOR(SeqString) | 2785 CAST_ACCESSOR(SeqString) |
(...skipping 3750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6547 return GetHeap()->CopyFixedDoubleArray(this); | 6536 return GetHeap()->CopyFixedDoubleArray(this); |
6548 } | 6537 } |
6549 | 6538 |
6550 | 6539 |
6551 MaybeObject* ConstantPoolArray::Copy() { | 6540 MaybeObject* ConstantPoolArray::Copy() { |
6552 if (length() == 0) return this; | 6541 if (length() == 0) return this; |
6553 return GetHeap()->CopyConstantPoolArray(this); | 6542 return GetHeap()->CopyConstantPoolArray(this); |
6554 } | 6543 } |
6555 | 6544 |
6556 | 6545 |
6557 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) { | 6546 Handle<Object> TypeFeedbackInfo::UninitializedSentinel(Isolate* isolate) { |
6558 set(1 + index * 2, Smi::FromInt(id.ToInt())); | |
6559 } | |
6560 | |
6561 | |
6562 TypeFeedbackId TypeFeedbackCells::AstId(int index) { | |
6563 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value()); | |
6564 } | |
6565 | |
6566 | |
6567 void TypeFeedbackCells::SetCell(int index, Cell* cell) { | |
6568 set(index * 2, cell); | |
6569 } | |
6570 | |
6571 | |
6572 Cell* TypeFeedbackCells::GetCell(int index) { | |
6573 return Cell::cast(get(index * 2)); | |
6574 } | |
6575 | |
6576 | |
6577 Handle<Object> TypeFeedbackCells::UninitializedSentinel(Isolate* isolate) { | |
6578 return isolate->factory()->the_hole_value(); | 6547 return isolate->factory()->the_hole_value(); |
6579 } | 6548 } |
6580 | 6549 |
6581 | 6550 |
6582 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { | 6551 Handle<Object> TypeFeedbackInfo::MegamorphicSentinel(Isolate* isolate) { |
6583 return isolate->factory()->undefined_value(); | 6552 return isolate->factory()->undefined_value(); |
6584 } | 6553 } |
6585 | 6554 |
6586 | 6555 |
6587 Handle<Object> TypeFeedbackCells::MonomorphicArraySentinel(Isolate* isolate, | 6556 Handle<Object> TypeFeedbackInfo::MonomorphicArraySentinel(Isolate* isolate, |
6588 ElementsKind elements_kind) { | 6557 ElementsKind elements_kind) { |
6589 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); | 6558 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); |
6590 } | 6559 } |
6591 | 6560 |
6592 | 6561 |
6593 Object* TypeFeedbackCells::RawUninitializedSentinel(Heap* heap) { | 6562 Object* TypeFeedbackInfo::RawUninitializedSentinel(Heap* heap) { |
6594 return heap->the_hole_value(); | 6563 return heap->the_hole_value(); |
6595 } | 6564 } |
6596 | 6565 |
6597 | 6566 |
6598 int TypeFeedbackInfo::ic_total_count() { | 6567 int TypeFeedbackInfo::ic_total_count() { |
6599 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 6568 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); |
6600 return ICTotalCountField::decode(current); | 6569 return ICTotalCountField::decode(current); |
6601 } | 6570 } |
6602 | 6571 |
6603 | 6572 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6666 } | 6635 } |
6667 | 6636 |
6668 | 6637 |
6669 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { | 6638 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { |
6670 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); | 6639 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); |
6671 int mask = (1 << kTypeChangeChecksumBits) - 1; | 6640 int mask = (1 << kTypeChangeChecksumBits) - 1; |
6672 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); | 6641 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); |
6673 } | 6642 } |
6674 | 6643 |
6675 | 6644 |
6676 ACCESSORS(TypeFeedbackInfo, type_feedback_cells, TypeFeedbackCells, | 6645 ACCESSORS(TypeFeedbackInfo, feedback_vector, FixedArray, |
6677 kTypeFeedbackCellsOffset) | 6646 kFeedbackVectorOffset) |
6678 | 6647 |
6679 | 6648 |
6680 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) | 6649 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) |
6681 | 6650 |
6682 | 6651 |
6683 Relocatable::Relocatable(Isolate* isolate) { | 6652 Relocatable::Relocatable(Isolate* isolate) { |
6684 isolate_ = isolate; | 6653 isolate_ = isolate; |
6685 prev_ = isolate->relocatable_top(); | 6654 prev_ = isolate->relocatable_top(); |
6686 isolate->set_relocatable_top(this); | 6655 isolate->set_relocatable_top(this); |
6687 } | 6656 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6781 #undef READ_UINT32_FIELD | 6750 #undef READ_UINT32_FIELD |
6782 #undef WRITE_UINT32_FIELD | 6751 #undef WRITE_UINT32_FIELD |
6783 #undef READ_SHORT_FIELD | 6752 #undef READ_SHORT_FIELD |
6784 #undef WRITE_SHORT_FIELD | 6753 #undef WRITE_SHORT_FIELD |
6785 #undef READ_BYTE_FIELD | 6754 #undef READ_BYTE_FIELD |
6786 #undef WRITE_BYTE_FIELD | 6755 #undef WRITE_BYTE_FIELD |
6787 | 6756 |
6788 } } // namespace v8::internal | 6757 } } // namespace v8::internal |
6789 | 6758 |
6790 #endif // V8_OBJECTS_INL_H_ | 6759 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |