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

Unified Diff: src/objects.h

Issue 8417035: Introduce extended mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased to tip of tree. Created 9 years, 1 month 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/objects.h
diff --git a/src/objects.h b/src/objects.h
index a592a33694867791194516be5f9c6ef1551e58d7..c1b934586860e7840127f35d0f8302d8ad0b40bf 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -3041,12 +3041,12 @@ class ScopeInfo : public FixedArray {
// Does this scope call eval?
bool CallsEval();
- // Is this scope a strict mode scope?
- bool IsStrictMode();
+ // Return the language mode of this scope.
+ LanguageMode language_mode();
// Does this scope make a non-strict eval call?
bool CallsNonStrictEval() {
- return CallsEval() && !IsStrictMode();
+ return CallsEval() && (language_mode() == CLASSIC_MODE);
}
// Return the total number of locals allocated on the stack and in the
@@ -3214,9 +3214,9 @@ class ScopeInfo : public FixedArray {
// Properties of scopes.
class TypeField: public BitField<ScopeType, 0, 3> {};
class CallsEvalField: public BitField<bool, 3, 1> {};
- class StrictModeField: public BitField<bool, 4, 1> {};
- class FunctionVariableField: public BitField<FunctionVariableInfo, 5, 2> {};
- class FunctionVariableMode: public BitField<VariableMode, 7, 3> {};
+ class LanguageModeField: public BitField<LanguageMode, 4, 2> {};
+ class FunctionVariableField: public BitField<FunctionVariableInfo, 6, 2> {};
+ class FunctionVariableMode: public BitField<VariableMode, 8, 3> {};
// BitFields representing the encoded information for context locals in the
// ContextLocalInfoEntries part.
@@ -4970,12 +4970,15 @@ class SharedFunctionInfo: public HeapObject {
// spending time attempting to optimize it again.
DECL_BOOLEAN_ACCESSORS(optimization_disabled)
- // Indicates whether the function is a strict mode function.
- inline bool strict_mode();
+ // Indicates whether the function is a classic mode function.
Rico 2011/11/15 08:25:07 I would add "(i.e., classic in the sense that we h
Steven 2011/11/15 13:33:30 Done.
+ inline bool is_classic_mode();
- // Indicates the mode of the function.
- inline StrictModeFlag strict_mode_flag();
- inline void set_strict_mode_flag(StrictModeFlag strict_mode_flag);
+ // Indicates whether the function is an extended mode function.
+ inline bool is_extended_mode();
Rico 2011/11/15 08:25:07 Also, please add a comment here (or below for lang
Steven 2011/11/15 13:33:30 Done.
+
+ // Indicates the language mode of the function.
+ inline LanguageMode language_mode();
+ inline void set_language_mode(LanguageMode language_mode);
// False if the function definitely does not allocate an arguments object.
DECL_BOOLEAN_ACCESSORS(uses_arguments)
@@ -5198,6 +5201,7 @@ class SharedFunctionInfo: public HeapObject {
kCodeAgeShift,
kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize,
kStrictModeFunction,
+ kExtendedModeFunction,
kUsesArguments,
kHasDuplicateParameters,
kNative,
@@ -5228,18 +5232,26 @@ class SharedFunctionInfo: public HeapObject {
static const int kStrictModeBitWithinByte =
(kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte;
+ static const int kExtendedModeBitWithinByte =
+ (kExtendedModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte;
+
static const int kNativeBitWithinByte =
(kNative + kCompilerHintsSmiTagSize) % kBitsPerByte;
#if __BYTE_ORDER == __LITTLE_ENDIAN
static const int kStrictModeByteOffset = kCompilerHintsOffset +
(kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte;
+ static const int kExtendedModeByteOffset = kCompilerHintsOffset +
+ (kExtendedModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte;
static const int kNativeByteOffset = kCompilerHintsOffset +
(kNative + kCompilerHintsSmiTagSize) / kBitsPerByte;
#elif __BYTE_ORDER == __BIG_ENDIAN
static const int kStrictModeByteOffset = kCompilerHintsOffset +
(kCompilerHintsSize - 1) -
((kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte);
+ static const int kExtendedModeByteOffset = kCompilerHintsOffset +
+ (kCompilerHintsSize - 1) -
+ ((kExtendedModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte);
static const int kNativeByteOffset = kCompilerHintsOffset +
(kCompilerHintsSize - 1) -
((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte);
@@ -5856,7 +5868,7 @@ class CompilationCacheTable: public HashTable<CompilationCacheShape,
Object* Lookup(String* src);
Object* LookupEval(String* src,
Context* context,
- StrictModeFlag strict_mode,
+ LanguageMode language_mode,
int scope_position);
Object* LookupRegExp(String* source, JSRegExp::Flags flags);
MaybeObject* Put(String* src, Object* value);

Powered by Google App Engine
This is Rietveld 408576698