| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); | 47 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); |
| 48 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, | 48 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, |
| 49 "Trace IC miss in optimized code"); | 49 "Trace IC miss in optimized code"); |
| 50 DEFINE_FLAG(bool, trace_optimized_ic_calls, false, | 50 DEFINE_FLAG(bool, trace_optimized_ic_calls, false, |
| 51 "Trace IC calls in optimized code."); | 51 "Trace IC calls in optimized code."); |
| 52 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); | 52 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); |
| 53 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); | 53 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); |
| 54 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); | 54 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); |
| 55 | 55 |
| 56 DECLARE_FLAG(int, deoptimization_counter_threshold); | 56 DECLARE_FLAG(int, deoptimization_counter_threshold); |
| 57 DECLARE_FLAG(bool, enable_asserts); | |
| 58 DECLARE_FLAG(bool, enable_type_checks); | 57 DECLARE_FLAG(bool, enable_type_checks); |
| 59 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 58 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
| 60 | 59 |
| 61 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); | 60 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); |
| 62 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); | 61 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); |
| 63 | 62 |
| 64 DEFINE_FLAG(int, stacktrace_every, 0, | 63 DEFINE_FLAG(int, stacktrace_every, 0, |
| 65 "Compute debugger stacktrace on every N stack overflow checks"); | 64 "Compute debugger stacktrace on every N stack overflow checks"); |
| 66 DEFINE_FLAG(charp, stacktrace_filter, NULL, | 65 DEFINE_FLAG(charp, stacktrace_filter, NULL, |
| 67 "Compute stacktrace in named function on stack overflow checks"); | 66 "Compute stacktrace in named function on stack overflow checks"); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 UNREACHABLE(); | 552 UNREACHABLE(); |
| 554 } | 553 } |
| 555 UpdateTypeTestCache(src_instance, dst_type, | 554 UpdateTypeTestCache(src_instance, dst_type, |
| 556 dst_instantiator, instantiator_type_arguments, | 555 dst_instantiator, instantiator_type_arguments, |
| 557 Bool::True(), cache); | 556 Bool::True(), cache); |
| 558 arguments.SetReturn(src_instance); | 557 arguments.SetReturn(src_instance); |
| 559 } | 558 } |
| 560 | 559 |
| 561 | 560 |
| 562 // Report that the type of the given object is not bool in conditional context. | 561 // Report that the type of the given object is not bool in conditional context. |
| 563 // Throw assertion error if the object is null. (cf. Boolean Conversion | |
| 564 // in language Spec.) | |
| 565 // Arg0: bad object. | 562 // Arg0: bad object. |
| 566 // Return value: none, throws TypeError or AssertionError. | 563 // Return value: none, throws a TypeError. |
| 567 DEFINE_RUNTIME_ENTRY(NonBoolTypeError, 1) { | 564 DEFINE_RUNTIME_ENTRY(NonBoolTypeError, 1) { |
| 568 const intptr_t location = GetCallerLocation(); | 565 const intptr_t location = GetCallerLocation(); |
| 569 const Instance& src_instance = Instance::CheckedHandle(arguments.ArgAt(0)); | 566 const Instance& src_instance = Instance::CheckedHandle(arguments.ArgAt(0)); |
| 570 | 567 ASSERT(src_instance.IsNull() || !src_instance.IsBool()); |
| 571 if (src_instance.IsNull()) { | |
| 572 const Array& args = Array::Handle(Array::New(4)); | |
| 573 args.SetAt(0, String::Handle( | |
| 574 String::New("Failed assertion: boolean expression must not be null"))); | |
| 575 | |
| 576 // No source code for this assertion, set url to null. | |
| 577 args.SetAt(1, String::Handle(String::null())); | |
| 578 args.SetAt(2, Smi::Handle(Smi::New(0))); | |
| 579 args.SetAt(3, Smi::Handle(Smi::New(0))); | |
| 580 | |
| 581 Exceptions::ThrowByType(Exceptions::kAssertion, args); | |
| 582 UNREACHABLE(); | |
| 583 } | |
| 584 | |
| 585 ASSERT(!src_instance.IsBool()); | |
| 586 const Type& bool_interface = Type::Handle(Type::BoolType()); | 568 const Type& bool_interface = Type::Handle(Type::BoolType()); |
| 587 const AbstractType& src_type = AbstractType::Handle(src_instance.GetType()); | 569 const AbstractType& src_type = AbstractType::Handle(src_instance.GetType()); |
| 588 const String& src_type_name = String::Handle(src_type.UserVisibleName()); | 570 const String& src_type_name = String::Handle(src_type.UserVisibleName()); |
| 589 const String& bool_type_name = | 571 const String& bool_type_name = |
| 590 String::Handle(bool_interface.UserVisibleName()); | 572 String::Handle(bool_interface.UserVisibleName()); |
| 591 const String& no_bound_error = String::Handle(); | 573 const String& no_bound_error = String::Handle(); |
| 592 Exceptions::CreateAndThrowTypeError(location, src_type_name, bool_type_name, | 574 Exceptions::CreateAndThrowTypeError(location, src_type_name, bool_type_name, |
| 593 Symbols::BooleanExpression(), | 575 Symbols::BooleanExpression(), |
| 594 no_bound_error); | 576 no_bound_error); |
| 595 UNREACHABLE(); | 577 UNREACHABLE(); |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1645 field.RecordStore(value); | 1627 field.RecordStore(value); |
| 1646 } | 1628 } |
| 1647 | 1629 |
| 1648 | 1630 |
| 1649 DEFINE_RUNTIME_ENTRY(InitStaticField, 1) { | 1631 DEFINE_RUNTIME_ENTRY(InitStaticField, 1) { |
| 1650 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1632 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1651 field.EvaluateInitializer(); | 1633 field.EvaluateInitializer(); |
| 1652 } | 1634 } |
| 1653 | 1635 |
| 1654 } // namespace dart | 1636 } // namespace dart |
| OLD | NEW |