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

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: fix for win32 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
« no previous file with comments | « src/assembler.cc ('k') | src/cpu-profiler.h » ('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_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 static SourcePosition Unknown() {
43 43 return SourcePosition::FromRaw(kNoPosition);
44 static SourcePosition Unknown() { return SourcePosition(kNoPosition); } 44 }
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 {
53 value_ = position; 53 value_ = position;
54 } 54 }
(...skipping 10 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) {} 75 friend class HPositionInfo;
76 friend class Deoptimizer;
76 77
77 friend class HPositionInfo; 78 static SourcePosition FromRaw(uint32_t raw_position) {
78 friend class LCodeGenBase; 79 SourcePosition position;
80 position.value_ = raw_position;
81 return position;
82 }
79 83
80 // If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField 84 // If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField
81 // and PositionField. 85 // and PositionField.
82 // Otherwise contains absolute offset from the script start. 86 // Otherwise contains absolute offset from the script start.
83 uint32_t value_; 87 uint32_t value_;
84 }; 88 };
85 89
86 90
87 std::ostream& operator<<(std::ostream& os, const SourcePosition& p); 91 std::ostream& operator<<(std::ostream& os, const SourcePosition& p);
88 92
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 Zone zone_; 862 Zone zone_;
859 size_t info_zone_start_allocation_size_; 863 size_t info_zone_start_allocation_size_;
860 base::ElapsedTimer timer_; 864 base::ElapsedTimer timer_;
861 865
862 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); 866 DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
863 }; 867 };
864 868
865 } } // namespace v8::internal 869 } } // namespace v8::internal
866 870
867 #endif // V8_COMPILER_H_ 871 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/cpu-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698