| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/code_descriptors.h" | 9 #include "vm/code_descriptors.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 // If nothing is known about the value, as is the case for passed-in | 438 // If nothing is known about the value, as is the case for passed-in |
| 439 // parameters, and since dst_type is not one of the tested cases above, then | 439 // parameters, and since dst_type is not one of the tested cases above, then |
| 440 // the type test cannot be eliminated. | 440 // the type test cannot be eliminated. |
| 441 if (value == NULL) { | 441 if (value == NULL) { |
| 442 return false; | 442 return false; |
| 443 } | 443 } |
| 444 | 444 |
| 445 // Propagated types are not set yet. | 445 // Propagated types are not set yet. |
| 446 // More checks will possibly be eliminated during type propagation. | 446 // More checks will possibly be eliminated during type propagation. |
| 447 const bool eliminated = value->CompileTypeIsMoreSpecificThan(dst_type); | 447 const bool eliminated = value->CompileTypeIsMoreSpecificThan(dst_type); |
| 448 // Note: 'eliminated' is true for a null constant value, since its type, |
| 449 // i.e. bottom type, is more specific than any type. |
| 448 if (FLAG_trace_type_check_elimination) { | 450 if (FLAG_trace_type_check_elimination) { |
| 449 FlowGraphPrinter::PrintTypeCheck(owner()->parsed_function(), | 451 FlowGraphPrinter::PrintTypeCheck(owner()->parsed_function(), |
| 450 token_pos, | 452 token_pos, |
| 451 value, | 453 value, |
| 452 dst_type, | 454 dst_type, |
| 453 dst_name, | 455 dst_name, |
| 454 eliminated); | 456 eliminated); |
| 455 } | 457 } |
| 456 return eliminated; | 458 return eliminated; |
| 457 } | 459 } |
| (...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2847 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 2849 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 2848 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2850 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 2849 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2851 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2850 const Error& error = Error::Handle( | 2852 const Error& error = Error::Handle( |
| 2851 LanguageError::New(String::Handle(String::New(chars)))); | 2853 LanguageError::New(String::Handle(String::New(chars)))); |
| 2852 Isolate::Current()->long_jump_base()->Jump(1, error); | 2854 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2853 } | 2855 } |
| 2854 | 2856 |
| 2855 | 2857 |
| 2856 } // namespace dart | 2858 } // namespace dart |
| OLD | NEW |