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

Unified Diff: src/conversions-inl.h

Issue 2625873009: [ast] Remove heap accesses from AST numbering (Closed)
Patch Set: Fix condition to not be stupid Created 3 years, 11 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
Index: src/conversions-inl.h
diff --git a/src/conversions-inl.h b/src/conversions-inl.h
index d7789f9180880868baac232fbc4eeab9e58cb4d9..08766202658eabf41791c7ba255d7440794e36aa 100644
--- a/src/conversions-inl.h
+++ b/src/conversions-inl.h
@@ -122,6 +122,19 @@ bool IsUint32Double(double value) {
value == FastUI2D(FastD2UI(value));
}
+bool DoubleToUint32(double value, uint32_t* uint32_value) {
+ if (IsMinusZero(value) || value < 0 || value > kMaxUInt32) {
+ return false;
+ }
+ // TODO(leszeks): We maybe could be faster than FastD2UI here, since we only
+ // care about the value being valid if the conversion is valid.
+ uint32_t converted_value = FastD2UI(value);
+ if (value == FastUI2D(converted_value)) {
+ *uint32_value = converted_value;
+ return true;
+ }
+ return false;
+}
int32_t NumberToInt32(Object* number) {
if (number->IsSmi()) return Smi::cast(number)->value();
« src/compiler.cc ('K') | « src/conversions.h ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698