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

Side by Side Diff: src/snapshot/serialize.cc

Issue 1092253003: Fix serialization statistics for external strings. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « src/snapshot/serialize.h ('k') | 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 #ifdef OBJECT_PRINT 1239 #ifdef OBJECT_PRINT
1240 if (instance_type_count_ != NULL) { 1240 if (instance_type_count_ != NULL) {
1241 DeleteArray(instance_type_count_); 1241 DeleteArray(instance_type_count_);
1242 DeleteArray(instance_type_size_); 1242 DeleteArray(instance_type_size_);
1243 } 1243 }
1244 #endif // OBJECT_PRINT 1244 #endif // OBJECT_PRINT
1245 } 1245 }
1246 1246
1247 1247
1248 #ifdef OBJECT_PRINT 1248 #ifdef OBJECT_PRINT
1249 void Serializer::CountInstanceType(HeapObject* obj) { 1249 void Serializer::CountInstanceType(Map* map, int size) {
1250 int instance_type = obj->map()->instance_type(); 1250 int instance_type = map->instance_type();
1251 instance_type_count_[instance_type]++; 1251 instance_type_count_[instance_type]++;
1252 instance_type_size_[instance_type] += obj->Size(); 1252 instance_type_size_[instance_type] += size;
1253 } 1253 }
1254 #endif // OBJECT_PRINT 1254 #endif // OBJECT_PRINT
1255 1255
1256 1256
1257 void Serializer::OutputStatistics(const char* name) { 1257 void Serializer::OutputStatistics(const char* name) {
1258 if (!FLAG_serialization_statistics) return; 1258 if (!FLAG_serialization_statistics) return;
1259 PrintF("%s:\n", name); 1259 PrintF("%s:\n", name);
1260 PrintF(" Spaces (bytes):\n"); 1260 PrintF(" Spaces (bytes):\n");
1261 for (int space = 0; space < kNumberOfSpaces; space++) { 1261 for (int space = 0; space < kNumberOfSpaces; space++) {
1262 PrintF("%16s", AllocationSpaceName(static_cast<AllocationSpace>(space))); 1262 PrintF("%16s", AllocationSpaceName(static_cast<AllocationSpace>(space)));
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 sink_->Put(kNewObject + reference_representation_ + space, "NewObject"); 1689 sink_->Put(kNewObject + reference_representation_ + space, "NewObject");
1690 if (needs_double_align) 1690 if (needs_double_align)
1691 sink_->PutInt(kDoubleAlignmentSentinel, "DoubleAlignSentinel"); 1691 sink_->PutInt(kDoubleAlignmentSentinel, "DoubleAlignSentinel");
1692 int encoded_size = size >> kObjectAlignmentBits; 1692 int encoded_size = size >> kObjectAlignmentBits;
1693 DCHECK_NE(kDoubleAlignmentSentinel, encoded_size); 1693 DCHECK_NE(kDoubleAlignmentSentinel, encoded_size);
1694 sink_->PutInt(encoded_size, "ObjectSizeInWords"); 1694 sink_->PutInt(encoded_size, "ObjectSizeInWords");
1695 } 1695 }
1696 1696
1697 #ifdef OBJECT_PRINT 1697 #ifdef OBJECT_PRINT
1698 if (FLAG_serialization_statistics) { 1698 if (FLAG_serialization_statistics) {
1699 serializer_->CountInstanceType(object_); 1699 serializer_->CountInstanceType(map, size);
1700 } 1700 }
1701 #endif // OBJECT_PRINT 1701 #endif // OBJECT_PRINT
1702 1702
1703 // Mark this object as already serialized. 1703 // Mark this object as already serialized.
1704 serializer_->back_reference_map()->Add(object_, back_reference); 1704 serializer_->back_reference_map()->Add(object_, back_reference);
1705 1705
1706 // Serialize the map (first word of the object). 1706 // Serialize the map (first word of the object).
1707 serializer_->SerializeObject(map, kPlain, kStartOfObject, 0); 1707 serializer_->SerializeObject(map, kPlain, kStartOfObject, 0);
1708 } 1708 }
1709 1709
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 DisallowHeapAllocation no_gc; 2592 DisallowHeapAllocation no_gc;
2593 SerializedCodeData* scd = new SerializedCodeData(cached_data); 2593 SerializedCodeData* scd = new SerializedCodeData(cached_data);
2594 SanityCheckResult r = scd->SanityCheck(isolate, source); 2594 SanityCheckResult r = scd->SanityCheck(isolate, source);
2595 if (r == CHECK_SUCCESS) return scd; 2595 if (r == CHECK_SUCCESS) return scd;
2596 cached_data->Reject(); 2596 cached_data->Reject();
2597 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); 2597 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r);
2598 delete scd; 2598 delete scd;
2599 return NULL; 2599 return NULL;
2600 } 2600 }
2601 } } // namespace v8::internal 2601 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/snapshot/serialize.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698