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

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: Deoptimize code and generate optimized code when switching allocations tracking 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 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 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after
5067 source->address(), 5068 source->address(),
5068 object_size); 5069 object_size);
5069 } 5070 }
5070 5071
5071 if (adjusted_object_size > object_size) { 5072 if (adjusted_object_size > object_size) {
5072 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>( 5073 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>(
5073 reinterpret_cast<Address>(clone) + object_size); 5074 reinterpret_cast<Address>(clone) + object_size);
5074 alloc_memento->set_map_no_write_barrier(allocation_memento_map()); 5075 alloc_memento->set_map_no_write_barrier(allocation_memento_map());
5075 ASSERT(site->map() == allocation_site_map()); 5076 ASSERT(site->map() == allocation_site_map());
5076 alloc_memento->set_allocation_site(site, SKIP_WRITE_BARRIER); 5077 alloc_memento->set_allocation_site(site, SKIP_WRITE_BARRIER);
5078
5079 HeapProfiler* profiler = isolate()->heap_profiler();
5080 if (profiler->is_tracking_allocations()) {
5081 profiler->UpdateObjectSizeEvent(HeapObject::cast(clone)->address(),
5082 object_size);
5083 profiler->NewObjectEvent(alloc_memento->address(),
5084 adjusted_object_size - object_size);
5085 }
5077 } 5086 }
5078 5087
5079 SLOW_ASSERT( 5088 SLOW_ASSERT(
5080 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind()); 5089 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind());
5081 FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); 5090 FixedArrayBase* elements = FixedArrayBase::cast(source->elements());
5082 FixedArray* properties = FixedArray::cast(source->properties()); 5091 FixedArray* properties = FixedArray::cast(source->properties());
5083 // Update elements if necessary. 5092 // Update elements if necessary.
5084 if (elements->length() > 0) { 5093 if (elements->length() > 0) {
5085 Object* elem; 5094 Object* elem;
5086 { MaybeObject* maybe_elem; 5095 { MaybeObject* maybe_elem;
(...skipping 2998 matching lines...) Expand 10 before | Expand all | Expand 10 after
8085 if (FLAG_concurrent_recompilation) { 8094 if (FLAG_concurrent_recompilation) {
8086 heap_->relocation_mutex_->Lock(); 8095 heap_->relocation_mutex_->Lock();
8087 #ifdef DEBUG 8096 #ifdef DEBUG
8088 heap_->relocation_mutex_locked_by_optimizer_thread_ = 8097 heap_->relocation_mutex_locked_by_optimizer_thread_ =
8089 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 8098 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
8090 #endif // DEBUG 8099 #endif // DEBUG
8091 } 8100 }
8092 } 8101 }
8093 8102
8094 } } // namespace v8::internal 8103 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/heap-profiler.h » ('j') | test/cctest/cctest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698