| Index: runtime/vm/code_generator_ia32.cc
|
| ===================================================================
|
| --- runtime/vm/code_generator_ia32.cc (revision 4731)
|
| +++ runtime/vm/code_generator_ia32.cc (working copy)
|
| @@ -810,8 +810,7 @@
|
|
|
|
|
| void CodeGenerator::VisitCloneContextNode(CloneContextNode *node) {
|
| - const Context& result = Context::ZoneHandle();
|
| - __ PushObject(result);
|
| + __ PushObject(Object::ZoneHandle()); // Make room for the result.
|
| __ pushl(CTX);
|
| GenerateCallRuntime(node->id(),
|
| node->token_index(), kCloneContextRuntimeEntry);
|
| @@ -1311,7 +1310,7 @@
|
| intptr_t token_index,
|
| const AbstractType& type,
|
| bool negate_result) {
|
| - ASSERT(type.IsFinalized());
|
| + ASSERT(type.IsFinalized() && !type.IsMalformed());
|
| const Bool& bool_true = Bool::ZoneHandle(Bool::True());
|
| const Bool& bool_false = Bool::ZoneHandle(Bool::False());
|
|
|
| @@ -1419,8 +1418,7 @@
|
| }
|
| }
|
| }
|
| - const Object& result = Object::ZoneHandle();
|
| - __ PushObject(result); // Make room for the result of the runtime call.
|
| + __ PushObject(Object::ZoneHandle()); // Make room for the result.
|
| __ pushl(EAX); // Push the instance.
|
| __ PushObject(type); // Push the type.
|
| if (!type.IsInstantiated()) {
|
| @@ -1473,6 +1471,23 @@
|
| ASSERT(!dst_type.IsNull());
|
| ASSERT(dst_type.IsFinalized());
|
|
|
| + // Generate throw new TypeError() if the type is malformed.
|
| + if (dst_type.IsMalformed()) {
|
| + const Error& error = Error::Handle(dst_type.malformed_error());
|
| + const String& error_message = String::ZoneHandle(
|
| + String::NewSymbol(error.ToErrorCString()));
|
| + __ PushObject(Object::ZoneHandle()); // Make room for the result.
|
| + const Immediate location =
|
| + Immediate(reinterpret_cast<int32_t>(Smi::New(token_index)));
|
| + __ pushl(location); // Push the source location.
|
| + __ pushl(EAX); // Push the source object.
|
| + __ PushObject(error_message);
|
| + GenerateCallRuntime(node_id, token_index, kMalformedTypeErrorRuntimeEntry);
|
| + // We should never return here.
|
| + __ int3();
|
| + return;
|
| + }
|
| +
|
| // Any expression is assignable to the Dynamic type and to the Object type.
|
| // Skip the test.
|
| if (dst_type.IsDynamicType() || dst_type.IsObjectType()) {
|
| @@ -1594,8 +1609,7 @@
|
| }
|
| }
|
| __ Bind(&runtime_call);
|
| - const Object& result = Object::ZoneHandle();
|
| - __ PushObject(result); // Make room for the result of the runtime call.
|
| + __ PushObject(Object::ZoneHandle()); // Make room for the result.
|
| const Immediate location =
|
| Immediate(reinterpret_cast<int32_t>(Smi::New(token_index)));
|
| __ pushl(location); // Push the source location.
|
| @@ -1661,16 +1675,13 @@
|
| __ j(EQUAL, &done, Assembler::kNearJump);
|
|
|
| __ Bind(&runtime_call);
|
| - const Object& result = Object::ZoneHandle();
|
| - __ PushObject(result); // Make room for the result of the runtime call.
|
| const Immediate location =
|
| Immediate(reinterpret_cast<int32_t>(Smi::New(token_index)));
|
| __ pushl(location); // Push the source location.
|
| __ pushl(EAX); // Push the source object.
|
| GenerateCallRuntime(node_id, token_index, kConditionTypeErrorRuntimeEntry);
|
| - // Pop the parameters supplied to the runtime entry. The result of the
|
| - // type check runtime call is the checked value.
|
| - __ addl(ESP, Immediate(3 * kWordSize));
|
| + // We should never return here.
|
| + __ int3();
|
|
|
| __ Bind(&done);
|
| }
|
| @@ -2196,7 +2207,8 @@
|
| // TODO(regis): Temporary type should be allocated in new gen heap.
|
| Type& type = Type::Handle(
|
| Type::New(instantiator_class, type_arguments, token_index));
|
| - type ^= ClassFinalizer::FinalizeType(instantiator_class, type);
|
| + type ^= ClassFinalizer::FinalizeType(
|
| + instantiator_class, type, ClassFinalizer::kFinalizeWellFormed);
|
| type_arguments = type.arguments();
|
| __ PushObject(type_arguments);
|
| } else {
|
| @@ -2279,8 +2291,7 @@
|
| if (node->constructor().IsFactory()) {
|
| // A runtime call to instantiate the type arguments is required before
|
| // calling the factory.
|
| - const Object& result = Object::ZoneHandle();
|
| - __ PushObject(result); // Make room for the result of the runtime call.
|
| + __ PushObject(Object::ZoneHandle()); // Make room for the result.
|
| __ PushObject(node->type_arguments());
|
| __ pushl(EAX); // Push instantiator type arguments.
|
| GenerateCallRuntime(node->id(),
|
| @@ -2614,17 +2625,12 @@
|
|
|
|
|
| void CodeGenerator::VisitThrowNode(ThrowNode* node) {
|
| - const Object& result = Object::ZoneHandle();
|
| node->exception()->Visit(this);
|
| - __ popl(EAX); // Exception object is now in EAX.
|
| + // Exception object is on TOS.
|
| if (node->stacktrace() != NULL) {
|
| - __ PushObject(result); // Make room for the result of the runtime call.
|
| - __ pushl(EAX); // Push the exception object.
|
| node->stacktrace()->Visit(this);
|
| GenerateCallRuntime(node->id(), node->token_index(), kReThrowRuntimeEntry);
|
| } else {
|
| - __ PushObject(result); // Make room for the result of the runtime call.
|
| - __ pushl(EAX); // Push the exception object.
|
| GenerateCallRuntime(node->id(), node->token_index(), kThrowRuntimeEntry);
|
| }
|
| // We should never return here.
|
|
|