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

Side by Side Diff: src/heap.cc

Issue 6903060: Version 3.3.2.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 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/heap.h ('k') | src/hydrogen.h » ('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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 1340
1341 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) { 1341 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) {
1342 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) 1342 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
1343 // Update NewSpace stats if necessary. 1343 // Update NewSpace stats if necessary.
1344 RecordCopiedObject(heap, target); 1344 RecordCopiedObject(heap, target);
1345 #endif 1345 #endif
1346 HEAP_PROFILE(heap, ObjectMoveEvent(source->address(), target->address())); 1346 HEAP_PROFILE(heap, ObjectMoveEvent(source->address(), target->address()));
1347 #if defined(ENABLE_LOGGING_AND_PROFILING) 1347 #if defined(ENABLE_LOGGING_AND_PROFILING)
1348 Isolate* isolate = heap->isolate(); 1348 Isolate* isolate = heap->isolate();
1349 if (isolate->logger()->is_logging() || 1349 if (isolate->logger()->is_logging() ||
1350 isolate->cpu_profiler()->is_profiling()) { 1350 CpuProfiler::is_profiling(isolate)) {
1351 if (target->IsSharedFunctionInfo()) { 1351 if (target->IsSharedFunctionInfo()) {
1352 PROFILE(isolate, SharedFunctionInfoMoveEvent( 1352 PROFILE(isolate, SharedFunctionInfoMoveEvent(
1353 source->address(), target->address())); 1353 source->address(), target->address()));
1354 } 1354 }
1355 } 1355 }
1356 #endif 1356 #endif
1357 } 1357 }
1358 1358
1359 return target; 1359 return target;
1360 } 1360 }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 scavenging_visitors_table_mode_ = LOGGING_AND_PROFILING_DISABLED; 1515 scavenging_visitors_table_mode_ = LOGGING_AND_PROFILING_DISABLED;
1516 } 1516 }
1517 1517
1518 1518
1519 void Heap::SwitchScavengingVisitorsTableIfProfilingWasEnabled() { 1519 void Heap::SwitchScavengingVisitorsTableIfProfilingWasEnabled() {
1520 if (scavenging_visitors_table_mode_ == LOGGING_AND_PROFILING_ENABLED) { 1520 if (scavenging_visitors_table_mode_ == LOGGING_AND_PROFILING_ENABLED) {
1521 // Table was already updated by some isolate. 1521 // Table was already updated by some isolate.
1522 return; 1522 return;
1523 } 1523 }
1524 1524
1525 if (isolate()->logger()->is_logging() || 1525 if (isolate()->logger()->is_logging() |
1526 isolate()->cpu_profiler()->is_profiling() || 1526 CpuProfiler::is_profiling(isolate()) ||
1527 (isolate()->heap_profiler() != NULL && 1527 (isolate()->heap_profiler() != NULL &&
1528 isolate()->heap_profiler()->is_profiling())) { 1528 isolate()->heap_profiler()->is_profiling())) {
1529 // If one of the isolates is doing scavenge at this moment of time 1529 // If one of the isolates is doing scavenge at this moment of time
1530 // it might see this table in an inconsitent state when 1530 // it might see this table in an inconsitent state when
1531 // some of the callbacks point to 1531 // some of the callbacks point to
1532 // ScavengingVisitor<LOGGING_AND_PROFILING_ENABLED> and others 1532 // ScavengingVisitor<LOGGING_AND_PROFILING_ENABLED> and others
1533 // to ScavengingVisitor<LOGGING_AND_PROFILING_DISABLED>. 1533 // to ScavengingVisitor<LOGGING_AND_PROFILING_DISABLED>.
1534 // However this does not lead to any bugs as such isolate does not have 1534 // However this does not lead to any bugs as such isolate does not have
1535 // profiling enabled and any isolate with enabled profiling is guaranteed 1535 // profiling enabled and any isolate with enabled profiling is guaranteed
1536 // to see the table in the consistent state. 1536 // to see the table in the consistent state.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 map->set_instance_type(instance_type); 1587 map->set_instance_type(instance_type);
1588 map->set_visitor_id( 1588 map->set_visitor_id(
1589 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); 1589 StaticVisitorBase::GetVisitorId(instance_type, instance_size));
1590 map->set_prototype(null_value()); 1590 map->set_prototype(null_value());
1591 map->set_constructor(null_value()); 1591 map->set_constructor(null_value());
1592 map->set_instance_size(instance_size); 1592 map->set_instance_size(instance_size);
1593 map->set_inobject_properties(0); 1593 map->set_inobject_properties(0);
1594 map->set_pre_allocated_property_fields(0); 1594 map->set_pre_allocated_property_fields(0);
1595 map->set_instance_descriptors(empty_descriptor_array()); 1595 map->set_instance_descriptors(empty_descriptor_array());
1596 map->set_code_cache(empty_fixed_array()); 1596 map->set_code_cache(empty_fixed_array());
1597 map->set_prototype_transitions(empty_fixed_array());
1597 map->set_unused_property_fields(0); 1598 map->set_unused_property_fields(0);
1598 map->set_bit_field(0); 1599 map->set_bit_field(0);
1599 map->set_bit_field2((1 << Map::kIsExtensible) | (1 << Map::kHasFastElements)); 1600 map->set_bit_field2((1 << Map::kIsExtensible) | (1 << Map::kHasFastElements));
1600 1601
1601 // If the map object is aligned fill the padding area with Smi 0 objects. 1602 // If the map object is aligned fill the padding area with Smi 0 objects.
1602 if (Map::kPadStart < Map::kSize) { 1603 if (Map::kPadStart < Map::kSize) {
1603 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, 1604 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag,
1604 0, 1605 0,
1605 Map::kSize - Map::kPadStart); 1606 Map::kSize - Map::kPadStart);
1606 } 1607 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 1680
1680 // Allocate the empty descriptor array. 1681 // Allocate the empty descriptor array.
1681 { MaybeObject* maybe_obj = AllocateEmptyFixedArray(); 1682 { MaybeObject* maybe_obj = AllocateEmptyFixedArray();
1682 if (!maybe_obj->ToObject(&obj)) return false; 1683 if (!maybe_obj->ToObject(&obj)) return false;
1683 } 1684 }
1684 set_empty_descriptor_array(DescriptorArray::cast(obj)); 1685 set_empty_descriptor_array(DescriptorArray::cast(obj));
1685 1686
1686 // Fix the instance_descriptors for the existing maps. 1687 // Fix the instance_descriptors for the existing maps.
1687 meta_map()->set_instance_descriptors(empty_descriptor_array()); 1688 meta_map()->set_instance_descriptors(empty_descriptor_array());
1688 meta_map()->set_code_cache(empty_fixed_array()); 1689 meta_map()->set_code_cache(empty_fixed_array());
1690 meta_map()->set_prototype_transitions(empty_fixed_array());
1689 1691
1690 fixed_array_map()->set_instance_descriptors(empty_descriptor_array()); 1692 fixed_array_map()->set_instance_descriptors(empty_descriptor_array());
1691 fixed_array_map()->set_code_cache(empty_fixed_array()); 1693 fixed_array_map()->set_code_cache(empty_fixed_array());
1694 fixed_array_map()->set_prototype_transitions(empty_fixed_array());
1692 1695
1693 oddball_map()->set_instance_descriptors(empty_descriptor_array()); 1696 oddball_map()->set_instance_descriptors(empty_descriptor_array());
1694 oddball_map()->set_code_cache(empty_fixed_array()); 1697 oddball_map()->set_code_cache(empty_fixed_array());
1698 oddball_map()->set_prototype_transitions(empty_fixed_array());
1695 1699
1696 // Fix prototype object for existing maps. 1700 // Fix prototype object for existing maps.
1697 meta_map()->set_prototype(null_value()); 1701 meta_map()->set_prototype(null_value());
1698 meta_map()->set_constructor(null_value()); 1702 meta_map()->set_constructor(null_value());
1699 1703
1700 fixed_array_map()->set_prototype(null_value()); 1704 fixed_array_map()->set_prototype(null_value());
1701 fixed_array_map()->set_constructor(null_value()); 1705 fixed_array_map()->set_constructor(null_value());
1702 1706
1703 oddball_map()->set_prototype(null_value()); 1707 oddball_map()->set_prototype(null_value());
1704 oddball_map()->set_constructor(null_value()); 1708 oddball_map()->set_constructor(null_value());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 if (!maybe_obj->ToObject(&obj)) return false; 1797 if (!maybe_obj->ToObject(&obj)) return false;
1794 } 1798 }
1795 set_external_unsigned_int_array_map(Map::cast(obj)); 1799 set_external_unsigned_int_array_map(Map::cast(obj));
1796 1800
1797 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_FLOAT_ARRAY_TYPE, 1801 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_FLOAT_ARRAY_TYPE,
1798 ExternalArray::kAlignedSize); 1802 ExternalArray::kAlignedSize);
1799 if (!maybe_obj->ToObject(&obj)) return false; 1803 if (!maybe_obj->ToObject(&obj)) return false;
1800 } 1804 }
1801 set_external_float_array_map(Map::cast(obj)); 1805 set_external_float_array_map(Map::cast(obj));
1802 1806
1807 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_DOUBLE_ARRAY_TYPE,
1808 ExternalArray::kAlignedSize);
1809 if (!maybe_obj->ToObject(&obj)) return false;
1810 }
1811 set_external_double_array_map(Map::cast(obj));
1812
1803 { MaybeObject* maybe_obj = AllocateMap(CODE_TYPE, kVariableSizeSentinel); 1813 { MaybeObject* maybe_obj = AllocateMap(CODE_TYPE, kVariableSizeSentinel);
1804 if (!maybe_obj->ToObject(&obj)) return false; 1814 if (!maybe_obj->ToObject(&obj)) return false;
1805 } 1815 }
1806 set_code_map(Map::cast(obj)); 1816 set_code_map(Map::cast(obj));
1807 1817
1808 { MaybeObject* maybe_obj = AllocateMap(JS_GLOBAL_PROPERTY_CELL_TYPE, 1818 { MaybeObject* maybe_obj = AllocateMap(JS_GLOBAL_PROPERTY_CELL_TYPE,
1809 JSGlobalPropertyCell::kSize); 1819 JSGlobalPropertyCell::kSize);
1810 if (!maybe_obj->ToObject(&obj)) return false; 1820 if (!maybe_obj->ToObject(&obj)) return false;
1811 } 1821 }
1812 set_global_property_cell_map(Map::cast(obj)); 1822 set_global_property_cell_map(Map::cast(obj));
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2281 case kExternalShortArray: 2291 case kExternalShortArray:
2282 return kExternalShortArrayMapRootIndex; 2292 return kExternalShortArrayMapRootIndex;
2283 case kExternalUnsignedShortArray: 2293 case kExternalUnsignedShortArray:
2284 return kExternalUnsignedShortArrayMapRootIndex; 2294 return kExternalUnsignedShortArrayMapRootIndex;
2285 case kExternalIntArray: 2295 case kExternalIntArray:
2286 return kExternalIntArrayMapRootIndex; 2296 return kExternalIntArrayMapRootIndex;
2287 case kExternalUnsignedIntArray: 2297 case kExternalUnsignedIntArray:
2288 return kExternalUnsignedIntArrayMapRootIndex; 2298 return kExternalUnsignedIntArrayMapRootIndex;
2289 case kExternalFloatArray: 2299 case kExternalFloatArray:
2290 return kExternalFloatArrayMapRootIndex; 2300 return kExternalFloatArrayMapRootIndex;
2301 case kExternalDoubleArray:
2302 return kExternalDoubleArrayMapRootIndex;
2291 case kExternalPixelArray: 2303 case kExternalPixelArray:
2292 return kExternalPixelArrayMapRootIndex; 2304 return kExternalPixelArrayMapRootIndex;
2293 default: 2305 default:
2294 UNREACHABLE(); 2306 UNREACHABLE();
2295 return kUndefinedValueRootIndex; 2307 return kUndefinedValueRootIndex;
2296 } 2308 }
2297 } 2309 }
2298 2310
2299 2311
2300 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) { 2312 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) {
(...skipping 3546 matching lines...) Expand 10 before | Expand all | Expand 10 after
5847 } 5859 }
5848 5860
5849 5861
5850 void ExternalStringTable::TearDown() { 5862 void ExternalStringTable::TearDown() {
5851 new_space_strings_.Free(); 5863 new_space_strings_.Free();
5852 old_space_strings_.Free(); 5864 old_space_strings_.Free();
5853 } 5865 }
5854 5866
5855 5867
5856 } } // namespace v8::internal 5868 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698