| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 DEFINE_RUNTIME_ENTRY(InstantiateTypeArguments, 2) { | 218 DEFINE_RUNTIME_ENTRY(InstantiateTypeArguments, 2) { |
| 219 TypeArguments& type_arguments = | 219 TypeArguments& type_arguments = |
| 220 TypeArguments::CheckedHandle(arguments.ArgAt(0)); | 220 TypeArguments::CheckedHandle(arguments.ArgAt(0)); |
| 221 const TypeArguments& instantiator = | 221 const TypeArguments& instantiator = |
| 222 TypeArguments::CheckedHandle(arguments.ArgAt(1)); | 222 TypeArguments::CheckedHandle(arguments.ArgAt(1)); |
| 223 ASSERT(!type_arguments.IsNull() && !type_arguments.IsInstantiated()); | 223 ASSERT(!type_arguments.IsNull() && !type_arguments.IsInstantiated()); |
| 224 ASSERT(instantiator.IsNull() || instantiator.IsInstantiated()); | 224 ASSERT(instantiator.IsNull() || instantiator.IsInstantiated()); |
| 225 // Code inlined in the caller should have optimized the case where the | 225 // Code inlined in the caller should have optimized the case where the |
| 226 // instantiator can be reused as type argument vector. | 226 // instantiator can be reused as type argument vector. |
| 227 ASSERT(instantiator.IsNull() || !type_arguments.IsUninstantiatedIdentity()); | 227 ASSERT(instantiator.IsNull() || !type_arguments.IsUninstantiatedIdentity()); |
| 228 if (Isolate::Current()->TypeChecksEnabled()) { | 228 if (isolate->flags().type_checks()) { |
| 229 Error& bound_error = Error::Handle(); | 229 Error& bound_error = Error::Handle(); |
| 230 type_arguments = | 230 type_arguments = |
| 231 type_arguments.InstantiateAndCanonicalizeFrom(instantiator, | 231 type_arguments.InstantiateAndCanonicalizeFrom(instantiator, |
| 232 &bound_error); | 232 &bound_error); |
| 233 if (!bound_error.IsNull()) { | 233 if (!bound_error.IsNull()) { |
| 234 // Throw a dynamic type error. | 234 // Throw a dynamic type error. |
| 235 const intptr_t location = GetCallerLocation(); | 235 const intptr_t location = GetCallerLocation(); |
| 236 String& bound_error_message = String::Handle( | 236 String& bound_error_message = String::Handle( |
| 237 String::New(bound_error.ToErrorCString())); | 237 String::New(bound_error.ToErrorCString())); |
| 238 Exceptions::CreateAndThrowTypeError( | 238 Exceptions::CreateAndThrowTypeError( |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 // Note that instantiated_dst_type may be malbounded. | 523 // Note that instantiated_dst_type may be malbounded. |
| 524 dst_type_name = instantiated_dst_type.UserVisibleName(); | 524 dst_type_name = instantiated_dst_type.UserVisibleName(); |
| 525 dst_type_lib = | 525 dst_type_lib = |
| 526 Class::Handle(instantiated_dst_type.type_class()).library(); | 526 Class::Handle(instantiated_dst_type.type_class()).library(); |
| 527 } else { | 527 } else { |
| 528 dst_type_name = dst_type.UserVisibleName(); | 528 dst_type_name = dst_type.UserVisibleName(); |
| 529 dst_type_lib = Class::Handle(dst_type.type_class()).library(); | 529 dst_type_lib = Class::Handle(dst_type.type_class()).library(); |
| 530 } | 530 } |
| 531 String& bound_error_message = String::Handle(); | 531 String& bound_error_message = String::Handle(); |
| 532 if (!bound_error.IsNull()) { | 532 if (!bound_error.IsNull()) { |
| 533 ASSERT(Isolate::Current()->TypeChecksEnabled()); | 533 ASSERT(isolate->flags().type_checks()); |
| 534 bound_error_message = String::New(bound_error.ToErrorCString()); | 534 bound_error_message = String::New(bound_error.ToErrorCString()); |
| 535 } | 535 } |
| 536 if (src_type_name.Equals(dst_type_name)) { | 536 if (src_type_name.Equals(dst_type_name)) { |
| 537 // Qualify the names with their libraries. | 537 // Qualify the names with their libraries. |
| 538 String& lib_name = String::Handle(); | 538 String& lib_name = String::Handle(); |
| 539 lib_name = Library::Handle( | 539 lib_name = Library::Handle( |
| 540 Class::Handle(src_type.type_class()).library()).name(); | 540 Class::Handle(src_type.type_class()).library()).name(); |
| 541 if (lib_name.Length() != 0) { | 541 if (lib_name.Length() != 0) { |
| 542 lib_name = String::Concat(lib_name, Symbols::Dot()); | 542 lib_name = String::Concat(lib_name, Symbols::Dot()); |
| 543 src_type_name = String::Concat(lib_name, src_type_name); | 543 src_type_name = String::Concat(lib_name, src_type_name); |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1684 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
| 1685 const TypedData& new_data = | 1685 const TypedData& new_data = |
| 1686 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1686 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
| 1687 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1687 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
| 1688 typed_data_cell.SetAt(0, new_data); | 1688 typed_data_cell.SetAt(0, new_data); |
| 1689 arguments.SetReturn(new_data); | 1689 arguments.SetReturn(new_data); |
| 1690 } | 1690 } |
| 1691 | 1691 |
| 1692 | 1692 |
| 1693 } // namespace dart | 1693 } // namespace dart |
| OLD | NEW |