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

Unified Diff: src/globals.h

Issue 1144183004: [strong] Refactor ObjectStrength into a replacement for strong boolean args (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: everything should work now Created 5 years, 7 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 c73f395cb6808672ffc19863112facb8c32c4752..23a647021d14e4724d881d422f6237c460206630 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -227,11 +227,6 @@ template <typename T, class P = FreeStoreAllocationPolicy> class List;
// -----------------------------------------------------------------------------
// Declarations for use in both the preparser and the rest of V8.
-enum ObjectStrength {
- WEAK,
- FIRM // strong object
-};
-
// The Strict Mode (ECMA-262 5th edition, 4.2.2).
enum LanguageMode {
@@ -291,8 +286,27 @@ inline LanguageMode construct_language_mode(bool strict_bit, bool strong_bit) {
}
-inline ObjectStrength strength(LanguageMode language_mode) {
- return is_strong(language_mode) ? FIRM : WEAK;
+enum class Strength : bool {
+ WEAK,
+ FIRM // strong behaviour
+};
+
+
+inline bool is_strong(Strength strength) { return strength == Strength::FIRM; }
+
+
+inline std::ostream& operator<<(std::ostream& os, const Strength& strength) {
+ return os << (is_strong(strength) ? "firm" : "weak");
+}
+
+
+inline Strength strength(LanguageMode language_mode) {
+ return is_strong(language_mode) ? Strength::FIRM : Strength::WEAK;
+}
+
+
+inline size_t hash_value(Strength strength) {
+ return static_cast<size_t>(strength);
}
« src/compiler/js-operator.h ('K') | « src/factory.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698