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

Side by Side Diff: src/heap.h

Issue 1694004: Simplify double to number convertion. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 7 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 | src/heap.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-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 JSObject::kHeaderSize + 2 * kPointerSize; 520 JSObject::kHeaderSize + 2 * kPointerSize;
521 static const int arguments_callee_index = 0; 521 static const int arguments_callee_index = 0;
522 static const int arguments_length_index = 1; 522 static const int arguments_length_index = 1;
523 523
524 // Allocates an arguments object - optionally with an elements array. 524 // Allocates an arguments object - optionally with an elements array.
525 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 525 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
526 // failed. 526 // failed.
527 // Please note this does not perform a garbage collection. 527 // Please note this does not perform a garbage collection.
528 static Object* AllocateArgumentsObject(Object* callee, int length); 528 static Object* AllocateArgumentsObject(Object* callee, int length);
529 529
530 // Converts a double into either a Smi or a HeapNumber object.
531 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
532 // failed.
533 // Please note this does not perform a garbage collection.
534 static Object* NewNumberFromDouble(double value,
535 PretenureFlag pretenure = NOT_TENURED);
536
537 // Same as NewNumberFromDouble, but may return a preallocated/immutable 530 // Same as NewNumberFromDouble, but may return a preallocated/immutable
538 // number object (e.g., minus_zero_value_, nan_value_) 531 // number object (e.g., minus_zero_value_, nan_value_)
539 static Object* NumberFromDouble(double value, 532 static Object* NumberFromDouble(double value,
540 PretenureFlag pretenure = NOT_TENURED); 533 PretenureFlag pretenure = NOT_TENURED);
541 534
542 // Allocated a HeapNumber from value. 535 // Allocated a HeapNumber from value.
543 static Object* AllocateHeapNumber(double value, PretenureFlag pretenure); 536 static Object* AllocateHeapNumber(double value, PretenureFlag pretenure);
544 static Object* AllocateHeapNumber(double value); // pretenure = NOT_TENURED 537 static Object* AllocateHeapNumber(double value); // pretenure = NOT_TENURED
545 538
546 // Converts an int into either a Smi or a HeapNumber object. 539 // Converts an int into either a Smi or a HeapNumber object.
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 static GCCallback global_gc_epilogue_callback_; 1117 static GCCallback global_gc_epilogue_callback_;
1125 1118
1126 // Checks whether a global GC is necessary 1119 // Checks whether a global GC is necessary
1127 static GarbageCollector SelectGarbageCollector(AllocationSpace space); 1120 static GarbageCollector SelectGarbageCollector(AllocationSpace space);
1128 1121
1129 // Performs garbage collection 1122 // Performs garbage collection
1130 static void PerformGarbageCollection(AllocationSpace space, 1123 static void PerformGarbageCollection(AllocationSpace space,
1131 GarbageCollector collector, 1124 GarbageCollector collector,
1132 GCTracer* tracer); 1125 GCTracer* tracer);
1133 1126
1134 // Returns either a Smi or a Number object from 'value'. If 'new_object'
1135 // is false, it may return a preallocated immutable object.
1136 static Object* SmiOrNumberFromDouble(double value,
1137 bool new_object,
1138 PretenureFlag pretenure = NOT_TENURED);
1139
1140 // Allocate an uninitialized object in map space. The behavior is identical 1127 // Allocate an uninitialized object in map space. The behavior is identical
1141 // to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't 1128 // to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't
1142 // have to test the allocation space argument and (b) can reduce code size 1129 // have to test the allocation space argument and (b) can reduce code size
1143 // (since both AllocateRaw and AllocateRawMap are inlined). 1130 // (since both AllocateRaw and AllocateRawMap are inlined).
1144 static inline Object* AllocateRawMap(); 1131 static inline Object* AllocateRawMap();
1145 1132
1146 // Allocate an uninitialized object in the global property cell space. 1133 // Allocate an uninitialized object in the global property cell space.
1147 static inline Object* AllocateRawCell(); 1134 static inline Object* AllocateRawCell();
1148 1135
1149 // Initializes a JSObject based on its map. 1136 // Initializes a JSObject based on its map.
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 1818
1832 // To speed up scavenge collections new space string are kept 1819 // To speed up scavenge collections new space string are kept
1833 // separate from old space strings. 1820 // separate from old space strings.
1834 static List<Object*> new_space_strings_; 1821 static List<Object*> new_space_strings_;
1835 static List<Object*> old_space_strings_; 1822 static List<Object*> old_space_strings_;
1836 }; 1823 };
1837 1824
1838 } } // namespace v8::internal 1825 } } // namespace v8::internal
1839 1826
1840 #endif // V8_HEAP_H_ 1827 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698