| Index: runtime/vm/stub_code_x64.cc
|
| ===================================================================
|
| --- runtime/vm/stub_code_x64.cc (revision 25558)
|
| +++ runtime/vm/stub_code_x64.cc (working copy)
|
| @@ -1005,8 +1005,9 @@
|
| const Immediate& raw_null =
|
| Immediate(reinterpret_cast<intptr_t>(Object::null()));
|
| // The generated code is different if the class is parameterized.
|
| - const bool is_cls_parameterized =
|
| - cls.type_arguments_field_offset() != Class::kNoTypeArguments;
|
| + const bool is_cls_parameterized = cls.HasTypeArguments();
|
| + ASSERT(!cls.HasTypeArguments() ||
|
| + cls.type_arguments_field_offset() != Class::kNoTypeArguments);
|
| // kInlineInstanceSize is a constant used as a threshold for determining
|
| // when the object initialization should be done as a loop or as
|
| // straight line code.
|
| @@ -1178,8 +1179,7 @@
|
| const Immediate& raw_null =
|
| Immediate(reinterpret_cast<intptr_t>(Object::null()));
|
| ASSERT(func.IsClosureFunction());
|
| - const bool is_implicit_static_closure =
|
| - func.IsImplicitStaticClosureFunction();
|
| + ASSERT(!func.IsImplicitStaticClosureFunction());
|
| const bool is_implicit_instance_closure =
|
| func.IsImplicitInstanceClosureFunction();
|
| const Class& cls = Class::ZoneHandle(func.signature_class());
|
| @@ -1232,14 +1232,7 @@
|
| __ movq(Address(RAX, Closure::function_offset()), R10);
|
|
|
| // Setup the context for this closure.
|
| - if (is_implicit_static_closure) {
|
| - ObjectStore* object_store = Isolate::Current()->object_store();
|
| - ASSERT(object_store != NULL);
|
| - const Context& empty_context =
|
| - Context::ZoneHandle(object_store->empty_context());
|
| - __ LoadObject(R10, empty_context);
|
| - __ movq(Address(RAX, Closure::context_offset()), R10);
|
| - } else if (is_implicit_instance_closure) {
|
| + if (is_implicit_instance_closure) {
|
| // Initialize the new context capturing the receiver.
|
|
|
| const Class& context_class = Class::ZoneHandle(Object::context_class());
|
| @@ -1291,27 +1284,23 @@
|
| __ EnterStubFrame();
|
| __ pushq(raw_null); // Setup space on stack for the return value.
|
| __ PushObject(func);
|
| - if (is_implicit_static_closure) {
|
| - __ CallRuntime(kAllocateImplicitStaticClosureRuntimeEntry);
|
| + if (is_implicit_instance_closure) {
|
| + __ pushq(RAX); // Receiver.
|
| + }
|
| + if (has_type_arguments) {
|
| + __ pushq(RCX); // Push type arguments of closure to be allocated.
|
| } else {
|
| - if (is_implicit_instance_closure) {
|
| - __ pushq(RAX); // Receiver.
|
| - }
|
| - if (has_type_arguments) {
|
| - __ pushq(RCX); // Push type arguments of closure to be allocated.
|
| - } else {
|
| - __ pushq(raw_null); // Push null type arguments.
|
| - }
|
| - if (is_implicit_instance_closure) {
|
| - __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry);
|
| - __ popq(RAX); // Pop type arguments.
|
| - __ popq(RAX); // Pop receiver.
|
| - } else {
|
| - ASSERT(func.IsNonImplicitClosureFunction());
|
| - __ CallRuntime(kAllocateClosureRuntimeEntry);
|
| - __ popq(RAX); // Pop type arguments.
|
| - }
|
| + __ pushq(raw_null); // Push null type arguments.
|
| }
|
| + if (is_implicit_instance_closure) {
|
| + __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry);
|
| + __ popq(RAX); // Pop type arguments.
|
| + __ popq(RAX); // Pop receiver.
|
| + } else {
|
| + ASSERT(func.IsNonImplicitClosureFunction());
|
| + __ CallRuntime(kAllocateClosureRuntimeEntry);
|
| + __ popq(RAX); // Pop type arguments.
|
| + }
|
| __ popq(RAX); // Pop the function object.
|
| __ popq(RAX); // Pop the result.
|
| // RAX: New closure object.
|
|
|