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

Side by Side Diff: src/deoptimizer.cc

Issue 10878012: Fix order of conversions in ObjectToInt32 and ObjectToUint32 helpers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 947
948 948
949 static bool ObjectToInt32(Object* obj, int32_t* value) { 949 static bool ObjectToInt32(Object* obj, int32_t* value) {
950 if (obj->IsSmi()) { 950 if (obj->IsSmi()) {
951 *value = Smi::cast(obj)->value(); 951 *value = Smi::cast(obj)->value();
952 return true; 952 return true;
953 } 953 }
954 954
955 if (obj->IsHeapNumber()) { 955 if (obj->IsHeapNumber()) {
956 double num = HeapNumber::cast(obj)->value(); 956 double num = HeapNumber::cast(obj)->value();
957 if (FastD2I(FastI2D(num)) != num) { 957 if (FastI2D(FastD2I(num)) != num) {
958 if (FLAG_trace_osr) { 958 if (FLAG_trace_osr) {
959 PrintF("**** %g could not be converted to int32 ****\n", 959 PrintF("**** %g could not be converted to int32 ****\n",
960 HeapNumber::cast(obj)->value()); 960 HeapNumber::cast(obj)->value());
961 } 961 }
962 return false; 962 return false;
963 } 963 }
964 964
965 *value = FastD2I(num); 965 *value = FastD2I(num);
966 return true; 966 return true;
967 } 967 }
968 968
969 return false; 969 return false;
970 } 970 }
971 971
972 972
973 static bool ObjectToUint32(Object* obj, uint32_t* value) { 973 static bool ObjectToUint32(Object* obj, uint32_t* value) {
974 if (obj->IsSmi()) { 974 if (obj->IsSmi()) {
975 if (Smi::cast(obj)->value() < 0) return false; 975 if (Smi::cast(obj)->value() < 0) return false;
976 976
977 *value = static_cast<uint32_t>(Smi::cast(obj)->value()); 977 *value = static_cast<uint32_t>(Smi::cast(obj)->value());
978 return true; 978 return true;
979 } 979 }
980 980
981 if (obj->IsHeapNumber()) { 981 if (obj->IsHeapNumber()) {
982 double num = HeapNumber::cast(obj)->value(); 982 double num = HeapNumber::cast(obj)->value();
983 if ((num < 0) || (FastD2UI(FastUI2D(num)) != num)) { 983 if ((num < 0) || (FastUI2D(FastD2UI(num)) != num)) {
984 if (FLAG_trace_osr) { 984 if (FLAG_trace_osr) {
985 PrintF("**** %g could not be converted to uint32 ****\n", 985 PrintF("**** %g could not be converted to uint32 ****\n",
986 HeapNumber::cast(obj)->value()); 986 HeapNumber::cast(obj)->value());
987 } 987 }
988 return false; 988 return false;
989 } 989 }
990 990
991 *value = FastD2UI(num); 991 *value = FastD2UI(num);
992 return true; 992 return true;
993 } 993 }
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 1840
1841 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 1841 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
1842 v->VisitPointer(BitCast<Object**>(&function_)); 1842 v->VisitPointer(BitCast<Object**>(&function_));
1843 v->VisitPointers(parameters_, parameters_ + parameters_count_); 1843 v->VisitPointers(parameters_, parameters_ + parameters_count_);
1844 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 1844 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
1845 } 1845 }
1846 1846
1847 #endif // ENABLE_DEBUGGER_SUPPORT 1847 #endif // ENABLE_DEBUGGER_SUPPORT
1848 1848
1849 } } // namespace v8::internal 1849 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698