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 3993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4004 int BytecodeArray::parameter_count() const { | 4004 int BytecodeArray::parameter_count() const { |
4005 // Parameter count is stored as the size on stack of the parameters to allow | 4005 // Parameter count is stored as the size on stack of the parameters to allow |
4006 // it to be used directly by generated code. | 4006 // it to be used directly by generated code. |
4007 return READ_INT_FIELD(this, kParameterSizeOffset) >> kPointerSizeLog2; | 4007 return READ_INT_FIELD(this, kParameterSizeOffset) >> kPointerSizeLog2; |
4008 } | 4008 } |
4009 | 4009 |
4010 ACCESSORS(BytecodeArray, constant_pool, FixedArray, kConstantPoolOffset) | 4010 ACCESSORS(BytecodeArray, constant_pool, FixedArray, kConstantPoolOffset) |
4011 ACCESSORS(BytecodeArray, handler_table, FixedArray, kHandlerTableOffset) | 4011 ACCESSORS(BytecodeArray, handler_table, FixedArray, kHandlerTableOffset) |
4012 ACCESSORS(BytecodeArray, source_position_table, ByteArray, | 4012 ACCESSORS(BytecodeArray, source_position_table, ByteArray, |
4013 kSourcePositionTableOffset) | 4013 kSourcePositionTableOffset) |
| 4014 ACCESSORS(BytecodeArray, stack_frame_cache, Object, kStackFrameCacheOffset) |
4014 | 4015 |
4015 Address BytecodeArray::GetFirstBytecodeAddress() { | 4016 Address BytecodeArray::GetFirstBytecodeAddress() { |
4016 return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize; | 4017 return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize; |
4017 } | 4018 } |
4018 | 4019 |
4019 | 4020 |
4020 int BytecodeArray::BytecodeArraySize() { return SizeFor(this->length()); } | 4021 int BytecodeArray::BytecodeArraySize() { return SizeFor(this->length()); } |
4021 | 4022 |
4022 int BytecodeArray::SizeIncludingMetadata() { | 4023 int BytecodeArray::SizeIncludingMetadata() { |
4023 int size = BytecodeArraySize(); | 4024 int size = BytecodeArraySize(); |
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5230 } | 5231 } |
5231 | 5232 |
5232 void AbstractCode::set_source_position_table(ByteArray* source_position_table) { | 5233 void AbstractCode::set_source_position_table(ByteArray* source_position_table) { |
5233 if (IsCode()) { | 5234 if (IsCode()) { |
5234 GetCode()->set_source_position_table(source_position_table); | 5235 GetCode()->set_source_position_table(source_position_table); |
5235 } else { | 5236 } else { |
5236 GetBytecodeArray()->set_source_position_table(source_position_table); | 5237 GetBytecodeArray()->set_source_position_table(source_position_table); |
5237 } | 5238 } |
5238 } | 5239 } |
5239 | 5240 |
| 5241 Object* AbstractCode::stack_frame_cache() { |
| 5242 if (IsCode()) { |
| 5243 return GetCode()->stack_frame_cache(); |
| 5244 } else { |
| 5245 return GetBytecodeArray()->stack_frame_cache(); |
| 5246 } |
| 5247 } |
| 5248 |
| 5249 void AbstractCode::set_stack_frame_cache(Object* stack_frame_cache) { |
| 5250 if (IsCode()) { |
| 5251 GetCode()->set_stack_frame_cache(stack_frame_cache); |
| 5252 } else { |
| 5253 GetBytecodeArray()->set_stack_frame_cache(stack_frame_cache); |
| 5254 } |
| 5255 } |
| 5256 |
5240 int AbstractCode::SizeIncludingMetadata() { | 5257 int AbstractCode::SizeIncludingMetadata() { |
5241 if (IsCode()) { | 5258 if (IsCode()) { |
5242 return GetCode()->SizeIncludingMetadata(); | 5259 return GetCode()->SizeIncludingMetadata(); |
5243 } else { | 5260 } else { |
5244 return GetBytecodeArray()->SizeIncludingMetadata(); | 5261 return GetBytecodeArray()->SizeIncludingMetadata(); |
5245 } | 5262 } |
5246 } | 5263 } |
| 5264 |
5247 int AbstractCode::ExecutableSize() { | 5265 int AbstractCode::ExecutableSize() { |
5248 if (IsCode()) { | 5266 if (IsCode()) { |
5249 return GetCode()->ExecutableSize(); | 5267 return GetCode()->ExecutableSize(); |
5250 } else { | 5268 } else { |
5251 return GetBytecodeArray()->BytecodeArraySize(); | 5269 return GetBytecodeArray()->BytecodeArraySize(); |
5252 } | 5270 } |
5253 } | 5271 } |
5254 | 5272 |
5255 Address AbstractCode::instruction_start() { | 5273 Address AbstractCode::instruction_start() { |
5256 if (IsCode()) { | 5274 if (IsCode()) { |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6621 ACCESSORS(JSMessageObject, argument, Object, kArgumentsOffset) | 6639 ACCESSORS(JSMessageObject, argument, Object, kArgumentsOffset) |
6622 ACCESSORS(JSMessageObject, script, Object, kScriptOffset) | 6640 ACCESSORS(JSMessageObject, script, Object, kScriptOffset) |
6623 ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset) | 6641 ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset) |
6624 SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset) | 6642 SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset) |
6625 SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset) | 6643 SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset) |
6626 SMI_ACCESSORS(JSMessageObject, error_level, kErrorLevelOffset) | 6644 SMI_ACCESSORS(JSMessageObject, error_level, kErrorLevelOffset) |
6627 | 6645 |
6628 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 6646 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
6629 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) | 6647 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) |
6630 INT_ACCESSORS(Code, constant_pool_offset, kConstantPoolOffset) | 6648 INT_ACCESSORS(Code, constant_pool_offset, kConstantPoolOffset) |
| 6649 ACCESSORS(Code, stack_frame_cache, Object, kStackFrameCacheOffset) |
6631 #define CODE_ACCESSORS(name, type, offset) \ | 6650 #define CODE_ACCESSORS(name, type, offset) \ |
6632 ACCESSORS_CHECKED2(Code, name, type, offset, true, \ | 6651 ACCESSORS_CHECKED2(Code, name, type, offset, true, \ |
6633 !GetHeap()->InNewSpace(value)) | 6652 !GetHeap()->InNewSpace(value)) |
6634 CODE_ACCESSORS(relocation_info, ByteArray, kRelocationInfoOffset) | 6653 CODE_ACCESSORS(relocation_info, ByteArray, kRelocationInfoOffset) |
6635 CODE_ACCESSORS(handler_table, FixedArray, kHandlerTableOffset) | 6654 CODE_ACCESSORS(handler_table, FixedArray, kHandlerTableOffset) |
6636 CODE_ACCESSORS(deoptimization_data, FixedArray, kDeoptimizationDataOffset) | 6655 CODE_ACCESSORS(deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
6637 CODE_ACCESSORS(source_position_table, ByteArray, kSourcePositionTableOffset) | 6656 CODE_ACCESSORS(source_position_table, ByteArray, kSourcePositionTableOffset) |
6638 CODE_ACCESSORS(trap_handler_index, Smi, kTrapHandlerIndex) | 6657 CODE_ACCESSORS(trap_handler_index, Smi, kTrapHandlerIndex) |
6639 CODE_ACCESSORS(raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) | 6658 CODE_ACCESSORS(raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) |
6640 CODE_ACCESSORS(next_code_link, Object, kNextCodeLinkOffset) | 6659 CODE_ACCESSORS(next_code_link, Object, kNextCodeLinkOffset) |
6641 #undef CODE_ACCESSORS | 6660 #undef CODE_ACCESSORS |
6642 | 6661 |
6643 void Code::WipeOutHeader() { | 6662 void Code::WipeOutHeader() { |
6644 WRITE_FIELD(this, kRelocationInfoOffset, NULL); | 6663 WRITE_FIELD(this, kRelocationInfoOffset, NULL); |
6645 WRITE_FIELD(this, kHandlerTableOffset, NULL); | 6664 WRITE_FIELD(this, kHandlerTableOffset, NULL); |
6646 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); | 6665 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); |
6647 WRITE_FIELD(this, kSourcePositionTableOffset, NULL); | 6666 WRITE_FIELD(this, kSourcePositionTableOffset, NULL); |
| 6667 WRITE_FIELD(this, kStackFrameCacheOffset, NULL); |
6648 // Do not wipe out major/minor keys on a code stub or IC | 6668 // Do not wipe out major/minor keys on a code stub or IC |
6649 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { | 6669 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { |
6650 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); | 6670 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); |
6651 } | 6671 } |
6652 WRITE_FIELD(this, kNextCodeLinkOffset, NULL); | 6672 WRITE_FIELD(this, kNextCodeLinkOffset, NULL); |
6653 WRITE_FIELD(this, kGCMetadataOffset, NULL); | 6673 WRITE_FIELD(this, kGCMetadataOffset, NULL); |
6654 } | 6674 } |
6655 | 6675 |
6656 | 6676 |
6657 Object* Code::type_feedback_info() { | 6677 Object* Code::type_feedback_info() { |
(...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8257 #undef WRITE_BYTE_FIELD | 8277 #undef WRITE_BYTE_FIELD |
8258 #undef NOBARRIER_READ_BYTE_FIELD | 8278 #undef NOBARRIER_READ_BYTE_FIELD |
8259 #undef NOBARRIER_WRITE_BYTE_FIELD | 8279 #undef NOBARRIER_WRITE_BYTE_FIELD |
8260 | 8280 |
8261 } // namespace internal | 8281 } // namespace internal |
8262 } // namespace v8 | 8282 } // namespace v8 |
8263 | 8283 |
8264 #include "src/objects/object-macros-undef.h" | 8284 #include "src/objects/object-macros-undef.h" |
8265 | 8285 |
8266 #endif // V8_OBJECTS_INL_H_ | 8286 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |