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

Side by Side Diff: src/compiler.h

Issue 959203002: CpuProfiler: replace raw position with SourcePosition for DeoptReason (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: unnecessary changes were removed Created 5 years, 9 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 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_COMPILER_H_ 5 #ifndef V8_COMPILER_H_
6 #define V8_COMPILER_H_ 6 #define V8_COMPILER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 21 matching lines...) Expand all
32 32
33 // This class encapsulates encoding and decoding of sources positions from 33 // This class encapsulates encoding and decoding of sources positions from
34 // which hydrogen values originated. 34 // which hydrogen values originated.
35 // When FLAG_track_hydrogen_positions is set this object encodes the 35 // When FLAG_track_hydrogen_positions is set this object encodes the
36 // identifier of the inlining and absolute offset from the start of the 36 // identifier of the inlining and absolute offset from the start of the
37 // inlined function. 37 // inlined function.
38 // When the flag is not set we simply track absolute offset from the 38 // When the flag is not set we simply track absolute offset from the
39 // script start. 39 // script start.
40 class SourcePosition { 40 class SourcePosition {
41 public: 41 public:
42 SourcePosition(const SourcePosition& other) : value_(other.value_) {} 42 explicit SourcePosition(uint32_t value) : value_(value) {}
43 43
44 static SourcePosition Unknown() { return SourcePosition(kNoPosition); } 44 static SourcePosition Unknown() { return SourcePosition(kNoPosition); }
45 45
46 bool IsUnknown() const { return value_ == kNoPosition; } 46 bool IsUnknown() const { return value_ == kNoPosition; }
47 47
48 uint32_t position() const { return PositionField::decode(value_); } 48 uint32_t position() const { return PositionField::decode(value_); }
49 void set_position(uint32_t position) { 49 void set_position(uint32_t position) {
50 if (FLAG_hydrogen_track_positions) { 50 if (FLAG_hydrogen_track_positions) {
51 value_ = static_cast<uint32_t>(PositionField::update(value_, position)); 51 value_ = static_cast<uint32_t>(PositionField::update(value_, position));
52 } else { 52 } else {
(...skipping 12 matching lines...) Expand all
65 uint32_t raw() const { return value_; } 65 uint32_t raw() const { return value_; }
66 66
67 private: 67 private:
68 static const uint32_t kNoPosition = 68 static const uint32_t kNoPosition =
69 static_cast<uint32_t>(RelocInfo::kNoPosition); 69 static_cast<uint32_t>(RelocInfo::kNoPosition);
70 typedef BitField<uint32_t, 0, 9> InliningIdField; 70 typedef BitField<uint32_t, 0, 9> InliningIdField;
71 71
72 // Offset from the start of the inlined function. 72 // Offset from the start of the inlined function.
73 typedef BitField<uint32_t, 9, 23> PositionField; 73 typedef BitField<uint32_t, 9, 23> PositionField;
74 74
75 explicit SourcePosition(uint32_t value) : value_(value) {}
76
77 friend class HPositionInfo; 75 friend class HPositionInfo;
78 friend class LCodeGenBase; 76 friend class LCodeGenBase;
79 77
80 // If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField 78 // If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField
81 // and PositionField. 79 // and PositionField.
82 // Otherwise contains absolute offset from the script start. 80 // Otherwise contains absolute offset from the script start.
83 uint32_t value_; 81 uint32_t value_;
84 }; 82 };
85 83
86 84
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 Zone zone_; 856 Zone zone_;
859 size_t info_zone_start_allocation_size_; 857 size_t info_zone_start_allocation_size_;
860 base::ElapsedTimer timer_; 858 base::ElapsedTimer timer_;
861 859
862 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); 860 DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
863 }; 861 };
864 862
865 } } // namespace v8::internal 863 } } // namespace v8::internal
866 864
867 #endif // V8_COMPILER_H_ 865 #endif // V8_COMPILER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698