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

Side by Side Diff: src/objects-inl.h

Issue 1997363002: Adds support for collecting statistics about code and its metadata. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments from Hannes. Created 4 years, 6 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/objects.cc ('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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 4002 matching lines...) Expand 10 before | Expand all | Expand 10 after
4013 ACCESSORS(BytecodeArray, source_position_table, ByteArray, 4013 ACCESSORS(BytecodeArray, source_position_table, ByteArray,
4014 kSourcePositionTableOffset) 4014 kSourcePositionTableOffset)
4015 4015
4016 Address BytecodeArray::GetFirstBytecodeAddress() { 4016 Address BytecodeArray::GetFirstBytecodeAddress() {
4017 return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize; 4017 return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize;
4018 } 4018 }
4019 4019
4020 4020
4021 int BytecodeArray::BytecodeArraySize() { return SizeFor(this->length()); } 4021 int BytecodeArray::BytecodeArraySize() { return SizeFor(this->length()); }
4022 4022
4023 int BytecodeArray::SizeIncludingMetadata() {
4024 int size = BytecodeArraySize();
4025 size += constant_pool()->Size();
4026 size += handler_table()->Size();
4027 size += source_position_table()->Size();
4028 return size;
4029 }
4023 4030
4024 ACCESSORS(FixedTypedArrayBase, base_pointer, Object, kBasePointerOffset) 4031 ACCESSORS(FixedTypedArrayBase, base_pointer, Object, kBasePointerOffset)
4025 4032
4026 4033
4027 void* FixedTypedArrayBase::external_pointer() const { 4034 void* FixedTypedArrayBase::external_pointer() const {
4028 intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset); 4035 intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset);
4029 return reinterpret_cast<void*>(ptr); 4036 return reinterpret_cast<void*>(ptr);
4030 } 4037 }
4031 4038
4032 4039
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
5191 }; 5198 };
5192 5199
5193 int AbstractCode::instruction_size() { 5200 int AbstractCode::instruction_size() {
5194 if (IsCode()) { 5201 if (IsCode()) {
5195 return GetCode()->instruction_size(); 5202 return GetCode()->instruction_size();
5196 } else { 5203 } else {
5197 return GetBytecodeArray()->length(); 5204 return GetBytecodeArray()->length();
5198 } 5205 }
5199 } 5206 }
5200 5207
5208 int AbstractCode::SizeIncludingMetadata() {
5209 if (IsCode()) {
5210 return GetCode()->SizeIncludingMetadata();
5211 } else {
5212 return GetBytecodeArray()->SizeIncludingMetadata();
5213 }
5214 }
5201 int AbstractCode::ExecutableSize() { 5215 int AbstractCode::ExecutableSize() {
5202 if (IsCode()) { 5216 if (IsCode()) {
5203 return GetCode()->ExecutableSize(); 5217 return GetCode()->ExecutableSize();
5204 } else { 5218 } else {
5205 return GetBytecodeArray()->BytecodeArraySize(); 5219 return GetBytecodeArray()->BytecodeArraySize();
5206 } 5220 }
5207 } 5221 }
5208 5222
5209 Address AbstractCode::instruction_start() { 5223 Address AbstractCode::instruction_start() {
5210 if (IsCode()) { 5224 if (IsCode()) {
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
6420 6434
6421 byte* Code::instruction_end() { 6435 byte* Code::instruction_end() {
6422 return instruction_start() + instruction_size(); 6436 return instruction_start() + instruction_size();
6423 } 6437 }
6424 6438
6425 6439
6426 int Code::body_size() { 6440 int Code::body_size() {
6427 return RoundUp(instruction_size(), kObjectAlignment); 6441 return RoundUp(instruction_size(), kObjectAlignment);
6428 } 6442 }
6429 6443
6444 int Code::SizeIncludingMetadata() {
6445 int size = CodeSize();
6446 size += relocation_info()->Size();
6447 size += deoptimization_data()->Size();
6448 size += handler_table()->Size();
6449 return size;
6450 }
6430 6451
6431 ByteArray* Code::unchecked_relocation_info() { 6452 ByteArray* Code::unchecked_relocation_info() {
6432 return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset)); 6453 return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset));
6433 } 6454 }
6434 6455
6435 6456
6436 byte* Code::relocation_start() { 6457 byte* Code::relocation_start() {
6437 return unchecked_relocation_info()->GetDataStartAddress(); 6458 return unchecked_relocation_info()->GetDataStartAddress();
6438 } 6459 }
6439 6460
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
7856 #undef WRITE_INT64_FIELD 7877 #undef WRITE_INT64_FIELD
7857 #undef READ_BYTE_FIELD 7878 #undef READ_BYTE_FIELD
7858 #undef WRITE_BYTE_FIELD 7879 #undef WRITE_BYTE_FIELD
7859 #undef NOBARRIER_READ_BYTE_FIELD 7880 #undef NOBARRIER_READ_BYTE_FIELD
7860 #undef NOBARRIER_WRITE_BYTE_FIELD 7881 #undef NOBARRIER_WRITE_BYTE_FIELD
7861 7882
7862 } // namespace internal 7883 } // namespace internal
7863 } // namespace v8 7884 } // namespace v8
7864 7885
7865 #endif // V8_OBJECTS_INL_H_ 7886 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698