Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/objects.h

Issue 10103035: Share optimized code for closures. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: addressed comments Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 5138 matching lines...) Expand 10 before | Expand all | Expand 10 after
5149 // SharedFunctionInfo describes the JSFunction information that can be 5149 // SharedFunctionInfo describes the JSFunction information that can be
5150 // shared by multiple instances of the function. 5150 // shared by multiple instances of the function.
5151 class SharedFunctionInfo: public HeapObject { 5151 class SharedFunctionInfo: public HeapObject {
5152 public: 5152 public:
5153 // [name]: Function name. 5153 // [name]: Function name.
5154 DECL_ACCESSORS(name, Object) 5154 DECL_ACCESSORS(name, Object)
5155 5155
5156 // [code]: Function code. 5156 // [code]: Function code.
5157 DECL_ACCESSORS(code, Code) 5157 DECL_ACCESSORS(code, Code)
5158 5158
5159 // [optimized_code_map]: Map from global context to optimized code
5160 // and a shared literals array or Smi 0 if none.
5161 DECL_ACCESSORS(optimized_code_map, Object)
5162
5163 // Returns index i of the entry with the specified context. At position
5164 // i - 1 is the context, position i the code, and i + 1 the literals array.
5165 // Returns -1 when no matching entry is found.
5166 int SearchOptimizedCodeMap(Context* global_context);
5167
5168 // Clear optimized code map.
5169 void ClearOptimizedCodeMap();
5170
5171 // Add a new entry to the optimized code map.
5172 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
5173 Handle<Context> global_context,
5174 Handle<Code> code,
5175 Handle<FixedArray> literals);
5176 static const int kEntryLength = 3;
5177
5159 // [scope_info]: Scope info. 5178 // [scope_info]: Scope info.
5160 DECL_ACCESSORS(scope_info, ScopeInfo) 5179 DECL_ACCESSORS(scope_info, ScopeInfo)
5161 5180
5162 // [construct stub]: Code stub for constructing instances of this function. 5181 // [construct stub]: Code stub for constructing instances of this function.
5163 DECL_ACCESSORS(construct_stub, Code) 5182 DECL_ACCESSORS(construct_stub, Code)
5164 5183
5165 inline Code* unchecked_code(); 5184 inline Code* unchecked_code();
5166 5185
5167 // Returns if this function has been compiled to native code yet. 5186 // Returns if this function has been compiled to native code yet.
5168 inline bool is_compiled(); 5187 inline bool is_compiled();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
5256 // Stores the initial map and installs the countdown stub. 5275 // Stores the initial map and installs the countdown stub.
5257 // IsInobjectSlackTrackingInProgress is normally true after this call, 5276 // IsInobjectSlackTrackingInProgress is normally true after this call,
5258 // except when tracking have not been started (e.g. the map has no unused 5277 // except when tracking have not been started (e.g. the map has no unused
5259 // properties or the snapshot is being built). 5278 // properties or the snapshot is being built).
5260 void StartInobjectSlackTracking(Map* map); 5279 void StartInobjectSlackTracking(Map* map);
5261 5280
5262 // Completes the tracking. 5281 // Completes the tracking.
5263 // IsInobjectSlackTrackingInProgress is false after this call. 5282 // IsInobjectSlackTrackingInProgress is false after this call.
5264 void CompleteInobjectSlackTracking(); 5283 void CompleteInobjectSlackTracking();
5265 5284
5285 // Invoked before pointers in SharedFunctionInfo are being marked.
5286 // Also clears the optimized code map.
5287 inline void BeforeVisitingPointers();
5288
5266 // Clears the initial_map before the GC marking phase to ensure the reference 5289 // Clears the initial_map before the GC marking phase to ensure the reference
5267 // is weak. IsInobjectSlackTrackingInProgress is false after this call. 5290 // is weak. IsInobjectSlackTrackingInProgress is false after this call.
5268 void DetachInitialMap(); 5291 void DetachInitialMap();
5269 5292
5270 // Restores the link to the initial map after the GC marking phase. 5293 // Restores the link to the initial map after the GC marking phase.
5271 // IsInobjectSlackTrackingInProgress is true after this call. 5294 // IsInobjectSlackTrackingInProgress is true after this call.
5272 void AttachInitialMap(Map* map); 5295 void AttachInitialMap(Map* map);
5273 5296
5274 // False if there are definitely no live objects created from this function. 5297 // False if there are definitely no live objects created from this function.
5275 // True if live objects _may_ exist (existence not guaranteed). 5298 // True if live objects _may_ exist (existence not guaranteed).
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
5516 // Casting. 5539 // Casting.
5517 static inline SharedFunctionInfo* cast(Object* obj); 5540 static inline SharedFunctionInfo* cast(Object* obj);
5518 5541
5519 // Constants. 5542 // Constants.
5520 static const int kDontAdaptArgumentsSentinel = -1; 5543 static const int kDontAdaptArgumentsSentinel = -1;
5521 5544
5522 // Layout description. 5545 // Layout description.
5523 // Pointer fields. 5546 // Pointer fields.
5524 static const int kNameOffset = HeapObject::kHeaderSize; 5547 static const int kNameOffset = HeapObject::kHeaderSize;
5525 static const int kCodeOffset = kNameOffset + kPointerSize; 5548 static const int kCodeOffset = kNameOffset + kPointerSize;
5526 static const int kScopeInfoOffset = kCodeOffset + kPointerSize; 5549 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize;
5550 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize;
5527 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; 5551 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize;
5528 static const int kInstanceClassNameOffset = 5552 static const int kInstanceClassNameOffset =
5529 kConstructStubOffset + kPointerSize; 5553 kConstructStubOffset + kPointerSize;
5530 static const int kFunctionDataOffset = 5554 static const int kFunctionDataOffset =
5531 kInstanceClassNameOffset + kPointerSize; 5555 kInstanceClassNameOffset + kPointerSize;
5532 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; 5556 static const int kScriptOffset = kFunctionDataOffset + kPointerSize;
5533 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; 5557 static const int kDebugInfoOffset = kScriptOffset + kPointerSize;
5534 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; 5558 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize;
5535 static const int kInitialMapOffset = 5559 static const int kInitialMapOffset =
5536 kInferredNameOffset + kPointerSize; 5560 kInferredNameOffset + kPointerSize;
(...skipping 3123 matching lines...) Expand 10 before | Expand all | Expand 10 after
8660 } else { 8684 } else {
8661 value &= ~(1 << bit_position); 8685 value &= ~(1 << bit_position);
8662 } 8686 }
8663 return value; 8687 return value;
8664 } 8688 }
8665 }; 8689 };
8666 8690
8667 } } // namespace v8::internal 8691 } } // namespace v8::internal
8668 8692
8669 #endif // V8_OBJECTS_H_ 8693 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698