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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 // Throw assertion error if the object is null. (cf. Boolean Conversion | 578 // Throw assertion error if the object is null. (cf. Boolean Conversion |
579 // in language Spec.) | 579 // in language Spec.) |
580 // Arg0: bad object. | 580 // Arg0: bad object. |
581 // Return value: none, throws TypeError or AssertionError. | 581 // Return value: none, throws TypeError or AssertionError. |
582 DEFINE_RUNTIME_ENTRY(NonBoolTypeError, 1) { | 582 DEFINE_RUNTIME_ENTRY(NonBoolTypeError, 1) { |
583 const TokenPosition location = GetCallerLocation(); | 583 const TokenPosition location = GetCallerLocation(); |
584 const Instance& src_instance = | 584 const Instance& src_instance = |
585 Instance::CheckedHandle(zone, arguments.ArgAt(0)); | 585 Instance::CheckedHandle(zone, arguments.ArgAt(0)); |
586 | 586 |
587 if (src_instance.IsNull()) { | 587 if (src_instance.IsNull()) { |
588 const Array& args = Array::Handle(zone, Array::New(4)); | 588 const Array& args = Array::Handle(zone, Array::New(5)); |
589 args.SetAt( | 589 args.SetAt( |
590 0, String::Handle( | 590 0, String::Handle( |
591 zone, | 591 zone, |
592 String::New( | 592 String::New( |
593 "Failed assertion: boolean expression must not be null"))); | 593 "Failed assertion: boolean expression must not be null"))); |
594 | 594 |
595 // No source code for this assertion, set url to null. | 595 // No source code for this assertion, set url to null. |
596 args.SetAt(1, String::Handle(zone, String::null())); | 596 args.SetAt(1, String::Handle(zone, String::null())); |
597 args.SetAt(2, Smi::Handle(zone, Smi::New(0))); | 597 args.SetAt(2, Smi::Handle(zone, Smi::New(0))); |
598 args.SetAt(3, Smi::Handle(zone, Smi::New(0))); | 598 args.SetAt(3, Smi::Handle(zone, Smi::New(0))); |
| 599 args.SetAt(4, String::Handle(zone, String::null())); |
599 | 600 |
600 Exceptions::ThrowByType(Exceptions::kAssertion, args); | 601 Exceptions::ThrowByType(Exceptions::kAssertion, args); |
601 UNREACHABLE(); | 602 UNREACHABLE(); |
602 } | 603 } |
603 | 604 |
604 ASSERT(!src_instance.IsBool()); | 605 ASSERT(!src_instance.IsBool()); |
605 const Type& bool_interface = Type::Handle(Type::BoolType()); | 606 const Type& bool_interface = Type::Handle(Type::BoolType()); |
606 const AbstractType& src_type = | 607 const AbstractType& src_type = |
607 AbstractType::Handle(zone, src_instance.GetType(Heap::kNew)); | 608 AbstractType::Handle(zone, src_instance.GetType(Heap::kNew)); |
608 const String& no_bound_error = String::Handle(zone); | 609 const String& no_bound_error = String::Handle(zone); |
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2291 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 2292 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
2292 const TypedData& new_data = | 2293 const TypedData& new_data = |
2293 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 2294 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
2294 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 2295 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
2295 typed_data_cell.SetAt(0, new_data); | 2296 typed_data_cell.SetAt(0, new_data); |
2296 arguments.SetReturn(new_data); | 2297 arguments.SetReturn(new_data); |
2297 } | 2298 } |
2298 | 2299 |
2299 | 2300 |
2300 } // namespace dart | 2301 } // namespace dart |
OLD | NEW |