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

Unified Diff: src/parser.cc

Issue 8961: Merge change list off bleeding_edge into toiger branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 12 years, 2 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/macro-assembler-ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
===================================================================
--- src/parser.cc (revision 668)
+++ src/parser.cc (working copy)
@@ -196,7 +196,7 @@
BreakableStatement* LookupBreakTarget(Handle<String> label, bool* ok);
IterationStatement* LookupContinueTarget(Handle<String> label, bool* ok);
- void RegisterLabelUse(Label* label, int index);
+ void RegisterTargetUse(JumpTarget* target, int index);
// Create a number literal.
Literal* NewNumberLiteral(double value);
@@ -1572,8 +1572,8 @@
Block* Parser::WithHelper(Expression* obj, ZoneStringList* labels, bool* ok) {
// Parse the statement and collect escaping labels.
- ZoneList<Label*>* label_list = NEW(ZoneList<Label*>(0));
- LabelCollector collector(label_list);
+ ZoneList<JumpTarget*>* target_list = NEW(ZoneList<JumpTarget*>(0));
+ TargetCollector collector(target_list);
Statement* stat;
{ Target target(this, &collector);
with_nesting_level_++;
@@ -1586,7 +1586,7 @@
// 2: The try-finally block evaluating the body.
Block* result = NEW(Block(NULL, 2, false));
- if (result) {
+ if (result != NULL) {
result->AddStatement(NEW(WithEnterStatement(obj)));
// Create body block.
@@ -1599,12 +1599,10 @@
// Return a try-finally statement.
TryFinally* wrapper = NEW(TryFinally(body, exit));
- wrapper->set_escaping_labels(collector.labels());
+ wrapper->set_escaping_targets(collector.targets());
result->AddStatement(wrapper);
- return result;
- } else {
- return NULL;
}
+ return result;
}
@@ -1745,8 +1743,8 @@
Expect(Token::TRY, CHECK_OK);
- ZoneList<Label*>* label_list = NEW(ZoneList<Label*>(0));
- LabelCollector collector(label_list);
+ ZoneList<JumpTarget*>* target_list = NEW(ZoneList<JumpTarget*>(0));
+ TargetCollector collector(target_list);
Block* try_block;
{ Target target(this, &collector);
@@ -1765,10 +1763,11 @@
}
// If we can break out from the catch block and there is a finally block,
- // then we will need to collect labels from the catch block. Since we don't
- // know yet if there will be a finally block, we always collect the labels.
- ZoneList<Label*>* catch_label_list = NEW(ZoneList<Label*>(0));
- LabelCollector catch_collector(catch_label_list);
+ // then we will need to collect jump targets from the catch block. Since
+ // we don't know yet if there will be a finally block, we always collect
+ // the jump targets.
+ ZoneList<JumpTarget*>* catch_target_list = NEW(ZoneList<JumpTarget*>(0));
+ TargetCollector catch_collector(catch_target_list);
bool has_catch = false;
if (tok == Token::CATCH) {
has_catch = true;
@@ -1807,7 +1806,7 @@
if (!is_pre_parsing_ && catch_block != NULL && finally_block != NULL) {
TryCatch* statement = NEW(TryCatch(try_block, catch_var, catch_block));
- statement->set_escaping_labels(collector.labels());
+ statement->set_escaping_targets(collector.targets());
try_block = NEW(Block(NULL, 1, false));
try_block->AddStatement(statement);
catch_block = NULL;
@@ -1818,15 +1817,15 @@
if (catch_block != NULL) {
ASSERT(finally_block == NULL);
result = NEW(TryCatch(try_block, catch_var, catch_block));
- result->set_escaping_labels(collector.labels());
+ result->set_escaping_targets(collector.targets());
} else {
ASSERT(finally_block != NULL);
result = NEW(TryFinally(try_block, finally_block));
- // Add the labels of the try block and the catch block.
- for (int i = 0; i < collector.labels()->length(); i++) {
- catch_collector.labels()->Add(collector.labels()->at(i));
+ // Add the jump targets of the try block and the catch block.
+ for (int i = 0; i < collector.targets()->length(); i++) {
+ catch_collector.targets()->Add(collector.targets()->at(i));
}
- result->set_escaping_labels(catch_collector.labels());
+ result->set_escaping_targets(catch_collector.targets());
}
}
@@ -3073,7 +3072,7 @@
if ((anonymous && stat->is_target_for_anonymous()) ||
(!anonymous && ContainsLabel(stat->labels(), label))) {
- RegisterLabelUse(stat->break_target(), i);
+ RegisterTargetUse(stat->break_target(), i);
return stat;
}
}
@@ -3090,7 +3089,7 @@
ASSERT(stat->is_target_for_anonymous());
if (anonymous || ContainsLabel(stat->labels(), label)) {
- RegisterLabelUse(stat->continue_target(), i);
+ RegisterTargetUse(stat->continue_target(), i);
return stat;
}
}
@@ -3098,13 +3097,13 @@
}
-void Parser::RegisterLabelUse(Label* label, int index) {
- // Register that a label found at the given index in the target
- // stack has been used from the top of the target stack. Add the
- // label to any LabelCollectors passed on the stack.
+void Parser::RegisterTargetUse(JumpTarget* target, int index) {
+ // Register that a jump target found at the given index in the target
+ // stack has been used from the top of the target stack. Add the jump
+ // target to any TargetCollectors passed on the stack.
for (int i = target_stack_->length(); i-- > index;) {
- LabelCollector* collector = target_stack_->at(i)->AsLabelCollector();
- if (collector != NULL) collector->AddLabel(label);
+ TargetCollector* collector = target_stack_->at(i)->AsTargetCollector();
+ if (collector != NULL) collector->AddTarget(target);
}
}
« no previous file with comments | « src/macro-assembler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698