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.cc

Issue 22852024: Track JS allocations as they arrive with no affection on performance when tracking is switched off (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix style + rebase Created 7 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
« no previous file with comments | « src/builtins.cc ('k') | src/heap-profiler.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 int size)) { 2094 int size)) {
2095 // Copy the content of source to target. 2095 // Copy the content of source to target.
2096 heap->CopyBlock(target->address(), source->address(), size); 2096 heap->CopyBlock(target->address(), source->address(), size);
2097 2097
2098 // Set the forwarding address. 2098 // Set the forwarding address.
2099 source->set_map_word(MapWord::FromForwardingAddress(target)); 2099 source->set_map_word(MapWord::FromForwardingAddress(target));
2100 2100
2101 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) { 2101 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) {
2102 // Update NewSpace stats if necessary. 2102 // Update NewSpace stats if necessary.
2103 RecordCopiedObject(heap, target); 2103 RecordCopiedObject(heap, target);
2104 HEAP_PROFILE(heap, ObjectMoveEvent(source->address(), target->address())); 2104 HEAP_PROFILE(heap,
2105 ObjectMoveEvent(source->address(), target->address(), size));
2105 Isolate* isolate = heap->isolate(); 2106 Isolate* isolate = heap->isolate();
2106 if (isolate->logger()->is_logging_code_events() || 2107 if (isolate->logger()->is_logging_code_events() ||
2107 isolate->cpu_profiler()->is_profiling()) { 2108 isolate->cpu_profiler()->is_profiling()) {
2108 if (target->IsSharedFunctionInfo()) { 2109 if (target->IsSharedFunctionInfo()) {
2109 PROFILE(isolate, SharedFunctionInfoMoveEvent( 2110 PROFILE(isolate, SharedFunctionInfoMoveEvent(
2110 source->address(), target->address())); 2111 source->address(), target->address()));
2111 } 2112 }
2112 } 2113 }
2113 } 2114 }
2114 2115
(...skipping 2805 matching lines...) Expand 10 before | Expand all | Expand 10 after
4920 CopyBlock(HeapObject::cast(clone)->address(), 4921 CopyBlock(HeapObject::cast(clone)->address(),
4921 source->address(), 4922 source->address(),
4922 object_size); 4923 object_size);
4923 4924
4924 if (site != NULL) { 4925 if (site != NULL) {
4925 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>( 4926 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>(
4926 reinterpret_cast<Address>(clone) + object_size); 4927 reinterpret_cast<Address>(clone) + object_size);
4927 alloc_memento->set_map_no_write_barrier(allocation_memento_map()); 4928 alloc_memento->set_map_no_write_barrier(allocation_memento_map());
4928 ASSERT(site->map() == allocation_site_map()); 4929 ASSERT(site->map() == allocation_site_map());
4929 alloc_memento->set_allocation_site(site, SKIP_WRITE_BARRIER); 4930 alloc_memento->set_allocation_site(site, SKIP_WRITE_BARRIER);
4931 HeapProfiler* profiler = isolate()->heap_profiler();
4932 if (profiler->is_tracking_allocations()) {
4933 profiler->UpdateObjectSizeEvent(HeapObject::cast(clone)->address(),
4934 object_size);
4935 profiler->NewObjectEvent(alloc_memento->address(),
4936 AllocationMemento::kSize);
4937 }
4930 } 4938 }
4931 } 4939 }
4932 4940
4933 SLOW_ASSERT( 4941 SLOW_ASSERT(
4934 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind()); 4942 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind());
4935 FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); 4943 FixedArrayBase* elements = FixedArrayBase::cast(source->elements());
4936 FixedArray* properties = FixedArray::cast(source->properties()); 4944 FixedArray* properties = FixedArray::cast(source->properties());
4937 // Update elements if necessary. 4945 // Update elements if necessary.
4938 if (elements->length() > 0) { 4946 if (elements->length() > 0) {
4939 Object* elem; 4947 Object* elem;
(...skipping 2962 matching lines...) Expand 10 before | Expand all | Expand 10 after
7902 if (FLAG_concurrent_recompilation) { 7910 if (FLAG_concurrent_recompilation) {
7903 heap_->relocation_mutex_->Lock(); 7911 heap_->relocation_mutex_->Lock();
7904 #ifdef DEBUG 7912 #ifdef DEBUG
7905 heap_->relocation_mutex_locked_by_optimizer_thread_ = 7913 heap_->relocation_mutex_locked_by_optimizer_thread_ =
7906 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 7914 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
7907 #endif // DEBUG 7915 #endif // DEBUG
7908 } 7916 }
7909 } 7917 }
7910 7918
7911 } } // namespace v8::internal 7919 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/heap-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698