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

Side by Side Diff: src/utils.h

Issue 10831172: Introduced TypeFeedbackId and BailoutId types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated review feedback. Created 8 years, 4 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/assembler-x64.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 T Mask(E element) const { 973 T Mask(E element) const {
974 // The strange typing in ASSERT is necessary to avoid stupid warnings, see: 974 // The strange typing in ASSERT is necessary to avoid stupid warnings, see:
975 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43680 975 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43680
976 ASSERT(element < static_cast<int>(sizeof(T) * CHAR_BIT)); 976 ASSERT(element < static_cast<int>(sizeof(T) * CHAR_BIT));
977 return 1 << element; 977 return 1 << element;
978 } 978 }
979 979
980 T bits_; 980 T bits_;
981 }; 981 };
982 982
983
984 class TypeFeedbackId {
985 public:
986 explicit TypeFeedbackId(int id) : id_(id) { }
987 int ToInt() const { return id_; }
988
989 static TypeFeedbackId None() { return TypeFeedbackId(kNoneId); }
990 bool IsNone() const { return id_ == kNoneId; }
991
992 private:
993 static const int kNoneId = -1;
994
995 int id_;
996 };
997
998
999 class BailoutId {
1000 public:
1001 explicit BailoutId(int id) : id_(id) { }
1002 int ToInt() const { return id_; }
1003
1004 static BailoutId None() { return BailoutId(kNoneId); }
1005 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); }
1006 static BailoutId Declarations() { return BailoutId(kDeclarationsId); }
1007 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); }
1008
1009 bool IsNone() const { return id_ == kNoneId; }
1010 bool operator==(const BailoutId& other) const { return id_ == other.id_; }
1011
1012 private:
1013 static const int kNoneId = -1;
1014
1015 // Using 0 could disguise errors.
1016 static const int kFunctionEntryId = 2;
1017
1018 // This AST id identifies the point after the declarations have been visited.
1019 // We need it to capture the environment effects of declarations that emit
1020 // code (function declarations).
1021 static const int kDeclarationsId = 3;
1022
1023 // Ever FunctionState starts with this id.
1024 static const int kFirstUsableId = 4;
1025
1026 int id_;
1027 };
1028
983 } } // namespace v8::internal 1029 } } // namespace v8::internal
984 1030
985 #endif // V8_UTILS_H_ 1031 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/type-info.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698