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

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: Make separate API for JS allocations recording, add example of checking JS allocations recording in… Created 7 years, 3 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
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 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 int size)) { 2043 int size)) {
2044 // Copy the content of source to target. 2044 // Copy the content of source to target.
2045 heap->CopyBlock(target->address(), source->address(), size); 2045 heap->CopyBlock(target->address(), source->address(), size);
2046 2046
2047 // Set the forwarding address. 2047 // Set the forwarding address.
2048 source->set_map_word(MapWord::FromForwardingAddress(target)); 2048 source->set_map_word(MapWord::FromForwardingAddress(target));
2049 2049
2050 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) { 2050 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) {
2051 // Update NewSpace stats if necessary. 2051 // Update NewSpace stats if necessary.
2052 RecordCopiedObject(heap, target); 2052 RecordCopiedObject(heap, target);
2053 HEAP_PROFILE(heap, ObjectMoveEvent(source->address(), target->address())); 2053 HEAP_PROFILE(heap,
2054 ObjectMoveEvent(source->address(), target->address(), size));
2054 Isolate* isolate = heap->isolate(); 2055 Isolate* isolate = heap->isolate();
2055 if (isolate->logger()->is_logging_code_events() || 2056 if (isolate->logger()->is_logging_code_events() ||
2056 isolate->cpu_profiler()->is_profiling()) { 2057 isolate->cpu_profiler()->is_profiling()) {
2057 if (target->IsSharedFunctionInfo()) { 2058 if (target->IsSharedFunctionInfo()) {
2058 PROFILE(isolate, SharedFunctionInfoMoveEvent( 2059 PROFILE(isolate, SharedFunctionInfoMoveEvent(
2059 source->address(), target->address())); 2060 source->address(), target->address()));
2060 } 2061 }
2061 } 2062 }
2062 } 2063 }
2063 2064
(...skipping 2962 matching lines...) Expand 10 before | Expand all | Expand 10 after
5026 CopyBlock(HeapObject::cast(clone)->address(), 5027 CopyBlock(HeapObject::cast(clone)->address(),
5027 source->address(), 5028 source->address(),
5028 object_size); 5029 object_size);
5029 } 5030 }
5030 5031
5031 if (adjusted_object_size > object_size) { 5032 if (adjusted_object_size > object_size) {
5032 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>( 5033 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>(
5033 reinterpret_cast<Address>(clone) + object_size); 5034 reinterpret_cast<Address>(clone) + object_size);
5034 alloc_memento->set_map_no_write_barrier(allocation_memento_map()); 5035 alloc_memento->set_map_no_write_barrier(allocation_memento_map());
5035 alloc_memento->set_allocation_site(site, SKIP_WRITE_BARRIER); 5036 alloc_memento->set_allocation_site(site, SKIP_WRITE_BARRIER);
5037
5038 HeapProfiler* profiler = isolate()->heap_profiler();
5039 if (profiler->is_tracking_allocations()) {
5040 profiler->NewObjectEvent(HeapObject::cast(clone)->address(),
loislo 2013/08/27 09:04:57 this call actually just updates the size for the o
Alexandra Mikhaylova 2013/09/19 16:03:38 Done.
5041 object_size);
5042 profiler->NewObjectEvent(alloc_memento->address(),
5043 adjusted_object_size - object_size);
5044 }
5036 } 5045 }
5037 5046
5038 SLOW_ASSERT( 5047 SLOW_ASSERT(
5039 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind()); 5048 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind());
5040 FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); 5049 FixedArrayBase* elements = FixedArrayBase::cast(source->elements());
5041 FixedArray* properties = FixedArray::cast(source->properties()); 5050 FixedArray* properties = FixedArray::cast(source->properties());
5042 // Update elements if necessary. 5051 // Update elements if necessary.
5043 if (elements->length() > 0) { 5052 if (elements->length() > 0) {
5044 Object* elem; 5053 Object* elem;
5045 { MaybeObject* maybe_elem; 5054 { MaybeObject* maybe_elem;
(...skipping 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after
8050 if (FLAG_concurrent_recompilation) { 8059 if (FLAG_concurrent_recompilation) {
8051 heap_->relocation_mutex_->Lock(); 8060 heap_->relocation_mutex_->Lock();
8052 #ifdef DEBUG 8061 #ifdef DEBUG
8053 heap_->relocation_mutex_locked_by_optimizer_thread_ = 8062 heap_->relocation_mutex_locked_by_optimizer_thread_ =
8054 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 8063 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
8055 #endif // DEBUG 8064 #endif // DEBUG
8056 } 8065 }
8057 } 8066 }
8058 8067
8059 } } // namespace v8::internal 8068 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698