Index: src/rewriter.cc |
=================================================================== |
--- src/rewriter.cc (revision 5319) |
+++ src/rewriter.cc (working copy) |
@@ -28,7 +28,6 @@ |
#include "v8.h" |
#include "ast.h" |
-#include "func-name-inferrer.h" |
#include "scopes.h" |
#include "rewriter.h" |
@@ -39,10 +38,6 @@ |
class AstOptimizer: public AstVisitor { |
public: |
explicit AstOptimizer() : has_function_literal_(false) {} |
- explicit AstOptimizer(Handle<String> enclosing_name) |
- : has_function_literal_(false) { |
- func_name_inferrer_.PushEnclosingName(enclosing_name); |
- } |
void Optimize(ZoneList<Statement*>* statements); |
@@ -50,8 +45,6 @@ |
// Used for loop condition analysis. Cleared before visiting a loop |
// condition, set when a function literal is visited. |
bool has_function_literal_; |
- // Helper object for function name inferring. |
- FuncNameInferrer func_name_inferrer_; |
// Helpers |
void OptimizeArguments(ZoneList<Expression*>* arguments); |
@@ -211,11 +204,6 @@ |
void AstOptimizer::VisitFunctionLiteral(FunctionLiteral* node) { |
has_function_literal_ = true; |
- |
- if (node->name()->length() == 0) { |
- // Anonymous function. |
- func_name_inferrer_.AddFunction(node); |
- } |
} |
@@ -247,11 +235,6 @@ |
var->type()->SetAsLikelySmi(); |
} |
- if (!var->is_this() && |
- !Heap::result_symbol()->Equals(*var->name())) { |
- func_name_inferrer_.PushName(var->name()); |
- } |
- |
if (FLAG_safe_int32_compiler) { |
if (var->IsStackAllocated() && |
!var->is_arguments() && |
@@ -268,11 +251,6 @@ |
if (literal->IsSmi()) { |
node->type()->SetAsLikelySmi(); |
node->set_side_effect_free(true); |
- } else if (literal->IsString()) { |
- Handle<String> lit_str(Handle<String>::cast(literal)); |
- if (!Heap::prototype_symbol()->Equals(*lit_str)) { |
- func_name_inferrer_.PushName(lit_str); |
- } |
} else if (literal->IsHeapNumber()) { |
if (node->to_int32()) { |
// Any HeapNumber has an int32 value if it is the input to a bit op. |
@@ -299,8 +277,6 @@ |
void AstOptimizer::VisitObjectLiteral(ObjectLiteral* node) { |
for (int i = 0; i < node->properties()->length(); i++) { |
- ScopedFuncNameInferrer scoped_fni(&func_name_inferrer_); |
- scoped_fni.Enter(); |
Visit(node->properties()->at(i)->key()); |
Visit(node->properties()->at(i)->value()); |
} |
@@ -314,17 +290,11 @@ |
void AstOptimizer::VisitAssignment(Assignment* node) { |
- ScopedFuncNameInferrer scoped_fni(&func_name_inferrer_); |
switch (node->op()) { |
case Token::INIT_VAR: |
case Token::INIT_CONST: |
case Token::ASSIGN: |
// No type can be infered from the general assignment. |
- |
- // Don't infer if it is "a = function(){...}();"-like expression. |
- if (node->value()->AsCall() == NULL) { |
- scoped_fni.Enter(); |
- } |
break; |
case Token::ASSIGN_BIT_OR: |
case Token::ASSIGN_BIT_XOR: |
@@ -430,12 +400,6 @@ |
void AstOptimizer::VisitCallRuntime(CallRuntime* node) { |
- ScopedFuncNameInferrer scoped_fni(&func_name_inferrer_); |
- if (Factory::InitializeVarGlobal_symbol()->Equals(*node->name()) && |
- node->arguments()->length() >= 2 && |
- node->arguments()->at(1)->AsFunctionLiteral() != NULL) { |
- scoped_fni.Enter(); |
- } |
OptimizeArguments(node->arguments()); |
} |
@@ -1025,7 +989,7 @@ |
if (FLAG_optimize_ast && !body->is_empty()) { |
HistogramTimerScope timer(&Counters::ast_optimization); |
- AstOptimizer optimizer(function->name()); |
+ AstOptimizer optimizer; |
optimizer.Optimize(body); |
if (optimizer.HasStackOverflow()) { |
return false; |