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 5112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5123 ++count_; | 5123 ++count_; |
5124 } | 5124 } |
5125 private: | 5125 private: |
5126 static const int kMaxCount = 4; | 5126 static const int kMaxCount = 4; |
5127 int count_; | 5127 int count_; |
5128 Handle<Map> find_[kMaxCount]; | 5128 Handle<Map> find_[kMaxCount]; |
5129 Handle<Object> replace_[kMaxCount]; | 5129 Handle<Object> replace_[kMaxCount]; |
5130 friend class Code; | 5130 friend class Code; |
5131 }; | 5131 }; |
5132 | 5132 |
5133 int AbstractCode::Size() { | 5133 int AbstractCode::instruction_size() { |
5134 if (IsCode()) { | 5134 if (IsCode()) { |
5135 return GetCode()->instruction_size(); | 5135 return GetCode()->instruction_size(); |
5136 } else { | 5136 } else { |
5137 return GetBytecodeArray()->length(); | 5137 return GetBytecodeArray()->length(); |
5138 } | 5138 } |
5139 } | 5139 } |
5140 | 5140 |
| 5141 int AbstractCode::ExecutableSize() { |
| 5142 if (IsCode()) { |
| 5143 return GetCode()->ExecutableSize(); |
| 5144 } else { |
| 5145 return GetBytecodeArray()->BytecodeArraySize(); |
| 5146 } |
| 5147 } |
| 5148 |
| 5149 Address AbstractCode::instruction_start() { |
| 5150 if (IsCode()) { |
| 5151 return GetCode()->instruction_start(); |
| 5152 } else { |
| 5153 return GetBytecodeArray()->GetFirstBytecodeAddress(); |
| 5154 } |
| 5155 } |
| 5156 |
| 5157 Address AbstractCode::instruction_end() { |
| 5158 if (IsCode()) { |
| 5159 return GetCode()->instruction_end(); |
| 5160 } else { |
| 5161 return GetBytecodeArray()->GetFirstBytecodeAddress() + |
| 5162 GetBytecodeArray()->length(); |
| 5163 } |
| 5164 } |
| 5165 |
| 5166 bool AbstractCode::contains(byte* inner_pointer) { |
| 5167 return (address() <= inner_pointer) && (inner_pointer <= address() + Size()); |
| 5168 } |
| 5169 |
| 5170 AbstractCode::Kind AbstractCode::kind() { |
| 5171 if (IsCode()) { |
| 5172 STATIC_ASSERT(AbstractCode::FUNCTION == |
| 5173 static_cast<AbstractCode::Kind>(Code::FUNCTION)); |
| 5174 return static_cast<AbstractCode::Kind>(GetCode()->kind()); |
| 5175 } else { |
| 5176 return INTERPRETED_FUNCTION; |
| 5177 } |
| 5178 } |
| 5179 |
5141 Code* AbstractCode::GetCode() { return Code::cast(this); } | 5180 Code* AbstractCode::GetCode() { return Code::cast(this); } |
5142 | 5181 |
5143 BytecodeArray* AbstractCode::GetBytecodeArray() { | 5182 BytecodeArray* AbstractCode::GetBytecodeArray() { |
5144 return BytecodeArray::cast(this); | 5183 return BytecodeArray::cast(this); |
5145 } | 5184 } |
5146 | 5185 |
5147 Object* Map::prototype() const { | 5186 Object* Map::prototype() const { |
5148 return READ_FIELD(this, kPrototypeOffset); | 5187 return READ_FIELD(this, kPrototypeOffset); |
5149 } | 5188 } |
5150 | 5189 |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5622 kProfilerTicksOffset) | 5661 kProfilerTicksOffset) |
5623 | 5662 |
5624 #endif | 5663 #endif |
5625 | 5664 |
5626 | 5665 |
5627 BOOL_GETTER(SharedFunctionInfo, | 5666 BOOL_GETTER(SharedFunctionInfo, |
5628 compiler_hints, | 5667 compiler_hints, |
5629 optimization_disabled, | 5668 optimization_disabled, |
5630 kOptimizationDisabled) | 5669 kOptimizationDisabled) |
5631 | 5670 |
| 5671 AbstractCode* SharedFunctionInfo::abstract_code() { |
| 5672 if (HasBytecodeArray()) { |
| 5673 return AbstractCode::cast(bytecode_array()); |
| 5674 } else { |
| 5675 return AbstractCode::cast(code()); |
| 5676 } |
| 5677 } |
5632 | 5678 |
5633 void SharedFunctionInfo::set_optimization_disabled(bool disable) { | 5679 void SharedFunctionInfo::set_optimization_disabled(bool disable) { |
5634 set_compiler_hints(BooleanBit::set(compiler_hints(), | 5680 set_compiler_hints(BooleanBit::set(compiler_hints(), |
5635 kOptimizationDisabled, | 5681 kOptimizationDisabled, |
5636 disable)); | 5682 disable)); |
5637 } | 5683 } |
5638 | 5684 |
5639 | 5685 |
5640 LanguageMode SharedFunctionInfo::language_mode() { | 5686 LanguageMode SharedFunctionInfo::language_mode() { |
5641 STATIC_ASSERT(LANGUAGE_END == 3); | 5687 STATIC_ASSERT(LANGUAGE_END == 3); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6013 | 6059 |
6014 void Map::InobjectSlackTrackingStep() { | 6060 void Map::InobjectSlackTrackingStep() { |
6015 if (!IsInobjectSlackTrackingInProgress()) return; | 6061 if (!IsInobjectSlackTrackingInProgress()) return; |
6016 int counter = construction_counter(); | 6062 int counter = construction_counter(); |
6017 set_construction_counter(counter - 1); | 6063 set_construction_counter(counter - 1); |
6018 if (counter == kSlackTrackingCounterEnd) { | 6064 if (counter == kSlackTrackingCounterEnd) { |
6019 CompleteInobjectSlackTracking(); | 6065 CompleteInobjectSlackTracking(); |
6020 } | 6066 } |
6021 } | 6067 } |
6022 | 6068 |
| 6069 AbstractCode* JSFunction::abstract_code() { |
| 6070 Code* code = this->code(); |
| 6071 if (code->is_interpreter_entry_trampoline()) { |
| 6072 return AbstractCode::cast(shared()->bytecode_array()); |
| 6073 } else { |
| 6074 return AbstractCode::cast(code); |
| 6075 } |
| 6076 } |
6023 | 6077 |
6024 Code* JSFunction::code() { | 6078 Code* JSFunction::code() { |
6025 return Code::cast( | 6079 return Code::cast( |
6026 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); | 6080 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); |
6027 } | 6081 } |
6028 | 6082 |
6029 | 6083 |
6030 void JSFunction::set_code(Code* value) { | 6084 void JSFunction::set_code(Code* value) { |
6031 DCHECK(!GetHeap()->InNewSpace(value)); | 6085 DCHECK(!GetHeap()->InNewSpace(value)); |
6032 Address entry = value->entry(); | 6086 Address entry = value->entry(); |
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7701 #undef WRITE_INT64_FIELD | 7755 #undef WRITE_INT64_FIELD |
7702 #undef READ_BYTE_FIELD | 7756 #undef READ_BYTE_FIELD |
7703 #undef WRITE_BYTE_FIELD | 7757 #undef WRITE_BYTE_FIELD |
7704 #undef NOBARRIER_READ_BYTE_FIELD | 7758 #undef NOBARRIER_READ_BYTE_FIELD |
7705 #undef NOBARRIER_WRITE_BYTE_FIELD | 7759 #undef NOBARRIER_WRITE_BYTE_FIELD |
7706 | 7760 |
7707 } // namespace internal | 7761 } // namespace internal |
7708 } // namespace v8 | 7762 } // namespace v8 |
7709 | 7763 |
7710 #endif // V8_OBJECTS_INL_H_ | 7764 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |