class FreeStoreAllocationPolicy;
template <typename T, class P = FreeStoreAllocationPolicy> class List;
+// -----------------------------------------------------------------------------
+// Declarations for use in both the preparser and the rest of V8.
+
+// The Strict Mode (ECMA-262 5th edition, 4.2.2).
+enum StrictModeFlag {
+ kNonStrictMode,
+ kStrictMode,
+ // This value is never used, but is needed to prevent GCC 4.5 from failing
+ // to compile when we assert that a flag is either kNonStrictMode or
+ // kStrictMode.
+ kInvalidStrictFlag
+};
+
+
} } // namespace v8::internal
#endif // V8_GLOBALS_H_
scanner().SeekForward(scope->end_position() - 1);
materialized_literal_count = entry.literal_count();
expected_property_count = entry.property_count();
- if (entry.strict_mode()) top_scope_->SetStrictModeFlag(kStrictMode);
+ top_scope_->SetStrictModeFlag(entry.strict_mode_flag());
only_simple_this_property_assignments = false;
this_property_assignments = isolate()->factory()->empty_fixed_array();
Expect(Token::RBRACE, CHECK_OK);
int end_pos() { return backing_[kEndPosOffset]; }
int literal_count() { return backing_[kLiteralCountOffset]; }
int property_count() { return backing_[kPropertyCountOffset]; }
- bool strict_mode() { return backing_[kStrictModeOffset] != 0; }
+ StrictModeFlag strict_mode_flag() {
+ return static_cast<StrictModeFlag>(backing_[kStrictModeOffset]);
+ }
bool is_valid() { return backing_.length() > 0; }
int end,
int literals,
int properties,
- int strict_mode) = 0;
+ StrictModeFlag strict_mode) = 0;
// Logs a symbol creation of a literal or identifier.
virtual void LogAsciiSymbol(int start, Vector<const char> literal) { }
int end,
int literals,
int properties,
- int strict_mode) {
+ StrictModeFlag strict_mode) {
function_store_.Add(start);
function_store_.Add(end);
function_store_.Add(literals);
log_->LogFunction(function_block_pos, end_pos,
function_scope.materialized_literal_count(),
function_scope.expected_properties(),
- strict_mode() ? 1 : 0);
+ strict_mode_flag());
} else {
ParseSourceElements(i::Token::RBRACE, CHECK_OK);
Expect(i::Token::RBRACE, CHECK_OK);
typedef int Arguments;
- // The Strict Mode (ECMA-262 5th edition, 4.2.2).
- enum StrictModeFlag {
- kNonStrictMode,
- kStrictMode,
- // This value is never used, but is needed to prevent GCC 4.5 from failing
- // to compile when we assert that a flag is either kNonStrictMode or
- // kStrictMode.
- kInvalidStrictFlag
- };
-
class Scope {
public:
Scope(Scope** variable, ScopeType type)
expected_properties_(0),
with_nesting_count_(0),
strict_mode_flag_((prev_ != NULL) ? prev_->strict_mode_flag()
- : kNonStrictMode) {
+ : i::kNonStrictMode) {
*variable = this;
}
~Scope() { *variable_ = prev_; }
int expected_properties() { return expected_properties_; }
int materialized_literal_count() { return materialized_literal_count_; }
bool IsInsideWith() { return with_nesting_count_ != 0; }
- bool is_strict_mode() { return strict_mode_flag_ == kStrictMode; }
- StrictModeFlag strict_mode_flag() {
+ bool is_strict_mode() { return strict_mode_flag_ == i::kStrictMode; }
+ i::StrictModeFlag strict_mode_flag() {
return strict_mode_flag_;
}
- void set_strict_mode_flag(StrictModeFlag strict_mode_flag) {
+ void set_strict_mode_flag(i::StrictModeFlag strict_mode_flag) {
strict_mode_flag_ = strict_mode_flag;
}
void EnterWith() { with_nesting_count_++; }
int materialized_literal_count_;
int expected_properties_;
int with_nesting_count_;
- StrictModeFlag strict_mode_flag_;
+ i::StrictModeFlag strict_mode_flag_;
};
// Private constructor only used in PreParseProgram.
bool peek_any_identifier();
void set_strict_mode() {
- scope_->set_strict_mode_flag(kStrictMode);
+ scope_->set_strict_mode_flag(i::kStrictMode);
}
- bool strict_mode() { return scope_->strict_mode_flag() == kStrictMode; }
+ bool strict_mode() { return scope_->strict_mode_flag() == i::kStrictMode; }
+
+ i::StrictModeFlag strict_mode_flag() { return scope_->strict_mode_flag(); }
void Consume(i::Token::Value token) { Next(); }
SAHF = 0, // x86
FPU = 1}; // MIPS
-// The Strict Mode (ECMA-262 5th edition, 4.2.2).
-enum StrictModeFlag {
- kNonStrictMode,
- kStrictMode,
- // This value is never used, but is needed to prevent GCC 4.5 from failing
- // to compile when we assert that a flag is either kNonStrictMode or
- // kStrictMode.
- kInvalidStrictFlag
-};
-
// Used to specify if a macro instruction must perform a smi check on tagged
// values.