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

Side by Side Diff: src/objects.h

Issue 4078: - Added a map cache for literal objects. This will... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 inline bool IsSharedFunctionInfo(); 612 inline bool IsSharedFunctionInfo();
613 inline bool IsJSValue(); 613 inline bool IsJSValue();
614 inline bool IsProxy(); 614 inline bool IsProxy();
615 inline bool IsBoolean(); 615 inline bool IsBoolean();
616 inline bool IsJSArray(); 616 inline bool IsJSArray();
617 inline bool IsJSRegExp(); 617 inline bool IsJSRegExp();
618 inline bool IsHashTable(); 618 inline bool IsHashTable();
619 inline bool IsDictionary(); 619 inline bool IsDictionary();
620 inline bool IsSymbolTable(); 620 inline bool IsSymbolTable();
621 inline bool IsCompilationCacheTable(); 621 inline bool IsCompilationCacheTable();
622 inline bool IsMapCache();
622 inline bool IsPrimitive(); 623 inline bool IsPrimitive();
623 inline bool IsGlobalObject(); 624 inline bool IsGlobalObject();
624 inline bool IsJSGlobalObject(); 625 inline bool IsJSGlobalObject();
625 inline bool IsJSBuiltinsObject(); 626 inline bool IsJSBuiltinsObject();
626 inline bool IsUndetectableObject(); 627 inline bool IsUndetectableObject();
627 inline bool IsAccessCheckNeeded(); 628 inline bool IsAccessCheckNeeded();
628 629
629 // Returns true if this object is an instance of the specified 630 // Returns true if this object is an instance of the specified
630 // function template. 631 // function template.
631 bool IsInstanceOf(FunctionTemplateInfo* type); 632 bool IsInstanceOf(FunctionTemplateInfo* type);
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 Object* Lookup(String* src); 1830 Object* Lookup(String* src);
1830 Object* Put(String* src, Object* value); 1831 Object* Put(String* src, Object* value);
1831 1832
1832 static inline CompilationCacheTable* cast(Object* obj); 1833 static inline CompilationCacheTable* cast(Object* obj);
1833 1834
1834 private: 1835 private:
1835 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); 1836 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable);
1836 }; 1837 };
1837 1838
1838 1839
1840 // MapCache.
1841 //
1842 // Maps keys that are a fixed array of symbols to a map.
1843 // Used for canonicalize maps for object literals.
1844 class MapCache: public HashTable<0, 2> {
1845 public:
1846 // Find cached value for a string key, otherwise return null.
1847 Object* Lookup(FixedArray* key);
1848 Object* Put(FixedArray* key, Map* value);
1849 static inline MapCache* cast(Object* obj);
1850
1851 private:
1852 DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache);
1853 };
1854
1855
1839 // Dictionary for keeping properties and elements in slow case. 1856 // Dictionary for keeping properties and elements in slow case.
1840 // 1857 //
1841 // One element in the prefix is used for storing non-element 1858 // One element in the prefix is used for storing non-element
1842 // information about the dictionary. 1859 // information about the dictionary.
1843 // 1860 //
1844 // The rest of the array embeds triples of (key, value, details). 1861 // The rest of the array embeds triples of (key, value, details).
1845 // if key == undefined the triple is empty. 1862 // if key == undefined the triple is empty.
1846 // if key == null the triple has been deleted. 1863 // if key == null the triple has been deleted.
1847 // otherwise key contains the name of a property. 1864 // otherwise key contains the name of a property.
1848 class DictionaryBase: public HashTable<2, 3> {}; 1865 class DictionaryBase: public HashTable<2, 3> {};
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 2681
2665 // Dispatched behavior. 2682 // Dispatched behavior.
2666 #ifdef DEBUG 2683 #ifdef DEBUG
2667 void JSFunctionPrint(); 2684 void JSFunctionPrint();
2668 void JSFunctionVerify(); 2685 void JSFunctionVerify();
2669 #endif 2686 #endif
2670 2687
2671 // Returns the number of allocated literals. 2688 // Returns the number of allocated literals.
2672 int NumberOfLiterals(); 2689 int NumberOfLiterals();
2673 2690
2691 // Retrieve the global context from a function's literal array.
2692 static Context* GlobalContextFromLiterals(FixedArray* literals);
2693
2674 // Layout descriptors. 2694 // Layout descriptors.
2675 static const int kPrototypeOrInitialMapOffset = JSObject::kHeaderSize; 2695 static const int kPrototypeOrInitialMapOffset = JSObject::kHeaderSize;
2676 static const int kSharedFunctionInfoOffset = 2696 static const int kSharedFunctionInfoOffset =
2677 kPrototypeOrInitialMapOffset + kPointerSize; 2697 kPrototypeOrInitialMapOffset + kPointerSize;
2678 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; 2698 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize;
2679 static const int kLiteralsOffset = kContextOffset + kPointerSize; 2699 static const int kLiteralsOffset = kContextOffset + kPointerSize;
2680 static const int kSize = kLiteralsOffset + kPointerSize; 2700 static const int kSize = kLiteralsOffset + kPointerSize;
2681 2701
2682 // Layout of the literals array. 2702 // Layout of the literals array.
2683 static const int kLiteralsPrefixSize = 3; 2703 static const int kLiteralsPrefixSize = 1;
2684 static const int kLiteralObjectFunctionIndex = 0; 2704 static const int kLiteralGlobalContextIndex = 0;
2685 static const int kLiteralRegExpFunctionIndex = 1;
2686 static const int kLiteralArrayFunctionIndex = 2;
2687
2688 private: 2705 private:
2689 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction); 2706 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction);
2690 }; 2707 };
2691 2708
2692 2709
2693 // Forward declaration. 2710 // Forward declaration.
2694 class JSBuiltinsObject; 2711 class JSBuiltinsObject;
2695 2712
2696 // Common super class for JavaScript global objects and the special 2713 // Common super class for JavaScript global objects and the special
2697 // builtins global objects. 2714 // builtins global objects.
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
3892 } else { 3909 } else {
3893 value &= ~(1 << bit_position); 3910 value &= ~(1 << bit_position);
3894 } 3911 }
3895 return value; 3912 return value;
3896 } 3913 }
3897 }; 3914 };
3898 3915
3899 } } // namespace v8::internal 3916 } } // namespace v8::internal
3900 3917
3901 #endif // V8_OBJECTS_H_ 3918 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698