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

Side by Side Diff: src/objects.h

Issue 239203003: Handlify CodeCache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback Created 6 years, 8 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
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after
3062 3062
3063 inline void FillWithHoles(int from, int to); 3063 inline void FillWithHoles(int from, int to);
3064 3064
3065 // Shrink length and insert filler objects. 3065 // Shrink length and insert filler objects.
3066 void Shrink(int length); 3066 void Shrink(int length);
3067 3067
3068 // Copy operations. 3068 // Copy operations.
3069 MUST_USE_RESULT inline MaybeObject* Copy(); 3069 MUST_USE_RESULT inline MaybeObject* Copy();
3070 MUST_USE_RESULT MaybeObject* CopySize(int new_length, 3070 MUST_USE_RESULT MaybeObject* CopySize(int new_length,
3071 PretenureFlag pretenure = NOT_TENURED); 3071 PretenureFlag pretenure = NOT_TENURED);
3072 static Handle<FixedArray> CopySize(Handle<FixedArray> array,
3073 int new_length,
3074 PretenureFlag pretenure = NOT_TENURED);
3072 3075
3073 // Add the elements of a JSArray to this FixedArray. 3076 // Add the elements of a JSArray to this FixedArray.
3074 MUST_USE_RESULT static MaybeHandle<FixedArray> AddKeysFromJSArray( 3077 MUST_USE_RESULT static MaybeHandle<FixedArray> AddKeysFromJSArray(
3075 Handle<FixedArray> content, 3078 Handle<FixedArray> content,
3076 Handle<JSArray> array); 3079 Handle<JSArray> array);
3077 3080
3078 // Computes the union of keys and return the result. 3081 // Computes the union of keys and return the result.
3079 // Used for implementing "for (n in object) { }" 3082 // Used for implementing "for (n in object) { }"
3080 MUST_USE_RESULT static MaybeHandle<FixedArray> UnionOfKeys( 3083 MUST_USE_RESULT static MaybeHandle<FixedArray> UnionOfKeys(
3081 Handle<FixedArray> first, 3084 Handle<FixedArray> first,
(...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after
6484 6487
6485 // Code cache operations. 6488 // Code cache operations.
6486 6489
6487 // Clears the code cache. 6490 // Clears the code cache.
6488 inline void ClearCodeCache(Heap* heap); 6491 inline void ClearCodeCache(Heap* heap);
6489 6492
6490 // Update code cache. 6493 // Update code cache.
6491 static void UpdateCodeCache(Handle<Map> map, 6494 static void UpdateCodeCache(Handle<Map> map,
6492 Handle<Name> name, 6495 Handle<Name> name,
6493 Handle<Code> code); 6496 Handle<Code> code);
6494 MUST_USE_RESULT MaybeObject* UpdateCodeCache(Name* name, Code* code);
6495 6497
6496 // Extend the descriptor array of the map with the list of descriptors. 6498 // Extend the descriptor array of the map with the list of descriptors.
6497 // In case of duplicates, the latest descriptor is used. 6499 // In case of duplicates, the latest descriptor is used.
6498 static void AppendCallbackDescriptors(Handle<Map> map, 6500 static void AppendCallbackDescriptors(Handle<Map> map,
6499 Handle<Object> descriptors); 6501 Handle<Object> descriptors);
6500 6502
6501 static void EnsureDescriptorSlack(Handle<Map> map, int slack); 6503 static void EnsureDescriptorSlack(Handle<Map> map, int slack);
6502 6504
6503 // Returns the found code or undefined if absent. 6505 // Returns the found code or undefined if absent.
6504 Object* FindInCodeCache(Name* name, Code::Flags flags); 6506 Object* FindInCodeCache(Name* name, Code::Flags flags);
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
8260 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); 8262 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable);
8261 }; 8263 };
8262 8264
8263 8265
8264 class CodeCache: public Struct { 8266 class CodeCache: public Struct {
8265 public: 8267 public:
8266 DECL_ACCESSORS(default_cache, FixedArray) 8268 DECL_ACCESSORS(default_cache, FixedArray)
8267 DECL_ACCESSORS(normal_type_cache, Object) 8269 DECL_ACCESSORS(normal_type_cache, Object)
8268 8270
8269 // Add the code object to the cache. 8271 // Add the code object to the cache.
8270 MUST_USE_RESULT MaybeObject* Update(Name* name, Code* code); 8272 static void Update(
8273 Handle<CodeCache> cache, Handle<Name> name, Handle<Code> code);
8271 8274
8272 // Lookup code object in the cache. Returns code object if found and undefined 8275 // Lookup code object in the cache. Returns code object if found and undefined
8273 // if not. 8276 // if not.
8274 Object* Lookup(Name* name, Code::Flags flags); 8277 Object* Lookup(Name* name, Code::Flags flags);
8275 8278
8276 // Get the internal index of a code object in the cache. Returns -1 if the 8279 // Get the internal index of a code object in the cache. Returns -1 if the
8277 // code object is not in that cache. This index can be used to later call 8280 // code object is not in that cache. This index can be used to later call
8278 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and 8281 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and
8279 // RemoveByIndex. 8282 // RemoveByIndex.
8280 int GetIndex(Object* name, Code* code); 8283 int GetIndex(Object* name, Code* code);
8281 8284
8282 // Remove an object from the cache with the provided internal index. 8285 // Remove an object from the cache with the provided internal index.
8283 void RemoveByIndex(Object* name, Code* code, int index); 8286 void RemoveByIndex(Object* name, Code* code, int index);
8284 8287
8285 static inline CodeCache* cast(Object* obj); 8288 static inline CodeCache* cast(Object* obj);
8286 8289
8287 // Dispatched behavior. 8290 // Dispatched behavior.
8288 DECLARE_PRINTER(CodeCache) 8291 DECLARE_PRINTER(CodeCache)
8289 DECLARE_VERIFIER(CodeCache) 8292 DECLARE_VERIFIER(CodeCache)
8290 8293
8291 static const int kDefaultCacheOffset = HeapObject::kHeaderSize; 8294 static const int kDefaultCacheOffset = HeapObject::kHeaderSize;
8292 static const int kNormalTypeCacheOffset = 8295 static const int kNormalTypeCacheOffset =
8293 kDefaultCacheOffset + kPointerSize; 8296 kDefaultCacheOffset + kPointerSize;
8294 static const int kSize = kNormalTypeCacheOffset + kPointerSize; 8297 static const int kSize = kNormalTypeCacheOffset + kPointerSize;
8295 8298
8296 private: 8299 private:
8297 MUST_USE_RESULT MaybeObject* UpdateDefaultCache(Name* name, Code* code); 8300 static void UpdateDefaultCache(
8298 MUST_USE_RESULT MaybeObject* UpdateNormalTypeCache(Name* name, Code* code); 8301 Handle<CodeCache> code_cache, Handle<Name> name, Handle<Code> code);
8302 static void UpdateNormalTypeCache(
8303 Handle<CodeCache> code_cache, Handle<Name> name, Handle<Code> code);
8299 Object* LookupDefaultCache(Name* name, Code::Flags flags); 8304 Object* LookupDefaultCache(Name* name, Code::Flags flags);
8300 Object* LookupNormalTypeCache(Name* name, Code::Flags flags); 8305 Object* LookupNormalTypeCache(Name* name, Code::Flags flags);
8301 8306
8302 // Code cache layout of the default cache. Elements are alternating name and 8307 // Code cache layout of the default cache. Elements are alternating name and
8303 // code objects for non normal load/store/call IC's. 8308 // code objects for non normal load/store/call IC's.
8304 static const int kCodeCacheEntrySize = 2; 8309 static const int kCodeCacheEntrySize = 2;
8305 static const int kCodeCacheEntryNameOffset = 0; 8310 static const int kCodeCacheEntryNameOffset = 0;
8306 static const int kCodeCacheEntryCodeOffset = 1; 8311 static const int kCodeCacheEntryCodeOffset = 1;
8307 8312
8308 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache); 8313 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache);
(...skipping 22 matching lines...) Expand all
8331 static const int kPrefixSize = 0; 8336 static const int kPrefixSize = 0;
8332 static const int kEntrySize = 2; 8337 static const int kEntrySize = 2;
8333 }; 8338 };
8334 8339
8335 8340
8336 class CodeCacheHashTable: public HashTable<CodeCacheHashTable, 8341 class CodeCacheHashTable: public HashTable<CodeCacheHashTable,
8337 CodeCacheHashTableShape, 8342 CodeCacheHashTableShape,
8338 HashTableKey*> { 8343 HashTableKey*> {
8339 public: 8344 public:
8340 Object* Lookup(Name* name, Code::Flags flags); 8345 Object* Lookup(Name* name, Code::Flags flags);
8341 MUST_USE_RESULT MaybeObject* Put(Name* name, Code* code); 8346 static Handle<CodeCacheHashTable> Put(
8347 Handle<CodeCacheHashTable> table,
8348 Handle<Name> name,
8349 Handle<Code> code);
8342 8350
8343 int GetIndex(Name* name, Code::Flags flags); 8351 int GetIndex(Name* name, Code::Flags flags);
8344 void RemoveByIndex(int index); 8352 void RemoveByIndex(int index);
8345 8353
8346 static inline CodeCacheHashTable* cast(Object* obj); 8354 static inline CodeCacheHashTable* cast(Object* obj);
8347 8355
8348 // Initial size of the fixed array backing the hash table. 8356 // Initial size of the fixed array backing the hash table.
8349 static const int kInitialSize = 64; 8357 static const int kInitialSize = 64;
8350 8358
8351 private: 8359 private:
8360 MUST_USE_RESULT MaybeObject* Put(Name* name, Code* code);
8361
8352 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); 8362 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable);
8353 }; 8363 };
8354 8364
8355 8365
8356 class PolymorphicCodeCache: public Struct { 8366 class PolymorphicCodeCache: public Struct {
8357 public: 8367 public:
8358 DECL_ACCESSORS(cache, Object) 8368 DECL_ACCESSORS(cache, Object)
8359 8369
8360 static void Update(Handle<PolymorphicCodeCache> cache, 8370 static void Update(Handle<PolymorphicCodeCache> cache,
8361 MapHandleList* maps, 8371 MapHandleList* maps,
(...skipping 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after
11055 } else { 11065 } else {
11056 value &= ~(1 << bit_position); 11066 value &= ~(1 << bit_position);
11057 } 11067 }
11058 return value; 11068 return value;
11059 } 11069 }
11060 }; 11070 };
11061 11071
11062 } } // namespace v8::internal 11072 } } // namespace v8::internal
11063 11073
11064 #endif // V8_OBJECTS_H_ 11074 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698