Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: runtime/vm/code_generator.cc

Issue 2574003003: Add optional message argument to assert statements in the VM. (Closed)
Patch Set: Update dart2js status file Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698