Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index d2925c0b02e9058f48f5024d7028c5832ccebd4d..ead37b0a2cf155e32b1bf590a22e3f4c48339ce9 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -143,7 +143,7 @@ void RegExpBuilder::AddQuantifierToAtom( |
} |
RegExpTree* atom; |
if (characters_ != NULL) { |
- ASSERT(last_added_ == ADD_CHAR); |
+ DCHECK(last_added_ == ADD_CHAR); |
// Last atom was character. |
Vector<const uc16> char_vector = characters_->ToConstVector(); |
int num_chars = char_vector.length(); |
@@ -156,11 +156,11 @@ void RegExpBuilder::AddQuantifierToAtom( |
atom = new(zone()) RegExpAtom(char_vector); |
FlushText(); |
} else if (text_.length() > 0) { |
- ASSERT(last_added_ == ADD_ATOM); |
+ DCHECK(last_added_ == ADD_ATOM); |
atom = text_.RemoveLast(); |
FlushText(); |
} else if (terms_.length() > 0) { |
- ASSERT(last_added_ == ADD_ATOM); |
+ DCHECK(last_added_ == ADD_ATOM); |
atom = terms_.RemoveLast(); |
if (atom->max_match() == 0) { |
// Guaranteed to only match an empty string. |
@@ -257,7 +257,7 @@ void Parser::SetCachedData() { |
if (compile_options() == ScriptCompiler::kNoCompileOptions) { |
cached_parse_data_ = NULL; |
} else { |
- ASSERT(info_->cached_data() != NULL); |
+ DCHECK(info_->cached_data() != NULL); |
if (compile_options() == ScriptCompiler::kConsumeParserCache) { |
cached_parse_data_ = new ParseData(*info_->cached_data()); |
} |
@@ -266,7 +266,7 @@ void Parser::SetCachedData() { |
Scope* Parser::NewScope(Scope* parent, ScopeType scope_type) { |
- ASSERT(ast_value_factory_); |
+ DCHECK(ast_value_factory_); |
Scope* result = |
new (zone()) Scope(parent, scope_type, ast_value_factory_, zone()); |
result->Initialize(); |
@@ -348,7 +348,7 @@ bool ParserTraits::IsEvalOrArguments(const AstRawString* identifier) const { |
bool ParserTraits::IsThisProperty(Expression* expression) { |
- ASSERT(expression != NULL); |
+ DCHECK(expression != NULL); |
Property* property = expression->AsProperty(); |
return property != NULL && |
property->obj()->AsVariableProxy() != NULL && |
@@ -375,7 +375,7 @@ void ParserTraits::PushPropertyName(FuncNameInferrer* fni, |
void ParserTraits::CheckAssigningFunctionLiteralToProperty(Expression* left, |
Expression* right) { |
- ASSERT(left != NULL); |
+ DCHECK(left != NULL); |
if (left->AsProperty() != NULL && |
right->AsFunctionLiteral() != NULL) { |
right->AsFunctionLiteral()->set_pretenure(); |
@@ -464,7 +464,7 @@ bool ParserTraits::ShortcutNumericLiteralBinaryExpression( |
Expression* ParserTraits::BuildUnaryExpression( |
Expression* expression, Token::Value op, int pos, |
AstNodeFactory<AstConstructionVisitor>* factory) { |
- ASSERT(expression != NULL); |
+ DCHECK(expression != NULL); |
if (expression->IsLiteral()) { |
const AstValue* literal = expression->AsLiteral()->raw_value(); |
if (op == Token::NOT) { |
@@ -604,7 +604,7 @@ void ParserTraits::ReportMessageAt(Scanner::Location source_location, |
const AstRawString* ParserTraits::GetSymbol(Scanner* scanner) { |
const AstRawString* result = |
parser_->scanner()->CurrentSymbol(parser_->ast_value_factory_); |
- ASSERT(result != NULL); |
+ DCHECK(result != NULL); |
return result; |
} |
@@ -636,7 +636,7 @@ Literal* ParserTraits::ExpressionFromLiteral( |
return factory->NewNumberLiteral(value, pos); |
} |
default: |
- ASSERT(false); |
+ DCHECK(false); |
} |
return NULL; |
} |
@@ -709,7 +709,7 @@ Parser::Parser(CompilationInfo* info) |
pending_error_message_(NULL), |
pending_error_arg_(NULL), |
pending_error_char_arg_(NULL) { |
- ASSERT(!script_.is_null()); |
+ DCHECK(!script_.is_null()); |
isolate_->set_ast_node_id(0); |
set_allow_harmony_scoping(!info->is_native() && FLAG_harmony_scoping); |
set_allow_modules(!info->is_native() && FLAG_harmony_modules); |
@@ -786,8 +786,8 @@ FunctionLiteral* Parser::ParseProgram() { |
FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info, |
Handle<String> source) { |
- ASSERT(scope_ == NULL); |
- ASSERT(target_stack_ == NULL); |
+ DCHECK(scope_ == NULL); |
+ DCHECK(target_stack_ == NULL); |
FunctionLiteral* result = NULL; |
{ Scope* scope = NewScope(scope_, GLOBAL_SCOPE); |
@@ -872,7 +872,7 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info, |
} |
// Make sure the target stack is empty. |
- ASSERT(target_stack_ == NULL); |
+ DCHECK(target_stack_ == NULL); |
return result; |
} |
@@ -916,11 +916,11 @@ FunctionLiteral* Parser::ParseLazy() { |
FunctionLiteral* Parser::ParseLazy(Utf16CharacterStream* source) { |
Handle<SharedFunctionInfo> shared_info = info()->shared_info(); |
scanner_.Initialize(source); |
- ASSERT(scope_ == NULL); |
- ASSERT(target_stack_ == NULL); |
+ DCHECK(scope_ == NULL); |
+ DCHECK(target_stack_ == NULL); |
Handle<String> name(String::cast(shared_info->name())); |
- ASSERT(ast_value_factory_); |
+ DCHECK(ast_value_factory_); |
fni_ = new(zone()) FuncNameInferrer(ast_value_factory_, zone()); |
const AstRawString* raw_name = ast_value_factory_->GetString(name); |
fni_->PushEnclosingName(raw_name); |
@@ -941,8 +941,8 @@ FunctionLiteral* Parser::ParseLazy(Utf16CharacterStream* source) { |
original_scope_ = scope; |
FunctionState function_state(&function_state_, &scope_, scope, zone(), |
ast_value_factory_); |
- ASSERT(scope->strict_mode() == SLOPPY || info()->strict_mode() == STRICT); |
- ASSERT(info()->strict_mode() == shared_info->strict_mode()); |
+ DCHECK(scope->strict_mode() == SLOPPY || info()->strict_mode() == STRICT); |
+ DCHECK(info()->strict_mode() == shared_info->strict_mode()); |
scope->SetStrictMode(shared_info->strict_mode()); |
FunctionLiteral::FunctionType function_type = shared_info->is_expression() |
? (shared_info->is_anonymous() |
@@ -953,9 +953,9 @@ FunctionLiteral* Parser::ParseLazy(Utf16CharacterStream* source) { |
bool ok = true; |
if (shared_info->is_arrow()) { |
- ASSERT(!is_generator); |
+ DCHECK(!is_generator); |
Expression* expression = ParseExpression(false, &ok); |
- ASSERT(expression->IsFunctionLiteral()); |
+ DCHECK(expression->IsFunctionLiteral()); |
result = expression->AsFunctionLiteral(); |
} else { |
result = ParseFunctionLiteral(raw_name, Scanner::Location::invalid(), |
@@ -965,11 +965,11 @@ FunctionLiteral* Parser::ParseLazy(Utf16CharacterStream* source) { |
FunctionLiteral::NORMAL_ARITY, &ok); |
} |
// Make sure the results agree. |
- ASSERT(ok == (result != NULL)); |
+ DCHECK(ok == (result != NULL)); |
} |
// Make sure the target stack is empty. |
- ASSERT(target_stack_ == NULL); |
+ DCHECK(target_stack_ == NULL); |
ast_value_factory_->Internalize(isolate()); |
if (result == NULL) { |
@@ -1000,7 +1000,7 @@ void* Parser::ParseSourceElements(ZoneList<Statement*>* processor, |
// functions. |
TargetScope scope(&this->target_stack_); |
- ASSERT(processor != NULL); |
+ DCHECK(processor != NULL); |
bool directive_prologue = true; // Parsing directive prologue. |
while (peek() != end_token) { |
@@ -1041,7 +1041,7 @@ void* Parser::ParseSourceElements(ZoneList<Statement*>* processor, |
// all over the code base, so we go with a quick-fix for now. |
// In the same manner, we have to patch the parsing mode. |
if (is_eval && !scope_->is_eval_scope()) { |
- ASSERT(scope_->is_global_scope()); |
+ DCHECK(scope_->is_global_scope()); |
Scope* scope = NewScope(scope_, EVAL_SCOPE); |
scope->set_start_position(scope_->start_position()); |
scope->set_end_position(scope_->end_position()); |
@@ -1098,7 +1098,7 @@ Statement* Parser::ParseModuleElement(ZoneList<const AstRawString*>* labels, |
case Token::CONST: |
return ParseVariableStatement(kModuleElement, NULL, ok); |
case Token::LET: |
- ASSERT(allow_harmony_scoping()); |
+ DCHECK(allow_harmony_scoping()); |
if (strict_mode() == STRICT) { |
return ParseVariableStatement(kModuleElement, NULL, ok); |
} |
@@ -1234,9 +1234,9 @@ Module* Parser::ParseModuleLiteral(bool* ok) { |
} |
interface->MakeModule(ok); |
- ASSERT(*ok); |
+ DCHECK(*ok); |
interface->Freeze(ok); |
- ASSERT(*ok); |
+ DCHECK(*ok); |
return factory()->NewModuleLiteral(body, interface, pos); |
} |
@@ -1317,9 +1317,9 @@ Module* Parser::ParseModuleUrl(bool* ok) { |
Interface* interface = scope->interface(); |
Module* result = factory()->NewModuleLiteral(body, interface, pos); |
interface->Freeze(ok); |
- ASSERT(*ok); |
+ DCHECK(*ok); |
interface->Unify(scope->interface(), zone(), ok); |
- ASSERT(*ok); |
+ DCHECK(*ok); |
return result; |
} |
@@ -1475,7 +1475,7 @@ Statement* Parser::ParseExportDeclaration(bool* ok) { |
// scope_->AddDeclaration(declaration); |
} |
- ASSERT(result != NULL); |
+ DCHECK(result != NULL); |
return result; |
} |
@@ -1499,7 +1499,7 @@ Statement* Parser::ParseBlockElement(ZoneList<const AstRawString*>* labels, |
case Token::CONST: |
return ParseVariableStatement(kModuleElement, NULL, ok); |
case Token::LET: |
- ASSERT(allow_harmony_scoping()); |
+ DCHECK(allow_harmony_scoping()); |
if (strict_mode() == STRICT) { |
return ParseVariableStatement(kModuleElement, NULL, ok); |
} |
@@ -1615,7 +1615,7 @@ Statement* Parser::ParseStatement(ZoneList<const AstRawString*>* labels, |
return ParseVariableStatement(kStatement, NULL, ok); |
case Token::LET: |
- ASSERT(allow_harmony_scoping()); |
+ DCHECK(allow_harmony_scoping()); |
if (strict_mode() == STRICT) { |
return ParseVariableStatement(kStatement, NULL, ok); |
} |
@@ -1640,7 +1640,7 @@ VariableProxy* Parser::NewUnresolved(const AstRawString* name, |
void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) { |
VariableProxy* proxy = declaration->proxy(); |
- ASSERT(proxy->raw_name() != NULL); |
+ DCHECK(proxy->raw_name() != NULL); |
const AstRawString* name = proxy->raw_name(); |
VariableMode mode = declaration->mode(); |
Scope* declaration_scope = DeclarationScope(mode); |
@@ -1687,7 +1687,7 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) { |
// |
// because the var declaration is hoisted to the function scope where 'x' |
// is already bound. |
- ASSERT(IsDeclaredVariableMode(var->mode())); |
+ DCHECK(IsDeclaredVariableMode(var->mode())); |
if (allow_harmony_scoping() && strict_mode() == STRICT) { |
// In harmony we treat re-declarations as early errors. See |
// ES5 16 for a definition of early errors. |
@@ -1723,7 +1723,7 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) { |
if (mode == CONST_LEGACY && declaration_scope->is_global_scope()) { |
// For global const variables we bind the proxy to a variable. |
- ASSERT(resolve); // should be set by all callers |
+ DCHECK(resolve); // should be set by all callers |
Variable::Kind kind = Variable::NORMAL; |
var = new (zone()) |
Variable(declaration_scope, name, mode, true, kind, |
@@ -2026,7 +2026,7 @@ Block* Parser::ParseVariableDeclarations( |
is_const = true; |
needs_init = true; |
} else if (peek() == Token::LET && strict_mode() == STRICT) { |
- ASSERT(allow_harmony_scoping()); |
+ DCHECK(allow_harmony_scoping()); |
Consume(Token::LET); |
if (var_context == kStatement) { |
// Let declarations are only allowed in source element positions. |
@@ -2228,9 +2228,9 @@ Block* Parser::ParseVariableDeclarations( |
// context for var declared variables). Sigh... |
// For 'let' and 'const' declared variables in harmony mode the |
// initialization also always assigns to the declared variable. |
- ASSERT(proxy != NULL); |
- ASSERT(proxy->var() != NULL); |
- ASSERT(value != NULL); |
+ DCHECK(proxy != NULL); |
+ DCHECK(proxy->var() != NULL); |
+ DCHECK(value != NULL); |
Assignment* assignment = |
factory()->NewAssignment(init_op, proxy, value, pos); |
block->AddStatement( |
@@ -2242,7 +2242,7 @@ Block* Parser::ParseVariableDeclarations( |
// Add an assignment node to the initialization statement block if we still |
// have a pending initialization value. |
if (value != NULL) { |
- ASSERT(mode == VAR); |
+ DCHECK(mode == VAR); |
// 'var' initializations are simply assignments (with all the consequences |
// if they are inside a 'with' statement - they may change a 'with' object |
// property). |
@@ -2270,7 +2270,7 @@ Block* Parser::ParseVariableDeclarations( |
static bool ContainsLabel(ZoneList<const AstRawString*>* labels, |
const AstRawString* label) { |
- ASSERT(label != NULL); |
+ DCHECK(label != NULL); |
if (labels != NULL) { |
for (int i = labels->length(); i-- > 0; ) { |
if (labels->at(i) == label) { |
@@ -2649,7 +2649,7 @@ TryStatement* Parser::ParseTryStatement(bool* ok) { |
} |
Block* finally_block = NULL; |
- ASSERT(tok == Token::FINALLY || catch_block != NULL); |
+ DCHECK(tok == Token::FINALLY || catch_block != NULL); |
if (tok == Token::FINALLY) { |
Consume(Token::FINALLY); |
finally_block = ParseBlock(NULL, CHECK_OK); |
@@ -2662,7 +2662,7 @@ TryStatement* Parser::ParseTryStatement(bool* ok) { |
if (catch_block != NULL && finally_block != NULL) { |
// If we have both, create an inner try/catch. |
- ASSERT(catch_scope != NULL && catch_variable != NULL); |
+ DCHECK(catch_scope != NULL && catch_variable != NULL); |
int index = function_state_->NextHandlerIndex(); |
TryCatchStatement* statement = factory()->NewTryCatchStatement( |
index, try_block, catch_scope, catch_variable, catch_block, |
@@ -2675,13 +2675,13 @@ TryStatement* Parser::ParseTryStatement(bool* ok) { |
TryStatement* result = NULL; |
if (catch_block != NULL) { |
- ASSERT(finally_block == NULL); |
- ASSERT(catch_scope != NULL && catch_variable != NULL); |
+ DCHECK(finally_block == NULL); |
+ DCHECK(catch_scope != NULL && catch_variable != NULL); |
int index = function_state_->NextHandlerIndex(); |
result = factory()->NewTryCatchStatement( |
index, try_block, catch_scope, catch_variable, catch_block, pos); |
} else { |
- ASSERT(finally_block != NULL); |
+ DCHECK(finally_block != NULL); |
int index = function_state_->NextHandlerIndex(); |
result = factory()->NewTryFinallyStatement( |
index, try_block, finally_block, pos); |
@@ -2874,7 +2874,7 @@ Statement* Parser::DesugarLetBindingsInForStatement( |
// } |
// } |
- ASSERT(names->length() > 0); |
+ DCHECK(names->length() > 0); |
Scope* for_scope = scope_; |
ZoneList<Variable*> temps(names->length(), zone()); |
@@ -3046,14 +3046,14 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels, |
scope_ = saved_scope; |
for_scope->set_end_position(scanner()->location().end_pos); |
for_scope = for_scope->FinalizeBlockScope(); |
- ASSERT(for_scope == NULL); |
+ DCHECK(for_scope == NULL); |
// Parsed for-in loop w/ variable/const declaration. |
return result; |
} else { |
init = variable_statement; |
} |
} else if (peek() == Token::LET && strict_mode() == STRICT) { |
- ASSERT(allow_harmony_scoping()); |
+ DCHECK(allow_harmony_scoping()); |
const AstRawString* name = NULL; |
VariableDeclarationProperties decl_props = kHasNoInitializers; |
Block* variable_statement = |
@@ -3137,7 +3137,7 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels, |
scope_ = saved_scope; |
for_scope->set_end_position(scanner()->location().end_pos); |
for_scope = for_scope->FinalizeBlockScope(); |
- ASSERT(for_scope == NULL); |
+ DCHECK(for_scope == NULL); |
// Parsed for-in loop. |
return loop; |
@@ -3200,7 +3200,7 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels, |
// const x = i; |
// for (; c; n) b |
// } |
- ASSERT(init != NULL); |
+ DCHECK(init != NULL); |
Block* block = |
factory()->NewBlock(NULL, 2, false, RelocInfo::kNoPosition); |
block->AddStatement(init, zone()); |
@@ -3241,11 +3241,11 @@ bool CompileTimeValue::IsCompileTimeValue(Expression* expression) { |
Handle<FixedArray> CompileTimeValue::GetValue(Isolate* isolate, |
Expression* expression) { |
Factory* factory = isolate->factory(); |
- ASSERT(IsCompileTimeValue(expression)); |
+ DCHECK(IsCompileTimeValue(expression)); |
Handle<FixedArray> result = factory->NewFixedArray(2, TENURED); |
ObjectLiteral* object_literal = expression->AsObjectLiteral(); |
if (object_literal != NULL) { |
- ASSERT(object_literal->is_simple()); |
+ DCHECK(object_literal->is_simple()); |
if (object_literal->fast_elements()) { |
result->set(kLiteralTypeSlot, Smi::FromInt(OBJECT_LITERAL_FAST_ELEMENTS)); |
} else { |
@@ -3254,7 +3254,7 @@ Handle<FixedArray> CompileTimeValue::GetValue(Isolate* isolate, |
result->set(kElementsSlot, *object_literal->constant_properties()); |
} else { |
ArrayLiteral* array_literal = expression->AsArrayLiteral(); |
- ASSERT(array_literal != NULL && array_literal->is_simple()); |
+ DCHECK(array_literal != NULL && array_literal->is_simple()); |
result->set(kLiteralTypeSlot, Smi::FromInt(ARRAY_LITERAL)); |
result->set(kElementsSlot, *array_literal->constant_elements()); |
} |
@@ -3502,7 +3502,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral( |
VariableMode fvar_mode = |
allow_harmony_scoping() && strict_mode() == STRICT |
? CONST : CONST_LEGACY; |
- ASSERT(function_name != NULL); |
+ DCHECK(function_name != NULL); |
fvar = new (zone()) |
Variable(scope_, function_name, fvar_mode, true /* is valid LHS */, |
Variable::NORMAL, kCreatedInitialized, kNotAssigned, |
@@ -3656,7 +3656,7 @@ void Parser::SkipLazyFunctionBody(const AstRawString* function_name, |
*expected_property_count = logger.properties(); |
scope_->SetStrictMode(logger.strict_mode()); |
if (compile_options() == ScriptCompiler::kProduceParserCache) { |
- ASSERT(log_); |
+ DCHECK(log_); |
// Position right after terminal '}'. |
int body_end = scanner()->location().end_pos; |
log_->LogFunction(function_block_pos, body_end, |
@@ -3730,7 +3730,7 @@ ZoneList<Statement*>* Parser::ParseEagerFunctionBody( |
PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser( |
SingletonLogger* logger) { |
HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); |
- ASSERT_EQ(Token::LBRACE, scanner()->current_token()); |
+ DCHECK_EQ(Token::LBRACE, scanner()->current_token()); |
if (reusable_preparser_ == NULL) { |
intptr_t stack_limit = isolate()->stack_guard()->real_climit(); |
@@ -3866,7 +3866,7 @@ IterationStatement* Parser::LookupContinueTarget(const AstRawString* label, |
IterationStatement* stat = t->node()->AsIterationStatement(); |
if (stat == NULL) continue; |
- ASSERT(stat->is_target_for_anonymous()); |
+ DCHECK(stat->is_target_for_anonymous()); |
if (anonymous || ContainsLabel(stat->labels(), label)) { |
RegisterTargetUse(stat->continue_target(), t->previous()); |
return stat; |
@@ -3901,7 +3901,7 @@ void Parser::HandleSourceURLComments() { |
void Parser::ThrowPendingError() { |
- ASSERT(ast_value_factory_->IsInternalized()); |
+ DCHECK(ast_value_factory_->IsInternalized()); |
if (has_pending_error_) { |
MessageLocation location(script_, |
pending_error_location_.beg_pos, |
@@ -4025,7 +4025,7 @@ RegExpTree* RegExpParser::ReportError(Vector<const char> message) { |
// Disjunction |
RegExpTree* RegExpParser::ParsePattern() { |
RegExpTree* result = ParseDisjunction(CHECK_FAILED); |
- ASSERT(!has_more()); |
+ DCHECK(!has_more()); |
// If the result of parsing is a literal string atom, and it has the |
// same length as the input, then the atom is identical to the input. |
if (result->IsAtom() && result->AsAtom()->length() == in()->length()) { |
@@ -4058,14 +4058,14 @@ RegExpTree* RegExpParser::ParseDisjunction() { |
// Inside a parenthesized group when hitting end of input. |
ReportError(CStrVector("Unterminated group") CHECK_FAILED); |
} |
- ASSERT_EQ(INITIAL, stored_state->group_type()); |
+ DCHECK_EQ(INITIAL, stored_state->group_type()); |
// Parsing completed successfully. |
return builder->ToRegExp(); |
case ')': { |
if (!stored_state->IsSubexpression()) { |
ReportError(CStrVector("Unmatched ')'") CHECK_FAILED); |
} |
- ASSERT_NE(INITIAL, stored_state->group_type()); |
+ DCHECK_NE(INITIAL, stored_state->group_type()); |
Advance(); |
// End disjunction parsing and convert builder content to new single |
@@ -4087,7 +4087,7 @@ RegExpTree* RegExpParser::ParseDisjunction() { |
captures_->at(capture_index - 1) = capture; |
body = capture; |
} else if (group_type != GROUPING) { |
- ASSERT(group_type == POSITIVE_LOOKAHEAD || |
+ DCHECK(group_type == POSITIVE_LOOKAHEAD || |
group_type == NEGATIVE_LOOKAHEAD); |
bool is_positive = (group_type == POSITIVE_LOOKAHEAD); |
body = new(zone()) RegExpLookahead(body, |
@@ -4371,7 +4371,7 @@ RegExpTree* RegExpParser::ParseDisjunction() { |
#ifdef DEBUG |
-// Currently only used in an ASSERT. |
+// Currently only used in an DCHECK. |
static bool IsSpecialClassEscape(uc32 c) { |
switch (c) { |
case 'd': case 'D': |
@@ -4425,8 +4425,8 @@ void RegExpParser::ScanForCaptures() { |
bool RegExpParser::ParseBackReferenceIndex(int* index_out) { |
- ASSERT_EQ('\\', current()); |
- ASSERT('1' <= Next() && Next() <= '9'); |
+ DCHECK_EQ('\\', current()); |
+ DCHECK('1' <= Next() && Next() <= '9'); |
// Try to parse a decimal literal that is no greater than the total number |
// of left capturing parentheses in the input. |
int start = position(); |
@@ -4469,7 +4469,7 @@ bool RegExpParser::ParseBackReferenceIndex(int* index_out) { |
// Returns true if parsing succeeds, and set the min_out and max_out |
// values. Values are truncated to RegExpTree::kInfinity if they overflow. |
bool RegExpParser::ParseIntervalQuantifier(int* min_out, int* max_out) { |
- ASSERT_EQ(current(), '{'); |
+ DCHECK_EQ(current(), '{'); |
int start = position(); |
Advance(); |
int min = 0; |
@@ -4529,7 +4529,7 @@ bool RegExpParser::ParseIntervalQuantifier(int* min_out, int* max_out) { |
uc32 RegExpParser::ParseOctalLiteral() { |
- ASSERT(('0' <= current() && current() <= '7') || current() == kEndMarker); |
+ DCHECK(('0' <= current() && current() <= '7') || current() == kEndMarker); |
// For compatibility with some other browsers (not all), we parse |
// up to three octal digits with a value below 256. |
uc32 value = current() - '0'; |
@@ -4569,8 +4569,8 @@ bool RegExpParser::ParseHexEscape(int length, uc32 *value) { |
uc32 RegExpParser::ParseClassCharacterEscape() { |
- ASSERT(current() == '\\'); |
- ASSERT(has_next() && !IsSpecialClassEscape(Next())); |
+ DCHECK(current() == '\\'); |
+ DCHECK(has_next() && !IsSpecialClassEscape(Next())); |
Advance(); |
switch (current()) { |
case 'b': |
@@ -4650,7 +4650,7 @@ uc32 RegExpParser::ParseClassCharacterEscape() { |
CharacterRange RegExpParser::ParseClassAtom(uc16* char_class) { |
- ASSERT_EQ(0, *char_class); |
+ DCHECK_EQ(0, *char_class); |
uc32 first = current(); |
if (first == '\\') { |
switch (Next()) { |
@@ -4693,7 +4693,7 @@ RegExpTree* RegExpParser::ParseCharacterClass() { |
static const char* kUnterminated = "Unterminated character class"; |
static const char* kRangeOutOfOrder = "Range out of order in character class"; |
- ASSERT_EQ(current(), '['); |
+ DCHECK_EQ(current(), '['); |
Advance(); |
bool is_negated = false; |
if (current() == '^') { |
@@ -4752,15 +4752,15 @@ bool RegExpParser::ParseRegExp(FlatStringReader* input, |
bool multiline, |
RegExpCompileData* result, |
Zone* zone) { |
- ASSERT(result != NULL); |
+ DCHECK(result != NULL); |
RegExpParser parser(input, &result->error, multiline, zone); |
RegExpTree* tree = parser.ParsePattern(); |
if (parser.failed()) { |
- ASSERT(tree == NULL); |
- ASSERT(!result->error.is_null()); |
+ DCHECK(tree == NULL); |
+ DCHECK(!result->error.is_null()); |
} else { |
- ASSERT(tree != NULL); |
- ASSERT(result->error.is_null()); |
+ DCHECK(tree != NULL); |
+ DCHECK(result->error.is_null()); |
result->tree = tree; |
int capture_count = parser.captures_started(); |
result->simple = tree->IsAtom() && parser.simple() && capture_count == 0; |
@@ -4772,7 +4772,7 @@ bool RegExpParser::ParseRegExp(FlatStringReader* input, |
bool Parser::Parse() { |
- ASSERT(info()->function() == NULL); |
+ DCHECK(info()->function() == NULL); |
FunctionLiteral* result = NULL; |
ast_value_factory_ = info()->ast_value_factory(); |
if (ast_value_factory_ == NULL) { |
@@ -4787,7 +4787,7 @@ bool Parser::Parse() { |
} |
if (info()->is_lazy()) { |
- ASSERT(!info()->is_eval()); |
+ DCHECK(!info()->is_eval()); |
if (info()->shared_info()->is_function()) { |
result = ParseLazy(); |
} else { |
@@ -4798,7 +4798,7 @@ bool Parser::Parse() { |
result = ParseProgram(); |
} |
info()->SetFunction(result); |
- ASSERT(ast_value_factory_->IsInternalized()); |
+ DCHECK(ast_value_factory_->IsInternalized()); |
// info takes ownership of ast_value_factory_. |
if (info()->ast_value_factory() == NULL) { |
info()->SetAstValueFactory(ast_value_factory_); |