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 8932004: Implement target cache for constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Vyacheslav Egorov. Created 8 years, 10 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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 V(ExternalPixelArray) \ 786 V(ExternalPixelArray) \
787 V(ByteArray) \ 787 V(ByteArray) \
788 V(FreeSpace) \ 788 V(FreeSpace) \
789 V(JSReceiver) \ 789 V(JSReceiver) \
790 V(JSObject) \ 790 V(JSObject) \
791 V(JSContextExtensionObject) \ 791 V(JSContextExtensionObject) \
792 V(Map) \ 792 V(Map) \
793 V(DescriptorArray) \ 793 V(DescriptorArray) \
794 V(DeoptimizationInputData) \ 794 V(DeoptimizationInputData) \
795 V(DeoptimizationOutputData) \ 795 V(DeoptimizationOutputData) \
796 V(TypeFeedbackCells) \
796 V(FixedArray) \ 797 V(FixedArray) \
797 V(FixedDoubleArray) \ 798 V(FixedDoubleArray) \
798 V(Context) \ 799 V(Context) \
799 V(GlobalContext) \ 800 V(GlobalContext) \
800 V(ScopeInfo) \ 801 V(ScopeInfo) \
801 V(JSFunction) \ 802 V(JSFunction) \
802 V(Code) \ 803 V(Code) \
803 V(Oddball) \ 804 V(Oddball) \
804 V(SharedFunctionInfo) \ 805 V(SharedFunctionInfo) \
805 V(JSValue) \ 806 V(JSValue) \
(...skipping 3127 matching lines...) Expand 10 before | Expand all | Expand 10 after
3933 3934
3934 // Casting. 3935 // Casting.
3935 static inline DeoptimizationOutputData* cast(Object* obj); 3936 static inline DeoptimizationOutputData* cast(Object* obj);
3936 3937
3937 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 3938 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
3938 void DeoptimizationOutputDataPrint(FILE* out); 3939 void DeoptimizationOutputDataPrint(FILE* out);
3939 #endif 3940 #endif
3940 }; 3941 };
3941 3942
3942 3943
3944 // Forward declaration.
3945 class JSGlobalPropertyCell;
3946
3947 // TypeFeedbackCells is a fixed array used to hold the association between
3948 // cache cells and AST ids for code generated by the full compiler.
3949 // The format of the these objects is
3950 // [i * 2]: Global property cell of ith cache cell.
3951 // [i * 2 + 1]: Ast ID for ith cache cell.
3952 class TypeFeedbackCells: public FixedArray {
3953 public:
3954 int CellCount() { return length() / 2; }
3955 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; }
3956
3957 // Accessors for AST ids associated with cache values.
3958 inline Smi* AstId(int index);
3959 inline void SetAstId(int index, Smi* id);
3960
3961 // Accessors for global property cells holding the cache values.
3962 inline JSGlobalPropertyCell* Cell(int index);
3963 inline void SetCell(int index, JSGlobalPropertyCell* cell);
3964
3965 // The object that indicates an uninitialized cache.
3966 static inline Handle<Object> UninitializedSentinel(Isolate* isolate);
3967
3968 // The object that indicates a megamorphic state.
3969 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate);
3970
3971 // A raw version of the uninitialized sentinel that's safe to read during
3972 // garbage collection (e.g., for patching the cache).
3973 static inline Object* RawUninitializedSentinel(Heap* heap);
3974
3975 // Casting.
3976 static inline TypeFeedbackCells* cast(Object* obj);
3977 };
3978
3979
3980 // Forward declaration.
3943 class SafepointEntry; 3981 class SafepointEntry;
3944 3982
3945
3946 // Code describes objects with on-the-fly generated machine code. 3983 // Code describes objects with on-the-fly generated machine code.
3947 class Code: public HeapObject { 3984 class Code: public HeapObject {
3948 public: 3985 public:
3949 // Opaque data type for encapsulating code flags like kind, inline 3986 // Opaque data type for encapsulating code flags like kind, inline
3950 // cache state, and arguments count. 3987 // cache state, and arguments count.
3951 // FLAGS_MIN_VALUE and FLAGS_MAX_VALUE are specified to ensure that 3988 // FLAGS_MIN_VALUE and FLAGS_MAX_VALUE are specified to ensure that
3952 // enumeration type has correct value range (see Issue 830 for more details). 3989 // enumeration type has correct value range (see Issue 830 for more details).
3953 enum Flags { 3990 enum Flags {
3954 FLAGS_MIN_VALUE = kMinInt, 3991 FLAGS_MIN_VALUE = kMinInt,
3955 FLAGS_MAX_VALUE = kMaxInt 3992 FLAGS_MAX_VALUE = kMaxInt
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
4006 // [relocation_info]: Code relocation information 4043 // [relocation_info]: Code relocation information
4007 DECL_ACCESSORS(relocation_info, ByteArray) 4044 DECL_ACCESSORS(relocation_info, ByteArray)
4008 void InvalidateRelocation(); 4045 void InvalidateRelocation();
4009 4046
4010 // [handler_table]: Fixed array containing offsets of exception handlers. 4047 // [handler_table]: Fixed array containing offsets of exception handlers.
4011 DECL_ACCESSORS(handler_table, FixedArray) 4048 DECL_ACCESSORS(handler_table, FixedArray)
4012 4049
4013 // [deoptimization_data]: Array containing data for deopt. 4050 // [deoptimization_data]: Array containing data for deopt.
4014 DECL_ACCESSORS(deoptimization_data, FixedArray) 4051 DECL_ACCESSORS(deoptimization_data, FixedArray)
4015 4052
4053 // [type_feedback_cells]: Array containing cache cells used for type feedback.
4054 DECL_ACCESSORS(type_feedback_cells, TypeFeedbackCells)
4055
4016 // [code_flushing_candidate]: Field only used during garbage 4056 // [code_flushing_candidate]: Field only used during garbage
4017 // collection to hold code flushing candidates. The contents of this 4057 // collection to hold code flushing candidates. The contents of this
4018 // field does not have to be traced during garbage collection since 4058 // field does not have to be traced during garbage collection since
4019 // it is only used by the garbage collector itself. 4059 // it is only used by the garbage collector itself.
4020 DECL_ACCESSORS(next_code_flushing_candidate, Object) 4060 DECL_ACCESSORS(next_code_flushing_candidate, Object)
4021 4061
4022 // Unchecked accessors to be used during GC. 4062 // Unchecked accessors to be used during GC.
4023 inline ByteArray* unchecked_relocation_info(); 4063 inline ByteArray* unchecked_relocation_info();
4024 inline FixedArray* unchecked_deoptimization_data(); 4064 inline FixedArray* unchecked_deoptimization_data();
4025 4065
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
4115 inline void set_binary_op_result_type(byte value); 4155 inline void set_binary_op_result_type(byte value);
4116 4156
4117 // [compare state]: For kind COMPARE_IC, tells what state the stub is in. 4157 // [compare state]: For kind COMPARE_IC, tells what state the stub is in.
4118 inline byte compare_state(); 4158 inline byte compare_state();
4119 inline void set_compare_state(byte value); 4159 inline void set_compare_state(byte value);
4120 4160
4121 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in. 4161 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in.
4122 inline byte to_boolean_state(); 4162 inline byte to_boolean_state();
4123 inline void set_to_boolean_state(byte value); 4163 inline void set_to_boolean_state(byte value);
4124 4164
4125 // For kind STUB, major_key == CallFunction, tells whether there is
4126 // a function cache in the instruction stream.
4127 inline bool has_function_cache();
4128 inline void set_has_function_cache(bool flag);
4129
4130 // Get the safepoint entry for the given pc. 4165 // Get the safepoint entry for the given pc.
4131 SafepointEntry GetSafepointEntry(Address pc); 4166 SafepointEntry GetSafepointEntry(Address pc);
4132 4167
4133 // Mark this code object as not having a stack check table. Assumes kind 4168 // Mark this code object as not having a stack check table. Assumes kind
4134 // is FUNCTION. 4169 // is FUNCTION.
4135 void SetNoStackCheckTable(); 4170 void SetNoStackCheckTable();
4136 4171
4137 // Find the first map in an IC stub. 4172 // Find the first map in an IC stub.
4138 Map* FindFirstMap(); 4173 Map* FindFirstMap();
4139 4174
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
4234 // Max loop nesting marker used to postpose OSR. We don't take loop 4269 // Max loop nesting marker used to postpose OSR. We don't take loop
4235 // nesting that is deeper than 5 levels into account. 4270 // nesting that is deeper than 5 levels into account.
4236 static const int kMaxLoopNestingMarker = 6; 4271 static const int kMaxLoopNestingMarker = 6;
4237 4272
4238 // Layout description. 4273 // Layout description.
4239 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; 4274 static const int kInstructionSizeOffset = HeapObject::kHeaderSize;
4240 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; 4275 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize;
4241 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; 4276 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize;
4242 static const int kDeoptimizationDataOffset = 4277 static const int kDeoptimizationDataOffset =
4243 kHandlerTableOffset + kPointerSize; 4278 kHandlerTableOffset + kPointerSize;
4279 static const int kTypeFeedbackCellsOffset =
4280 kDeoptimizationDataOffset + kPointerSize;
4244 static const int kNextCodeFlushingCandidateOffset = 4281 static const int kNextCodeFlushingCandidateOffset =
4245 kDeoptimizationDataOffset + kPointerSize; 4282 kTypeFeedbackCellsOffset + kPointerSize;
4246 static const int kFlagsOffset = 4283 static const int kFlagsOffset =
4247 kNextCodeFlushingCandidateOffset + kPointerSize; 4284 kNextCodeFlushingCandidateOffset + kPointerSize;
4248 4285
4249 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; 4286 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize;
4250 static const int kKindSpecificFlagsSize = 2 * kIntSize; 4287 static const int kKindSpecificFlagsSize = 2 * kIntSize;
4251 4288
4252 static const int kHeaderPaddingStart = kKindSpecificFlagsOffset + 4289 static const int kHeaderPaddingStart = kKindSpecificFlagsOffset +
4253 kKindSpecificFlagsSize; 4290 kKindSpecificFlagsSize;
4254 4291
4255 // Add padding to align the instruction start following right after 4292 // Add padding to align the instruction start following right after
4256 // the Code object header. 4293 // the Code object header.
4257 static const int kHeaderSize = 4294 static const int kHeaderSize =
4258 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; 4295 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask;
4259 4296
4260 // Byte offsets within kKindSpecificFlagsOffset. 4297 // Byte offsets within kKindSpecificFlagsOffset.
4261 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset; 4298 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset;
4262 static const int kOptimizableOffset = kKindSpecificFlagsOffset; 4299 static const int kOptimizableOffset = kKindSpecificFlagsOffset;
4263 static const int kStackSlotsOffset = kKindSpecificFlagsOffset; 4300 static const int kStackSlotsOffset = kKindSpecificFlagsOffset;
4264 static const int kCheckTypeOffset = kKindSpecificFlagsOffset; 4301 static const int kCheckTypeOffset = kKindSpecificFlagsOffset;
4265 4302
4266 static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1; 4303 static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1;
4267 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1; 4304 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1;
4268 static const int kCompareStateOffset = kStubMajorKeyOffset + 1; 4305 static const int kCompareStateOffset = kStubMajorKeyOffset + 1;
4269 static const int kToBooleanTypeOffset = kStubMajorKeyOffset + 1; 4306 static const int kToBooleanTypeOffset = kStubMajorKeyOffset + 1;
4270 static const int kHasFunctionCacheOffset = kStubMajorKeyOffset + 1;
4271 4307
4272 static const int kFullCodeFlags = kOptimizableOffset + 1; 4308 static const int kFullCodeFlags = kOptimizableOffset + 1;
4273 class FullCodeFlagsHasDeoptimizationSupportField: 4309 class FullCodeFlagsHasDeoptimizationSupportField:
4274 public BitField<bool, 0, 1> {}; // NOLINT 4310 public BitField<bool, 0, 1> {}; // NOLINT
4275 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; 4311 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {};
4276 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; 4312 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {};
4277 4313
4278 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; 4314 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1;
4279 4315
4280 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; 4316 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1;
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after
5651 static const int kContextOffset = JSObject::kHeaderSize; 5687 static const int kContextOffset = JSObject::kHeaderSize;
5652 static const int kSize = kContextOffset + kPointerSize; 5688 static const int kSize = kContextOffset + kPointerSize;
5653 5689
5654 private: 5690 private:
5655 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); 5691 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy);
5656 }; 5692 };
5657 5693
5658 5694
5659 // Forward declaration. 5695 // Forward declaration.
5660 class JSBuiltinsObject; 5696 class JSBuiltinsObject;
5661 class JSGlobalPropertyCell;
5662 5697
5663 // Common super class for JavaScript global objects and the special 5698 // Common super class for JavaScript global objects and the special
5664 // builtins global objects. 5699 // builtins global objects.
5665 class GlobalObject: public JSObject { 5700 class GlobalObject: public JSObject {
5666 public: 5701 public:
5667 // [builtins]: the object holding the runtime routines written in JS. 5702 // [builtins]: the object holding the runtime routines written in JS.
5668 DECL_ACCESSORS(builtins, JSBuiltinsObject) 5703 DECL_ACCESSORS(builtins, JSBuiltinsObject)
5669 5704
5670 // [global context]: the global context corresponding to this global object. 5705 // [global context]: the global context corresponding to this global object.
5671 DECL_ACCESSORS(global_context, Context) 5706 DECL_ACCESSORS(global_context, Context)
(...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after
8154 } else { 8189 } else {
8155 value &= ~(1 << bit_position); 8190 value &= ~(1 << bit_position);
8156 } 8191 }
8157 return value; 8192 return value;
8158 } 8193 }
8159 }; 8194 };
8160 8195
8161 } } // namespace v8::internal 8196 } } // namespace v8::internal
8162 8197
8163 #endif // V8_OBJECTS_H_ 8198 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects-inl.h » ('j') | src/type-info.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698