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

Side by Side Diff: src/heap.cc

Issue 307018: Heap profiler: guard calls to Producer profile. (Closed)
Patch Set: Created 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 2126
2127 2127
2128 Object* Heap::Allocate(Map* map, AllocationSpace space) { 2128 Object* Heap::Allocate(Map* map, AllocationSpace space) {
2129 ASSERT(gc_state_ == NOT_IN_GC); 2129 ASSERT(gc_state_ == NOT_IN_GC);
2130 ASSERT(map->instance_type() != MAP_TYPE); 2130 ASSERT(map->instance_type() != MAP_TYPE);
2131 Object* result = AllocateRaw(map->instance_size(), 2131 Object* result = AllocateRaw(map->instance_size(),
2132 space, 2132 space,
2133 TargetSpaceId(map->instance_type())); 2133 TargetSpaceId(map->instance_type()));
2134 if (result->IsFailure()) return result; 2134 if (result->IsFailure()) return result;
2135 HeapObject::cast(result)->set_map(map); 2135 HeapObject::cast(result)->set_map(map);
2136 #ifdef ENABLE_LOGGING_AND_PROFILING
2136 ProducerHeapProfile::RecordJSObjectAllocation(result); 2137 ProducerHeapProfile::RecordJSObjectAllocation(result);
2138 #endif
2137 return result; 2139 return result;
2138 } 2140 }
2139 2141
2140 2142
2141 Object* Heap::InitializeFunction(JSFunction* function, 2143 Object* Heap::InitializeFunction(JSFunction* function,
2142 SharedFunctionInfo* shared, 2144 SharedFunctionInfo* shared,
2143 Object* prototype) { 2145 Object* prototype) {
2144 ASSERT(!prototype->IsMap()); 2146 ASSERT(!prototype->IsMap());
2145 function->initialize_properties(); 2147 function->initialize_properties();
2146 function->initialize_elements(); 2148 function->initialize_elements();
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2448 if (elem->IsFailure()) return elem; 2450 if (elem->IsFailure()) return elem;
2449 JSObject::cast(clone)->set_elements(FixedArray::cast(elem)); 2451 JSObject::cast(clone)->set_elements(FixedArray::cast(elem));
2450 } 2452 }
2451 // Update properties if necessary. 2453 // Update properties if necessary.
2452 if (properties->length() > 0) { 2454 if (properties->length() > 0) {
2453 Object* prop = CopyFixedArray(properties); 2455 Object* prop = CopyFixedArray(properties);
2454 if (prop->IsFailure()) return prop; 2456 if (prop->IsFailure()) return prop;
2455 JSObject::cast(clone)->set_properties(FixedArray::cast(prop)); 2457 JSObject::cast(clone)->set_properties(FixedArray::cast(prop));
2456 } 2458 }
2457 // Return the new clone. 2459 // Return the new clone.
2460 #ifdef ENABLE_LOGGING_AND_PROFILING
2458 ProducerHeapProfile::RecordJSObjectAllocation(clone); 2461 ProducerHeapProfile::RecordJSObjectAllocation(clone);
2462 #endif
2459 return clone; 2463 return clone;
2460 } 2464 }
2461 2465
2462 2466
2463 Object* Heap::ReinitializeJSGlobalProxy(JSFunction* constructor, 2467 Object* Heap::ReinitializeJSGlobalProxy(JSFunction* constructor,
2464 JSGlobalProxy* object) { 2468 JSGlobalProxy* object) {
2465 // Allocate initial map if absent. 2469 // Allocate initial map if absent.
2466 if (!constructor->has_initial_map()) { 2470 if (!constructor->has_initial_map()) {
2467 Object* initial_map = AllocateInitialMap(constructor); 2471 Object* initial_map = AllocateInitialMap(constructor);
2468 if (initial_map->IsFailure()) return initial_map; 2472 if (initial_map->IsFailure()) return initial_map;
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
3415 if (!CreateInitialMaps()) return false; 3419 if (!CreateInitialMaps()) return false;
3416 if (!CreateApiObjects()) return false; 3420 if (!CreateApiObjects()) return false;
3417 3421
3418 // Create initial objects 3422 // Create initial objects
3419 if (!CreateInitialObjects()) return false; 3423 if (!CreateInitialObjects()) return false;
3420 } 3424 }
3421 3425
3422 LOG(IntEvent("heap-capacity", Capacity())); 3426 LOG(IntEvent("heap-capacity", Capacity()));
3423 LOG(IntEvent("heap-available", Available())); 3427 LOG(IntEvent("heap-available", Available()));
3424 3428
3429 #ifdef ENABLE_LOGGING_AND_PROFILING
3425 // This should be called only after initial objects have been created. 3430 // This should be called only after initial objects have been created.
3426 ProducerHeapProfile::Setup(); 3431 ProducerHeapProfile::Setup();
3432 #endif
3427 3433
3428 return true; 3434 return true;
3429 } 3435 }
3430 3436
3431 3437
3432 void Heap::SetStackLimit(intptr_t limit) { 3438 void Heap::SetStackLimit(intptr_t limit) {
3433 // On 64 bit machines, pointers are generally out of range of Smis. We write 3439 // On 64 bit machines, pointers are generally out of range of Smis. We write
3434 // something that looks like an out of range Smi to the GC. 3440 // something that looks like an out of range Smi to the GC.
3435 3441
3436 // Set up the special root array entry containing the stack guard. 3442 // Set up the special root array entry containing the stack guard.
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
4004 for (int i = 0; i < kNumberOfCaches; i++) { 4010 for (int i = 0; i < kNumberOfCaches; i++) {
4005 if (caches_[i] != NULL) { 4011 if (caches_[i] != NULL) {
4006 delete caches_[i]; 4012 delete caches_[i];
4007 caches_[i] = NULL; 4013 caches_[i] = NULL;
4008 } 4014 }
4009 } 4015 }
4010 } 4016 }
4011 4017
4012 4018
4013 } } // namespace v8::internal 4019 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698