| Index: src/globals.h
|
| diff --git a/src/globals.h b/src/globals.h
|
| index f01c10044e9815d02c861075058e399b5a4356a7..cde58c9d58ab78855bfce07b39a47041c27acd63 100644
|
| --- a/src/globals.h
|
| +++ b/src/globals.h
|
| @@ -233,11 +233,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 {
|
| @@ -297,8 +292,32 @@ inline LanguageMode construct_language_mode(bool strict_bit, bool strong_bit) {
|
| }
|
|
|
|
|
| -inline ObjectStrength strength(LanguageMode language_mode) {
|
| - return is_strong(language_mode) ? FIRM : WEAK;
|
| +// Strong mode behaviour must sometimes be signalled by a two valued enum where
|
| +// caching is involved, to prevent sloppy and strict mode from being incorrectly
|
| +// differentiated.
|
| +enum class Strength : bool {
|
| + WEAK, // sloppy, strict behaviour
|
| + STRONG // strong behaviour
|
| +};
|
| +
|
| +
|
| +inline bool is_strong(Strength strength) {
|
| + return strength == Strength::STRONG;
|
| +}
|
| +
|
| +
|
| +inline std::ostream& operator<<(std::ostream& os, const Strength& strength) {
|
| + return os << (is_strong(strength) ? "strong" : "weak");
|
| +}
|
| +
|
| +
|
| +inline Strength strength(LanguageMode language_mode) {
|
| + return is_strong(language_mode) ? Strength::STRONG : Strength::WEAK;
|
| +}
|
| +
|
| +
|
| +inline size_t hash_value(Strength strength) {
|
| + return static_cast<size_t>(strength);
|
| }
|
|
|
|
|
|
|