Index: runtime/vm/code_generator_ia32.cc |
=================================================================== |
--- runtime/vm/code_generator_ia32.cc (revision 348) |
+++ runtime/vm/code_generator_ia32.cc (working copy) |
@@ -849,6 +849,7 @@ |
const ContextScope& context_scope = ContextScope::ZoneHandle( |
node->scope()->PreserveOuterScope(current_context_level)); |
const Function& function = node->function(); |
+ ASSERT(function.IsClosureFunction() && !function.IsImplicitClosureFunction()); |
ASSERT(!function.HasCode()); |
ASSERT(function.context_scope() == ContextScope::null()); |
function.set_context_scope(context_scope); |
@@ -865,9 +866,11 @@ |
void CodeGenerator::VisitStaticImplicitClosureNode( |
StaticImplicitClosureNode* node) { |
const Function& function = node->function(); |
+ ASSERT(function.IsImplicitClosureFunction()); |
+ ASSERT(function.is_static()); |
ASSERT(function.context_scope() != ContextScope::null()); |
const Code& stub = Code::Handle( |
- StubCode::GetAllocationStubForStaticImplicitClosure(function)); |
+ StubCode::GetAllocationStubForClosure(function)); |
const ExternalLabel label(function.ToCString(), stub.EntryPoint()); |
GenerateCall(node->token_index(), &label); |
if (IsResultNeeded(node)) { |
@@ -878,22 +881,15 @@ |
void CodeGenerator::VisitImplicitClosureNode(ImplicitClosureNode* node) { |
const Function& function = node->function(); |
+ ASSERT(function.IsImplicitClosureFunction()); |
+ ASSERT(!function.is_static()); |
ASSERT(function.context_scope() != ContextScope::null()); |
- const Immediate raw_null = |
- Immediate(reinterpret_cast<intptr_t>(Object::null())); |
- Label null_receiver; |
node->receiver()->Visit(this); |
- __ popl(EAX); // Get receiver. |
- const Object& result = Object::ZoneHandle(); |
- __ PushObject(result); // Make room for the result of the runtime call. |
- __ PushObject(function); // Push the type. |
- __ pushl(EAX); // Push the receiver. |
- GenerateCallRuntime(node->token_index(), |
- kAllocateImplicitClosureRuntimeEntry); |
- // Pop the parameters supplied to the runtime entry. The result of the |
- // type check runtime call is the checked value. |
- __ addl(ESP, Immediate(2 * kWordSize)); |
- __ popl(EAX); // Allocated closure. |
+ const Code& stub = Code::Handle( |
+ StubCode::GetAllocationStubForClosure(function)); |
+ const ExternalLabel label(function.ToCString(), stub.EntryPoint()); |
+ GenerateCall(node->token_index(), &label); |
+ __ popl(ECX); // Pop receiver. |
if (IsResultNeeded(node)) { |
__ pushl(EAX); |
} |