| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 int number_of_slow_used_elements_; | 1443 int number_of_slow_used_elements_; |
| 1444 int number_of_slow_unused_elements_; | 1444 int number_of_slow_unused_elements_; |
| 1445 }; | 1445 }; |
| 1446 | 1446 |
| 1447 void IncrementSpillStatistics(SpillInformation* info); | 1447 void IncrementSpillStatistics(SpillInformation* info); |
| 1448 #endif | 1448 #endif |
| 1449 Object* SlowReverseLookup(Object* value); | 1449 Object* SlowReverseLookup(Object* value); |
| 1450 | 1450 |
| 1451 static const uint32_t kMaxGap = 1024; | 1451 static const uint32_t kMaxGap = 1024; |
| 1452 static const int kMaxFastElementsLength = 5000; | 1452 static const int kMaxFastElementsLength = 5000; |
| 1453 static const int kInitialMaxFastElementArray = 100000; |
| 1453 static const int kMaxFastProperties = 8; | 1454 static const int kMaxFastProperties = 8; |
| 1454 static const int kMaxInstanceSize = 255 * kPointerSize; | 1455 static const int kMaxInstanceSize = 255 * kPointerSize; |
| 1455 // When extending the backing storage for property values, we increase | 1456 // When extending the backing storage for property values, we increase |
| 1456 // its size by more than the 1 entry necessary, so sequentially adding fields | 1457 // its size by more than the 1 entry necessary, so sequentially adding fields |
| 1457 // to the same object requires fewer allocations and copies. | 1458 // to the same object requires fewer allocations and copies. |
| 1458 static const int kFieldsAdded = 3; | 1459 static const int kFieldsAdded = 3; |
| 1459 | 1460 |
| 1460 // Layout description. | 1461 // Layout description. |
| 1461 static const int kPropertiesOffset = HeapObject::kHeaderSize; | 1462 static const int kPropertiesOffset = HeapObject::kHeaderSize; |
| 1462 static const int kElementsOffset = kPropertiesOffset + kPointerSize; | 1463 static const int kElementsOffset = kPropertiesOffset + kPointerSize; |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2169 // objects or relative instruction addresses. | 2170 // objects or relative instruction addresses. |
| 2170 enum ICTargetState { | 2171 enum ICTargetState { |
| 2171 IC_TARGET_IS_ADDRESS, | 2172 IC_TARGET_IS_ADDRESS, |
| 2172 IC_TARGET_IS_OBJECT | 2173 IC_TARGET_IS_OBJECT |
| 2173 }; | 2174 }; |
| 2174 | 2175 |
| 2175 #ifdef ENABLE_DISASSEMBLER | 2176 #ifdef ENABLE_DISASSEMBLER |
| 2176 // Printing | 2177 // Printing |
| 2177 static const char* Kind2String(Kind kind); | 2178 static const char* Kind2String(Kind kind); |
| 2178 static const char* ICState2String(InlineCacheState state); | 2179 static const char* ICState2String(InlineCacheState state); |
| 2179 void Disassemble(); | 2180 void Disassemble(const char* name); |
| 2180 #endif // ENABLE_DISASSEMBLER | 2181 #endif // ENABLE_DISASSEMBLER |
| 2181 | 2182 |
| 2182 // [instruction_size]: Size of the native instructions | 2183 // [instruction_size]: Size of the native instructions |
| 2183 inline int instruction_size(); | 2184 inline int instruction_size(); |
| 2184 inline void set_instruction_size(int value); | 2185 inline void set_instruction_size(int value); |
| 2185 | 2186 |
| 2186 // [relocation_size]: Size of relocation information. | 2187 // [relocation_size]: Size of relocation information. |
| 2187 inline int relocation_size(); | 2188 inline int relocation_size(); |
| 2188 inline void set_relocation_size(int value); | 2189 inline void set_relocation_size(int value); |
| 2189 | 2190 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2270 void CopyFrom(const CodeDesc& desc); | 2271 void CopyFrom(const CodeDesc& desc); |
| 2271 | 2272 |
| 2272 // Returns the object size for a given body and sinfo size (Used for | 2273 // Returns the object size for a given body and sinfo size (Used for |
| 2273 // allocation). | 2274 // allocation). |
| 2274 static int SizeFor(int body_size, int sinfo_size) { | 2275 static int SizeFor(int body_size, int sinfo_size) { |
| 2275 ASSERT_SIZE_TAG_ALIGNED(body_size); | 2276 ASSERT_SIZE_TAG_ALIGNED(body_size); |
| 2276 ASSERT_SIZE_TAG_ALIGNED(sinfo_size); | 2277 ASSERT_SIZE_TAG_ALIGNED(sinfo_size); |
| 2277 return RoundUp(kHeaderSize + body_size + sinfo_size, kCodeAlignment); | 2278 return RoundUp(kHeaderSize + body_size + sinfo_size, kCodeAlignment); |
| 2278 } | 2279 } |
| 2279 | 2280 |
| 2281 // Calculate the size of the code object to report for log events. This takes |
| 2282 // the layout of the code object into account. |
| 2283 int ExecutableSize() { |
| 2284 // Check that the assumptions about the layout of the code object holds. |
| 2285 ASSERT_EQ(reinterpret_cast<unsigned int>(instruction_start()) - |
| 2286 reinterpret_cast<unsigned int>(address()), |
| 2287 Code::kHeaderSize); |
| 2288 return instruction_size() + Code::kHeaderSize; |
| 2289 } |
| 2290 |
| 2280 // Locating source position. | 2291 // Locating source position. |
| 2281 int SourcePosition(Address pc); | 2292 int SourcePosition(Address pc); |
| 2282 int SourceStatementPosition(Address pc); | 2293 int SourceStatementPosition(Address pc); |
| 2283 | 2294 |
| 2284 // Casting. | 2295 // Casting. |
| 2285 static inline Code* cast(Object* obj); | 2296 static inline Code* cast(Object* obj); |
| 2286 | 2297 |
| 2287 // Dispatched behavior. | 2298 // Dispatched behavior. |
| 2288 int CodeSize() { return SizeFor(body_size(), sinfo_size()); } | 2299 int CodeSize() { return SizeFor(body_size(), sinfo_size()); } |
| 2289 void CodeIterateBody(ObjectVisitor* v); | 2300 void CodeIterateBody(ObjectVisitor* v); |
| (...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3823 | 3834 |
| 3824 // Set the content of the array to the content of storage. | 3835 // Set the content of the array to the content of storage. |
| 3825 inline void SetContent(FixedArray* storage); | 3836 inline void SetContent(FixedArray* storage); |
| 3826 | 3837 |
| 3827 // Support for sorting | 3838 // Support for sorting |
| 3828 Object* RemoveHoles(); | 3839 Object* RemoveHoles(); |
| 3829 | 3840 |
| 3830 // Casting. | 3841 // Casting. |
| 3831 static inline JSArray* cast(Object* obj); | 3842 static inline JSArray* cast(Object* obj); |
| 3832 | 3843 |
| 3833 // Uses handles. Ensures that the fixed array backing the JSArray has at | |
| 3834 // least the stated size. | |
| 3835 void EnsureSize(int minimum_size_of_backing_fixed_array); | |
| 3836 | |
| 3837 // Dispatched behavior. | 3844 // Dispatched behavior. |
| 3838 #ifdef DEBUG | 3845 #ifdef DEBUG |
| 3839 void JSArrayPrint(); | 3846 void JSArrayPrint(); |
| 3840 void JSArrayVerify(); | 3847 void JSArrayVerify(); |
| 3841 #endif | 3848 #endif |
| 3842 | 3849 |
| 3843 // Layout description. | 3850 // Layout description. |
| 3844 static const int kLengthOffset = JSObject::kHeaderSize; | 3851 static const int kLengthOffset = JSObject::kHeaderSize; |
| 3845 static const int kSize = kLengthOffset + kPointerSize; | 3852 static const int kSize = kLengthOffset + kPointerSize; |
| 3846 | 3853 |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4293 } else { | 4300 } else { |
| 4294 value &= ~(1 << bit_position); | 4301 value &= ~(1 << bit_position); |
| 4295 } | 4302 } |
| 4296 return value; | 4303 return value; |
| 4297 } | 4304 } |
| 4298 }; | 4305 }; |
| 4299 | 4306 |
| 4300 } } // namespace v8::internal | 4307 } } // namespace v8::internal |
| 4301 | 4308 |
| 4302 #endif // V8_OBJECTS_H_ | 4309 #endif // V8_OBJECTS_H_ |
| OLD | NEW |