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

Unified Diff: src/parser.cc

Issue 18842: Experimental: periodic merge of the bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 years, 11 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
« no previous file with comments | « src/parser.h ('k') | src/platform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
===================================================================
--- src/parser.cc (revision 1168)
+++ src/parser.cc (working copy)
@@ -640,7 +640,7 @@
// Allocation macro that should be used to allocate objects that must
// only be allocated in real parsing mode. Note that in preparse mode
// not only is the syntax tree not created but the constructor
-// arguments are not evaulated.
+// arguments are not evaluated.
#define NEW(expr) (is_pre_parsing_ ? NULL : new expr)
@@ -1092,7 +1092,7 @@
Counters::total_parse_size.Increment(source->length(shape));
// Initialize parser state.
- source->TryFlatten(shape);
+ source->TryFlattenIfNotFlat(shape);
scanner_.Init(source, stream, 0);
ASSERT(target_stack_ == NULL);
@@ -1119,7 +1119,7 @@
temp_scope.materialized_literal_count(),
temp_scope.contains_array_literal(),
temp_scope.expected_property_count(),
- 0, 0, source->length(shape), false));
+ 0, 0, source->length(), false));
} else if (scanner().stack_overflow()) {
Top::StackOverflow();
}
@@ -1141,7 +1141,7 @@
bool is_expression) {
ZoneScope zone_scope(DONT_DELETE_ON_EXIT);
StatsRateScope timer(&Counters::parse_lazy);
- source->TryFlatten(StringShape(*source));
+ source->TryFlattenIfNotFlat(StringShape(*source));
StringShape shape(*source);
Counters::total_parse_size.Increment(source->length(shape));
SafeStringInputBuffer buffer(source.location());
@@ -1254,7 +1254,7 @@
// statements, which themselves are only valid within blocks,
// iterations or 'switch' statements (i.e., BreakableStatements),
// labels can be simply ignored in all other cases; except for
- // trivial labelled break statements 'label: break label' which is
+ // trivial labeled break statements 'label: break label' which is
// parsed into an empty statement.
// Keep the source position of the statement
@@ -1869,7 +1869,7 @@
tok != Token::SEMICOLON && tok != Token::RBRACE && tok != Token::EOS) {
label = ParseIdentifier(CHECK_OK);
}
- // Parse labelled break statements that target themselves into
+ // Parse labeled break statements that target themselves into
// empty statements, e.g. 'l1: l2: l3: break l2;'
if (!label.is_null() && ContainsLabel(labels, label)) {
return factory()->EmptyStatement();
@@ -2062,32 +2062,6 @@
}
-Expression* Parser::MakeCatchContext(Handle<String> id, VariableProxy* value) {
- ZoneListWrapper<ObjectLiteral::Property> properties =
- factory()->NewList<ObjectLiteral::Property>(1);
- Literal* key = NEW(Literal(id));
- ObjectLiteral::Property* property = NEW(ObjectLiteral::Property(key, value));
- properties.Add(property);
-
- // This must be called always, even during pre-parsing!
- // (Computation of literal index must happen before pre-parse bailout.)
- int literal_index = temp_scope_->NextMaterializedLiteralIndex();
- if (is_pre_parsing_) {
- return NULL;
- }
-
- // Construct the expression for calling Runtime::CreateObjectLiteral
- // with the literal array as argument.
- Handle<FixedArray> constant_properties = Factory::empty_fixed_array();
- ZoneList<Expression*>* arguments = new ZoneList<Expression*>(1);
- arguments->Add(new Literal(constant_properties));
-
- return new ObjectLiteral(constant_properties,
- properties.elements(),
- literal_index);
-}
-
-
TryStatement* Parser::ParseTryStatement(bool* ok) {
// TryStatement ::
// 'try' Block Catch
@@ -2140,7 +2114,8 @@
// Allocate a temporary for holding the finally state while
// executing the finally block.
catch_var = top_scope_->NewTemporary(Factory::catch_var_symbol());
- Expression* obj = MakeCatchContext(name, catch_var);
+ Literal* name_literal = NEW(Literal(name));
+ Expression* obj = NEW(CatchExtensionObject(name_literal, catch_var));
{ Target target(this, &catch_collector);
catch_block = WithHelper(obj, NULL, true, CHECK_OK);
}
@@ -3102,10 +3077,6 @@
constant_properties->set(position++, *literal->handle());
}
- // Construct the expression for calling Runtime::CreateObjectLiteral
- // with the literal array as argument.
- ZoneList<Expression*>* arguments = new ZoneList<Expression*>(1);
- arguments->Add(new Literal(constant_properties));
return new ObjectLiteral(constant_properties,
properties.elements(),
literal_index);
@@ -4080,6 +4051,7 @@
Advance();
return '\v';
case 'c':
+ Advance();
return ParseControlLetterEscape();
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7':
@@ -4176,7 +4148,10 @@
} else {
ASSERT(type == '=' || type == '!');
bool is_positive = (type == '=');
- return new RegExpLookahead(body, is_positive);
+ return new RegExpLookahead(body,
+ is_positive,
+ end_capture_index - capture_index,
+ capture_index);
}
}
« no previous file with comments | « src/parser.h ('k') | src/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698