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

Side by Side Diff: src/runtime.cc

Issue 2992001: Merge fixes for issue 736 and 764 to 2.1 branch for Chrome 5. (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.1/
Patch Set: Created 10 years, 5 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 | « src/runtime.h ('k') | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 5171 matching lines...) Expand 10 before | Expand all | Expand 10 after
5182 CONVERT_DOUBLE_CHECKED(number, args[0]); 5182 CONVERT_DOUBLE_CHECKED(number, args[0]);
5183 5183
5184 // We do not include 0 so that we don't have to treat +0 / -0 cases. 5184 // We do not include 0 so that we don't have to treat +0 / -0 cases.
5185 if (number > 0 && number <= Smi::kMaxValue) { 5185 if (number > 0 && number <= Smi::kMaxValue) {
5186 return Smi::FromInt(static_cast<int>(number)); 5186 return Smi::FromInt(static_cast<int>(number));
5187 } 5187 }
5188 return Heap::NumberFromDouble(DoubleToInteger(number)); 5188 return Heap::NumberFromDouble(DoubleToInteger(number));
5189 } 5189 }
5190 5190
5191 5191
5192 static Object* Runtime_NumberToIntegerMapMinusZero(Arguments args) {
5193 NoHandleAllocation ha;
5194 ASSERT(args.length() == 1);
5195
5196 CONVERT_DOUBLE_CHECKED(number, args[0]);
5197
5198 // We do not include 0 so that we don't have to treat +0 / -0 cases.
5199 if (number > 0 && number <= Smi::kMaxValue) {
5200 return Smi::FromInt(static_cast<int>(number));
5201 }
5202
5203 double double_value = DoubleToInteger(number);
5204 // Map both -0 and +0 to +0.
5205 if (double_value == 0) double_value = 0;
5206
5207 return Heap::NumberFromDouble(double_value);
5208 }
5209
5210
5192 static Object* Runtime_NumberToJSUint32(Arguments args) { 5211 static Object* Runtime_NumberToJSUint32(Arguments args) {
5193 NoHandleAllocation ha; 5212 NoHandleAllocation ha;
5194 ASSERT(args.length() == 1); 5213 ASSERT(args.length() == 1);
5195 5214
5196 CONVERT_NUMBER_CHECKED(int32_t, number, Uint32, args[0]); 5215 CONVERT_NUMBER_CHECKED(int32_t, number, Uint32, args[0]);
5197 return Heap::NumberFromUint32(number); 5216 return Heap::NumberFromUint32(number);
5198 } 5217 }
5199 5218
5200 5219
5201 static Object* Runtime_NumberToJSInt32(Arguments args) { 5220 static Object* Runtime_NumberToJSInt32(Arguments args) {
(...skipping 4786 matching lines...) Expand 10 before | Expand all | Expand 10 after
9988 } else { 10007 } else {
9989 // Handle last resort GC and make sure to allow future allocations 10008 // Handle last resort GC and make sure to allow future allocations
9990 // to grow the heap without causing GCs (if possible). 10009 // to grow the heap without causing GCs (if possible).
9991 Counters::gc_last_resort_from_js.Increment(); 10010 Counters::gc_last_resort_from_js.Increment();
9992 Heap::CollectAllGarbage(false); 10011 Heap::CollectAllGarbage(false);
9993 } 10012 }
9994 } 10013 }
9995 10014
9996 10015
9997 } } // namespace v8::internal 10016 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698