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

Unified Diff: src/globals.h

Issue 1773653002: [strong] Remove all remainders of strong mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: src/globals.h
diff --git a/src/globals.h b/src/globals.h
index 61cce5cade9afe5f1e9bf303788487ec89e7608a..7ca680f041cd04029d7be216516d3dc5ea8dfeec 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -243,60 +243,35 @@ template <typename T, class P = FreeStoreAllocationPolicy> class List;
// The Strict Mode (ECMA-262 5th edition, 4.2.2).
-enum LanguageMode {
- // LanguageMode is expressed as a bitmask. Descriptions of the bits:
- STRICT_BIT = 1 << 0,
- STRONG_BIT = 1 << 1,
- LANGUAGE_END,
-
- // Shorthands for some common language modes.
- SLOPPY = 0,
- STRICT = STRICT_BIT,
- STRONG = STRICT_BIT | STRONG_BIT
-};
+enum LanguageMode { SLOPPY, STRICT, LANGUAGE_END = 3 };
Michael Starzinger 2016/03/08 10:53:45 As discussed offline: A nice follow-up to this CL
inline std::ostream& operator<<(std::ostream& os, const LanguageMode& mode) {
switch (mode) {
- case SLOPPY:
- return os << "sloppy";
- case STRICT:
- return os << "strict";
- case STRONG:
- return os << "strong";
- default:
- return os << "unknown";
+ case SLOPPY: return os << "sloppy";
+ case STRICT: return os << "strict";
+ default: UNREACHABLE();
}
}
inline bool is_sloppy(LanguageMode language_mode) {
- return (language_mode & STRICT_BIT) == 0;
+ return language_mode == SLOPPY;
}
inline bool is_strict(LanguageMode language_mode) {
- return language_mode & STRICT_BIT;
-}
-
-
-inline bool is_strong(LanguageMode language_mode) {
- return language_mode & STRONG_BIT;
+ return language_mode != SLOPPY;
}
inline bool is_valid_language_mode(int language_mode) {
- return language_mode == SLOPPY || language_mode == STRICT ||
- language_mode == STRONG;
+ return language_mode == SLOPPY || language_mode == STRICT;
}
-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);
+inline LanguageMode construct_language_mode(bool strict_bit) {
+ return static_cast<LanguageMode>(strict_bit);
}
@@ -1034,7 +1009,6 @@ inline bool IsConstructable(FunctionKind kind, LanguageMode mode) {
if (IsConciseMethod(kind)) return false;
if (IsArrowFunction(kind)) return false;
if (IsGeneratorFunction(kind)) return false;
- if (is_strong(mode)) return IsClassConstructor(kind);
return true;
}
« no previous file with comments | « src/full-codegen/full-codegen.cc ('k') | src/heap-symbols.h » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698