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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 TYPE_CHECKER(Cell, CELL_TYPE) | 839 TYPE_CHECKER(Cell, CELL_TYPE) |
840 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) | 840 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) |
841 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) | 841 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) |
842 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) | 842 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) |
843 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) | 843 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) |
844 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) | 844 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) |
845 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) | 845 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) |
846 TYPE_CHECKER(JSDate, JS_DATE_TYPE) | 846 TYPE_CHECKER(JSDate, JS_DATE_TYPE) |
847 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) | 847 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) |
848 | 848 |
| 849 bool Object::IsAbstractCode() const { return IsBytecodeArray() || IsCode(); } |
849 | 850 |
850 bool Object::IsStringWrapper() const { | 851 bool Object::IsStringWrapper() const { |
851 return IsJSValue() && JSValue::cast(this)->value()->IsString(); | 852 return IsJSValue() && JSValue::cast(this)->value()->IsString(); |
852 } | 853 } |
853 | 854 |
854 | 855 |
855 TYPE_CHECKER(Foreign, FOREIGN_TYPE) | 856 TYPE_CHECKER(Foreign, FOREIGN_TYPE) |
856 | 857 |
857 | 858 |
858 bool Object::IsBoolean() const { | 859 bool Object::IsBoolean() const { |
(...skipping 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3172 | 3173 |
3173 | 3174 |
3174 void SeededNumberDictionary::set_requires_slow_elements() { | 3175 void SeededNumberDictionary::set_requires_slow_elements() { |
3175 set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask)); | 3176 set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask)); |
3176 } | 3177 } |
3177 | 3178 |
3178 | 3179 |
3179 // ------------------------------------ | 3180 // ------------------------------------ |
3180 // Cast operations | 3181 // Cast operations |
3181 | 3182 |
3182 | 3183 CAST_ACCESSOR(AbstractCode) |
3183 CAST_ACCESSOR(ArrayList) | 3184 CAST_ACCESSOR(ArrayList) |
3184 CAST_ACCESSOR(Bool16x8) | 3185 CAST_ACCESSOR(Bool16x8) |
3185 CAST_ACCESSOR(Bool32x4) | 3186 CAST_ACCESSOR(Bool32x4) |
3186 CAST_ACCESSOR(Bool8x16) | 3187 CAST_ACCESSOR(Bool8x16) |
3187 CAST_ACCESSOR(ByteArray) | 3188 CAST_ACCESSOR(ByteArray) |
3188 CAST_ACCESSOR(BytecodeArray) | 3189 CAST_ACCESSOR(BytecodeArray) |
3189 CAST_ACCESSOR(Cell) | 3190 CAST_ACCESSOR(Cell) |
3190 CAST_ACCESSOR(Code) | 3191 CAST_ACCESSOR(Code) |
3191 CAST_ACCESSOR(CodeCacheHashTable) | 3192 CAST_ACCESSOR(CodeCacheHashTable) |
3192 CAST_ACCESSOR(CompilationCacheTable) | 3193 CAST_ACCESSOR(CompilationCacheTable) |
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5279 ++count_; | 5280 ++count_; |
5280 } | 5281 } |
5281 private: | 5282 private: |
5282 static const int kMaxCount = 4; | 5283 static const int kMaxCount = 4; |
5283 int count_; | 5284 int count_; |
5284 Handle<Map> find_[kMaxCount]; | 5285 Handle<Map> find_[kMaxCount]; |
5285 Handle<Object> replace_[kMaxCount]; | 5286 Handle<Object> replace_[kMaxCount]; |
5286 friend class Code; | 5287 friend class Code; |
5287 }; | 5288 }; |
5288 | 5289 |
| 5290 Code* AbstractCode::GetCode() { return Code::cast(this); } |
| 5291 BytecodeArray* AbstractCode::GetBytecodeArray() { |
| 5292 return BytecodeArray::cast(this); |
| 5293 } |
5289 | 5294 |
5290 Object* Map::prototype() const { | 5295 Object* Map::prototype() const { |
5291 return READ_FIELD(this, kPrototypeOffset); | 5296 return READ_FIELD(this, kPrototypeOffset); |
5292 } | 5297 } |
5293 | 5298 |
5294 | 5299 |
5295 void Map::set_prototype(Object* value, WriteBarrierMode mode) { | 5300 void Map::set_prototype(Object* value, WriteBarrierMode mode) { |
5296 DCHECK(value->IsNull() || value->IsJSReceiver()); | 5301 DCHECK(value->IsNull() || value->IsJSReceiver()); |
5297 WRITE_FIELD(this, kPrototypeOffset, value); | 5302 WRITE_FIELD(this, kPrototypeOffset, value); |
5298 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); | 5303 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5608 DCHECK(!(origin_options.Flags() & ~((1 << kOriginOptionsSize) - 1))); | 5613 DCHECK(!(origin_options.Flags() & ~((1 << kOriginOptionsSize) - 1))); |
5609 set_flags((flags() & ~kOriginOptionsMask) | | 5614 set_flags((flags() & ~kOriginOptionsMask) | |
5610 (origin_options.Flags() << kOriginOptionsShift)); | 5615 (origin_options.Flags() << kOriginOptionsShift)); |
5611 } | 5616 } |
5612 | 5617 |
5613 | 5618 |
5614 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex) | 5619 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex) |
5615 ACCESSORS(DebugInfo, code, Code, kCodeIndex) | 5620 ACCESSORS(DebugInfo, code, Code, kCodeIndex) |
5616 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) | 5621 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) |
5617 | 5622 |
5618 SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex) | 5623 SMI_ACCESSORS(BreakPointInfo, code_offset, kCodeOffsetIndex) |
5619 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) | 5624 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) |
5620 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) | 5625 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) |
5621 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) | 5626 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) |
5622 | 5627 |
5623 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) | 5628 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) |
5624 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, | 5629 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, |
5625 kOptimizedCodeMapOffset) | 5630 kOptimizedCodeMapOffset) |
5626 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) | 5631 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) |
5627 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, | 5632 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, |
5628 kFeedbackVectorOffset) | 5633 kFeedbackVectorOffset) |
(...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7821 #undef WRITE_INT64_FIELD | 7826 #undef WRITE_INT64_FIELD |
7822 #undef READ_BYTE_FIELD | 7827 #undef READ_BYTE_FIELD |
7823 #undef WRITE_BYTE_FIELD | 7828 #undef WRITE_BYTE_FIELD |
7824 #undef NOBARRIER_READ_BYTE_FIELD | 7829 #undef NOBARRIER_READ_BYTE_FIELD |
7825 #undef NOBARRIER_WRITE_BYTE_FIELD | 7830 #undef NOBARRIER_WRITE_BYTE_FIELD |
7826 | 7831 |
7827 } // namespace internal | 7832 } // namespace internal |
7828 } // namespace v8 | 7833 } // namespace v8 |
7829 | 7834 |
7830 #endif // V8_OBJECTS_INL_H_ | 7835 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |