Revision: 9189
Author: [email protected]
Date: Thu Sep 8 01:59:14 2011
Log: Remove ExitContextStatement.
All the constructs that used it are now properly bracketed in the AST and we
handle abrupt exits without try/finally. We can treat normal context exit
as occurring implicitly at the end of a body.
Review URL: http://codereview.chromium.org/7837025
http://code.google.com/p/v8/source/detail?r=9189
Modified:
/branches/bleeding_edge/src/ast.cc
/branches/bleeding_edge/src/ast.h
/branches/bleeding_edge/src/full-codegen.cc
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/parser.cc
/branches/bleeding_edge/src/prettyprinter.cc
/branches/bleeding_edge/src/rewriter.cc
=======================================
--- /branches/bleeding_edge/src/ast.cc Wed Sep 7 04:02:31 2011
+++ /branches/bleeding_edge/src/ast.cc Thu Sep 8 01:59:14 2011
@@ -402,11 +402,6 @@
bool WithStatement::IsInlineable() const {
return false;
}
-
-
-bool ExitContextStatement::IsInlineable() const {
- return false;
-}
bool SwitchStatement::IsInlineable() const {
=======================================
--- /branches/bleeding_edge/src/ast.h Wed Sep 7 04:02:31 2011
+++ /branches/bleeding_edge/src/ast.h Thu Sep 8 01:59:14 2011
@@ -62,7 +62,6 @@
V(BreakStatement) \
V(ReturnStatement) \
V(WithStatement) \
- V(ExitContextStatement) \
V(SwitchStatement) \
V(DoWhileStatement) \
V(WhileStatement) \
@@ -681,14 +680,6 @@
};
-class ExitContextStatement: public Statement {
- public:
- virtual bool IsInlineable() const;
-
- DECLARE_NODE_TYPE(ExitContextStatement)
-};
-
-
class CaseClause: public ZoneObject {
public:
CaseClause(Isolate* isolate,
=======================================
--- /branches/bleeding_edge/src/full-codegen.cc Wed Sep 7 04:02:31 2011
+++ /branches/bleeding_edge/src/full-codegen.cc Thu Sep 8 01:59:14 2011
@@ -94,11 +94,6 @@
void BreakableStatementChecker::VisitWithStatement(WithStatement* stmt) {
Visit(stmt->expression());
}
-
-
-void BreakableStatementChecker::VisitExitContextStatement(
- ExitContextStatement* stmt) {
-}
void BreakableStatementChecker::VisitSwitchStatement(SwitchStatement*
stmt) {
@@ -987,17 +982,6 @@
// Update local stack frame context field.
StoreToFrameField(StandardFrameConstants::kContextOffset,
context_register());
}
-
-
-void FullCodeGenerator::VisitExitContextStatement(ExitContextStatement*
stmt) {
- Comment cmnt(masm_, "[ ExitContextStatement");
- SetStatementPosition(stmt);
-
- // Pop context.
- LoadContextField(context_register(), Context::PREVIOUS_INDEX);
- // Update local stack frame context field.
- StoreToFrameField(StandardFrameConstants::kContextOffset,
context_register());
-}
void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) {
@@ -1147,6 +1131,9 @@
{ WithOrCatch body(this);
Visit(stmt->catch_block());
}
+ // Restore the context.
+ LoadContextField(context_register(), Context::PREVIOUS_INDEX);
+ StoreToFrameField(StandardFrameConstants::kContextOffset,
context_register());
scope_ = saved_scope;
__ jmp(&done);
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Thu Sep 8 00:40:11 2011
+++ /branches/bleeding_edge/src/hydrogen.cc Thu Sep 8 01:59:14 2011
@@ -2652,14 +2652,6 @@
ASSERT(current_block()->HasPredecessor());
return Bailout("WithStatement");
}
-
-
-void HGraphBuilder::VisitExitContextStatement(ExitContextStatement* stmt) {
- ASSERT(!HasStackOverflow());
- ASSERT(current_block() != NULL);
- ASSERT(current_block()->HasPredecessor());
- return Bailout("ExitContextStatement");
-}
void HGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
=======================================
--- /branches/bleeding_edge/src/parser.cc Tue Sep 6 15:00:59 2011
+++ /branches/bleeding_edge/src/parser.cc Thu Sep 8 01:59:14 2011
@@ -2216,8 +2216,6 @@
Expect(Token::RPAREN, CHECK_OK);
if (peek() == Token::LBRACE) {
- // Rewrite the catch body { B } to a block:
- // { { B } ExitContext; }.
Target target(&this->target_stack_, &catch_collector);
catch_scope = NewScope(top_scope_, Scope::CATCH_SCOPE,
inside_with());
if (top_scope_->is_strict_mode()) {
@@ -2226,14 +2224,11 @@
Variable::Mode mode = harmony_block_scoping_
? Variable::LET : Variable::VAR;
catch_variable = catch_scope->DeclareLocal(name, mode);
- catch_block = new(zone()) Block(isolate(), NULL, 2, false);
Scope* saved_scope = top_scope_;
top_scope_ = catch_scope;
- Block* catch_body = ParseBlock(NULL, CHECK_OK);
+ catch_block = ParseBlock(NULL, CHECK_OK);
top_scope_ = saved_scope;
- catch_block->AddStatement(catch_body);
- catch_block->AddStatement(new(zone()) ExitContextStatement());
} else {
Expect(Token::LBRACE, CHECK_OK);
}
=======================================
--- /branches/bleeding_edge/src/prettyprinter.cc Wed Sep 7 04:02:31 2011
+++ /branches/bleeding_edge/src/prettyprinter.cc Thu Sep 8 01:59:14 2011
@@ -129,11 +129,6 @@
Print(") ");
Visit(node->statement());
}
-
-
-void PrettyPrinter::VisitExitContextStatement(ExitContextStatement* node) {
- Print("<exit context>");
-}
void PrettyPrinter::VisitSwitchStatement(SwitchStatement* node) {
@@ -781,11 +776,6 @@
PrintIndentedVisit("OBJECT", node->expression());
PrintIndentedVisit("BODY", node->statement());
}
-
-
-void AstPrinter::VisitExitContextStatement(ExitContextStatement* node) {
- PrintIndented("EXIT CONTEXT\n");
-}
void AstPrinter::VisitSwitchStatement(SwitchStatement* node) {
@@ -1185,11 +1175,6 @@
Visit(stmt->expression());
Visit(stmt->statement());
}
-
-
-void JsonAstBuilder::VisitExitContextStatement(ExitContextStatement* stmt)
{
- TagScope tag(this, "ExitContextStatement");
-}
void JsonAstBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
=======================================
--- /branches/bleeding_edge/src/rewriter.cc Fri Aug 12 03:52:49 2011
+++ /branches/bleeding_edge/src/rewriter.cc Thu Sep 8 01:59:14 2011
@@ -208,7 +208,6 @@
void Processor::VisitDeclaration(Declaration* node) {}
void Processor::VisitEmptyStatement(EmptyStatement* node) {}
void Processor::VisitReturnStatement(ReturnStatement* node) {}
-void Processor::VisitExitContextStatement(ExitContextStatement* node) {}
void Processor::VisitDebuggerStatement(DebuggerStatement* node) {}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev