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

Side by Side Diff: src/heap.h

Issue 240293002: Handlify number-related allocators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/factory.cc ('k') | 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 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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 // Please note this function does not perform a garbage collection. 760 // Please note this function does not perform a garbage collection.
761 MUST_USE_RESULT MaybeObject* AllocateMap( 761 MUST_USE_RESULT MaybeObject* AllocateMap(
762 InstanceType instance_type, 762 InstanceType instance_type,
763 int instance_size, 763 int instance_size,
764 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 764 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
765 765
766 // Allocates a partial map for bootstrapping. 766 // Allocates a partial map for bootstrapping.
767 MUST_USE_RESULT MaybeObject* AllocatePartialMap(InstanceType instance_type, 767 MUST_USE_RESULT MaybeObject* AllocatePartialMap(InstanceType instance_type,
768 int instance_size); 768 int instance_size);
769 769
770 // Allocates an empty code cache.
771 MUST_USE_RESULT MaybeObject* AllocateCodeCache();
772
773 // Allocates an empty PolymorphicCodeCache. 770 // Allocates an empty PolymorphicCodeCache.
774 MUST_USE_RESULT MaybeObject* AllocatePolymorphicCodeCache(); 771 MUST_USE_RESULT MaybeObject* AllocatePolymorphicCodeCache();
775 772
776 // Clear the Instanceof cache (used when a prototype changes). 773 // Clear the Instanceof cache (used when a prototype changes).
777 inline void ClearInstanceofCache(); 774 inline void ClearInstanceofCache();
778 775
779 // Iterates the whole code space to clear all ICs of the given kind. 776 // Iterates the whole code space to clear all ICs of the given kind.
780 void ClearAllICsByKind(Code::Kind kind); 777 void ClearAllICsByKind(Code::Kind kind);
781 778
782 // For use during bootup. 779 // For use during bootup.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 // callee is only valid in sloppy mode. 984 // callee is only valid in sloppy mode.
988 static const int kArgumentsCalleeIndex = 1; 985 static const int kArgumentsCalleeIndex = 1;
989 986
990 // Allocates an arguments object - optionally with an elements array. 987 // Allocates an arguments object - optionally with an elements array.
991 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 988 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
992 // failed. 989 // failed.
993 // Please note this does not perform a garbage collection. 990 // Please note this does not perform a garbage collection.
994 MUST_USE_RESULT MaybeObject* AllocateArgumentsObject( 991 MUST_USE_RESULT MaybeObject* AllocateArgumentsObject(
995 Object* callee, int length); 992 Object* callee, int length);
996 993
997 // Same as NewNumberFromDouble, but may return a preallocated/immutable
998 // number object (e.g., minus_zero_value_, nan_value_)
999 MUST_USE_RESULT MaybeObject* NumberFromDouble(
1000 double value, PretenureFlag pretenure = NOT_TENURED);
1001
1002 // Allocated a HeapNumber from value. 994 // Allocated a HeapNumber from value.
1003 MUST_USE_RESULT MaybeObject* AllocateHeapNumber( 995 MUST_USE_RESULT MaybeObject* AllocateHeapNumber(
1004 double value, PretenureFlag pretenure = NOT_TENURED); 996 double value, PretenureFlag pretenure = NOT_TENURED);
1005 997
1006 // Converts an int into either a Smi or a HeapNumber object. 998 // Converts an int into either a Smi or a HeapNumber object.
1007 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 999 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
1008 // failed. 1000 // failed.
1009 // Please note this does not perform a garbage collection. 1001 // Please note this does not perform a garbage collection.
1010 MUST_USE_RESULT inline MaybeObject* NumberFromInt32(
1011 int32_t value, PretenureFlag pretenure = NOT_TENURED);
1012
1013 // Converts an int into either a Smi or a HeapNumber object.
1014 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
1015 // failed.
1016 // Please note this does not perform a garbage collection.
1017 MUST_USE_RESULT inline MaybeObject* NumberFromUint32( 1002 MUST_USE_RESULT inline MaybeObject* NumberFromUint32(
1018 uint32_t value, PretenureFlag pretenure = NOT_TENURED); 1003 uint32_t value, PretenureFlag pretenure = NOT_TENURED);
1019 1004
1020 // Allocates a new foreign object. 1005 // Allocates a new foreign object.
1021 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 1006 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
1022 // failed. 1007 // failed.
1023 // Please note this does not perform a garbage collection. 1008 // Please note this does not perform a garbage collection.
1024 MUST_USE_RESULT MaybeObject* AllocateForeign( 1009 MUST_USE_RESULT MaybeObject* AllocateForeign(
1025 Address address, PretenureFlag pretenure = NOT_TENURED); 1010 Address address, PretenureFlag pretenure = NOT_TENURED);
1026 1011
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 // Support for partial snapshots. After calling this we have a linear 1385 // Support for partial snapshots. After calling this we have a linear
1401 // space to write objects in each space. 1386 // space to write objects in each space.
1402 void ReserveSpace(int *sizes, Address* addresses); 1387 void ReserveSpace(int *sizes, Address* addresses);
1403 1388
1404 // 1389 //
1405 // Support for the API. 1390 // Support for the API.
1406 // 1391 //
1407 1392
1408 bool CreateApiObjects(); 1393 bool CreateApiObjects();
1409 1394
1410 // Attempt to find the number in a small cache. If we finds it, return
1411 // the string representation of the number. Otherwise return undefined.
1412 Object* GetNumberStringCache(Object* number);
1413
1414 // Update the cache with a new number-string pair.
1415 void SetNumberStringCache(Object* number, String* str);
1416
1417 // Adjusts the amount of registered external memory. 1395 // Adjusts the amount of registered external memory.
1418 // Returns the adjusted value. 1396 // Returns the adjusted value.
1419 inline int64_t AdjustAmountOfExternalAllocatedMemory( 1397 inline int64_t AdjustAmountOfExternalAllocatedMemory(
1420 int64_t change_in_bytes); 1398 int64_t change_in_bytes);
1421 1399
1422 // This is only needed for testing high promotion mode. 1400 // This is only needed for testing high promotion mode.
1423 void SetNewSpaceHighPromotionModeActive(bool mode) { 1401 void SetNewSpaceHighPromotionModeActive(bool mode) {
1424 new_space_high_promotion_mode_active_ = mode; 1402 new_space_high_promotion_mode_active_ = mode;
1425 } 1403 }
1426 1404
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 STATIC_CHECK(kTrueValueRootIndex == Internals::kTrueValueRootIndex); 1481 STATIC_CHECK(kTrueValueRootIndex == Internals::kTrueValueRootIndex);
1504 STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex); 1482 STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex);
1505 STATIC_CHECK(kempty_stringRootIndex == Internals::kEmptyStringRootIndex); 1483 STATIC_CHECK(kempty_stringRootIndex == Internals::kEmptyStringRootIndex);
1506 1484
1507 // Generated code can embed direct references to non-writable roots if 1485 // Generated code can embed direct references to non-writable roots if
1508 // they are in new space. 1486 // they are in new space.
1509 static bool RootCanBeWrittenAfterInitialization(RootListIndex root_index); 1487 static bool RootCanBeWrittenAfterInitialization(RootListIndex root_index);
1510 // Generated code can treat direct references to this root as constant. 1488 // Generated code can treat direct references to this root as constant.
1511 bool RootCanBeTreatedAsConstant(RootListIndex root_index); 1489 bool RootCanBeTreatedAsConstant(RootListIndex root_index);
1512 1490
1513 MUST_USE_RESULT MaybeObject* NumberToString(
1514 Object* number, bool check_number_string_cache = true);
1515 MUST_USE_RESULT MaybeObject* Uint32ToString(
1516 uint32_t value, bool check_number_string_cache = true);
1517
1518 Map* MapForFixedTypedArray(ExternalArrayType array_type); 1491 Map* MapForFixedTypedArray(ExternalArrayType array_type);
1519 RootListIndex RootIndexForFixedTypedArray( 1492 RootListIndex RootIndexForFixedTypedArray(
1520 ExternalArrayType array_type); 1493 ExternalArrayType array_type);
1521 1494
1522 Map* MapForExternalArrayType(ExternalArrayType array_type); 1495 Map* MapForExternalArrayType(ExternalArrayType array_type);
1523 RootListIndex RootIndexForExternalArrayType( 1496 RootListIndex RootIndexForExternalArrayType(
1524 ExternalArrayType array_type); 1497 ExternalArrayType array_type);
1525 1498
1526 RootListIndex RootIndexForEmptyExternalArray(ElementsKind kind); 1499 RootListIndex RootIndexForEmptyExternalArray(ElementsKind kind);
1527 RootListIndex RootIndexForEmptyFixedTypedArray(ElementsKind kind); 1500 RootListIndex RootIndexForEmptyFixedTypedArray(ElementsKind kind);
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); 2125 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object);
2153 2126
2154 // Total RegExp code ever generated 2127 // Total RegExp code ever generated
2155 double total_regexp_code_generated_; 2128 double total_regexp_code_generated_;
2156 2129
2157 GCTracer* tracer_; 2130 GCTracer* tracer_;
2158 2131
2159 // Allocates a small number to string cache. 2132 // Allocates a small number to string cache.
2160 MUST_USE_RESULT MaybeObject* AllocateInitialNumberStringCache(); 2133 MUST_USE_RESULT MaybeObject* AllocateInitialNumberStringCache();
2161 // Creates and installs the full-sized number string cache. 2134 // Creates and installs the full-sized number string cache.
2162 void AllocateFullSizeNumberStringCache();
2163 // Get the length of the number to string cache based on the max semispace
2164 // size.
2165 int FullSizeNumberStringCacheLength(); 2135 int FullSizeNumberStringCacheLength();
2166 // Flush the number to string cache. 2136 // Flush the number to string cache.
2167 void FlushNumberStringCache(); 2137 void FlushNumberStringCache();
2168 2138
2169 // Allocates a fixed-size allocation sites scratchpad. 2139 // Allocates a fixed-size allocation sites scratchpad.
2170 MUST_USE_RESULT MaybeObject* AllocateAllocationSitesScratchpad(); 2140 MUST_USE_RESULT MaybeObject* AllocateAllocationSitesScratchpad();
2171 2141
2172 // Sets used allocation sites entries to undefined. 2142 // Sets used allocation sites entries to undefined.
2173 void FlushAllocationSitesScratchpad(); 2143 void FlushAllocationSitesScratchpad();
2174 2144
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
2980 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2950 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2981 2951
2982 private: 2952 private:
2983 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2953 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2984 }; 2954 };
2985 #endif // DEBUG 2955 #endif // DEBUG
2986 2956
2987 } } // namespace v8::internal 2957 } } // namespace v8::internal
2988 2958
2989 #endif // V8_HEAP_H_ 2959 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698