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

Side by Side Diff: src/objects.h

Issue 2882973002: [coverage] Block coverage with support for IfStatements (Closed)
Patch Set: Comment nit Created 3 years, 7 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include <memory> 9 #include <memory>
10 10
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 V(Callable) \ 991 V(Callable) \
992 V(CallHandlerInfo) \ 992 V(CallHandlerInfo) \
993 V(Cell) \ 993 V(Cell) \
994 V(Code) \ 994 V(Code) \
995 V(CodeCacheHashTable) \ 995 V(CodeCacheHashTable) \
996 V(CompilationCacheTable) \ 996 V(CompilationCacheTable) \
997 V(ConsString) \ 997 V(ConsString) \
998 V(ConstantElementsPair) \ 998 V(ConstantElementsPair) \
999 V(Constructor) \ 999 V(Constructor) \
1000 V(Context) \ 1000 V(Context) \
1001 V(CoverageInfo) \
1001 V(DeoptimizationInputData) \ 1002 V(DeoptimizationInputData) \
1002 V(DeoptimizationOutputData) \ 1003 V(DeoptimizationOutputData) \
1003 V(DependentCode) \ 1004 V(DependentCode) \
1004 V(DescriptorArray) \ 1005 V(DescriptorArray) \
1005 V(Dictionary) \ 1006 V(Dictionary) \
1006 V(External) \ 1007 V(External) \
1007 V(ExternalOneByteString) \ 1008 V(ExternalOneByteString) \
1008 V(ExternalString) \ 1009 V(ExternalString) \
1009 V(ExternalTwoByteString) \ 1010 V(ExternalTwoByteString) \
1010 V(FeedbackMetadata) \ 1011 V(FeedbackMetadata) \
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 // Smi represents integer Numbers that can be stored in 31 bits. 1568 // Smi represents integer Numbers that can be stored in 31 bits.
1568 // Smis are immediate which means they are NOT allocated in the heap. 1569 // Smis are immediate which means they are NOT allocated in the heap.
1569 // The this pointer has the following format: [31 bit signed int] 0 1570 // The this pointer has the following format: [31 bit signed int] 0
1570 // For long smis it has the following format: 1571 // For long smis it has the following format:
1571 // [32 bit signed int] [31 bits zero padding] 0 1572 // [32 bit signed int] [31 bits zero padding] 0
1572 // Smi stands for small integer. 1573 // Smi stands for small integer.
1573 class Smi: public Object { 1574 class Smi: public Object {
1574 public: 1575 public:
1575 // Returns the integer value. 1576 // Returns the integer value.
1576 inline int value() const { return Internals::SmiValue(this); } 1577 inline int value() const { return Internals::SmiValue(this); }
1578
1579 // Casts o to a Smi and returns its value.
1580 static inline int ToInt(Object* o);
rmcilroy 2017/05/18 14:17:59 Is this worth adding rather than just Smi::cast(o)
jgruber 2017/05/22 09:43:32 Smi::cast(o)->value() Smi::ToInt(o) I think the l
rmcilroy 2017/05/22 11:08:46 Acknowledged.
1581
1577 inline Smi* ToUint32Smi() { 1582 inline Smi* ToUint32Smi() {
1578 if (value() <= 0) return Smi::kZero; 1583 if (value() <= 0) return Smi::kZero;
1579 return Smi::FromInt(static_cast<uint32_t>(value())); 1584 return Smi::FromInt(static_cast<uint32_t>(value()));
1580 } 1585 }
1581 1586
1582 // Convert a value to a Smi object. 1587 // Convert a value to a Smi object.
1583 static inline Smi* FromInt(int value) { 1588 static inline Smi* FromInt(int value) {
1584 DCHECK(Smi::IsValid(value)); 1589 DCHECK(Smi::IsValid(value));
1585 return reinterpret_cast<Smi*>(Internals::IntToSmi(value)); 1590 return reinterpret_cast<Smi*>(Internals::IntToSmi(value));
1586 } 1591 }
(...skipping 4405 matching lines...) Expand 10 before | Expand all | Expand 10 after
5992 // The function is subject to debugging if a debug info is attached. 5997 // The function is subject to debugging if a debug info is attached.
5993 inline bool HasDebugInfo() const; 5998 inline bool HasDebugInfo() const;
5994 inline DebugInfo* GetDebugInfo() const; 5999 inline DebugInfo* GetDebugInfo() const;
5995 6000
5996 // A function has debug code if the compiled code has debug break slots. 6001 // A function has debug code if the compiled code has debug break slots.
5997 inline bool HasDebugCode() const; 6002 inline bool HasDebugCode() const;
5998 6003
5999 // [debug info]: Debug information. 6004 // [debug info]: Debug information.
6000 DECL_ACCESSORS(debug_info, Object) 6005 DECL_ACCESSORS(debug_info, Object)
6001 6006
6007 // A function has coverage info if block coverage has been enabled and the
6008 // function is user JS.
6009 inline bool HasCoverageInfo() const;
6010 DECL_ACCESSORS(coverage_info, Object)
6011
6002 // Bit field containing various information collected for debugging. 6012 // Bit field containing various information collected for debugging.
6003 // This field is either stored on the kDebugInfo slot or inside the 6013 // This field is either stored on the kDebugInfo slot or inside the
6004 // debug info struct. 6014 // debug info struct.
6005 inline int debugger_hints() const; 6015 inline int debugger_hints() const;
6006 inline void set_debugger_hints(int value); 6016 inline void set_debugger_hints(int value);
6007 6017
6008 // Indicates that the function was created by the Function function. 6018 // Indicates that the function was created by the Function function.
6009 // Though it's anonymous, toString should treat it as if it had the name 6019 // Though it's anonymous, toString should treat it as if it had the name
6010 // "anonymous". We don't set the name itself so that the system does not 6020 // "anonymous". We don't set the name itself so that the system does not
6011 // see a binding for it. 6021 // see a binding for it.
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
6259 static const int kNameOffset = kCodeOffset + kPointerSize; 6269 static const int kNameOffset = kCodeOffset + kPointerSize;
6260 static const int kScopeInfoOffset = kNameOffset + kPointerSize; 6270 static const int kScopeInfoOffset = kNameOffset + kPointerSize;
6261 static const int kOuterScopeInfoOffset = kScopeInfoOffset + kPointerSize; 6271 static const int kOuterScopeInfoOffset = kScopeInfoOffset + kPointerSize;
6262 static const int kConstructStubOffset = kOuterScopeInfoOffset + kPointerSize; 6272 static const int kConstructStubOffset = kOuterScopeInfoOffset + kPointerSize;
6263 static const int kInstanceClassNameOffset = 6273 static const int kInstanceClassNameOffset =
6264 kConstructStubOffset + kPointerSize; 6274 kConstructStubOffset + kPointerSize;
6265 static const int kFunctionDataOffset = 6275 static const int kFunctionDataOffset =
6266 kInstanceClassNameOffset + kPointerSize; 6276 kInstanceClassNameOffset + kPointerSize;
6267 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; 6277 static const int kScriptOffset = kFunctionDataOffset + kPointerSize;
6268 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; 6278 static const int kDebugInfoOffset = kScriptOffset + kPointerSize;
6269 static const int kFunctionIdentifierOffset = kDebugInfoOffset + kPointerSize; 6279 static const int kCoverageInfoOffset = kDebugInfoOffset + kPointerSize;
rmcilroy 2017/05/18 14:17:59 I don't think we want to add this as a field to SF
jgruber 2017/05/22 09:43:32 Ack. I discussed this with Benedikt a while ago, a
6280 static const int kFunctionIdentifierOffset =
6281 kCoverageInfoOffset + kPointerSize;
6270 static const int kFeedbackMetadataOffset = 6282 static const int kFeedbackMetadataOffset =
6271 kFunctionIdentifierOffset + kPointerSize; 6283 kFunctionIdentifierOffset + kPointerSize;
6272 static const int kFunctionLiteralIdOffset = 6284 static const int kFunctionLiteralIdOffset =
6273 kFeedbackMetadataOffset + kPointerSize; 6285 kFeedbackMetadataOffset + kPointerSize;
6274 #if TRACE_MAPS 6286 #if TRACE_MAPS
6275 static const int kUniqueIdOffset = kFunctionLiteralIdOffset + kPointerSize; 6287 static const int kUniqueIdOffset = kFunctionLiteralIdOffset + kPointerSize;
6276 static const int kLastPointerFieldOffset = kUniqueIdOffset; 6288 static const int kLastPointerFieldOffset = kUniqueIdOffset;
6277 #else 6289 #else
6278 // Just to not break the postmortrem support with conditional offsets 6290 // Just to not break the postmortrem support with conditional offsets
6279 static const int kUniqueIdOffset = kFunctionLiteralIdOffset; 6291 static const int kUniqueIdOffset = kFunctionLiteralIdOffset;
(...skipping 3762 matching lines...) Expand 10 before | Expand all | Expand 10 after
10042 10054
10043 static const int kEstimatedNofBreakPointsInFunction = 4; 10055 static const int kEstimatedNofBreakPointsInFunction = 4;
10044 10056
10045 private: 10057 private:
10046 // Get the break point info object for a source position. 10058 // Get the break point info object for a source position.
10047 Object* GetBreakPointInfo(int source_position); 10059 Object* GetBreakPointInfo(int source_position);
10048 10060
10049 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo); 10061 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo);
10050 }; 10062 };
10051 10063
10064 // Holds information related to block code coverage.
10065 // More information at go/v8-designdoc-block-code-coverage.
10066 class CoverageInfo : public FixedArray {
marja 2017/05/18 11:30:17 Please put this in a different file than objects.h
jgruber 2017/05/22 09:43:32 Ack, thought so myself after uploading this CL. I'
10067 public:
10068 int SlotCount() const;
10069
10070 int FromSourcePosition(int slot_index) const;
10071 int ToSourcePosition(int slot_index) const;
10072 int BlockCount(int slot_index) const;
10073
10074 void InitializeSlot(int slot_index, int from_pos, int to_pos);
10075 void IncrementBlockCount(int slot_index);
10076
10077 static int FixedArrayLengthForSlotCount(int slot_count) {
10078 return slot_count * kSlotIndexCount + kFirstSlotIndex;
10079 }
10080
10081 DECLARE_CAST(CoverageInfo)
10082
10083 private:
10084 static int FirstIndexForSlot(int slot_index) {
10085 return kFirstSlotIndex + slot_index * kSlotIndexCount;
10086 }
10087
10088 static const int kFirstSlotIndex = 0;
10089
10090 // Each slot is assigned a group of indices starting at kFirstSlotIndex.
10091 // Within this group, semantics are as follows:
10092 static const int kSlotFromSourcePositionIndex = 0;
10093 static const int kSlotToSourcePositionIndex = 1;
10094 static const int kSlotBlockCountIndex = 2;
10095 static const int kSlotIndexCount = 3;
10096
10097 DISALLOW_IMPLICIT_CONSTRUCTORS(CoverageInfo);
10098 };
10052 10099
10053 // The BreakPointInfo class holds information for break points set in a 10100 // The BreakPointInfo class holds information for break points set in a
10054 // function. The DebugInfo object holds a BreakPointInfo object for each code 10101 // function. The DebugInfo object holds a BreakPointInfo object for each code
10055 // position with one or more break points. 10102 // position with one or more break points.
10056 class BreakPointInfo : public Tuple2 { 10103 class BreakPointInfo : public Tuple2 {
10057 public: 10104 public:
10058 // The position in the source for the break position. 10105 // The position in the source for the break position.
10059 DECL_INT_ACCESSORS(source_position) 10106 DECL_INT_ACCESSORS(source_position)
10060 // List of related JavaScript break points. 10107 // List of related JavaScript break points.
10061 DECL_ACCESSORS(break_point_objects, Object) 10108 DECL_ACCESSORS(break_point_objects, Object)
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
10215 } 10262 }
10216 }; 10263 };
10217 10264
10218 10265
10219 } // NOLINT, false-positive due to second-order macros. 10266 } // NOLINT, false-positive due to second-order macros.
10220 } // NOLINT, false-positive due to second-order macros. 10267 } // NOLINT, false-positive due to second-order macros.
10221 10268
10222 #include "src/objects/object-macros-undef.h" 10269 #include "src/objects/object-macros-undef.h"
10223 10270
10224 #endif // V8_OBJECTS_H_ 10271 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698