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

Side by Side Diff: src/heap.cc

Issue 7607031: Update gc branch to bleeding_edge revision 8862. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Fix bug in weak-map merge Created 9 years, 4 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/heap.h ('k') | src/hydrogen.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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 isolate_->counters()->alive_after_last_gc()->Set( 412 isolate_->counters()->alive_after_last_gc()->Set(
413 static_cast<int>(SizeOfObjects())); 413 static_cast<int>(SizeOfObjects()));
414 414
415 isolate_->counters()->symbol_table_capacity()->Set( 415 isolate_->counters()->symbol_table_capacity()->Set(
416 symbol_table()->Capacity()); 416 symbol_table()->Capacity());
417 isolate_->counters()->number_of_symbols()->Set( 417 isolate_->counters()->number_of_symbols()->Set(
418 symbol_table()->NumberOfElements()); 418 symbol_table()->NumberOfElements());
419 #if defined(DEBUG) 419 #if defined(DEBUG)
420 ReportStatisticsAfterGC(); 420 ReportStatisticsAfterGC();
421 #endif // DEBUG 421 #endif // DEBUG
422 #ifdef ENABLE_DEBUGGER_SUPPORT
422 isolate_->debug()->AfterGarbageCollection(); 423 isolate_->debug()->AfterGarbageCollection();
424 #endif // ENABLE_DEBUGGER_SUPPORT
423 } 425 }
424 426
425 427
426 void Heap::CollectAllGarbage(int flags) { 428 void Heap::CollectAllGarbage(int flags) {
427 // Since we are ignoring the return value, the exact choice of space does 429 // Since we are ignoring the return value, the exact choice of space does
428 // not matter, so long as we do not specify NEW_SPACE, which would not 430 // not matter, so long as we do not specify NEW_SPACE, which would not
429 // cause a full GC. 431 // cause a full GC.
430 mark_compact_collector_.SetFlags(flags); 432 mark_compact_collector_.SetFlags(flags);
431 CollectGarbage(OLD_POINTER_SPACE); 433 CollectGarbage(OLD_POINTER_SPACE);
432 mark_compact_collector_.SetFlags(kNoGCFlags); 434 mark_compact_collector_.SetFlags(kNoGCFlags);
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 template VisitSpecialized<Context::kSize>); 1347 template VisitSpecialized<Context::kSize>);
1346 1348
1347 table_.Register(kVisitConsString, 1349 table_.Register(kVisitConsString,
1348 &ObjectEvacuationStrategy<POINTER_OBJECT>:: 1350 &ObjectEvacuationStrategy<POINTER_OBJECT>::
1349 template VisitSpecialized<ConsString::kSize>); 1351 template VisitSpecialized<ConsString::kSize>);
1350 1352
1351 table_.Register(kVisitSharedFunctionInfo, 1353 table_.Register(kVisitSharedFunctionInfo,
1352 &ObjectEvacuationStrategy<POINTER_OBJECT>:: 1354 &ObjectEvacuationStrategy<POINTER_OBJECT>::
1353 template VisitSpecialized<SharedFunctionInfo::kSize>); 1355 template VisitSpecialized<SharedFunctionInfo::kSize>);
1354 1356
1357 table_.Register(kVisitJSWeakMap,
1358 &ObjectEvacuationStrategy<POINTER_OBJECT>::
1359 Visit);
1360
1355 table_.Register(kVisitJSRegExp, 1361 table_.Register(kVisitJSRegExp,
1356 &ObjectEvacuationStrategy<POINTER_OBJECT>:: 1362 &ObjectEvacuationStrategy<POINTER_OBJECT>::
1357 Visit); 1363 Visit);
1358 1364
1359 table_.Register(kVisitJSFunction, 1365 table_.Register(kVisitJSFunction,
1360 &ObjectEvacuationStrategy<POINTER_OBJECT>:: 1366 &ObjectEvacuationStrategy<POINTER_OBJECT>::
1361 template VisitSpecialized<JSFunction::kSize>); 1367 template VisitSpecialized<JSFunction::kSize>);
1362 1368
1363 table_.RegisterSpecializations<ObjectEvacuationStrategy<DATA_OBJECT>, 1369 table_.RegisterSpecializations<ObjectEvacuationStrategy<DATA_OBJECT>,
1364 kVisitDataObject, 1370 kVisitDataObject,
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 { MaybeObject* maybe_result = Allocate(foreign_map(), space); 2475 { MaybeObject* maybe_result = Allocate(foreign_map(), space);
2470 if (!maybe_result->ToObject(&result)) return maybe_result; 2476 if (!maybe_result->ToObject(&result)) return maybe_result;
2471 } 2477 }
2472 2478
2473 Foreign::cast(result)->set_address(address); 2479 Foreign::cast(result)->set_address(address);
2474 return result; 2480 return result;
2475 } 2481 }
2476 2482
2477 2483
2478 MaybeObject* Heap::AllocateSharedFunctionInfo(Object* name) { 2484 MaybeObject* Heap::AllocateSharedFunctionInfo(Object* name) {
2479 Object* result; 2485 SharedFunctionInfo* share;
2480 { MaybeObject* maybe_result = 2486 MaybeObject* maybe = Allocate(shared_function_info_map(), OLD_POINTER_SPACE);
2481 Allocate(shared_function_info_map(), OLD_POINTER_SPACE); 2487 if (!maybe->To<SharedFunctionInfo>(&share)) return maybe;
2482 if (!maybe_result->ToObject(&result)) return maybe_result;
2483 }
2484 2488
2485 SharedFunctionInfo* share = SharedFunctionInfo::cast(result); 2489 // Set pointer fields.
2486 share->set_name(name); 2490 share->set_name(name);
2487 Code* illegal = isolate_->builtins()->builtin(Builtins::kIllegal); 2491 Code* illegal = isolate_->builtins()->builtin(Builtins::kIllegal);
2488 share->set_code(illegal); 2492 share->set_code(illegal);
2489 share->set_scope_info(SerializedScopeInfo::Empty()); 2493 share->set_scope_info(SerializedScopeInfo::Empty());
2490 Code* construct_stub = isolate_->builtins()->builtin( 2494 Code* construct_stub =
2491 Builtins::kJSConstructStubGeneric); 2495 isolate_->builtins()->builtin(Builtins::kJSConstructStubGeneric);
2492 share->set_construct_stub(construct_stub); 2496 share->set_construct_stub(construct_stub);
2493 share->set_expected_nof_properties(0);
2494 share->set_length(0);
2495 share->set_formal_parameter_count(0);
2496 share->set_instance_class_name(Object_symbol()); 2497 share->set_instance_class_name(Object_symbol());
2497 share->set_function_data(undefined_value()); 2498 share->set_function_data(undefined_value());
2498 share->set_script(undefined_value()); 2499 share->set_script(undefined_value());
2499 share->set_start_position_and_type(0);
2500 share->set_debug_info(undefined_value()); 2500 share->set_debug_info(undefined_value());
2501 share->set_inferred_name(empty_string()); 2501 share->set_inferred_name(empty_string());
2502 share->set_compiler_hints(0); 2502 share->set_initial_map(undefined_value());
2503 share->set_this_property_assignments(undefined_value());
2503 share->set_deopt_counter(Smi::FromInt(FLAG_deopt_every_n_times)); 2504 share->set_deopt_counter(Smi::FromInt(FLAG_deopt_every_n_times));
2504 share->set_initial_map(undefined_value()); 2505
2505 share->set_this_property_assignments_count(0); 2506 // Set integer fields (smi or int, depending on the architecture).
2506 share->set_this_property_assignments(undefined_value()); 2507 share->set_length(0);
2507 share->set_opt_count(0); 2508 share->set_formal_parameter_count(0);
2509 share->set_expected_nof_properties(0);
2508 share->set_num_literals(0); 2510 share->set_num_literals(0);
2511 share->set_start_position_and_type(0);
2509 share->set_end_position(0); 2512 share->set_end_position(0);
2510 share->set_function_token_position(0); 2513 share->set_function_token_position(0);
2511 share->set_native(false); 2514 // All compiler hints default to false or 0.
2512 return result; 2515 share->set_compiler_hints(0);
2516 share->set_this_property_assignments_count(0);
2517 share->set_opt_count(0);
2518
2519 return share;
2513 } 2520 }
2514 2521
2515 2522
2516 MaybeObject* Heap::AllocateJSMessageObject(String* type, 2523 MaybeObject* Heap::AllocateJSMessageObject(String* type,
2517 JSArray* arguments, 2524 JSArray* arguments,
2518 int start_position, 2525 int start_position,
2519 int end_position, 2526 int end_position,
2520 Object* script, 2527 Object* script,
2521 Object* stack_trace, 2528 Object* stack_trace,
2522 Object* stack_frames) { 2529 Object* stack_frames) {
(...skipping 3499 matching lines...) Expand 10 before | Expand all | Expand 10 after
6022 } 6029 }
6023 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); 6030 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED);
6024 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 6031 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
6025 next = chunk->next_chunk(); 6032 next = chunk->next_chunk();
6026 isolate_->memory_allocator()->Free(chunk); 6033 isolate_->memory_allocator()->Free(chunk);
6027 } 6034 }
6028 chunks_queued_for_free_ = NULL; 6035 chunks_queued_for_free_ = NULL;
6029 } 6036 }
6030 6037
6031 } } // namespace v8::internal 6038 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698