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

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: Code style fixes after review #2 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
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 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 int size)) { 2093 int size)) {
2094 // Copy the content of source to target. 2094 // Copy the content of source to target.
2095 heap->CopyBlock(target->address(), source->address(), size); 2095 heap->CopyBlock(target->address(), source->address(), size);
2096 2096
2097 // Set the forwarding address. 2097 // Set the forwarding address.
2098 source->set_map_word(MapWord::FromForwardingAddress(target)); 2098 source->set_map_word(MapWord::FromForwardingAddress(target));
2099 2099
2100 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) { 2100 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) {
2101 // Update NewSpace stats if necessary. 2101 // Update NewSpace stats if necessary.
2102 RecordCopiedObject(heap, target); 2102 RecordCopiedObject(heap, target);
2103 HEAP_PROFILE(heap, ObjectMoveEvent(source->address(), target->address())); 2103 HEAP_PROFILE(heap,
2104 ObjectMoveEvent(source->address(), target->address(), size));
2104 Isolate* isolate = heap->isolate(); 2105 Isolate* isolate = heap->isolate();
2105 if (isolate->logger()->is_logging_code_events() || 2106 if (isolate->logger()->is_logging_code_events() ||
2106 isolate->cpu_profiler()->is_profiling()) { 2107 isolate->cpu_profiler()->is_profiling()) {
2107 if (target->IsSharedFunctionInfo()) { 2108 if (target->IsSharedFunctionInfo()) {
2108 PROFILE(isolate, SharedFunctionInfoMoveEvent( 2109 PROFILE(isolate, SharedFunctionInfoMoveEvent(
2109 source->address(), target->address())); 2110 source->address(), target->address()));
2110 } 2111 }
2111 } 2112 }
2112 } 2113 }
2113 2114
(...skipping 2854 matching lines...) Expand 10 before | Expand all | Expand 10 after
4968 CopyBlock(HeapObject::cast(clone)->address(), 4969 CopyBlock(HeapObject::cast(clone)->address(),
4969 source->address(), 4970 source->address(),
4970 object_size); 4971 object_size);
4971 4972
4972 if (site != NULL) { 4973 if (site != NULL) {
4973 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>( 4974 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>(
4974 reinterpret_cast<Address>(clone) + object_size); 4975 reinterpret_cast<Address>(clone) + object_size);
4975 alloc_memento->set_map_no_write_barrier(allocation_memento_map()); 4976 alloc_memento->set_map_no_write_barrier(allocation_memento_map());
4976 ASSERT(site->map() == allocation_site_map()); 4977 ASSERT(site->map() == allocation_site_map());
4977 alloc_memento->set_allocation_site(site, SKIP_WRITE_BARRIER); 4978 alloc_memento->set_allocation_site(site, SKIP_WRITE_BARRIER);
4979 HeapProfiler* profiler = isolate()->heap_profiler();
Hannes Payer (out of office) 2013/10/02 18:00:29 Why do you track the allocation of the memento sep
Hannes Payer (out of office) 2013/10/02 18:20:04 Ok, ignore question two, because you allocate usin
Alexandra Mikhaylova 2013/10/03 16:27:55 The memento is treated as a separate HeapObject wh
Hannes Payer (out of office) 2013/10/10 18:54:40 OK. You could also ignore the mementos since they
4980 if (profiler->is_tracking_allocations()) {
4981 profiler->UpdateObjectSizeEvent(HeapObject::cast(clone)->address(),
4982 object_size);
4983 profiler->NewObjectEvent(alloc_memento->address(),
4984 AllocationMemento::kSize);
4985 }
4978 } 4986 }
4979 } 4987 }
4980 4988
4981 SLOW_ASSERT( 4989 SLOW_ASSERT(
4982 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind()); 4990 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind());
4983 FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); 4991 FixedArrayBase* elements = FixedArrayBase::cast(source->elements());
4984 FixedArray* properties = FixedArray::cast(source->properties()); 4992 FixedArray* properties = FixedArray::cast(source->properties());
4985 // Update elements if necessary. 4993 // Update elements if necessary.
4986 if (elements->length() > 0) { 4994 if (elements->length() > 0) {
4987 Object* elem; 4995 Object* elem;
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after
7987 if (FLAG_concurrent_recompilation) { 7995 if (FLAG_concurrent_recompilation) {
7988 heap_->relocation_mutex_->Lock(); 7996 heap_->relocation_mutex_->Lock();
7989 #ifdef DEBUG 7997 #ifdef DEBUG
7990 heap_->relocation_mutex_locked_by_optimizer_thread_ = 7998 heap_->relocation_mutex_locked_by_optimizer_thread_ =
7991 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 7999 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
7992 #endif // DEBUG 8000 #endif // DEBUG
7993 } 8001 }
7994 } 8002 }
7995 8003
7996 } } // namespace v8::internal 8004 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698