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

Unified Diff: src/codegen-ia32.cc

Issue 13234: Experimental: three small codegen changes.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 12 years 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
Index: src/codegen-ia32.cc
===================================================================
--- src/codegen-ia32.cc (revision 927)
+++ src/codegen-ia32.cc (working copy)
@@ -269,6 +269,7 @@
// that control flow leaves the body on all paths and cannot fall
// through.
if (frame_ != NULL) {
+ frame_->SpillAll();
Literal undefined(Factory::undefined_value());
ReturnStatement statement(&undefined);
statement.set_statement_pos(fun->end_position());
@@ -476,6 +477,7 @@
if (property != NULL) {
// The expression is either a property or a variable proxy that rewrites
// to a property.
+ frame_->SpillAll();
Load(property->obj());
frame_->SpillAll();
// We use a named reference if the key is a literal symbol, unless it is
@@ -497,6 +499,7 @@
// The expression is a variable proxy that does not rewrite to a
// property. Global variables are treated as named property references.
if (var->is_global()) {
+ frame_->SpillAll();
LoadGlobal();
ref->set_type(Reference::NAMED);
} else {
@@ -1275,7 +1278,6 @@
void CodeGenerator::VisitBlock(Block* node) {
- frame_->SpillAll();
Comment cmnt(masm_, "[ Block");
RecordStatementPosition(node);
node->set_break_stack_height(break_stack_height_);
@@ -1370,10 +1372,6 @@
Load(expression);
// Remove the lingering expression result from the top of stack.
frame_->Drop();
- // Rather than using SpillAll after all recursive calls to Visit over
- // statements, we spill here in the only statement type that uses the
- // virtual frame. This is temporary.
- frame_->SpillAll();
}
@@ -1416,6 +1414,7 @@
// then statement, it escaped on all branches. In that case, a jump
// to the exit label would be dead code (and impossible, because we
// don't have a current virtual frame to set at the exit label).
+ frame_->SpillAll();
exit.Jump();
}
// else
@@ -1709,6 +1708,7 @@
// If control flow can fall through from the body, jump to the next body
// or the end of the statement.
if (frame_ != NULL) {
+ frame_->SpillAll();
if (i < length - 1 && cases->at(i + 1)->is_default()) {
default_entry.Jump();
} else {
@@ -1726,6 +1726,9 @@
Comment cmnt(masm_, "[ Default clause");
default_entry.Bind();
VisitStatements(default_clause->statements());
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
// If control flow can fall out of the default and there is a case after
// it, jump to that case's body.
if (frame_ != NULL && default_exit.is_bound()) {
@@ -1783,6 +1786,9 @@
}
CheckStack(); // TODO(1222600): ignore if body contains calls.
Visit(node->body());
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
// Compile the "test".
if (info == ALWAYS_TRUE) {
@@ -1847,6 +1853,7 @@
// If control flow can fall out of the body, jump back to the top.
if (frame_ != NULL) {
+ frame_->SpillAll();
node->continue_target()->Jump();
}
}
@@ -1864,6 +1871,8 @@
// There is no need to compile the test or body.
if (info == ALWAYS_FALSE) break;
+ // TODO(): Could frame_ be NULL here?
+ frame_->SpillAll();
// If there is no update statement, label the top of the loop with the
// continue target, otherwise with the loop target.
if (node->next() == NULL) {
@@ -1887,6 +1896,9 @@
if (frame_ != NULL) {
CheckStack(); // TODO(1222600): ignore if body contains calls.
Visit(node->body());
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
if (node->next() == NULL) {
// If there is no update statement and control flow can fall out
@@ -1907,6 +1919,10 @@
__ RecordPosition(node->statement_pos());
ASSERT(node->type() == LoopStatement::FOR_LOOP);
Visit(node->next());
+ // TODO(): Can frame_ actually be NULL here?
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
loop.Jump();
}
}
@@ -2089,6 +2105,9 @@
// Body.
CheckStack(); // TODO(1222600): ignore if body contains calls.
Visit(node->body());
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
// Next.
node->continue_target()->Bind();
@@ -2134,6 +2153,7 @@
VisitStatements(node->catch_block()->statements());
if (frame_ != NULL) {
+ frame_->SpillAll();
exit.Jump();
}
@@ -2164,6 +2184,9 @@
bool was_inside_try = is_inside_try_;
is_inside_try_ = true;
VisitStatements(node->try_block()->statements());
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
is_inside_try_ = was_inside_try;
// Stop the introduced shadowing and count the number of required unlinks.
@@ -2272,6 +2295,9 @@
bool was_inside_try = is_inside_try_;
is_inside_try_ = true;
VisitStatements(node->try_block()->statements());
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
is_inside_try_ = was_inside_try;
// Stop the introduced shadowing and count the number of required unlinks.
@@ -2348,6 +2374,7 @@
break_stack_height_ -= kFinallyStackSize;
if (frame_ != NULL) {
+ frame_->SpillAll();
JumpTarget exit(this);
// Restore state and return value or faked TOS.
frame_->EmitPop(ecx);
@@ -2852,7 +2879,6 @@
void CodeGenerator::VisitAssignment(Assignment* node) {
- frame_->SpillAll();
Comment cmnt(masm_, "[ Assignment");
RecordStatementPosition(node);
@@ -2870,6 +2896,7 @@
Load(node->value());
} else {
+ frame_->SpillAll();
target.GetValue(NOT_INSIDE_TYPEOF);
Literal* literal = node->value()->AsLiteral();
if (IsInlineSmi(literal)) {
« no previous file with comments | « src/assembler-ia32.h ('k') | src/jump-target-ia32.cc » ('j') | src/jump-target-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698