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

Side by Side Diff: src/objects.h

Issue 873233002: Cache WeakCell for optimized code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add check Created 5 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
« no previous file with comments | « src/mips64/lithium-codegen-mips64.cc ('k') | src/objects.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 4834 matching lines...) Expand 10 before | Expand all | Expand 10 after
4845 class DeoptimizationInputData: public FixedArray { 4845 class DeoptimizationInputData: public FixedArray {
4846 public: 4846 public:
4847 // Layout description. Indices in the array. 4847 // Layout description. Indices in the array.
4848 static const int kTranslationByteArrayIndex = 0; 4848 static const int kTranslationByteArrayIndex = 0;
4849 static const int kInlinedFunctionCountIndex = 1; 4849 static const int kInlinedFunctionCountIndex = 1;
4850 static const int kLiteralArrayIndex = 2; 4850 static const int kLiteralArrayIndex = 2;
4851 static const int kOsrAstIdIndex = 3; 4851 static const int kOsrAstIdIndex = 3;
4852 static const int kOsrPcOffsetIndex = 4; 4852 static const int kOsrPcOffsetIndex = 4;
4853 static const int kOptimizationIdIndex = 5; 4853 static const int kOptimizationIdIndex = 5;
4854 static const int kSharedFunctionInfoIndex = 6; 4854 static const int kSharedFunctionInfoIndex = 6;
4855 static const int kFirstDeoptEntryIndex = 7; 4855 static const int kWeakCellCacheIndex = 7;
4856 static const int kFirstDeoptEntryIndex = 8;
4856 4857
4857 // Offsets of deopt entry elements relative to the start of the entry. 4858 // Offsets of deopt entry elements relative to the start of the entry.
4858 static const int kAstIdRawOffset = 0; 4859 static const int kAstIdRawOffset = 0;
4859 static const int kTranslationIndexOffset = 1; 4860 static const int kTranslationIndexOffset = 1;
4860 static const int kArgumentsStackHeightOffset = 2; 4861 static const int kArgumentsStackHeightOffset = 2;
4861 static const int kPcOffset = 3; 4862 static const int kPcOffset = 3;
4862 static const int kDeoptEntrySize = 4; 4863 static const int kDeoptEntrySize = 4;
4863 4864
4864 // Simple element accessors. 4865 // Simple element accessors.
4865 #define DEFINE_ELEMENT_ACCESSORS(name, type) \ 4866 #define DEFINE_ELEMENT_ACCESSORS(name, type) \
4866 type* name() { \ 4867 type* name() { \
4867 return type::cast(get(k##name##Index)); \ 4868 return type::cast(get(k##name##Index)); \
4868 } \ 4869 } \
4869 void Set##name(type* value) { \ 4870 void Set##name(type* value) { \
4870 set(k##name##Index, value); \ 4871 set(k##name##Index, value); \
4871 } 4872 }
4872 4873
4873 DEFINE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) 4874 DEFINE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray)
4874 DEFINE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) 4875 DEFINE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi)
4875 DEFINE_ELEMENT_ACCESSORS(LiteralArray, FixedArray) 4876 DEFINE_ELEMENT_ACCESSORS(LiteralArray, FixedArray)
4876 DEFINE_ELEMENT_ACCESSORS(OsrAstId, Smi) 4877 DEFINE_ELEMENT_ACCESSORS(OsrAstId, Smi)
4877 DEFINE_ELEMENT_ACCESSORS(OsrPcOffset, Smi) 4878 DEFINE_ELEMENT_ACCESSORS(OsrPcOffset, Smi)
4878 DEFINE_ELEMENT_ACCESSORS(OptimizationId, Smi) 4879 DEFINE_ELEMENT_ACCESSORS(OptimizationId, Smi)
4879 DEFINE_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) 4880 DEFINE_ELEMENT_ACCESSORS(SharedFunctionInfo, Object)
4881 DEFINE_ELEMENT_ACCESSORS(WeakCellCache, Object)
4880 4882
4881 #undef DEFINE_ELEMENT_ACCESSORS 4883 #undef DEFINE_ELEMENT_ACCESSORS
4882 4884
4883 // Accessors for elements of the ith deoptimization entry. 4885 // Accessors for elements of the ith deoptimization entry.
4884 #define DEFINE_ENTRY_ACCESSORS(name, type) \ 4886 #define DEFINE_ENTRY_ACCESSORS(name, type) \
4885 type* name(int i) { \ 4887 type* name(int i) { \
4886 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ 4888 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \
4887 } \ 4889 } \
4888 void Set##name(int i, type* value) { \ 4890 void Set##name(int i, type* value) { \
4889 set(IndexForEntry(i) + k##name##Offset, value); \ 4891 set(IndexForEntry(i) + k##name##Offset, value); \
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
5400 !can_have_weak_objects()); 5402 !can_have_weak_objects());
5401 return is_optimized_code() && can_have_weak_objects(); 5403 return is_optimized_code() && can_have_weak_objects();
5402 } 5404 }
5403 5405
5404 inline bool IsWeakObject(Object* object) { 5406 inline bool IsWeakObject(Object* object) {
5405 return (CanContainWeakObjects() && IsWeakObjectInOptimizedCode(object)); 5407 return (CanContainWeakObjects() && IsWeakObjectInOptimizedCode(object));
5406 } 5408 }
5407 5409
5408 static inline bool IsWeakObjectInOptimizedCode(Object* object); 5410 static inline bool IsWeakObjectInOptimizedCode(Object* object);
5409 5411
5412 static Handle<WeakCell> WeakCellFor(Handle<Code> code);
5413 WeakCell* CachedWeakCell();
5414
5410 // Max loop nesting marker used to postpose OSR. We don't take loop 5415 // Max loop nesting marker used to postpose OSR. We don't take loop
5411 // nesting that is deeper than 5 levels into account. 5416 // nesting that is deeper than 5 levels into account.
5412 static const int kMaxLoopNestingMarker = 6; 5417 static const int kMaxLoopNestingMarker = 6;
5413 5418
5414 // Layout description. 5419 // Layout description.
5415 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; 5420 static const int kRelocationInfoOffset = HeapObject::kHeaderSize;
5416 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; 5421 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize;
5417 static const int kDeoptimizationDataOffset = 5422 static const int kDeoptimizationDataOffset =
5418 kHandlerTableOffset + kPointerSize; 5423 kHandlerTableOffset + kPointerSize;
5419 // For FUNCTION kind, we store the type feedback info here. 5424 // For FUNCTION kind, we store the type feedback info here.
(...skipping 5508 matching lines...) Expand 10 before | Expand all | Expand 10 after
10928 } else { 10933 } else {
10929 value &= ~(1 << bit_position); 10934 value &= ~(1 << bit_position);
10930 } 10935 }
10931 return value; 10936 return value;
10932 } 10937 }
10933 }; 10938 };
10934 10939
10935 } } // namespace v8::internal 10940 } } // namespace v8::internal
10936 10941
10937 #endif // V8_OBJECTS_H_ 10942 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips64/lithium-codegen-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698