OLD | NEW |
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 4869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4880 return is_crankshafted() && kind() != OPTIMIZED_FUNCTION; | 4880 return is_crankshafted() && kind() != OPTIMIZED_FUNCTION; |
4881 } | 4881 } |
4882 | 4882 |
4883 inline bool Code::is_interpreter_trampoline_builtin() { | 4883 inline bool Code::is_interpreter_trampoline_builtin() { |
4884 Builtins* builtins = GetIsolate()->builtins(); | 4884 Builtins* builtins = GetIsolate()->builtins(); |
4885 return this == *builtins->InterpreterEntryTrampoline() || | 4885 return this == *builtins->InterpreterEntryTrampoline() || |
4886 this == *builtins->InterpreterEnterBytecodeDispatch() || | 4886 this == *builtins->InterpreterEnterBytecodeDispatch() || |
4887 this == *builtins->InterpreterMarkBaselineOnReturn(); | 4887 this == *builtins->InterpreterMarkBaselineOnReturn(); |
4888 } | 4888 } |
4889 | 4889 |
| 4890 inline bool Code::has_unwinding_info() const { |
| 4891 return HasUnwindingInfoField::decode(READ_UINT32_FIELD(this, kFlagsOffset)); |
| 4892 } |
| 4893 |
| 4894 inline void Code::set_has_unwinding_info(bool state) { |
| 4895 uint32_t previous = READ_UINT32_FIELD(this, kFlagsOffset); |
| 4896 uint32_t updated_value = HasUnwindingInfoField::update(previous, state); |
| 4897 WRITE_UINT32_FIELD(this, kFlagsOffset, updated_value); |
| 4898 } |
| 4899 |
4890 inline void Code::set_is_crankshafted(bool value) { | 4900 inline void Code::set_is_crankshafted(bool value) { |
4891 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4901 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
4892 int updated = IsCrankshaftedField::update(previous, value); | 4902 int updated = IsCrankshaftedField::update(previous, value); |
4893 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4903 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
4894 } | 4904 } |
4895 | 4905 |
4896 | 4906 |
4897 inline bool Code::is_turbofanned() { | 4907 inline bool Code::is_turbofanned() { |
4898 return IsTurbofannedField::decode( | 4908 return IsTurbofannedField::decode( |
4899 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 4909 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6402 | 6412 |
6403 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 6413 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
6404 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) | 6414 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) |
6405 INT_ACCESSORS(Code, constant_pool_offset, kConstantPoolOffset) | 6415 INT_ACCESSORS(Code, constant_pool_offset, kConstantPoolOffset) |
6406 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) | 6416 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) |
6407 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) | 6417 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) |
6408 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) | 6418 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
6409 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) | 6419 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) |
6410 ACCESSORS(Code, next_code_link, Object, kNextCodeLinkOffset) | 6420 ACCESSORS(Code, next_code_link, Object, kNextCodeLinkOffset) |
6411 | 6421 |
6412 | |
6413 void Code::WipeOutHeader() { | 6422 void Code::WipeOutHeader() { |
6414 WRITE_FIELD(this, kRelocationInfoOffset, NULL); | 6423 WRITE_FIELD(this, kRelocationInfoOffset, NULL); |
6415 WRITE_FIELD(this, kHandlerTableOffset, NULL); | 6424 WRITE_FIELD(this, kHandlerTableOffset, NULL); |
6416 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); | 6425 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); |
6417 // Do not wipe out major/minor keys on a code stub or IC | 6426 // Do not wipe out major/minor keys on a code stub or IC |
6418 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { | 6427 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { |
6419 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); | 6428 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); |
6420 } | 6429 } |
6421 WRITE_FIELD(this, kNextCodeLinkOffset, NULL); | 6430 WRITE_FIELD(this, kNextCodeLinkOffset, NULL); |
6422 WRITE_FIELD(this, kGCMetadataOffset, NULL); | 6431 WRITE_FIELD(this, kGCMetadataOffset, NULL); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6456 | 6465 |
6457 byte* Code::instruction_start() { | 6466 byte* Code::instruction_start() { |
6458 return FIELD_ADDR(this, kHeaderSize); | 6467 return FIELD_ADDR(this, kHeaderSize); |
6459 } | 6468 } |
6460 | 6469 |
6461 | 6470 |
6462 byte* Code::instruction_end() { | 6471 byte* Code::instruction_end() { |
6463 return instruction_start() + instruction_size(); | 6472 return instruction_start() + instruction_size(); |
6464 } | 6473 } |
6465 | 6474 |
| 6475 int Code::GetUnwindingInfoSizeOffset() const { |
| 6476 DCHECK(has_unwinding_info()); |
| 6477 return RoundUp(kHeaderSize + instruction_size(), kInt64Size); |
| 6478 } |
| 6479 |
| 6480 int Code::unwinding_info_size() const { |
| 6481 DCHECK(has_unwinding_info()); |
| 6482 return static_cast<int>( |
| 6483 READ_UINT64_FIELD(this, GetUnwindingInfoSizeOffset())); |
| 6484 } |
| 6485 |
| 6486 void Code::set_unwinding_info_size(int value) { |
| 6487 DCHECK(has_unwinding_info()); |
| 6488 WRITE_UINT64_FIELD(this, GetUnwindingInfoSizeOffset(), value); |
| 6489 } |
| 6490 |
| 6491 byte* Code::unwinding_info_start() { |
| 6492 DCHECK(has_unwinding_info()); |
| 6493 return FIELD_ADDR(this, GetUnwindingInfoSizeOffset()) + kInt64Size; |
| 6494 } |
| 6495 |
| 6496 byte* Code::unwinding_info_end() { |
| 6497 DCHECK(has_unwinding_info()); |
| 6498 return unwinding_info_start() + unwinding_info_size(); |
| 6499 } |
6466 | 6500 |
6467 int Code::body_size() { | 6501 int Code::body_size() { |
6468 return RoundUp(instruction_size(), kObjectAlignment); | 6502 int unpadded_body_size = |
| 6503 has_unwinding_info() |
| 6504 ? static_cast<int>(unwinding_info_end() - instruction_start()) |
| 6505 : instruction_size(); |
| 6506 return RoundUp(unpadded_body_size, kObjectAlignment); |
6469 } | 6507 } |
6470 | 6508 |
6471 int Code::SizeIncludingMetadata() { | 6509 int Code::SizeIncludingMetadata() { |
6472 int size = CodeSize(); | 6510 int size = CodeSize(); |
6473 size += relocation_info()->Size(); | 6511 size += relocation_info()->Size(); |
6474 size += deoptimization_data()->Size(); | 6512 size += deoptimization_data()->Size(); |
6475 size += handler_table()->Size(); | 6513 size += handler_table()->Size(); |
6476 return size; | 6514 return size; |
6477 } | 6515 } |
6478 | 6516 |
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7931 #undef WRITE_INT64_FIELD | 7969 #undef WRITE_INT64_FIELD |
7932 #undef READ_BYTE_FIELD | 7970 #undef READ_BYTE_FIELD |
7933 #undef WRITE_BYTE_FIELD | 7971 #undef WRITE_BYTE_FIELD |
7934 #undef NOBARRIER_READ_BYTE_FIELD | 7972 #undef NOBARRIER_READ_BYTE_FIELD |
7935 #undef NOBARRIER_WRITE_BYTE_FIELD | 7973 #undef NOBARRIER_WRITE_BYTE_FIELD |
7936 | 7974 |
7937 } // namespace internal | 7975 } // namespace internal |
7938 } // namespace v8 | 7976 } // namespace v8 |
7939 | 7977 |
7940 #endif // V8_OBJECTS_INL_H_ | 7978 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |