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

Side by Side Diff: src/objects.h

Issue 1211453002: Reland "Keep a canonical list of shared function infos." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix alwaysopt Created 5 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
« no previous file with comments | « src/mips64/full-codegen-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »
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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 868
869 #define DECLARE_CAST(type) \ 869 #define DECLARE_CAST(type) \
870 INLINE(static type* cast(Object* object)); \ 870 INLINE(static type* cast(Object* object)); \
871 INLINE(static const type* cast(const Object* object)); 871 INLINE(static const type* cast(const Object* object));
872 872
873 873
874 class AccessorPair; 874 class AccessorPair;
875 class AllocationSite; 875 class AllocationSite;
876 class AllocationSiteCreationContext; 876 class AllocationSiteCreationContext;
877 class AllocationSiteUsageContext; 877 class AllocationSiteUsageContext;
878 class Cell;
878 class ConsString; 879 class ConsString;
879 class DictionaryElementsAccessor; 880 class DictionaryElementsAccessor;
880 class ElementsAccessor; 881 class ElementsAccessor;
881 class FixedArrayBase; 882 class FixedArrayBase;
882 class FunctionLiteral; 883 class FunctionLiteral;
883 class GlobalObject; 884 class GlobalObject;
885 class JSBuiltinsObject;
884 class LayoutDescriptor; 886 class LayoutDescriptor;
885 class LookupIterator; 887 class LookupIterator;
888 class ObjectHashTable;
886 class ObjectVisitor; 889 class ObjectVisitor;
890 class PropertyCell;
891 class SafepointEntry;
892 class SharedFunctionInfo;
887 class StringStream; 893 class StringStream;
894 class TypeFeedbackInfo;
888 class TypeFeedbackVector; 895 class TypeFeedbackVector;
889 class WeakCell; 896 class WeakCell;
890 897
891 // We cannot just say "class HeapType;" if it is created from a template... =8-? 898 // We cannot just say "class HeapType;" if it is created from a template... =8-?
892 template<class> class TypeImpl; 899 template<class> class TypeImpl;
893 struct HeapTypeConfig; 900 struct HeapTypeConfig;
894 typedef TypeImpl<HeapTypeConfig> HeapType; 901 typedef TypeImpl<HeapTypeConfig> HeapType;
895 902
896 903
897 // A template-ized version of the IsXXX functions. 904 // A template-ized version of the IsXXX functions.
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 // Computes the enumerable keys for a JSObject. Used for implementing 1733 // Computes the enumerable keys for a JSObject. Used for implementing
1727 // "for (n in object) { }". 1734 // "for (n in object) { }".
1728 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( 1735 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys(
1729 Handle<JSReceiver> object, 1736 Handle<JSReceiver> object,
1730 KeyCollectionType type); 1737 KeyCollectionType type);
1731 1738
1732 private: 1739 private:
1733 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); 1740 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver);
1734 }; 1741 };
1735 1742
1736 // Forward declaration for JSObject::GetOrCreateHiddenPropertiesHashTable.
1737 class ObjectHashTable;
1738
1739 1743
1740 // The JSObject describes real heap allocated JavaScript objects with 1744 // The JSObject describes real heap allocated JavaScript objects with
1741 // properties. 1745 // properties.
1742 // Note that the map of JSObject changes during execution to enable inline 1746 // Note that the map of JSObject changes during execution to enable inline
1743 // caching. 1747 // caching.
1744 class JSObject: public JSReceiver { 1748 class JSObject: public JSReceiver {
1745 public: 1749 public:
1746 // [properties]: Backing storage for properties. 1750 // [properties]: Backing storage for properties.
1747 // properties is a FixedArray in the fast case and a Dictionary in the 1751 // properties is a FixedArray in the fast case and a Dictionary in the
1748 // slow case. 1752 // slow case.
(...skipping 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after
4839 static const int kReturnOffsetIndex = 0; 4843 static const int kReturnOffsetIndex = 0;
4840 static const int kReturnHandlerIndex = 1; 4844 static const int kReturnHandlerIndex = 1;
4841 static const int kReturnEntrySize = 2; 4845 static const int kReturnEntrySize = 2;
4842 4846
4843 // Encoding of the {handler} field. 4847 // Encoding of the {handler} field.
4844 class HandlerPredictionField : public BitField<CatchPrediction, 0, 1> {}; 4848 class HandlerPredictionField : public BitField<CatchPrediction, 0, 1> {};
4845 class HandlerOffsetField : public BitField<int, 1, 30> {}; 4849 class HandlerOffsetField : public BitField<int, 1, 30> {};
4846 }; 4850 };
4847 4851
4848 4852
4849 // Forward declaration.
4850 class Cell;
4851 class PropertyCell;
4852 class SafepointEntry;
4853 class TypeFeedbackInfo;
4854
4855 // Code describes objects with on-the-fly generated machine code. 4853 // Code describes objects with on-the-fly generated machine code.
4856 class Code: public HeapObject { 4854 class Code: public HeapObject {
4857 public: 4855 public:
4858 // Opaque data type for encapsulating code flags like kind, inline 4856 // Opaque data type for encapsulating code flags like kind, inline
4859 // cache state, and arguments count. 4857 // cache state, and arguments count.
4860 typedef uint32_t Flags; 4858 typedef uint32_t Flags;
4861 4859
4862 #define NON_IC_KIND_LIST(V) \ 4860 #define NON_IC_KIND_LIST(V) \
4863 V(FUNCTION) \ 4861 V(FUNCTION) \
4864 V(OPTIMIZED_FUNCTION) \ 4862 V(OPTIMIZED_FUNCTION) \
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
6408 DECL_ACCESSORS(line_ends, Object) 6406 DECL_ACCESSORS(line_ends, Object)
6409 6407
6410 // [eval_from_shared]: for eval scripts the shared funcion info for the 6408 // [eval_from_shared]: for eval scripts the shared funcion info for the
6411 // function from which eval was called. 6409 // function from which eval was called.
6412 DECL_ACCESSORS(eval_from_shared, Object) 6410 DECL_ACCESSORS(eval_from_shared, Object)
6413 6411
6414 // [eval_from_instructions_offset]: the instruction offset in the code for the 6412 // [eval_from_instructions_offset]: the instruction offset in the code for the
6415 // function from which eval was called where eval was called. 6413 // function from which eval was called where eval was called.
6416 DECL_ACCESSORS(eval_from_instructions_offset, Smi) 6414 DECL_ACCESSORS(eval_from_instructions_offset, Smi)
6417 6415
6416 // [shared_function_infos]: weak fixed array containing all shared
6417 // function infos created from this script.
6418 DECL_ACCESSORS(shared_function_infos, Object)
6419
6418 // [flags]: Holds an exciting bitfield. 6420 // [flags]: Holds an exciting bitfield.
6419 DECL_ACCESSORS(flags, Smi) 6421 DECL_ACCESSORS(flags, Smi)
6420 6422
6421 // [source_url]: sourceURL from magic comment 6423 // [source_url]: sourceURL from magic comment
6422 DECL_ACCESSORS(source_url, Object) 6424 DECL_ACCESSORS(source_url, Object)
6423 6425
6424 // [source_url]: sourceMappingURL magic comment 6426 // [source_url]: sourceMappingURL magic comment
6425 DECL_ACCESSORS(source_mapping_url, Object) 6427 DECL_ACCESSORS(source_mapping_url, Object)
6426 6428
6427 // [compilation_type]: how the the script was compiled. Encoded in the 6429 // [compilation_type]: how the the script was compiled. Encoded in the
(...skipping 27 matching lines...) Expand all
6455 int GetLineNumber(int code_pos); 6457 int GetLineNumber(int code_pos);
6456 6458
6457 static Handle<Object> GetNameOrSourceURL(Handle<Script> script); 6459 static Handle<Object> GetNameOrSourceURL(Handle<Script> script);
6458 6460
6459 // Init line_ends array with code positions of line ends inside script source. 6461 // Init line_ends array with code positions of line ends inside script source.
6460 static void InitLineEnds(Handle<Script> script); 6462 static void InitLineEnds(Handle<Script> script);
6461 6463
6462 // Get the JS object wrapping the given script; create it if none exists. 6464 // Get the JS object wrapping the given script; create it if none exists.
6463 static Handle<JSObject> GetWrapper(Handle<Script> script); 6465 static Handle<JSObject> GetWrapper(Handle<Script> script);
6464 6466
6467 // Look through the list of existing shared function infos to find one
6468 // that matches the function literal. Return empty handle if not found.
6469 MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(FunctionLiteral* fun);
6470
6465 // Dispatched behavior. 6471 // Dispatched behavior.
6466 DECLARE_PRINTER(Script) 6472 DECLARE_PRINTER(Script)
6467 DECLARE_VERIFIER(Script) 6473 DECLARE_VERIFIER(Script)
6468 6474
6469 static const int kSourceOffset = HeapObject::kHeaderSize; 6475 static const int kSourceOffset = HeapObject::kHeaderSize;
6470 static const int kNameOffset = kSourceOffset + kPointerSize; 6476 static const int kNameOffset = kSourceOffset + kPointerSize;
6471 static const int kLineOffsetOffset = kNameOffset + kPointerSize; 6477 static const int kLineOffsetOffset = kNameOffset + kPointerSize;
6472 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; 6478 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize;
6473 static const int kContextOffset = kColumnOffsetOffset + kPointerSize; 6479 static const int kContextOffset = kColumnOffsetOffset + kPointerSize;
6474 static const int kWrapperOffset = kContextOffset + kPointerSize; 6480 static const int kWrapperOffset = kContextOffset + kPointerSize;
6475 static const int kTypeOffset = kWrapperOffset + kPointerSize; 6481 static const int kTypeOffset = kWrapperOffset + kPointerSize;
6476 static const int kLineEndsOffset = kTypeOffset + kPointerSize; 6482 static const int kLineEndsOffset = kTypeOffset + kPointerSize;
6477 static const int kIdOffset = kLineEndsOffset + kPointerSize; 6483 static const int kIdOffset = kLineEndsOffset + kPointerSize;
6478 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize; 6484 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize;
6479 static const int kEvalFrominstructionsOffsetOffset = 6485 static const int kEvalFrominstructionsOffsetOffset =
6480 kEvalFromSharedOffset + kPointerSize; 6486 kEvalFromSharedOffset + kPointerSize;
6481 static const int kFlagsOffset = 6487 static const int kSharedFunctionInfosOffset =
6482 kEvalFrominstructionsOffsetOffset + kPointerSize; 6488 kEvalFrominstructionsOffsetOffset + kPointerSize;
6489 static const int kFlagsOffset = kSharedFunctionInfosOffset + kPointerSize;
6483 static const int kSourceUrlOffset = kFlagsOffset + kPointerSize; 6490 static const int kSourceUrlOffset = kFlagsOffset + kPointerSize;
6484 static const int kSourceMappingUrlOffset = kSourceUrlOffset + kPointerSize; 6491 static const int kSourceMappingUrlOffset = kSourceUrlOffset + kPointerSize;
6485 static const int kSize = kSourceMappingUrlOffset + kPointerSize; 6492 static const int kSize = kSourceMappingUrlOffset + kPointerSize;
6486 6493
6487 private: 6494 private:
6488 int GetLineNumberWithArray(int code_pos); 6495 int GetLineNumberWithArray(int code_pos);
6489 6496
6490 // Bit positions in the flags field. 6497 // Bit positions in the flags field.
6491 static const int kCompilationTypeBit = 0; 6498 static const int kCompilationTypeBit = 0;
6492 static const int kCompilationStateBit = 1; 6499 static const int kCompilationStateBit = 1;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
6603 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, 6610 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info,
6604 FunctionLiteral* lit); 6611 FunctionLiteral* lit);
6605 6612
6606 // Add a new entry to the optimized code map. 6613 // Add a new entry to the optimized code map.
6607 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6614 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6608 Handle<Context> native_context, 6615 Handle<Context> native_context,
6609 Handle<Code> code, 6616 Handle<Code> code,
6610 Handle<FixedArray> literals, 6617 Handle<FixedArray> literals,
6611 BailoutId osr_ast_id); 6618 BailoutId osr_ast_id);
6612 6619
6620 // Set up the link between shared function info and the script. The shared
6621 // function info is added to the list on the script.
6622 static void SetScript(Handle<SharedFunctionInfo> shared,
6623 Handle<Object> script_object);
6624
6613 // Layout description of the optimized code map. 6625 // Layout description of the optimized code map.
6614 static const int kNextMapIndex = 0; 6626 static const int kNextMapIndex = 0;
6615 static const int kEntriesStart = 1; 6627 static const int kEntriesStart = 1;
6616 static const int kContextOffset = 0; 6628 static const int kContextOffset = 0;
6617 static const int kCachedCodeOffset = 1; 6629 static const int kCachedCodeOffset = 1;
6618 static const int kLiteralsOffset = 2; 6630 static const int kLiteralsOffset = 2;
6619 static const int kOsrAstIdOffset = 3; 6631 static const int kOsrAstIdOffset = 3;
6620 static const int kEntryLength = 4; 6632 static const int kEntryLength = 4;
6621 static const int kInitialLength = kEntriesStart + kEntryLength; 6633 static const int kInitialLength = kEntriesStart + kEntryLength;
6622 6634
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
6816 6828
6817 // Indicates that this function is a default constructor. 6829 // Indicates that this function is a default constructor.
6818 DECL_BOOLEAN_ACCESSORS(is_default_constructor) 6830 DECL_BOOLEAN_ACCESSORS(is_default_constructor)
6819 6831
6820 // Indicates that this function is an asm function. 6832 // Indicates that this function is an asm function.
6821 DECL_BOOLEAN_ACCESSORS(asm_function) 6833 DECL_BOOLEAN_ACCESSORS(asm_function)
6822 6834
6823 // Indicates that the the shared function info is deserialized from cache. 6835 // Indicates that the the shared function info is deserialized from cache.
6824 DECL_BOOLEAN_ACCESSORS(deserialized) 6836 DECL_BOOLEAN_ACCESSORS(deserialized)
6825 6837
6838 // Indicates that the the shared function info has never been compiled before.
6839 DECL_BOOLEAN_ACCESSORS(never_compiled)
6840
6826 inline FunctionKind kind(); 6841 inline FunctionKind kind();
6827 inline void set_kind(FunctionKind kind); 6842 inline void set_kind(FunctionKind kind);
6828 6843
6829 // Indicates whether or not the code in the shared function support 6844 // Indicates whether or not the code in the shared function support
6830 // deoptimization. 6845 // deoptimization.
6831 inline bool has_deoptimization_support(); 6846 inline bool has_deoptimization_support();
6832 6847
6833 // Enable deoptimization support through recompiled code. 6848 // Enable deoptimization support through recompiled code.
6834 void EnableDeoptimizationSupport(Code* recompiled); 6849 void EnableDeoptimizationSupport(Code* recompiled);
6835 6850
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
7065 kIsArrow, 7080 kIsArrow,
7066 kIsGenerator, 7081 kIsGenerator,
7067 kIsConciseMethod, 7082 kIsConciseMethod,
7068 kIsAccessorFunction, 7083 kIsAccessorFunction,
7069 kIsDefaultConstructor, 7084 kIsDefaultConstructor,
7070 kIsSubclassConstructor, 7085 kIsSubclassConstructor,
7071 kIsBaseConstructor, 7086 kIsBaseConstructor,
7072 kInClassLiteral, 7087 kInClassLiteral,
7073 kIsAsmFunction, 7088 kIsAsmFunction,
7074 kDeserialized, 7089 kDeserialized,
7090 kNeverCompiled,
7075 kCompilerHintsCount // Pseudo entry 7091 kCompilerHintsCount // Pseudo entry
7076 }; 7092 };
7077 // Add hints for other modes when they're added. 7093 // Add hints for other modes when they're added.
7078 STATIC_ASSERT(LANGUAGE_END == 3); 7094 STATIC_ASSERT(LANGUAGE_END == 3);
7079 7095
7080 class FunctionKindBits : public BitField<FunctionKind, kIsArrow, 8> {}; 7096 class FunctionKindBits : public BitField<FunctionKind, kIsArrow, 8> {};
7081 7097
7082 class DeoptCountBits : public BitField<int, 0, 4> {}; 7098 class DeoptCountBits : public BitField<int, 0, 4> {};
7083 class OptReenableTriesBits : public BitField<int, 4, 18> {}; 7099 class OptReenableTriesBits : public BitField<int, 4, 18> {};
7084 class ICAgeBits : public BitField<int, 22, 8> {}; 7100 class ICAgeBits : public BitField<int, 22, 8> {};
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
7482 // Layout description. 7498 // Layout description.
7483 static const int kNativeContextOffset = JSObject::kHeaderSize; 7499 static const int kNativeContextOffset = JSObject::kHeaderSize;
7484 static const int kHashOffset = kNativeContextOffset + kPointerSize; 7500 static const int kHashOffset = kNativeContextOffset + kPointerSize;
7485 static const int kSize = kHashOffset + kPointerSize; 7501 static const int kSize = kHashOffset + kPointerSize;
7486 7502
7487 private: 7503 private:
7488 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); 7504 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy);
7489 }; 7505 };
7490 7506
7491 7507
7492 // Forward declaration.
7493 class JSBuiltinsObject;
7494
7495 // Common super class for JavaScript global objects and the special 7508 // Common super class for JavaScript global objects and the special
7496 // builtins global objects. 7509 // builtins global objects.
7497 class GlobalObject: public JSObject { 7510 class GlobalObject: public JSObject {
7498 public: 7511 public:
7499 // [builtins]: the object holding the runtime routines written in JS. 7512 // [builtins]: the object holding the runtime routines written in JS.
7500 DECL_ACCESSORS(builtins, JSBuiltinsObject) 7513 DECL_ACCESSORS(builtins, JSBuiltinsObject)
7501 7514
7502 // [native context]: the natives corresponding to this global object. 7515 // [native context]: the natives corresponding to this global object.
7503 DECL_ACCESSORS(native_context, Context) 7516 DECL_ACCESSORS(native_context, Context)
7504 7517
(...skipping 3297 matching lines...) Expand 10 before | Expand all | Expand 10 after
10802 } else { 10815 } else {
10803 value &= ~(1 << bit_position); 10816 value &= ~(1 << bit_position);
10804 } 10817 }
10805 return value; 10818 return value;
10806 } 10819 }
10807 }; 10820 };
10808 10821
10809 } } // namespace v8::internal 10822 } } // namespace v8::internal
10810 10823
10811 #endif // V8_OBJECTS_H_ 10824 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips64/full-codegen-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698