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 5263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5274 ++count_; | 5274 ++count_; |
5275 } | 5275 } |
5276 private: | 5276 private: |
5277 static const int kMaxCount = 4; | 5277 static const int kMaxCount = 4; |
5278 int count_; | 5278 int count_; |
5279 Handle<Map> find_[kMaxCount]; | 5279 Handle<Map> find_[kMaxCount]; |
5280 Handle<Object> replace_[kMaxCount]; | 5280 Handle<Object> replace_[kMaxCount]; |
5281 friend class Code; | 5281 friend class Code; |
5282 }; | 5282 }; |
5283 | 5283 |
| 5284 int AbstractCode::Size() { |
| 5285 if (IsCode()) { |
| 5286 return GetCode()->instruction_size(); |
| 5287 } else { |
| 5288 return GetBytecodeArray()->length(); |
| 5289 } |
| 5290 } |
| 5291 |
5284 Code* AbstractCode::GetCode() { return Code::cast(this); } | 5292 Code* AbstractCode::GetCode() { return Code::cast(this); } |
| 5293 |
5285 BytecodeArray* AbstractCode::GetBytecodeArray() { | 5294 BytecodeArray* AbstractCode::GetBytecodeArray() { |
5286 return BytecodeArray::cast(this); | 5295 return BytecodeArray::cast(this); |
5287 } | 5296 } |
5288 | 5297 |
5289 Object* Map::prototype() const { | 5298 Object* Map::prototype() const { |
5290 return READ_FIELD(this, kPrototypeOffset); | 5299 return READ_FIELD(this, kPrototypeOffset); |
5291 } | 5300 } |
5292 | 5301 |
5293 | 5302 |
5294 void Map::set_prototype(Object* value, WriteBarrierMode mode) { | 5303 void Map::set_prototype(Object* value, WriteBarrierMode mode) { |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5604 kOriginOptionsShift); | 5613 kOriginOptionsShift); |
5605 } | 5614 } |
5606 void Script::set_origin_options(ScriptOriginOptions origin_options) { | 5615 void Script::set_origin_options(ScriptOriginOptions origin_options) { |
5607 DCHECK(!(origin_options.Flags() & ~((1 << kOriginOptionsSize) - 1))); | 5616 DCHECK(!(origin_options.Flags() & ~((1 << kOriginOptionsSize) - 1))); |
5608 set_flags((flags() & ~kOriginOptionsMask) | | 5617 set_flags((flags() & ~kOriginOptionsMask) | |
5609 (origin_options.Flags() << kOriginOptionsShift)); | 5618 (origin_options.Flags() << kOriginOptionsShift)); |
5610 } | 5619 } |
5611 | 5620 |
5612 | 5621 |
5613 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex) | 5622 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex) |
5614 ACCESSORS(DebugInfo, code, Code, kCodeIndex) | 5623 ACCESSORS(DebugInfo, abstract_code, AbstractCode, kAbstractCodeIndex) |
5615 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) | 5624 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) |
5616 | 5625 |
5617 SMI_ACCESSORS(BreakPointInfo, code_offset, kCodeOffsetIndex) | 5626 SMI_ACCESSORS(BreakPointInfo, code_offset, kCodeOffsetIndex) |
5618 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) | 5627 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) |
5619 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) | 5628 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) |
5620 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) | 5629 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) |
5621 | 5630 |
5622 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) | 5631 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) |
5623 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, | 5632 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, |
5624 kOptimizedCodeMapOffset) | 5633 kOptimizedCodeMapOffset) |
(...skipping 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7827 #undef WRITE_INT64_FIELD | 7836 #undef WRITE_INT64_FIELD |
7828 #undef READ_BYTE_FIELD | 7837 #undef READ_BYTE_FIELD |
7829 #undef WRITE_BYTE_FIELD | 7838 #undef WRITE_BYTE_FIELD |
7830 #undef NOBARRIER_READ_BYTE_FIELD | 7839 #undef NOBARRIER_READ_BYTE_FIELD |
7831 #undef NOBARRIER_WRITE_BYTE_FIELD | 7840 #undef NOBARRIER_WRITE_BYTE_FIELD |
7832 | 7841 |
7833 } // namespace internal | 7842 } // namespace internal |
7834 } // namespace v8 | 7843 } // namespace v8 |
7835 | 7844 |
7836 #endif // V8_OBJECTS_INL_H_ | 7845 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |