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

Unified Diff: runtime/vm/parser.cc

Issue 10051011: Eliminate type checks that can successfully be performed at compile time. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/opt_code_generator_ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 6419)
+++ runtime/vm/parser.cc (working copy)
@@ -7152,22 +7152,10 @@
if (FLAG_enable_type_checks &&
!is_const &&
!element_type.IsDynamicType()) {
- // The expression needs to be type checked at runtime.
- // Eliminate the type check if it can be performed at compile time and
- // if it succeeds.
- Error& malformed_error = Error::Handle();
- if (!element_type.IsInstantiated() ||
- !element->IsLiteralNode() ||
- (!element->AsLiteralNode()->literal().IsNull() &&
- !element->AsLiteralNode()->literal().IsInstanceOf(
- element_type,
- TypeArguments::Handle(),
- &malformed_error))) {
- element = new AssignableNode(element_pos,
- element,
- element_type,
- dst_name);
- }
+ element = new AssignableNode(element_pos,
+ element,
+ element_type,
+ dst_name);
}
list->AddElement(element);
if (CurrentToken() == Token::kCOMMA) {
@@ -7339,20 +7327,10 @@
if (FLAG_enable_type_checks &&
!is_const &&
!value_type.IsDynamicType()) {
- // The expression needs to be type checked at runtime.
- // Eliminate the type check if it can be performed at compile time and
- // if it succeeds.
- Error& malformed_error = Error::Handle();
- if (!value_type.IsInstantiated() ||
- !value->IsLiteralNode() ||
- (!value->AsLiteralNode()->literal().IsNull() &&
- !value->AsLiteralNode()->literal().IsInstanceOf(
- value_type, TypeArguments::Handle(), &malformed_error))) {
- value = new AssignableNode(value_pos,
- value,
- value_type,
- dst_name);
- }
+ value = new AssignableNode(value_pos,
+ value,
+ value_type,
+ dst_name);
}
AddKeyValuePair(kv_pairs, is_const, key, value);
« no previous file with comments | « runtime/vm/opt_code_generator_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698