Skip to content

Commit

Permalink
code-space: use non-optimizing compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Nov 20, 2012
1 parent 9fd6b09 commit e62d37f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/code-space.cc
Expand Up @@ -175,7 +175,7 @@ char* CodeSpace::Compile(const char* filename,
for (FunctionIterator it(ast); !it.IsEnded(); it.Advance()) {
FunctionLiteral* current = it.Value();

if (true) {
if (current->own_length() < HIRGen::kMaxOptimizableSize) {
// Generate CFG with SSA
HIRGen hir(heap(), &r, chunk->filename());

Expand Down
2 changes: 2 additions & 0 deletions src/hir.h
Expand Up @@ -276,6 +276,8 @@ class HIRGen : public Visitor<HIRInstruction> {
inline int instr_id();
inline int dfs_id();

static const int kMaxOptimizableSize = 25000;

private:
HIRBlock* current_block_;
HIRBlock* current_root_;
Expand Down
13 changes: 12 additions & 1 deletion src/parser.cc
Expand Up @@ -41,6 +41,18 @@ AstNode* Parser::Execute() {
if (offset_ != length_) {
SetError("Unexpected symbol");
} else {
// Calculate size of main function
FunctionLiteral* fn = FunctionLiteral::Cast(ast());
fn->end(Peek()->offset());

fn->own_length(fn->length());
while (fns_.length() != 0) {
FunctionLiteral* i = fns_.Pop();

// Unroll all visited functions
fn->own_length(fn->own_length() - i->length());
}

SetError(NULL);
}
}
Expand Down Expand Up @@ -485,7 +497,6 @@ AstNode* Parser::ParseMember() {
if (result == NULL) fn->offset(Peek()->offset());
Skip();


// Push function to the list
fns_.Push(fn);

Expand Down

0 comments on commit e62d37f

Please sign in to comment.