| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5222 // SharedFunctionInfo describes the JSFunction information that can be | 5222 // SharedFunctionInfo describes the JSFunction information that can be |
| 5223 // shared by multiple instances of the function. | 5223 // shared by multiple instances of the function. |
| 5224 class SharedFunctionInfo: public HeapObject { | 5224 class SharedFunctionInfo: public HeapObject { |
| 5225 public: | 5225 public: |
| 5226 // [name]: Function name. | 5226 // [name]: Function name. |
| 5227 DECL_ACCESSORS(name, Object) | 5227 DECL_ACCESSORS(name, Object) |
| 5228 | 5228 |
| 5229 // [code]: Function code. | 5229 // [code]: Function code. |
| 5230 DECL_ACCESSORS(code, Code) | 5230 DECL_ACCESSORS(code, Code) |
| 5231 | 5231 |
| 5232 // [optimized_code_map]: Map from global context to optimized code |
| 5233 // and a shared literals array or Smi 0 if none. |
| 5234 DECL_ACCESSORS(optimized_code_map, Object) |
| 5235 |
| 5236 // Returns index i of the entry with the specified context. At position |
| 5237 // i - 1 is the context, position i the code, and i + 1 the literals array. |
| 5238 // Returns -1 when no matching entry is found. |
| 5239 int SearchOptimizedCodeMap(Context* global_context); |
| 5240 |
| 5241 // Clear optimized code map. |
| 5242 void ClearOptimizedCodeMap(); |
| 5243 |
| 5244 // Add a new entry to the optimized code map. |
| 5245 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
| 5246 Handle<Context> global_context, |
| 5247 Handle<Code> code, |
| 5248 Handle<FixedArray> literals); |
| 5249 static const int kEntryLength = 3; |
| 5250 |
| 5232 // [scope_info]: Scope info. | 5251 // [scope_info]: Scope info. |
| 5233 DECL_ACCESSORS(scope_info, ScopeInfo) | 5252 DECL_ACCESSORS(scope_info, ScopeInfo) |
| 5234 | 5253 |
| 5235 // [construct stub]: Code stub for constructing instances of this function. | 5254 // [construct stub]: Code stub for constructing instances of this function. |
| 5236 DECL_ACCESSORS(construct_stub, Code) | 5255 DECL_ACCESSORS(construct_stub, Code) |
| 5237 | 5256 |
| 5238 inline Code* unchecked_code(); | 5257 inline Code* unchecked_code(); |
| 5239 | 5258 |
| 5240 // Returns if this function has been compiled to native code yet. | 5259 // Returns if this function has been compiled to native code yet. |
| 5241 inline bool is_compiled(); | 5260 inline bool is_compiled(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5329 // Stores the initial map and installs the countdown stub. | 5348 // Stores the initial map and installs the countdown stub. |
| 5330 // IsInobjectSlackTrackingInProgress is normally true after this call, | 5349 // IsInobjectSlackTrackingInProgress is normally true after this call, |
| 5331 // except when tracking have not been started (e.g. the map has no unused | 5350 // except when tracking have not been started (e.g. the map has no unused |
| 5332 // properties or the snapshot is being built). | 5351 // properties or the snapshot is being built). |
| 5333 void StartInobjectSlackTracking(Map* map); | 5352 void StartInobjectSlackTracking(Map* map); |
| 5334 | 5353 |
| 5335 // Completes the tracking. | 5354 // Completes the tracking. |
| 5336 // IsInobjectSlackTrackingInProgress is false after this call. | 5355 // IsInobjectSlackTrackingInProgress is false after this call. |
| 5337 void CompleteInobjectSlackTracking(); | 5356 void CompleteInobjectSlackTracking(); |
| 5338 | 5357 |
| 5358 // Invoked before pointers in SharedFunctionInfo are being marked. |
| 5359 // Also clears the optimized code map. |
| 5360 inline void BeforeVisitingPointers(); |
| 5361 |
| 5339 // Clears the initial_map before the GC marking phase to ensure the reference | 5362 // Clears the initial_map before the GC marking phase to ensure the reference |
| 5340 // is weak. IsInobjectSlackTrackingInProgress is false after this call. | 5363 // is weak. IsInobjectSlackTrackingInProgress is false after this call. |
| 5341 void DetachInitialMap(); | 5364 void DetachInitialMap(); |
| 5342 | 5365 |
| 5343 // Restores the link to the initial map after the GC marking phase. | 5366 // Restores the link to the initial map after the GC marking phase. |
| 5344 // IsInobjectSlackTrackingInProgress is true after this call. | 5367 // IsInobjectSlackTrackingInProgress is true after this call. |
| 5345 void AttachInitialMap(Map* map); | 5368 void AttachInitialMap(Map* map); |
| 5346 | 5369 |
| 5347 // False if there are definitely no live objects created from this function. | 5370 // False if there are definitely no live objects created from this function. |
| 5348 // True if live objects _may_ exist (existence not guaranteed). | 5371 // True if live objects _may_ exist (existence not guaranteed). |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5606 // Casting. | 5629 // Casting. |
| 5607 static inline SharedFunctionInfo* cast(Object* obj); | 5630 static inline SharedFunctionInfo* cast(Object* obj); |
| 5608 | 5631 |
| 5609 // Constants. | 5632 // Constants. |
| 5610 static const int kDontAdaptArgumentsSentinel = -1; | 5633 static const int kDontAdaptArgumentsSentinel = -1; |
| 5611 | 5634 |
| 5612 // Layout description. | 5635 // Layout description. |
| 5613 // Pointer fields. | 5636 // Pointer fields. |
| 5614 static const int kNameOffset = HeapObject::kHeaderSize; | 5637 static const int kNameOffset = HeapObject::kHeaderSize; |
| 5615 static const int kCodeOffset = kNameOffset + kPointerSize; | 5638 static const int kCodeOffset = kNameOffset + kPointerSize; |
| 5616 static const int kScopeInfoOffset = kCodeOffset + kPointerSize; | 5639 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; |
| 5640 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; |
| 5617 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 5641 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
| 5618 static const int kInstanceClassNameOffset = | 5642 static const int kInstanceClassNameOffset = |
| 5619 kConstructStubOffset + kPointerSize; | 5643 kConstructStubOffset + kPointerSize; |
| 5620 static const int kFunctionDataOffset = | 5644 static const int kFunctionDataOffset = |
| 5621 kInstanceClassNameOffset + kPointerSize; | 5645 kInstanceClassNameOffset + kPointerSize; |
| 5622 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 5646 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
| 5623 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 5647 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
| 5624 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 5648 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
| 5625 static const int kInitialMapOffset = | 5649 static const int kInitialMapOffset = |
| 5626 kInferredNameOffset + kPointerSize; | 5650 kInferredNameOffset + kPointerSize; |
| (...skipping 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8768 } else { | 8792 } else { |
| 8769 value &= ~(1 << bit_position); | 8793 value &= ~(1 << bit_position); |
| 8770 } | 8794 } |
| 8771 return value; | 8795 return value; |
| 8772 } | 8796 } |
| 8773 }; | 8797 }; |
| 8774 | 8798 |
| 8775 } } // namespace v8::internal | 8799 } } // namespace v8::internal |
| 8776 | 8800 |
| 8777 #endif // V8_OBJECTS_H_ | 8801 #endif // V8_OBJECTS_H_ |
| OLD | NEW |