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

Unified Diff: runtime/vm/locations.cc

Issue 11362210: Restrict immediate operands to smi where only smis are supported. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/locations.h ('k') | tests/language/inline_closure_with_constant_arguments.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/locations.cc
===================================================================
--- runtime/vm/locations.cc (revision 14796)
+++ runtime/vm/locations.cc (working copy)
@@ -53,6 +53,14 @@
}
+Location Location::RegisterOrSmiConstant(Value* value) {
+ ConstantInstr* constant = value->definition()->AsConstant();
+ return ((constant != NULL) && constant->value().IsSmi())
+ ? Location::Constant(constant->value())
+ : Location::RequiresRegister();
+}
+
+
Location Location::FixedRegisterOrConstant(Value* value, Register reg) {
ConstantInstr* constant = value->definition()->AsConstant();
return (constant != NULL)
@@ -61,6 +69,14 @@
}
+Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) {
+ ConstantInstr* constant = value->definition()->AsConstant();
+ return ((constant != NULL) && constant->value().IsSmi())
+ ? Location::Constant(constant->value())
+ : Location::RegisterLocation(reg);
+}
+
+
const char* Location::Name() const {
switch (kind()) {
case kInvalid: return "?";
« no previous file with comments | « runtime/vm/locations.h ('k') | tests/language/inline_closure_with_constant_arguments.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698