Chromium Code Reviews| Index: runtime/vm/code_generator_x64.cc |
| =================================================================== |
| --- runtime/vm/code_generator_x64.cc (revision 4727) |
| +++ runtime/vm/code_generator_x64.cc (working copy) |
| @@ -1300,7 +1300,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()); |
| @@ -1462,6 +1462,25 @@ |
| 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())); |
| + |
| + const Object& result = Object::ZoneHandle(); |
| + __ PushObject(result); // Make room for the result of the runtime call. |
|
srdjan
2012/02/29 00:15:54
ditto
regis
2012/02/29 02:10:01
Done.
|
| + const Immediate location = |
| + Immediate(reinterpret_cast<int64_t>(Smi::New(token_index))); |
| + __ pushq(location); // Push the source location. |
| + __ pushq(RAX); // 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()) { |
| @@ -1657,9 +1676,8 @@ |
| __ pushq(location); // Push the source location. |
| __ pushq(RAX); // 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. |
| - __ addq(RSP, Immediate(3 * kWordSize)); |
| + // We should never return here. |
| + __ int3(); |
| __ Bind(&done); |
| } |
| @@ -2185,7 +2203,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 { |