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

Side by Side Diff: src/heap.h

Issue 7977001: Added ability to lock strings to prevent their representation or encoding from changing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix bug in test when running threaded. Created 9 years, 2 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/handles.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 V(Map, global_context_map, GlobalContextMap) \ 70 V(Map, global_context_map, GlobalContextMap) \
71 V(Map, fixed_array_map, FixedArrayMap) \ 71 V(Map, fixed_array_map, FixedArrayMap) \
72 V(Map, serialized_scope_info_map, SerializedScopeInfoMap) \ 72 V(Map, serialized_scope_info_map, SerializedScopeInfoMap) \
73 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ 73 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \
74 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ 74 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \
75 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ 75 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \
76 V(Map, meta_map, MetaMap) \ 76 V(Map, meta_map, MetaMap) \
77 V(Map, hash_table_map, HashTableMap) \ 77 V(Map, hash_table_map, HashTableMap) \
78 V(Smi, stack_limit, StackLimit) \ 78 V(Smi, stack_limit, StackLimit) \
79 V(FixedArray, number_string_cache, NumberStringCache) \ 79 V(FixedArray, number_string_cache, NumberStringCache) \
80 V(FixedArray, string_locks, StringLocks) \
80 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ 81 V(Object, instanceof_cache_function, InstanceofCacheFunction) \
81 V(Object, instanceof_cache_map, InstanceofCacheMap) \ 82 V(Object, instanceof_cache_map, InstanceofCacheMap) \
82 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ 83 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \
83 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ 84 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \
84 V(FixedArray, string_split_cache, StringSplitCache) \ 85 V(FixedArray, string_split_cache, StringSplitCache) \
85 V(Object, termination_exception, TerminationException) \ 86 V(Object, termination_exception, TerminationException) \
86 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ 87 V(FixedArray, empty_fixed_array, EmptyFixedArray) \
87 V(ByteArray, empty_byte_array, EmptyByteArray) \ 88 V(ByteArray, empty_byte_array, EmptyByteArray) \
88 V(FixedDoubleArray, empty_fixed_double_array, EmptyFixedDoubleArray) \ 89 V(FixedDoubleArray, empty_fixed_double_array, EmptyFixedDoubleArray) \
89 V(String, empty_string, EmptyString) \ 90 V(String, empty_string, EmptyString) \
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 // 1208 //
1208 // Support for the API. 1209 // Support for the API.
1209 // 1210 //
1210 1211
1211 bool CreateApiObjects(); 1212 bool CreateApiObjects();
1212 1213
1213 // Attempt to find the number in a small cache. If we finds it, return 1214 // Attempt to find the number in a small cache. If we finds it, return
1214 // the string representation of the number. Otherwise return undefined. 1215 // the string representation of the number. Otherwise return undefined.
1215 Object* GetNumberStringCache(Object* number); 1216 Object* GetNumberStringCache(Object* number);
1216 1217
1218 // Locks a string to prevent changes to the string's representation or
1219 // encoding, e.g., due to externalization.
1220 // It does not prevent moving the string during a GC
1221 // (i.e., it's not a way to keep a pointer to an underlying character
1222 // sequence valid). Might fail if the underlying data structure can't
1223 // grow to accomodate the string, otherwise returns the string itself.
1224 //
1225 // Stores data in Heap::string_locks(), a FixedArray with the number
1226 // of filled in elements in the first position, and that number of
1227 // string pointers in the following positions (in no particular order).
1228 // The FixedArray is padded with undefined or similar uninteresting values.
1229 MaybeObject* LockString(String* string);
1230 // Removes the lock on the string.
1231 void UnlockString(String* string);
1232 // Check if a string is locked.
1233 bool IsStringLocked(String* string);
1234 // Initializes the data structure underlying LockString.
1235 MaybeObject* InitializeStringLocks();
1236
1217 // Update the cache with a new number-string pair. 1237 // Update the cache with a new number-string pair.
1218 void SetNumberStringCache(Object* number, String* str); 1238 void SetNumberStringCache(Object* number, String* str);
1219 1239
1220 // Adjusts the amount of registered external memory. 1240 // Adjusts the amount of registered external memory.
1221 // Returns the adjusted value. 1241 // Returns the adjusted value.
1222 inline int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes); 1242 inline int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes);
1223 1243
1224 // Allocate uninitialized fixed array. 1244 // Allocate uninitialized fixed array.
1225 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length); 1245 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length);
1226 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length, 1246 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length,
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2486 2506
2487 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2507 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2488 }; 2508 };
2489 #endif // DEBUG || LIVE_OBJECT_LIST 2509 #endif // DEBUG || LIVE_OBJECT_LIST
2490 2510
2491 } } // namespace v8::internal 2511 } } // namespace v8::internal
2492 2512
2493 #undef HEAP 2513 #undef HEAP
2494 2514
2495 #endif // V8_HEAP_H_ 2515 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698