| 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 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2823 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 2825 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 2824 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2826 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 2825 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2827 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2826 const Error& error = Error::Handle( | 2828 const Error& error = Error::Handle( |
| 2827 LanguageError::New(String::Handle(String::New(chars)))); | 2829 LanguageError::New(String::Handle(String::New(chars)))); |
| 2828 Isolate::Current()->long_jump_base()->Jump(1, error); | 2830 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2829 } | 2831 } |
| 2830 | 2832 |
| 2831 | 2833 |
| 2832 } // namespace dart | 2834 } // namespace dart |
| OLD | NEW |