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

Unified Diff: runtime/vm/opt_code_generator_ia32.cc

Issue 9854030: Improve checked mode a little (more to come in a different CL). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/opt_code_generator_ia32.cc
===================================================================
--- runtime/vm/opt_code_generator_ia32.cc (revision 5841)
+++ runtime/vm/opt_code_generator_ia32.cc (working copy)
@@ -1343,6 +1343,8 @@
// Operators "&&" and "||" cannot be overloaded, therefore inline them
// instead of calling the operator.
if ((node->kind() == Token::kAND) || (node->kind() == Token::kOR)) {
+ // TODO(srdjan): Test in checked mode if they are Booleans otherwise
+ // throw exception.
if (FLAG_enable_type_checks) {
CodeGenerator::VisitBinaryOpNode(node);
return;
@@ -1410,11 +1412,16 @@
}
+// Optimized for Smi only.
void OptimizingCodeGenerator::VisitIncrOpLocalNode(IncrOpLocalNode* node) {
if (FLAG_enable_type_checks) {
- classes_for_locals_->SetLocalType(node->local(), Class::ZoneHandle());
- CodeGenerator::VisitIncrOpLocalNode(node);
- return;
+ const AbstractType& local_type = node->local().type();
+ if (!local_type.IsNumberInterface() && !local_type.IsIntInterface()) {
+ // Local does not accept a Smi (only Smi's interfaces are public).
+ classes_for_locals_->SetLocalType(node->local(), Class::ZoneHandle());
+ CodeGenerator::VisitIncrOpLocalNode(node);
+ return;
+ }
}
const ICData& ic_data = node->ICDataAtId(node->id());
if (ic_data.NumberOfChecks() == 0) {
@@ -3116,7 +3123,9 @@
void OptimizingCodeGenerator::VisitUnaryOpNode(UnaryOpNode* node) {
- if (FLAG_enable_type_checks) {
+ // TODO(srdjan): Test in checked mode if value is Boolean, throw error
+ // otherwise.
+ if (FLAG_enable_type_checks && node->kind() == Token::kNOT) {
CodeGenerator::VisitUnaryOpNode(node);
return;
}
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698