Added support for expression statements to the CFG builder and
fast-mode compiler. This will generate a compiler temporary for complex expressions and then immediately throw it away, so a better approach (to be implemented later) is to pass to the expression builder whether an expression is in an effect or value context. Review URL: http://codereview.chromium.org/162006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2630 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
23507e34db
commit
98b93c739d
14
src/cfg.cc
14
src/cfg.cc
@ -424,7 +424,19 @@ void StatementBuilder::VisitBlock(Block* stmt) {
|
||||
|
||||
|
||||
void StatementBuilder::VisitExpressionStatement(ExpressionStatement* stmt) {
|
||||
BAILOUT("ExpressionStatement");
|
||||
ExpressionBuilder builder;
|
||||
builder.Build(stmt->expression());
|
||||
if (builder.cfg() == NULL) {
|
||||
BAILOUT("unsupported expression in expression statement");
|
||||
}
|
||||
// Here's a temporary hack: we bang on the last instruction of the
|
||||
// expression (if any) to set its location to Effect.
|
||||
if (!builder.cfg()->is_empty()) {
|
||||
InstructionBlock* block = InstructionBlock::cast(builder.cfg()->exit());
|
||||
Instruction* instr = block->instructions()->last();
|
||||
instr->set_location(CfgGlobals::current()->effect_location());
|
||||
}
|
||||
cfg_->Concatenate(builder.cfg());
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,11 +201,13 @@ class Location : public Value {
|
||||
// computation is not needed (though its side effects are).
|
||||
class Effect : public Location {
|
||||
public:
|
||||
// We should not try to emit code to read or write to Effect.
|
||||
// We should not try to emit code to read Effect.
|
||||
void Get(MacroAssembler* masm, Register reg) { UNREACHABLE(); }
|
||||
void Set(MacroAssembler* masm, Register reg) { UNREACHABLE(); }
|
||||
void Push(MacroAssembler* masm) { UNREACHABLE(); }
|
||||
|
||||
// Setting Effect is ignored.
|
||||
void Set(MacroAssembler* masm, Register reg) {}
|
||||
|
||||
#ifdef DEBUG
|
||||
void Print();
|
||||
#endif
|
||||
@ -311,6 +313,7 @@ class Instruction : public ZoneObject {
|
||||
|
||||
// Accessors.
|
||||
Location* location() { return loc_; }
|
||||
void set_location(Location* loc) { loc_ = loc; }
|
||||
|
||||
// Support for fast-compilation mode:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user