Reviewers: Sven Panne, yurys, alph,

Message:
PTAL

Description:
Adjust types in SourcePosition. int -> uint32_t

BUG=
LOG=n

Please review this at https://codereview.chromium.org/931163002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+16, -16 lines):
  M src/compiler.h
  M src/compiler.cc


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 4b8157bee6a274ce3594391ec9e7244e03fd9d6c..5bdb19d163fcc12320c47b26be22a98197cfef4d 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -333,7 +333,6 @@ bool CompilationInfo::is_simple_parameter_list() {
   return scope_->is_simple_parameter_list();
 }

-
int CompilationInfo::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
                                           SourcePosition position) {
   if (!FLAG_hydrogen_track_positions) {
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index c9d91c24a43e8939b6c3075d2e50acf164fdfcad..8ef2e0a95b3ca19813347b7de738f1a1ae6a1cfe 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -41,37 +41,38 @@ class SourcePosition {
  public:
   SourcePosition(const SourcePosition& other) : value_(other.value_) {}

-  static SourcePosition Unknown() {
-    return SourcePosition(RelocInfo::kNoPosition);
-  }
+  static SourcePosition Unknown() { return SourcePosition(kNoPosition); }

-  bool IsUnknown() const { return value_ == RelocInfo::kNoPosition; }
+  bool IsUnknown() const { return value_ == kNoPosition; }

-  int position() const { return PositionField::decode(value_); }
-  void set_position(int position) {
+  uint32_t position() const { return PositionField::decode(value_); }
+  void set_position(uint32_t position) {
     if (FLAG_hydrogen_track_positions) {
-      value_ = static_cast<int>(PositionField::update(value_, position));
+ value_ = static_cast<uint32_t>(PositionField::update(value_, position));
     } else {
       value_ = position;
     }
   }

-  int inlining_id() const { return InliningIdField::decode(value_); }
-  void set_inlining_id(int inlining_id) {
+  uint32_t inlining_id() const { return InliningIdField::decode(value_); }
+  void set_inlining_id(uint32_t inlining_id) {
     if (FLAG_hydrogen_track_positions) {
- value_ = static_cast<int>(InliningIdField::update(value_, inlining_id));
+      value_ =
+ static_cast<uint32_t>(InliningIdField::update(value_, inlining_id));
     }
   }

-  int raw() const { return value_; }
+  uint32_t raw() const { return value_; }

  private:
-  typedef BitField<int, 0, 9> InliningIdField;
+  static const uint32_t kNoPosition =
+      static_cast<uint32_t>(RelocInfo::kNoPosition);
+  typedef BitField<uint32_t, 0, 9> InliningIdField;

   // Offset from the start of the inlined function.
-  typedef BitField<int, 9, 23> PositionField;
+  typedef BitField<uint32_t, 9, 23> PositionField;

-  explicit SourcePosition(int value) : value_(value) {}
+  explicit SourcePosition(uint32_t value) : value_(value) {}

   friend class HPositionInfo;
   friend class LCodeGenBase;
@@ -79,7 +80,7 @@ class SourcePosition {
// If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField
   // and PositionField.
   // Otherwise contains absolute offset from the script start.
-  int value_;
+  uint32_t value_;
 };




--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to