| 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); |
| 57 DECLARE_FLAG(bool, enable_type_checks); | 58 DECLARE_FLAG(bool, enable_type_checks); |
| 58 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 59 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
| 59 | 60 |
| 60 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); | 61 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); |
| 61 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); | 62 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); |
| 62 | 63 |
| 63 DEFINE_FLAG(int, stacktrace_every, 0, | 64 DEFINE_FLAG(int, stacktrace_every, 0, |
| 64 "Compute debugger stacktrace on every N stack overflow checks"); | 65 "Compute debugger stacktrace on every N stack overflow checks"); |
| 65 DEFINE_FLAG(charp, stacktrace_filter, NULL, | 66 DEFINE_FLAG(charp, stacktrace_filter, NULL, |
| 66 "Compute stacktrace in named function on stack overflow checks"); | 67 "Compute stacktrace in named function on stack overflow checks"); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 UNREACHABLE(); | 553 UNREACHABLE(); |
| 553 } | 554 } |
| 554 UpdateTypeTestCache(src_instance, dst_type, | 555 UpdateTypeTestCache(src_instance, dst_type, |
| 555 dst_instantiator, instantiator_type_arguments, | 556 dst_instantiator, instantiator_type_arguments, |
| 556 Bool::True(), cache); | 557 Bool::True(), cache); |
| 557 arguments.SetReturn(src_instance); | 558 arguments.SetReturn(src_instance); |
| 558 } | 559 } |
| 559 | 560 |
| 560 | 561 |
| 561 // Report that the type of the given object is not bool in conditional context. | 562 // 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.) |
| 562 // Arg0: bad object. | 565 // Arg0: bad object. |
| 563 // Return value: none, throws a TypeError. | 566 // Return value: none, throws TypeError or AssertionError. |
| 564 DEFINE_RUNTIME_ENTRY(NonBoolTypeError, 1) { | 567 DEFINE_RUNTIME_ENTRY(NonBoolTypeError, 1) { |
| 565 const intptr_t location = GetCallerLocation(); | 568 const intptr_t location = GetCallerLocation(); |
| 566 const Instance& src_instance = Instance::CheckedHandle(arguments.ArgAt(0)); | 569 const Instance& src_instance = Instance::CheckedHandle(arguments.ArgAt(0)); |
| 567 ASSERT(src_instance.IsNull() || !src_instance.IsBool()); | 570 |
| 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()); |
| 568 const Type& bool_interface = Type::Handle(Type::BoolType()); | 586 const Type& bool_interface = Type::Handle(Type::BoolType()); |
| 569 const AbstractType& src_type = AbstractType::Handle(src_instance.GetType()); | 587 const AbstractType& src_type = AbstractType::Handle(src_instance.GetType()); |
| 570 const String& src_type_name = String::Handle(src_type.UserVisibleName()); | 588 const String& src_type_name = String::Handle(src_type.UserVisibleName()); |
| 571 const String& bool_type_name = | 589 const String& bool_type_name = |
| 572 String::Handle(bool_interface.UserVisibleName()); | 590 String::Handle(bool_interface.UserVisibleName()); |
| 573 const String& no_bound_error = String::Handle(); | 591 const String& no_bound_error = String::Handle(); |
| 574 Exceptions::CreateAndThrowTypeError(location, src_type_name, bool_type_name, | 592 Exceptions::CreateAndThrowTypeError(location, src_type_name, bool_type_name, |
| 575 Symbols::BooleanExpression(), | 593 Symbols::BooleanExpression(), |
| 576 no_bound_error); | 594 no_bound_error); |
| 577 UNREACHABLE(); | 595 UNREACHABLE(); |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 field.RecordStore(value); | 1645 field.RecordStore(value); |
| 1628 } | 1646 } |
| 1629 | 1647 |
| 1630 | 1648 |
| 1631 DEFINE_RUNTIME_ENTRY(InitStaticField, 1) { | 1649 DEFINE_RUNTIME_ENTRY(InitStaticField, 1) { |
| 1632 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1650 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1633 field.EvaluateInitializer(); | 1651 field.EvaluateInitializer(); |
| 1634 } | 1652 } |
| 1635 | 1653 |
| 1636 } // namespace dart | 1654 } // namespace dart |
| OLD | NEW |