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