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

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: Addressed review comments 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
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 V(Map, global_context_map, GlobalContextMap) \ 69 V(Map, global_context_map, GlobalContextMap) \
70 V(Map, fixed_array_map, FixedArrayMap) \ 70 V(Map, fixed_array_map, FixedArrayMap) \
71 V(Map, serialized_scope_info_map, SerializedScopeInfoMap) \ 71 V(Map, serialized_scope_info_map, SerializedScopeInfoMap) \
72 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ 72 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \
73 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ 73 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \
74 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ 74 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \
75 V(Map, meta_map, MetaMap) \ 75 V(Map, meta_map, MetaMap) \
76 V(Map, hash_table_map, HashTableMap) \ 76 V(Map, hash_table_map, HashTableMap) \
77 V(Smi, stack_limit, StackLimit) \ 77 V(Smi, stack_limit, StackLimit) \
78 V(FixedArray, number_string_cache, NumberStringCache) \ 78 V(FixedArray, number_string_cache, NumberStringCache) \
79 V(FixedArray, string_locks, StringLocks) \
79 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ 80 V(Object, instanceof_cache_function, InstanceofCacheFunction) \
80 V(Object, instanceof_cache_map, InstanceofCacheMap) \ 81 V(Object, instanceof_cache_map, InstanceofCacheMap) \
81 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ 82 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \
82 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ 83 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \
83 V(FixedArray, string_split_cache, StringSplitCache) \ 84 V(FixedArray, string_split_cache, StringSplitCache) \
84 V(Object, termination_exception, TerminationException) \ 85 V(Object, termination_exception, TerminationException) \
85 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ 86 V(FixedArray, empty_fixed_array, EmptyFixedArray) \
86 V(ByteArray, empty_byte_array, EmptyByteArray) \ 87 V(ByteArray, empty_byte_array, EmptyByteArray) \
87 V(FixedDoubleArray, empty_fixed_double_array, EmptyFixedDoubleArray) \ 88 V(FixedDoubleArray, empty_fixed_double_array, EmptyFixedDoubleArray) \
88 V(String, empty_string, EmptyString) \ 89 V(String, empty_string, EmptyString) \
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 // 1204 //
1204 // Support for the API. 1205 // Support for the API.
1205 // 1206 //
1206 1207
1207 bool CreateApiObjects(); 1208 bool CreateApiObjects();
1208 1209
1209 // Attempt to find the number in a small cache. If we finds it, return 1210 // Attempt to find the number in a small cache. If we finds it, return
1210 // the string representation of the number. Otherwise return undefined. 1211 // the string representation of the number. Otherwise return undefined.
1211 Object* GetNumberStringCache(Object* number); 1212 Object* GetNumberStringCache(Object* number);
1212 1213
1214 // Locks a string to prevent changes to the string's representation or
1215 // encoding, e.g., due to externalization.
1216 // It does not prevent moving the string during a GC
1217 // (i.e., it's not a way to keep a pointer to an underlying character
1218 // sequence valid). Might fail if the underlying data structure can't
1219 // grow to accomodate the string, otherwise returns the string itself.
1220 //
1221 // Stores data in Heap::string_locks(), a FixedArray with the number
1222 // of filled in elements in the first position, and that number of
1223 // string pointers in the following positions (in no particular order).
1224 // The FixedArray is padded with undefined or similar uninteresting values.
1225 MaybeObject* LockString(String* string);
1226 // Removes the lock on the string.
1227 void UnlockString(String* string);
1228 // Check if a string is locked.
1229 bool IsStringLocked(String* string);
1230 // Initializes the data structure underlying LockString.
1231 MaybeObject* InitializeStringLocks();
1232
1213 // Update the cache with a new number-string pair. 1233 // Update the cache with a new number-string pair.
1214 void SetNumberStringCache(Object* number, String* str); 1234 void SetNumberStringCache(Object* number, String* str);
1215 1235
1216 // Adjusts the amount of registered external memory. 1236 // Adjusts the amount of registered external memory.
1217 // Returns the adjusted value. 1237 // Returns the adjusted value.
1218 inline int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes); 1238 inline int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes);
1219 1239
1220 // Allocate uninitialized fixed array. 1240 // Allocate uninitialized fixed array.
1221 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length); 1241 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length);
1222 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length, 1242 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length,
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 2502
2483 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2503 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2484 }; 2504 };
2485 #endif // DEBUG || LIVE_OBJECT_LIST 2505 #endif // DEBUG || LIVE_OBJECT_LIST
2486 2506
2487 } } // namespace v8::internal 2507 } } // namespace v8::internal
2488 2508
2489 #undef HEAP 2509 #undef HEAP
2490 2510
2491 #endif // V8_HEAP_H_ 2511 #endif // V8_HEAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698