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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 DEFINE_RUNTIME_ENTRY(InstantiateTypeArguments, 2) { | 225 DEFINE_RUNTIME_ENTRY(InstantiateTypeArguments, 2) { |
226 TypeArguments& type_arguments = | 226 TypeArguments& type_arguments = |
227 TypeArguments::CheckedHandle(arguments.ArgAt(0)); | 227 TypeArguments::CheckedHandle(arguments.ArgAt(0)); |
228 const TypeArguments& instantiator = | 228 const TypeArguments& instantiator = |
229 TypeArguments::CheckedHandle(arguments.ArgAt(1)); | 229 TypeArguments::CheckedHandle(arguments.ArgAt(1)); |
230 ASSERT(!type_arguments.IsNull() && !type_arguments.IsInstantiated()); | 230 ASSERT(!type_arguments.IsNull() && !type_arguments.IsInstantiated()); |
231 ASSERT(instantiator.IsNull() || instantiator.IsInstantiated()); | 231 ASSERT(instantiator.IsNull() || instantiator.IsInstantiated()); |
232 // Code inlined in the caller should have optimized the case where the | 232 // Code inlined in the caller should have optimized the case where the |
233 // instantiator can be reused as type argument vector. | 233 // instantiator can be reused as type argument vector. |
234 ASSERT(instantiator.IsNull() || !type_arguments.IsUninstantiatedIdentity()); | 234 ASSERT(instantiator.IsNull() || !type_arguments.IsUninstantiatedIdentity()); |
235 if (isolate->flags().type_checks()) { | 235 if (isolate->type_checks()) { |
236 Error& bound_error = Error::Handle(); | 236 Error& bound_error = Error::Handle(); |
237 type_arguments = | 237 type_arguments = |
238 type_arguments.InstantiateAndCanonicalizeFrom(instantiator, | 238 type_arguments.InstantiateAndCanonicalizeFrom(instantiator, |
239 &bound_error); | 239 &bound_error); |
240 if (!bound_error.IsNull()) { | 240 if (!bound_error.IsNull()) { |
241 // Throw a dynamic type error. | 241 // Throw a dynamic type error. |
242 const TokenPosition location = GetCallerLocation(); | 242 const TokenPosition location = GetCallerLocation(); |
243 String& bound_error_message = String::Handle( | 243 String& bound_error_message = String::Handle( |
244 String::New(bound_error.ToErrorCString())); | 244 String::New(bound_error.ToErrorCString())); |
245 Exceptions::CreateAndThrowTypeError( | 245 Exceptions::CreateAndThrowTypeError( |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 // Note that instantiated_dst_type may be malbounded. | 530 // Note that instantiated_dst_type may be malbounded. |
531 dst_type_name = instantiated_dst_type.UserVisibleName(); | 531 dst_type_name = instantiated_dst_type.UserVisibleName(); |
532 dst_type_lib = | 532 dst_type_lib = |
533 Class::Handle(instantiated_dst_type.type_class()).library(); | 533 Class::Handle(instantiated_dst_type.type_class()).library(); |
534 } else { | 534 } else { |
535 dst_type_name = dst_type.UserVisibleName(); | 535 dst_type_name = dst_type.UserVisibleName(); |
536 dst_type_lib = Class::Handle(dst_type.type_class()).library(); | 536 dst_type_lib = Class::Handle(dst_type.type_class()).library(); |
537 } | 537 } |
538 String& bound_error_message = String::Handle(); | 538 String& bound_error_message = String::Handle(); |
539 if (!bound_error.IsNull()) { | 539 if (!bound_error.IsNull()) { |
540 ASSERT(isolate->flags().type_checks()); | 540 ASSERT(isolate->type_checks()); |
541 bound_error_message = String::New(bound_error.ToErrorCString()); | 541 bound_error_message = String::New(bound_error.ToErrorCString()); |
542 } | 542 } |
543 if (src_type_name.Equals(dst_type_name)) { | 543 if (src_type_name.Equals(dst_type_name)) { |
544 // Qualify the names with their libraries. | 544 // Qualify the names with their libraries. |
545 String& lib_name = String::Handle(); | 545 String& lib_name = String::Handle(); |
546 lib_name = Library::Handle( | 546 lib_name = Library::Handle( |
547 Class::Handle(src_type.type_class()).library()).name(); | 547 Class::Handle(src_type.type_class()).library()).name(); |
548 if (lib_name.Length() != 0) { | 548 if (lib_name.Length() != 0) { |
549 lib_name = String::Concat(lib_name, Symbols::Dot()); | 549 lib_name = String::Concat(lib_name, Symbols::Dot()); |
550 src_type_name = String::Concat(lib_name, src_type_name); | 550 src_type_name = String::Concat(lib_name, src_type_name); |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1890 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
1891 const TypedData& new_data = | 1891 const TypedData& new_data = |
1892 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1892 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
1893 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1893 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
1894 typed_data_cell.SetAt(0, new_data); | 1894 typed_data_cell.SetAt(0, new_data); |
1895 arguments.SetReturn(new_data); | 1895 arguments.SetReturn(new_data); |
1896 } | 1896 } |
1897 | 1897 |
1898 | 1898 |
1899 } // namespace dart | 1899 } // namespace dart |
OLD | NEW |