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 5111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5122 ++count_; | 5122 ++count_; |
5123 } | 5123 } |
5124 private: | 5124 private: |
5125 static const int kMaxCount = 4; | 5125 static const int kMaxCount = 4; |
5126 int count_; | 5126 int count_; |
5127 Handle<Map> find_[kMaxCount]; | 5127 Handle<Map> find_[kMaxCount]; |
5128 Handle<Object> replace_[kMaxCount]; | 5128 Handle<Object> replace_[kMaxCount]; |
5129 friend class Code; | 5129 friend class Code; |
5130 }; | 5130 }; |
5131 | 5131 |
5132 int AbstractCode::Size() { | 5132 int AbstractCode::instruction_size() { |
5133 if (IsCode()) { | 5133 if (IsCode()) { |
5134 return GetCode()->instruction_size(); | 5134 return GetCode()->instruction_size(); |
5135 } else { | 5135 } else { |
5136 return GetBytecodeArray()->length(); | 5136 return GetBytecodeArray()->length(); |
5137 } | 5137 } |
5138 } | 5138 } |
5139 | 5139 |
| 5140 int AbstractCode::ExecutableSize() { |
| 5141 if (IsCode()) { |
| 5142 return GetCode()->ExecutableSize(); |
| 5143 } else { |
| 5144 return GetBytecodeArray()->BytecodeArraySize(); |
| 5145 } |
| 5146 } |
| 5147 |
| 5148 Address AbstractCode::instruction_start() { |
| 5149 if (IsCode()) { |
| 5150 return GetCode()->instruction_start(); |
| 5151 } else { |
| 5152 return GetBytecodeArray()->GetFirstBytecodeAddress(); |
| 5153 } |
| 5154 } |
| 5155 |
| 5156 Address AbstractCode::instruction_end() { |
| 5157 if (IsCode()) { |
| 5158 return GetCode()->instruction_end(); |
| 5159 } else { |
| 5160 return GetBytecodeArray()->GetFirstBytecodeAddress() + |
| 5161 GetBytecodeArray()->length(); |
| 5162 } |
| 5163 } |
| 5164 |
| 5165 bool AbstractCode::contains(byte* inner_pointer) { |
| 5166 return (address() <= inner_pointer) && (inner_pointer <= address() + Size()); |
| 5167 } |
| 5168 |
| 5169 AbstractCode::Kind AbstractCode::kind() { |
| 5170 if (IsCode()) { |
| 5171 STATIC_ASSERT(AbstractCode::FUNCTION == |
| 5172 static_cast<AbstractCode::Kind>(Code::FUNCTION)); |
| 5173 return static_cast<AbstractCode::Kind>(GetCode()->kind()); |
| 5174 } else { |
| 5175 return INTERPRETED_FUNCTION; |
| 5176 } |
| 5177 } |
| 5178 |
5140 Code* AbstractCode::GetCode() { return Code::cast(this); } | 5179 Code* AbstractCode::GetCode() { return Code::cast(this); } |
5141 | 5180 |
5142 BytecodeArray* AbstractCode::GetBytecodeArray() { | 5181 BytecodeArray* AbstractCode::GetBytecodeArray() { |
5143 return BytecodeArray::cast(this); | 5182 return BytecodeArray::cast(this); |
5144 } | 5183 } |
5145 | 5184 |
5146 Object* Map::prototype() const { | 5185 Object* Map::prototype() const { |
5147 return READ_FIELD(this, kPrototypeOffset); | 5186 return READ_FIELD(this, kPrototypeOffset); |
5148 } | 5187 } |
5149 | 5188 |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5621 kProfilerTicksOffset) | 5660 kProfilerTicksOffset) |
5622 | 5661 |
5623 #endif | 5662 #endif |
5624 | 5663 |
5625 | 5664 |
5626 BOOL_GETTER(SharedFunctionInfo, | 5665 BOOL_GETTER(SharedFunctionInfo, |
5627 compiler_hints, | 5666 compiler_hints, |
5628 optimization_disabled, | 5667 optimization_disabled, |
5629 kOptimizationDisabled) | 5668 kOptimizationDisabled) |
5630 | 5669 |
| 5670 AbstractCode* SharedFunctionInfo::abstract_code() { |
| 5671 if (HasBytecodeArray()) { |
| 5672 return AbstractCode::cast(bytecode_array()); |
| 5673 } else { |
| 5674 return AbstractCode::cast(code()); |
| 5675 } |
| 5676 } |
5631 | 5677 |
5632 void SharedFunctionInfo::set_optimization_disabled(bool disable) { | 5678 void SharedFunctionInfo::set_optimization_disabled(bool disable) { |
5633 set_compiler_hints(BooleanBit::set(compiler_hints(), | 5679 set_compiler_hints(BooleanBit::set(compiler_hints(), |
5634 kOptimizationDisabled, | 5680 kOptimizationDisabled, |
5635 disable)); | 5681 disable)); |
5636 } | 5682 } |
5637 | 5683 |
5638 | 5684 |
5639 LanguageMode SharedFunctionInfo::language_mode() { | 5685 LanguageMode SharedFunctionInfo::language_mode() { |
5640 STATIC_ASSERT(LANGUAGE_END == 3); | 5686 STATIC_ASSERT(LANGUAGE_END == 3); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5995 | 6041 |
5996 void Map::InobjectSlackTrackingStep() { | 6042 void Map::InobjectSlackTrackingStep() { |
5997 if (!IsInobjectSlackTrackingInProgress()) return; | 6043 if (!IsInobjectSlackTrackingInProgress()) return; |
5998 int counter = construction_counter(); | 6044 int counter = construction_counter(); |
5999 set_construction_counter(counter - 1); | 6045 set_construction_counter(counter - 1); |
6000 if (counter == kSlackTrackingCounterEnd) { | 6046 if (counter == kSlackTrackingCounterEnd) { |
6001 CompleteInobjectSlackTracking(); | 6047 CompleteInobjectSlackTracking(); |
6002 } | 6048 } |
6003 } | 6049 } |
6004 | 6050 |
| 6051 AbstractCode* JSFunction::abstract_code() { |
| 6052 Code* code = this->code(); |
| 6053 if (code->is_interpreter_entry_trampoline()) { |
| 6054 return AbstractCode::cast(shared()->bytecode_array()); |
| 6055 } else { |
| 6056 return AbstractCode::cast(code); |
| 6057 } |
| 6058 } |
6005 | 6059 |
6006 Code* JSFunction::code() { | 6060 Code* JSFunction::code() { |
6007 return Code::cast( | 6061 return Code::cast( |
6008 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); | 6062 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); |
6009 } | 6063 } |
6010 | 6064 |
6011 | 6065 |
6012 void JSFunction::set_code(Code* value) { | 6066 void JSFunction::set_code(Code* value) { |
6013 DCHECK(!GetHeap()->InNewSpace(value)); | 6067 DCHECK(!GetHeap()->InNewSpace(value)); |
6014 Address entry = value->entry(); | 6068 Address entry = value->entry(); |
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7683 #undef WRITE_INT64_FIELD | 7737 #undef WRITE_INT64_FIELD |
7684 #undef READ_BYTE_FIELD | 7738 #undef READ_BYTE_FIELD |
7685 #undef WRITE_BYTE_FIELD | 7739 #undef WRITE_BYTE_FIELD |
7686 #undef NOBARRIER_READ_BYTE_FIELD | 7740 #undef NOBARRIER_READ_BYTE_FIELD |
7687 #undef NOBARRIER_WRITE_BYTE_FIELD | 7741 #undef NOBARRIER_WRITE_BYTE_FIELD |
7688 | 7742 |
7689 } // namespace internal | 7743 } // namespace internal |
7690 } // namespace v8 | 7744 } // namespace v8 |
7691 | 7745 |
7692 #endif // V8_OBJECTS_INL_H_ | 7746 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |