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

Unified Diff: src/globals.h

Issue 898983002: Add strong mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code review + fixes Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/globals.h
diff --git a/src/globals.h b/src/globals.h
index 83fa2fa720e7b660034d84df15ee9a3c4a2e18cb..761a85d011f10a43c15d0e3ef2bd1ba5d38c4eb0 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -227,25 +227,47 @@ template <typename T, class P = FreeStoreAllocationPolicy> class List;
enum LanguageMode {
// LanguageMode is expressed as a bitmask. Descriptions of the bits:
- STRICT = 1 << 0,
+ STRICT_BIT = 1 << 0,
+ STRONG_BIT = 1 << 1,
LANGUAGE_END,
// Shorthands for some common language modes.
- SLOPPY = 0
+ SLOPPY = 0,
+ STRICT = STRICT_BIT,
+ STRONG = STRICT_BIT | STRONG_BIT
};
+
+inline bool is_sloppy(LanguageMode language_mode) {
+ return (language_mode & STRICT_BIT) == 0;
+}
+
+
inline bool is_strict(LanguageMode language_mode) {
- return language_mode & STRICT;
+ return language_mode & STRICT_BIT;
}
-inline bool is_sloppy(LanguageMode language_mode) {
- return (language_mode & STRICT) == 0;
+
+inline bool is_strong(LanguageMode language_mode) {
+ return language_mode & STRONG_BIT;
}
+
inline bool is_valid_language_mode(int language_mode) {
- return language_mode == SLOPPY || language_mode == STRICT;
+ return language_mode == SLOPPY || language_mode == STRICT ||
+ language_mode == STRONG;
+}
+
+
+inline LanguageMode construct_language_mode(bool strict_bit, bool strong_bit) {
+ int language_mode = 0;
+ if (strict_bit) language_mode |= STRICT_BIT;
+ if (strong_bit) language_mode |= STRONG_BIT;
+ DCHECK(is_valid_language_mode(language_mode));
+ return static_cast<LanguageMode>(language_mode);
}
+
// Mask for the sign bit in a smi.
const intptr_t kSmiSignMask = kIntptrSignBit;
« no previous file with comments | « src/flag-definitions.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698