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

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: Addressed feedback. Created 6 years, 10 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
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 2774
2785 2775
2786 CAST_ACCESSOR(FixedArray) 2776 CAST_ACCESSOR(FixedArray)
2787 CAST_ACCESSOR(FixedDoubleArray) 2777 CAST_ACCESSOR(FixedDoubleArray)
2788 CAST_ACCESSOR(FixedTypedArrayBase) 2778 CAST_ACCESSOR(FixedTypedArrayBase)
2789 CAST_ACCESSOR(ConstantPoolArray) 2779 CAST_ACCESSOR(ConstantPoolArray)
2790 CAST_ACCESSOR(DescriptorArray) 2780 CAST_ACCESSOR(DescriptorArray)
2791 CAST_ACCESSOR(DeoptimizationInputData) 2781 CAST_ACCESSOR(DeoptimizationInputData)
2792 CAST_ACCESSOR(DeoptimizationOutputData) 2782 CAST_ACCESSOR(DeoptimizationOutputData)
2793 CAST_ACCESSOR(DependentCode) 2783 CAST_ACCESSOR(DependentCode)
2794 CAST_ACCESSOR(TypeFeedbackCells)
2795 CAST_ACCESSOR(StringTable) 2784 CAST_ACCESSOR(StringTable)
2796 CAST_ACCESSOR(JSFunctionResultCache) 2785 CAST_ACCESSOR(JSFunctionResultCache)
2797 CAST_ACCESSOR(NormalizedMapCache) 2786 CAST_ACCESSOR(NormalizedMapCache)
2798 CAST_ACCESSOR(ScopeInfo) 2787 CAST_ACCESSOR(ScopeInfo)
2799 CAST_ACCESSOR(CompilationCacheTable) 2788 CAST_ACCESSOR(CompilationCacheTable)
2800 CAST_ACCESSOR(CodeCacheHashTable) 2789 CAST_ACCESSOR(CodeCacheHashTable)
2801 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) 2790 CAST_ACCESSOR(PolymorphicCodeCacheHashTable)
2802 CAST_ACCESSOR(MapCache) 2791 CAST_ACCESSOR(MapCache)
2803 CAST_ACCESSOR(String) 2792 CAST_ACCESSOR(String)
2804 CAST_ACCESSOR(SeqString) 2793 CAST_ACCESSOR(SeqString)
(...skipping 3751 matching lines...) Expand 10 before | Expand all | Expand 10 after
6556 return GetHeap()->CopyFixedDoubleArray(this); 6545 return GetHeap()->CopyFixedDoubleArray(this);
6557 } 6546 }
6558 6547
6559 6548
6560 MaybeObject* ConstantPoolArray::Copy() { 6549 MaybeObject* ConstantPoolArray::Copy() {
6561 if (length() == 0) return this; 6550 if (length() == 0) return this;
6562 return GetHeap()->CopyConstantPoolArray(this); 6551 return GetHeap()->CopyConstantPoolArray(this);
6563 } 6552 }
6564 6553
6565 6554
6566 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) { 6555 Handle<Object> TypeFeedbackInfo::UninitializedSentinel(Isolate* isolate) {
6567 set(1 + index * 2, Smi::FromInt(id.ToInt()));
6568 }
6569
6570
6571 TypeFeedbackId TypeFeedbackCells::AstId(int index) {
6572 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value());
6573 }
6574
6575
6576 void TypeFeedbackCells::SetCell(int index, Cell* cell) {
6577 set(index * 2, cell);
6578 }
6579
6580
6581 Cell* TypeFeedbackCells::GetCell(int index) {
6582 return Cell::cast(get(index * 2));
6583 }
6584
6585
6586 Handle<Object> TypeFeedbackCells::UninitializedSentinel(Isolate* isolate) {
6587 return isolate->factory()->the_hole_value(); 6556 return isolate->factory()->the_hole_value();
6588 } 6557 }
6589 6558
6590 6559
6591 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { 6560 Handle<Object> TypeFeedbackInfo::MegamorphicSentinel(Isolate* isolate) {
6592 return isolate->factory()->undefined_value(); 6561 return isolate->factory()->undefined_value();
6593 } 6562 }
6594 6563
6595 6564
6596 Handle<Object> TypeFeedbackCells::MonomorphicArraySentinel(Isolate* isolate, 6565 Handle<Object> TypeFeedbackInfo::MonomorphicArraySentinel(Isolate* isolate,
6597 ElementsKind elements_kind) { 6566 ElementsKind elements_kind) {
6598 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); 6567 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate);
6599 } 6568 }
6600 6569
6601 6570
6602 Object* TypeFeedbackCells::RawUninitializedSentinel(Heap* heap) { 6571 Object* TypeFeedbackInfo::RawUninitializedSentinel(Heap* heap) {
6603 return heap->the_hole_value(); 6572 return heap->the_hole_value();
6604 } 6573 }
6605 6574
6606 6575
6607 int TypeFeedbackInfo::ic_total_count() { 6576 int TypeFeedbackInfo::ic_total_count() {
6608 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); 6577 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
6609 return ICTotalCountField::decode(current); 6578 return ICTotalCountField::decode(current);
6610 } 6579 }
6611 6580
6612 6581
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
6675 } 6644 }
6676 6645
6677 6646
6678 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { 6647 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) {
6679 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); 6648 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value();
6680 int mask = (1 << kTypeChangeChecksumBits) - 1; 6649 int mask = (1 << kTypeChangeChecksumBits) - 1;
6681 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); 6650 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask);
6682 } 6651 }
6683 6652
6684 6653
6685 ACCESSORS(TypeFeedbackInfo, type_feedback_cells, TypeFeedbackCells, 6654 ACCESSORS(TypeFeedbackInfo, feedback_vector, FixedArray,
6686 kTypeFeedbackCellsOffset) 6655 kFeedbackVectorOffset)
6687 6656
6688 6657
6689 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) 6658 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot)
6690 6659
6691 6660
6692 Relocatable::Relocatable(Isolate* isolate) { 6661 Relocatable::Relocatable(Isolate* isolate) {
6693 isolate_ = isolate; 6662 isolate_ = isolate;
6694 prev_ = isolate->relocatable_top(); 6663 prev_ = isolate->relocatable_top();
6695 isolate->set_relocatable_top(this); 6664 isolate->set_relocatable_top(this);
6696 } 6665 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
6790 #undef READ_UINT32_FIELD 6759 #undef READ_UINT32_FIELD
6791 #undef WRITE_UINT32_FIELD 6760 #undef WRITE_UINT32_FIELD
6792 #undef READ_SHORT_FIELD 6761 #undef READ_SHORT_FIELD
6793 #undef WRITE_SHORT_FIELD 6762 #undef WRITE_SHORT_FIELD
6794 #undef READ_BYTE_FIELD 6763 #undef READ_BYTE_FIELD
6795 #undef WRITE_BYTE_FIELD 6764 #undef WRITE_BYTE_FIELD
6796 6765
6797 } } // namespace v8::internal 6766 } } // namespace v8::internal
6798 6767
6799 #endif // V8_OBJECTS_INL_H_ 6768 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698