Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/objects-inl.h

Issue 137403009: Adding a type vector to replace type cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Smarter vector allocation and refactoring. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 760
761 761
762 bool Object::IsDependentCode() { 762 bool Object::IsDependentCode() {
763 if (!IsFixedArray()) return false; 763 if (!IsFixedArray()) return false;
764 // There's actually no way to see the difference between a fixed array and 764 // There's actually no way to see the difference between a fixed array and
765 // a dependent codes array. 765 // a dependent codes array.
766 return true; 766 return true;
767 } 767 }
768 768
769 769
770 bool Object::IsTypeFeedbackCells() {
771 if (!IsFixedArray()) return false;
772 // There's actually no way to see the difference between a fixed array and
773 // a cache cells array. Since this is used for asserts we can check that
774 // the length is plausible though.
775 if (FixedArray::cast(this)->length() % 2 != 0) return false;
776 return true;
777 }
778
779
780 bool Object::IsContext() { 770 bool Object::IsContext() {
781 if (!Object::IsHeapObject()) return false; 771 if (!Object::IsHeapObject()) return false;
782 Map* map = HeapObject::cast(this)->map(); 772 Map* map = HeapObject::cast(this)->map();
783 Heap* heap = map->GetHeap(); 773 Heap* heap = map->GetHeap();
784 return (map == heap->function_context_map() || 774 return (map == heap->function_context_map() ||
785 map == heap->catch_context_map() || 775 map == heap->catch_context_map() ||
786 map == heap->with_context_map() || 776 map == heap->with_context_map() ||
787 map == heap->native_context_map() || 777 map == heap->native_context_map() ||
788 map == heap->block_context_map() || 778 map == heap->block_context_map() ||
789 map == heap->module_context_map() || 779 map == heap->module_context_map() ||
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2791 2781
2792 2782
2793 CAST_ACCESSOR(FixedArray) 2783 CAST_ACCESSOR(FixedArray)
2794 CAST_ACCESSOR(FixedDoubleArray) 2784 CAST_ACCESSOR(FixedDoubleArray)
2795 CAST_ACCESSOR(FixedTypedArrayBase) 2785 CAST_ACCESSOR(FixedTypedArrayBase)
2796 CAST_ACCESSOR(ConstantPoolArray) 2786 CAST_ACCESSOR(ConstantPoolArray)
2797 CAST_ACCESSOR(DescriptorArray) 2787 CAST_ACCESSOR(DescriptorArray)
2798 CAST_ACCESSOR(DeoptimizationInputData) 2788 CAST_ACCESSOR(DeoptimizationInputData)
2799 CAST_ACCESSOR(DeoptimizationOutputData) 2789 CAST_ACCESSOR(DeoptimizationOutputData)
2800 CAST_ACCESSOR(DependentCode) 2790 CAST_ACCESSOR(DependentCode)
2801 CAST_ACCESSOR(TypeFeedbackCells)
2802 CAST_ACCESSOR(StringTable) 2791 CAST_ACCESSOR(StringTable)
2803 CAST_ACCESSOR(JSFunctionResultCache) 2792 CAST_ACCESSOR(JSFunctionResultCache)
2804 CAST_ACCESSOR(NormalizedMapCache) 2793 CAST_ACCESSOR(NormalizedMapCache)
2805 CAST_ACCESSOR(ScopeInfo) 2794 CAST_ACCESSOR(ScopeInfo)
2806 CAST_ACCESSOR(CompilationCacheTable) 2795 CAST_ACCESSOR(CompilationCacheTable)
2807 CAST_ACCESSOR(CodeCacheHashTable) 2796 CAST_ACCESSOR(CodeCacheHashTable)
2808 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) 2797 CAST_ACCESSOR(PolymorphicCodeCacheHashTable)
2809 CAST_ACCESSOR(MapCache) 2798 CAST_ACCESSOR(MapCache)
2810 CAST_ACCESSOR(String) 2799 CAST_ACCESSOR(String)
2811 CAST_ACCESSOR(SeqString) 2800 CAST_ACCESSOR(SeqString)
(...skipping 3748 matching lines...) Expand 10 before | Expand all | Expand 10 after
6560 return GetHeap()->CopyFixedDoubleArray(this); 6549 return GetHeap()->CopyFixedDoubleArray(this);
6561 } 6550 }
6562 6551
6563 6552
6564 MaybeObject* ConstantPoolArray::Copy() { 6553 MaybeObject* ConstantPoolArray::Copy() {
6565 if (length() == 0) return this; 6554 if (length() == 0) return this;
6566 return GetHeap()->CopyConstantPoolArray(this); 6555 return GetHeap()->CopyConstantPoolArray(this);
6567 } 6556 }
6568 6557
6569 6558
6570 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) { 6559 Handle<Object> TypeFeedbackInfo::UninitializedSentinel(Isolate* isolate) {
6571 set(1 + index * 2, Smi::FromInt(id.ToInt()));
6572 }
6573
6574
6575 TypeFeedbackId TypeFeedbackCells::AstId(int index) {
6576 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value());
6577 }
6578
6579
6580 void TypeFeedbackCells::SetCell(int index, Cell* cell) {
6581 set(index * 2, cell);
6582 }
6583
6584
6585 Cell* TypeFeedbackCells::GetCell(int index) {
6586 return Cell::cast(get(index * 2));
6587 }
6588
6589
6590 Handle<Object> TypeFeedbackCells::UninitializedSentinel(Isolate* isolate) {
6591 return isolate->factory()->the_hole_value(); 6560 return isolate->factory()->the_hole_value();
6592 } 6561 }
6593 6562
6594 6563
6595 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { 6564 Handle<Object> TypeFeedbackInfo::MegamorphicSentinel(Isolate* isolate) {
6596 return isolate->factory()->undefined_value(); 6565 return isolate->factory()->undefined_value();
6597 } 6566 }
6598 6567
6599 6568
6600 Handle<Object> TypeFeedbackCells::MonomorphicArraySentinel(Isolate* isolate, 6569 Handle<Object> TypeFeedbackInfo::MonomorphicArraySentinel(Isolate* isolate,
6601 ElementsKind elements_kind) { 6570 ElementsKind elements_kind) {
6602 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); 6571 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate);
6603 } 6572 }
6604 6573
6605 6574
6606 Object* TypeFeedbackCells::RawUninitializedSentinel(Heap* heap) { 6575 Object* TypeFeedbackInfo::RawUninitializedSentinel(Heap* heap) {
6607 return heap->the_hole_value(); 6576 return heap->the_hole_value();
6608 } 6577 }
6609 6578
6610 6579
6611 int TypeFeedbackInfo::ic_total_count() { 6580 int TypeFeedbackInfo::ic_total_count() {
6612 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); 6581 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
6613 return ICTotalCountField::decode(current); 6582 return ICTotalCountField::decode(current);
6614 } 6583 }
6615 6584
6616 6585
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
6679 } 6648 }
6680 6649
6681 6650
6682 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { 6651 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) {
6683 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); 6652 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value();
6684 int mask = (1 << kTypeChangeChecksumBits) - 1; 6653 int mask = (1 << kTypeChangeChecksumBits) - 1;
6685 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); 6654 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask);
6686 } 6655 }
6687 6656
6688 6657
6689 ACCESSORS(TypeFeedbackInfo, type_feedback_cells, TypeFeedbackCells, 6658 ACCESSORS(TypeFeedbackInfo, feedback_vector, FixedArray,
6690 kTypeFeedbackCellsOffset) 6659 kFeedbackVectorOffset)
6691 6660
6692 6661
6693 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) 6662 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot)
6694 6663
6695 6664
6696 Relocatable::Relocatable(Isolate* isolate) { 6665 Relocatable::Relocatable(Isolate* isolate) {
6697 isolate_ = isolate; 6666 isolate_ = isolate;
6698 prev_ = isolate->relocatable_top(); 6667 prev_ = isolate->relocatable_top();
6699 isolate->set_relocatable_top(this); 6668 isolate->set_relocatable_top(this);
6700 } 6669 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
6794 #undef READ_UINT32_FIELD 6763 #undef READ_UINT32_FIELD
6795 #undef WRITE_UINT32_FIELD 6764 #undef WRITE_UINT32_FIELD
6796 #undef READ_SHORT_FIELD 6765 #undef READ_SHORT_FIELD
6797 #undef WRITE_SHORT_FIELD 6766 #undef WRITE_SHORT_FIELD
6798 #undef READ_BYTE_FIELD 6767 #undef READ_BYTE_FIELD
6799 #undef WRITE_BYTE_FIELD 6768 #undef WRITE_BYTE_FIELD
6800 6769
6801 } } // namespace v8::internal 6770 } } // namespace v8::internal
6802 6771
6803 #endif // V8_OBJECTS_INL_H_ 6772 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/ia32/code-stubs-ia32.cc ('K') | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698