Index: src/arm/fast-codegen-arm.cc |
=================================================================== |
--- src/arm/fast-codegen-arm.cc (revision 3204) |
+++ src/arm/fast-codegen-arm.cc (working copy) |
@@ -92,7 +92,9 @@ |
} |
{ Comment cmnt(masm_, "[ Body"); |
+ ASSERT(loop_depth() == 0); |
VisitStatements(fun->body()); |
+ ASSERT(loop_depth() == 0); |
fschneider
2009/11/03 14:10:13
Why this duplicate ASSERT? (also on ia32, x64)
Kevin Millikin (Chromium)
2009/11/03 14:16:09
We should not be in a loop before we compile the b
|
} |
{ Comment cmnt(masm_, "[ return <undefined>;"); |
@@ -323,7 +325,7 @@ |
void FastCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
- Comment cmnt(masm_, "[ RegExp Literal"); |
+ Comment cmnt(masm_, "[ RegExpLiteral"); |
Label done; |
// Registers will be used as follows: |
// r4 = JS function, literals array |
@@ -818,8 +820,16 @@ |
EmitCallWithStub(expr); |
} |
} else { |
- // Call to some other function expression. |
- Visit(expr->expression()); |
+ // Call to some other expression. If the expression is an anonymous |
+ // function literal not called in a loop, mark it as one that should |
+ // also use the fast code generator. |
+ FunctionLiteral* lit = fun->AsFunctionLiteral(); |
+ if (lit != NULL && |
+ lit->name()->Equals(Heap::empty_string()) && |
+ loop_depth() == 0) { |
+ lit->mark_as_fast(); |
Søren Thygesen Gjesse
2009/11/03 13:57:47
As this logic is duplicated in all three code gene
Kevin Millikin (Chromium)
2009/11/03 14:16:09
That's a good idea. For now the check is pretty s
|
+ } |
+ Visit(fun); |
// Load global receiver object. |
__ ldr(r1, CodeGenerator::GlobalObject()); |
__ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
@@ -890,7 +900,6 @@ |
void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
Comment cmnt(masm_, "[ UnaryOperation"); |
- |
switch (expr->op()) { |
case Token::VOID: |
Visit(expr->expression()); |
@@ -988,12 +997,12 @@ |
void FastCodeGenerator::VisitCountOperation(CountOperation* expr) { |
- VariableProxy* v = expr->expression()->AsVariableProxy(); |
- ASSERT(v->AsVariable() != NULL); |
- ASSERT(v->AsVariable()->is_global()); |
+ Comment cmnt(masm_, "[ CountOperation"); |
+ VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
+ ASSERT(proxy->AsVariable() != NULL); |
+ ASSERT(proxy->AsVariable()->is_global()); |
- Visit(v); |
- |
+ Visit(proxy); |
__ InvokeBuiltin(Builtins::TO_NUMBER, CALL_JS); |
switch (expr->context()) { |
@@ -1020,7 +1029,7 @@ |
__ CallRuntime(Runtime::kNumberSub, 2); |
} |
// Call Store IC. |
- __ mov(r2, Operand(v->AsVariable()->name())); |
+ __ mov(r2, Operand(proxy->AsVariable()->name())); |
__ ldr(ip, CodeGenerator::GlobalObject()); |
__ push(ip); |
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); |
@@ -1063,6 +1072,7 @@ |
void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { |
+ Comment cmnt(masm_, "[ BinaryOperation"); |
switch (expr->op()) { |
case Token::COMMA: |
ASSERT_EQ(Expression::kEffect, expr->left()->context()); |
@@ -1108,6 +1118,7 @@ |
void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
+ Comment cmnt(masm_, "[ CompareOperation"); |
ASSERT_EQ(Expression::kValue, expr->left()->context()); |
ASSERT_EQ(Expression::kValue, expr->right()->context()); |
Visit(expr->left()); |