| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_HEAP_H_ | 28 #ifndef V8_HEAP_H_ |
| 29 #define V8_HEAP_H_ | 29 #define V8_HEAP_H_ |
| 30 | 30 |
| 31 #include <math.h> | 31 #include <math.h> |
| 32 | 32 |
| 33 #include "allocation.h" |
| 33 #include "globals.h" | 34 #include "globals.h" |
| 34 #include "incremental-marking.h" | 35 #include "incremental-marking.h" |
| 35 #include "list.h" | 36 #include "list.h" |
| 36 #include "mark-compact.h" | 37 #include "mark-compact.h" |
| 37 #include "spaces.h" | 38 #include "spaces.h" |
| 38 #include "splay-tree-inl.h" | 39 #include "splay-tree-inl.h" |
| 39 #include "store-buffer.h" | 40 #include "store-buffer.h" |
| 40 #include "v8-counters.h" | 41 #include "v8-counters.h" |
| 41 #include "v8globals.h" | 42 #include "v8globals.h" |
| 42 | 43 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 V(string_symbol, "string") \ | 173 V(string_symbol, "string") \ |
| 173 V(String_symbol, "String") \ | 174 V(String_symbol, "String") \ |
| 174 V(Date_symbol, "Date") \ | 175 V(Date_symbol, "Date") \ |
| 175 V(this_symbol, "this") \ | 176 V(this_symbol, "this") \ |
| 176 V(to_string_symbol, "toString") \ | 177 V(to_string_symbol, "toString") \ |
| 177 V(char_at_symbol, "CharAt") \ | 178 V(char_at_symbol, "CharAt") \ |
| 178 V(undefined_symbol, "undefined") \ | 179 V(undefined_symbol, "undefined") \ |
| 179 V(value_of_symbol, "valueOf") \ | 180 V(value_of_symbol, "valueOf") \ |
| 180 V(InitializeVarGlobal_symbol, "InitializeVarGlobal") \ | 181 V(InitializeVarGlobal_symbol, "InitializeVarGlobal") \ |
| 181 V(InitializeConstGlobal_symbol, "InitializeConstGlobal") \ | 182 V(InitializeConstGlobal_symbol, "InitializeConstGlobal") \ |
| 182 V(KeyedLoadSpecialized_symbol, "KeyedLoadSpecialized") \ | 183 V(KeyedLoadSpecializedMonomorphic_symbol, \ |
| 183 V(KeyedStoreSpecialized_symbol, "KeyedStoreSpecialized") \ | 184 "KeyedLoadSpecializedMonomorphic") \ |
| 185 V(KeyedLoadSpecializedPolymorphic_symbol, \ |
| 186 "KeyedLoadSpecializedPolymorphic") \ |
| 187 V(KeyedStoreSpecializedMonomorphic_symbol, \ |
| 188 "KeyedStoreSpecializedMonomorphic") \ |
| 189 V(KeyedStoreSpecializedPolymorphic_symbol, \ |
| 190 "KeyedStoreSpecializedPolymorphic") \ |
| 184 V(stack_overflow_symbol, "kStackOverflowBoilerplate") \ | 191 V(stack_overflow_symbol, "kStackOverflowBoilerplate") \ |
| 185 V(illegal_access_symbol, "illegal access") \ | 192 V(illegal_access_symbol, "illegal access") \ |
| 186 V(out_of_memory_symbol, "out-of-memory") \ | 193 V(out_of_memory_symbol, "out-of-memory") \ |
| 187 V(illegal_execution_state_symbol, "illegal execution state") \ | 194 V(illegal_execution_state_symbol, "illegal execution state") \ |
| 188 V(get_symbol, "get") \ | 195 V(get_symbol, "get") \ |
| 189 V(set_symbol, "set") \ | 196 V(set_symbol, "set") \ |
| 190 V(function_class_symbol, "Function") \ | 197 V(function_class_symbol, "Function") \ |
| 191 V(illegal_argument_symbol, "illegal argument") \ | 198 V(illegal_argument_symbol, "illegal argument") \ |
| 192 V(MakeReferenceError_symbol, "MakeReferenceError") \ | 199 V(MakeReferenceError_symbol, "MakeReferenceError") \ |
| 193 V(MakeSyntaxError_symbol, "MakeSyntaxError") \ | 200 V(MakeSyntaxError_symbol, "MakeSyntaxError") \ |
| 194 V(MakeTypeError_symbol, "MakeTypeError") \ | 201 V(MakeTypeError_symbol, "MakeTypeError") \ |
| 195 V(invalid_lhs_in_assignment_symbol, "invalid_lhs_in_assignment") \ | 202 V(invalid_lhs_in_assignment_symbol, "invalid_lhs_in_assignment") \ |
| 196 V(invalid_lhs_in_for_in_symbol, "invalid_lhs_in_for_in") \ | 203 V(invalid_lhs_in_for_in_symbol, "invalid_lhs_in_for_in") \ |
| 197 V(invalid_lhs_in_postfix_op_symbol, "invalid_lhs_in_postfix_op") \ | 204 V(invalid_lhs_in_postfix_op_symbol, "invalid_lhs_in_postfix_op") \ |
| 198 V(invalid_lhs_in_prefix_op_symbol, "invalid_lhs_in_prefix_op") \ | 205 V(invalid_lhs_in_prefix_op_symbol, "invalid_lhs_in_prefix_op") \ |
| 199 V(illegal_return_symbol, "illegal_return") \ | 206 V(illegal_return_symbol, "illegal_return") \ |
| 200 V(illegal_break_symbol, "illegal_break") \ | 207 V(illegal_break_symbol, "illegal_break") \ |
| 201 V(illegal_continue_symbol, "illegal_continue") \ | 208 V(illegal_continue_symbol, "illegal_continue") \ |
| 202 V(unknown_label_symbol, "unknown_label") \ | 209 V(unknown_label_symbol, "unknown_label") \ |
| 203 V(redeclaration_symbol, "redeclaration") \ | 210 V(redeclaration_symbol, "redeclaration") \ |
| 204 V(failure_symbol, "<failure>") \ | 211 V(failure_symbol, "<failure>") \ |
| 205 V(space_symbol, " ") \ | 212 V(space_symbol, " ") \ |
| 206 V(exec_symbol, "exec") \ | 213 V(exec_symbol, "exec") \ |
| 207 V(zero_symbol, "0") \ | 214 V(zero_symbol, "0") \ |
| 208 V(global_eval_symbol, "GlobalEval") \ | 215 V(global_eval_symbol, "GlobalEval") \ |
| 209 V(identity_hash_symbol, "v8::IdentityHash") \ | 216 V(identity_hash_symbol, "v8::IdentityHash") \ |
| 210 V(closure_symbol, "(closure)") \ | 217 V(closure_symbol, "(closure)") \ |
| 211 V(use_strict, "use strict") \ | 218 V(use_strict, "use strict") |
| 212 V(KeyedLoadExternalByteArray_symbol, "KeyedLoadExternalByteArray") \ | |
| 213 V(KeyedLoadExternalUnsignedByteArray_symbol, \ | |
| 214 "KeyedLoadExternalUnsignedByteArray") \ | |
| 215 V(KeyedLoadExternalShortArray_symbol, \ | |
| 216 "KeyedLoadExternalShortArray") \ | |
| 217 V(KeyedLoadExternalUnsignedShortArray_symbol, \ | |
| 218 "KeyedLoadExternalUnsignedShortArray") \ | |
| 219 V(KeyedLoadExternalIntArray_symbol, "KeyedLoadExternalIntArray") \ | |
| 220 V(KeyedLoadExternalUnsignedIntArray_symbol, \ | |
| 221 "KeyedLoadExternalUnsignedIntArray") \ | |
| 222 V(KeyedLoadExternalFloatArray_symbol, "KeyedLoadExternalFloatArray") \ | |
| 223 V(KeyedLoadExternalDoubleArray_symbol, "KeyedLoadExternalDoubleArray") \ | |
| 224 V(KeyedLoadExternalPixelArray_symbol, "KeyedLoadExternalPixelArray") \ | |
| 225 V(KeyedStoreExternalByteArray_symbol, "KeyedStoreExternalByteArray") \ | |
| 226 V(KeyedStoreExternalUnsignedByteArray_symbol, \ | |
| 227 "KeyedStoreExternalUnsignedByteArray") \ | |
| 228 V(KeyedStoreExternalShortArray_symbol, "KeyedStoreExternalShortArray") \ | |
| 229 V(KeyedStoreExternalUnsignedShortArray_symbol, \ | |
| 230 "KeyedStoreExternalUnsignedShortArray") \ | |
| 231 V(KeyedStoreExternalIntArray_symbol, "KeyedStoreExternalIntArray") \ | |
| 232 V(KeyedStoreExternalUnsignedIntArray_symbol, \ | |
| 233 "KeyedStoreExternalUnsignedIntArray") \ | |
| 234 V(KeyedStoreExternalFloatArray_symbol, "KeyedStoreExternalFloatArray") \ | |
| 235 V(KeyedStoreExternalDoubleArray_symbol, "KeyedStoreExternalDoubleArray") \ | |
| 236 V(KeyedStoreExternalPixelArray_symbol, "KeyedStoreExternalPixelArray") | |
| 237 | 219 |
| 238 // Forward declarations. | 220 // Forward declarations. |
| 239 class GCTracer; | 221 class GCTracer; |
| 240 class HeapStats; | 222 class HeapStats; |
| 241 class Isolate; | 223 class Isolate; |
| 242 class WeakObjectRetainer; | 224 class WeakObjectRetainer; |
| 243 | 225 |
| 244 | 226 |
| 245 typedef String* (*ExternalStringTableUpdaterCallback)(Heap* heap, | 227 typedef String* (*ExternalStringTableUpdaterCallback)(Heap* heap, |
| 246 Object** pointer); | 228 Object** pointer); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // Properties and elements are copied too. | 449 // Properties and elements are copied too. |
| 468 // Returns failure if allocation failed. | 450 // Returns failure if allocation failed. |
| 469 MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source); | 451 MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source); |
| 470 | 452 |
| 471 // Allocates the function prototype. | 453 // Allocates the function prototype. |
| 472 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 454 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 473 // failed. | 455 // failed. |
| 474 // Please note this does not perform a garbage collection. | 456 // Please note this does not perform a garbage collection. |
| 475 MUST_USE_RESULT MaybeObject* AllocateFunctionPrototype(JSFunction* function); | 457 MUST_USE_RESULT MaybeObject* AllocateFunctionPrototype(JSFunction* function); |
| 476 | 458 |
| 459 // Allocates a Harmony Proxy. |
| 460 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 461 // failed. |
| 462 // Please note this does not perform a garbage collection. |
| 463 MUST_USE_RESULT MaybeObject* AllocateJSProxy(Object* handler, |
| 464 Object* prototype); |
| 465 |
| 477 // Reinitialize an JSGlobalProxy based on a constructor. The object | 466 // Reinitialize an JSGlobalProxy based on a constructor. The object |
| 478 // must have the same size as objects allocated using the | 467 // must have the same size as objects allocated using the |
| 479 // constructor. The object is reinitialized and behaves as an | 468 // constructor. The object is reinitialized and behaves as an |
| 480 // object that has been freshly allocated using the constructor. | 469 // object that has been freshly allocated using the constructor. |
| 481 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy( | 470 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy( |
| 482 JSFunction* constructor, JSGlobalProxy* global); | 471 JSFunction* constructor, JSGlobalProxy* global); |
| 483 | 472 |
| 484 // Allocates and initializes a new JavaScript object based on a map. | 473 // Allocates and initializes a new JavaScript object based on a map. |
| 485 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 474 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 486 // failed. | 475 // failed. |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 | 1261 |
| 1273 void ClearJSFunctionResultCaches(); | 1262 void ClearJSFunctionResultCaches(); |
| 1274 | 1263 |
| 1275 void ClearNormalizedMapCaches(); | 1264 void ClearNormalizedMapCaches(); |
| 1276 | 1265 |
| 1277 GCTracer* tracer() { return tracer_; } | 1266 GCTracer* tracer() { return tracer_; } |
| 1278 | 1267 |
| 1279 // Returns the size of objects residing in non new spaces. | 1268 // Returns the size of objects residing in non new spaces. |
| 1280 intptr_t PromotedSpaceSize(); | 1269 intptr_t PromotedSpaceSize(); |
| 1281 | 1270 |
| 1271 double total_regexp_code_generated() { return total_regexp_code_generated_; } |
| 1272 void IncreaseTotalRegexpCodeGenerated(int size) { |
| 1273 total_regexp_code_generated_ += size; |
| 1274 } |
| 1275 |
| 1282 // Returns maximum GC pause. | 1276 // Returns maximum GC pause. |
| 1283 int get_max_gc_pause() { return max_gc_pause_; } | 1277 int get_max_gc_pause() { return max_gc_pause_; } |
| 1284 | 1278 |
| 1285 // Returns maximum size of objects alive after GC. | 1279 // Returns maximum size of objects alive after GC. |
| 1286 intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; } | 1280 intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; } |
| 1287 | 1281 |
| 1288 // Returns minimal interval between two subsequent collections. | 1282 // Returns minimal interval between two subsequent collections. |
| 1289 int get_min_in_mutator() { return min_in_mutator_; } | 1283 int get_min_in_mutator() { return min_in_mutator_; } |
| 1290 | 1284 |
| 1291 MarkCompactCollector* mark_compact_collector() { | 1285 MarkCompactCollector* mark_compact_collector() { |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1573 // Returns the function. | 1567 // Returns the function. |
| 1574 // Note: this code was factored out of AllocateFunction such that | 1568 // Note: this code was factored out of AllocateFunction such that |
| 1575 // other parts of the VM could use it. Specifically, a function that creates | 1569 // other parts of the VM could use it. Specifically, a function that creates |
| 1576 // instances of type JS_FUNCTION_TYPE benefit from the use of this function. | 1570 // instances of type JS_FUNCTION_TYPE benefit from the use of this function. |
| 1577 // Please note this does not perform a garbage collection. | 1571 // Please note this does not perform a garbage collection. |
| 1578 MUST_USE_RESULT inline MaybeObject* InitializeFunction( | 1572 MUST_USE_RESULT inline MaybeObject* InitializeFunction( |
| 1579 JSFunction* function, | 1573 JSFunction* function, |
| 1580 SharedFunctionInfo* shared, | 1574 SharedFunctionInfo* shared, |
| 1581 Object* prototype); | 1575 Object* prototype); |
| 1582 | 1576 |
| 1577 // Total RegExp code ever generated |
| 1578 double total_regexp_code_generated_; |
| 1579 |
| 1583 GCTracer* tracer_; | 1580 GCTracer* tracer_; |
| 1584 | 1581 |
| 1585 | 1582 |
| 1586 // Initializes the number to string cache based on the max semispace size. | 1583 // Initializes the number to string cache based on the max semispace size. |
| 1587 MUST_USE_RESULT MaybeObject* InitializeNumberStringCache(); | 1584 MUST_USE_RESULT MaybeObject* InitializeNumberStringCache(); |
| 1588 // Flush the number to string cache. | 1585 // Flush the number to string cache. |
| 1589 void FlushNumberStringCache(); | 1586 void FlushNumberStringCache(); |
| 1590 | 1587 |
| 1591 void UpdateSurvivalRateTrend(int start_new_space_size); | 1588 void UpdateSurvivalRateTrend(int start_new_space_size); |
| 1592 | 1589 |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2344 | 2341 |
| 2345 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2342 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2346 }; | 2343 }; |
| 2347 #endif // DEBUG || LIVE_OBJECT_LIST | 2344 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2348 | 2345 |
| 2349 } } // namespace v8::internal | 2346 } } // namespace v8::internal |
| 2350 | 2347 |
| 2351 #undef HEAP | 2348 #undef HEAP |
| 2352 | 2349 |
| 2353 #endif // V8_HEAP_H_ | 2350 #endif // V8_HEAP_H_ |
| OLD | NEW |