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

Side by Side Diff: src/utils.h

Issue 641373002: Introduce FeedbackVectorSlot type - better than int. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports. Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/type-info.cc ('k') | src/x64/full-codegen-x64.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_UTILS_H_ 5 #ifndef V8_UTILS_H_
6 #define V8_UTILS_H_ 6 #define V8_UTILS_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 static TypeFeedbackId None() { return TypeFeedbackId(kNoneId); } 944 static TypeFeedbackId None() { return TypeFeedbackId(kNoneId); }
945 bool IsNone() const { return id_ == kNoneId; } 945 bool IsNone() const { return id_ == kNoneId; }
946 946
947 private: 947 private:
948 static const int kNoneId = -1; 948 static const int kNoneId = -1;
949 949
950 int id_; 950 int id_;
951 }; 951 };
952 952
953 953
954 class FeedbackVectorSlot {
955 public:
956 explicit FeedbackVectorSlot(int id) : id_(id) {}
957 int ToInt() const { return id_; }
958
959 static FeedbackVectorSlot Invalid() {
960 return FeedbackVectorSlot(kInvalidSlot);
961 }
962 bool IsInvalid() const { return id_ == kInvalidSlot; }
963
964 FeedbackVectorSlot next() const {
965 DCHECK(id_ != kInvalidSlot);
966 return FeedbackVectorSlot(id_ + 1);
967 }
968
969 private:
970 static const int kInvalidSlot = -1;
971
972 int id_;
973 };
974
975
954 class BailoutId { 976 class BailoutId {
955 public: 977 public:
956 explicit BailoutId(int id) : id_(id) { } 978 explicit BailoutId(int id) : id_(id) { }
957 int ToInt() const { return id_; } 979 int ToInt() const { return id_; }
958 980
959 static BailoutId None() { return BailoutId(kNoneId); } 981 static BailoutId None() { return BailoutId(kNoneId); }
960 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); } 982 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); }
961 static BailoutId Declarations() { return BailoutId(kDeclarationsId); } 983 static BailoutId Declarations() { return BailoutId(kDeclarationsId); }
962 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); } 984 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); }
963 static BailoutId StubEntry() { return BailoutId(kStubEntryId); } 985 static BailoutId StubEntry() { return BailoutId(kStubEntryId); }
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 // Takes the address of the limit variable in order to find out where 1484 // Takes the address of the limit variable in order to find out where
1463 // the top of stack is right now. 1485 // the top of stack is right now.
1464 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); 1486 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit);
1465 return limit; 1487 return limit;
1466 } 1488 }
1467 1489
1468 } // namespace internal 1490 } // namespace internal
1469 } // namespace v8 1491 } // namespace v8
1470 1492
1471 #endif // V8_UTILS_H_ 1493 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/type-info.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698