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