| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // Return value: instantiated type arguments. | 270 // Return value: instantiated type arguments. |
| 271 DEFINE_RUNTIME_ENTRY(InstantiateTypeArguments, 2) { | 271 DEFINE_RUNTIME_ENTRY(InstantiateTypeArguments, 2) { |
| 272 TypeArguments& type_arguments = | 272 TypeArguments& type_arguments = |
| 273 TypeArguments::CheckedHandle(zone, arguments.ArgAt(0)); | 273 TypeArguments::CheckedHandle(zone, arguments.ArgAt(0)); |
| 274 const TypeArguments& instantiator = | 274 const TypeArguments& instantiator = |
| 275 TypeArguments::CheckedHandle(zone, arguments.ArgAt(1)); | 275 TypeArguments::CheckedHandle(zone, arguments.ArgAt(1)); |
| 276 ASSERT(!type_arguments.IsNull() && !type_arguments.IsInstantiated()); | 276 ASSERT(!type_arguments.IsNull() && !type_arguments.IsInstantiated()); |
| 277 ASSERT(instantiator.IsNull() || instantiator.IsInstantiated()); | 277 ASSERT(instantiator.IsNull() || instantiator.IsInstantiated()); |
| 278 // Code inlined in the caller should have optimized the case where the | 278 // Code inlined in the caller should have optimized the case where the |
| 279 // instantiator can be reused as type argument vector. | 279 // instantiator can be reused as type argument vector. |
| 280 ASSERT(instantiator.IsNull() || !type_arguments.IsUninstantiatedIdentity()); | 280 ASSERT(!type_arguments.IsUninstantiatedIdentity()); |
| 281 if (isolate->type_checks()) { | 281 if (isolate->type_checks()) { |
| 282 Error& bound_error = Error::Handle(zone); | 282 Error& bound_error = Error::Handle(zone); |
| 283 type_arguments = type_arguments.InstantiateAndCanonicalizeFrom( | 283 type_arguments = type_arguments.InstantiateAndCanonicalizeFrom( |
| 284 instantiator, &bound_error); | 284 instantiator, &bound_error); |
| 285 if (!bound_error.IsNull()) { | 285 if (!bound_error.IsNull()) { |
| 286 // Throw a dynamic type error. | 286 // Throw a dynamic type error. |
| 287 const TokenPosition location = GetCallerLocation(); | 287 const TokenPosition location = GetCallerLocation(); |
| 288 String& bound_error_message = | 288 String& bound_error_message = |
| 289 String::Handle(zone, String::New(bound_error.ToErrorCString())); | 289 String::Handle(zone, String::New(bound_error.ToErrorCString())); |
| 290 Exceptions::CreateAndThrowTypeError( | 290 Exceptions::CreateAndThrowTypeError( |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 // handled by InvokeNoSuchMethodDispatcher. | 805 // handled by InvokeNoSuchMethodDispatcher. |
| 806 ASSERT(!result.IsNull() || !FLAG_lazy_dispatchers); | 806 ASSERT(!result.IsNull() || !FLAG_lazy_dispatchers); |
| 807 return result.raw(); | 807 return result.raw(); |
| 808 } | 808 } |
| 809 | 809 |
| 810 | 810 |
| 811 // Perform the subtype and return constant function based on the result. | 811 // Perform the subtype and return constant function based on the result. |
| 812 static RawFunction* ComputeTypeCheckTarget(const Instance& receiver, | 812 static RawFunction* ComputeTypeCheckTarget(const Instance& receiver, |
| 813 const AbstractType& type, | 813 const AbstractType& type, |
| 814 const ArgumentsDescriptor& desc) { | 814 const ArgumentsDescriptor& desc) { |
| 815 const TypeArguments& checked_type_arguments = TypeArguments::Handle(); | |
| 816 Error& error = Error::Handle(); | 815 Error& error = Error::Handle(); |
| 817 bool result = receiver.IsInstanceOf(type, checked_type_arguments, &error); | 816 bool result = |
| 817 receiver.IsInstanceOf(type, Object::null_type_arguments(), &error); |
| 818 ASSERT(error.IsNull()); | 818 ASSERT(error.IsNull()); |
| 819 ObjectStore* store = Isolate::Current()->object_store(); | 819 ObjectStore* store = Isolate::Current()->object_store(); |
| 820 const Function& target = | 820 const Function& target = |
| 821 Function::Handle(result ? store->simple_instance_of_true_function() | 821 Function::Handle(result ? store->simple_instance_of_true_function() |
| 822 : store->simple_instance_of_false_function()); | 822 : store->simple_instance_of_false_function()); |
| 823 ASSERT(!target.IsNull()); | 823 ASSERT(!target.IsNull()); |
| 824 return target.raw(); | 824 return target.raw(); |
| 825 } | 825 } |
| 826 | 826 |
| 827 | 827 |
| (...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2261 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 2261 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
| 2262 const TypedData& new_data = | 2262 const TypedData& new_data = |
| 2263 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 2263 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
| 2264 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 2264 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
| 2265 typed_data_cell.SetAt(0, new_data); | 2265 typed_data_cell.SetAt(0, new_data); |
| 2266 arguments.SetReturn(new_data); | 2266 arguments.SetReturn(new_data); |
| 2267 } | 2267 } |
| 2268 | 2268 |
| 2269 | 2269 |
| 2270 } // namespace dart | 2270 } // namespace dart |
| OLD | NEW |