OLD | NEW |
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 "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
11 #include "src/checks.h" | 11 #include "src/checks.h" |
12 #include "src/elements-kind.h" | 12 #include "src/elements-kind.h" |
13 #include "src/field-index.h" | 13 #include "src/field-index.h" |
14 #include "src/flags.h" | 14 #include "src/flags.h" |
15 #include "src/list.h" | 15 #include "src/list.h" |
16 #include "src/ostreams.h" | |
17 #include "src/property-details.h" | 16 #include "src/property-details.h" |
18 #include "src/smart-pointers.h" | 17 #include "src/smart-pointers.h" |
19 #include "src/unicode-inl.h" | 18 #include "src/unicode-inl.h" |
20 #include "src/zone.h" | 19 #include "src/zone.h" |
21 | 20 |
22 #if V8_TARGET_ARCH_ARM | 21 #if V8_TARGET_ARCH_ARM |
23 #include "src/arm/constants-arm.h" // NOLINT | 22 #include "src/arm/constants-arm.h" // NOLINT |
24 #elif V8_TARGET_ARCH_ARM64 | 23 #elif V8_TARGET_ARCH_ARM64 |
25 #include "src/arm64/constants-arm64.h" // NOLINT | 24 #include "src/arm64/constants-arm64.h" // NOLINT |
26 #elif V8_TARGET_ARCH_MIPS | 25 #elif V8_TARGET_ARCH_MIPS |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // - BreakPointInfo | 138 // - BreakPointInfo |
140 // - CodeCache | 139 // - CodeCache |
141 // | 140 // |
142 // Formats of Object*: | 141 // Formats of Object*: |
143 // Smi: [31 bit signed int] 0 | 142 // Smi: [31 bit signed int] 0 |
144 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 | 143 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 |
145 | 144 |
146 namespace v8 { | 145 namespace v8 { |
147 namespace internal { | 146 namespace internal { |
148 | 147 |
| 148 class OStream; |
| 149 |
149 enum KeyedAccessStoreMode { | 150 enum KeyedAccessStoreMode { |
150 STANDARD_STORE, | 151 STANDARD_STORE, |
151 STORE_TRANSITION_SMI_TO_OBJECT, | 152 STORE_TRANSITION_SMI_TO_OBJECT, |
152 STORE_TRANSITION_SMI_TO_DOUBLE, | 153 STORE_TRANSITION_SMI_TO_DOUBLE, |
153 STORE_TRANSITION_DOUBLE_TO_OBJECT, | 154 STORE_TRANSITION_DOUBLE_TO_OBJECT, |
154 STORE_TRANSITION_HOLEY_SMI_TO_OBJECT, | 155 STORE_TRANSITION_HOLEY_SMI_TO_OBJECT, |
155 STORE_TRANSITION_HOLEY_SMI_TO_DOUBLE, | 156 STORE_TRANSITION_HOLEY_SMI_TO_DOUBLE, |
156 STORE_TRANSITION_HOLEY_DOUBLE_TO_OBJECT, | 157 STORE_TRANSITION_HOLEY_DOUBLE_TO_OBJECT, |
157 STORE_AND_GROW_NO_TRANSITION, | 158 STORE_AND_GROW_NO_TRANSITION, |
158 STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT, | 159 STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT, |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 INLINE(bool IsTrue() const); | 1412 INLINE(bool IsTrue() const); |
1412 INLINE(bool IsFalse() const); | 1413 INLINE(bool IsFalse() const); |
1413 INLINE(bool IsArgumentsMarker() const); | 1414 INLINE(bool IsArgumentsMarker() const); |
1414 | 1415 |
1415 // Filler objects (fillers and free space objects). | 1416 // Filler objects (fillers and free space objects). |
1416 INLINE(bool IsFiller() const); | 1417 INLINE(bool IsFiller() const); |
1417 | 1418 |
1418 // Extract the number. | 1419 // Extract the number. |
1419 inline double Number(); | 1420 inline double Number(); |
1420 INLINE(bool IsNaN() const); | 1421 INLINE(bool IsNaN() const); |
| 1422 INLINE(bool IsMinusZero() const); |
1421 bool ToInt32(int32_t* value); | 1423 bool ToInt32(int32_t* value); |
1422 bool ToUint32(uint32_t* value); | 1424 bool ToUint32(uint32_t* value); |
1423 | 1425 |
1424 inline Representation OptimalRepresentation() { | 1426 inline Representation OptimalRepresentation() { |
1425 if (!FLAG_track_fields) return Representation::Tagged(); | 1427 if (!FLAG_track_fields) return Representation::Tagged(); |
1426 if (IsSmi()) { | 1428 if (IsSmi()) { |
1427 return Representation::Smi(); | 1429 return Representation::Smi(); |
1428 } else if (FLAG_track_double_fields && IsHeapNumber()) { | 1430 } else if (FLAG_track_double_fields && IsHeapNumber()) { |
1429 return Representation::Double(); | 1431 return Representation::Double(); |
1430 } else if (FLAG_track_computed_fields && IsUninitialized()) { | 1432 } else if (FLAG_track_computed_fields && IsUninitialized()) { |
(...skipping 3182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4613 | 4615 |
4614 // Return the name of the given context local. | 4616 // Return the name of the given context local. |
4615 String* ContextLocalName(int var); | 4617 String* ContextLocalName(int var); |
4616 | 4618 |
4617 // Return the mode of the given context local. | 4619 // Return the mode of the given context local. |
4618 VariableMode ContextLocalMode(int var); | 4620 VariableMode ContextLocalMode(int var); |
4619 | 4621 |
4620 // Return the initialization flag of the given context local. | 4622 // Return the initialization flag of the given context local. |
4621 InitializationFlag ContextLocalInitFlag(int var); | 4623 InitializationFlag ContextLocalInitFlag(int var); |
4622 | 4624 |
| 4625 // Return the initialization flag of the given context local. |
| 4626 MaybeAssignedFlag ContextLocalMaybeAssignedFlag(int var); |
| 4627 |
4623 // Return true if this local was introduced by the compiler, and should not be | 4628 // Return true if this local was introduced by the compiler, and should not be |
4624 // exposed to the user in a debugger. | 4629 // exposed to the user in a debugger. |
4625 bool LocalIsSynthetic(int var); | 4630 bool LocalIsSynthetic(int var); |
4626 | 4631 |
4627 // Lookup support for serialized scope info. Returns the | 4632 // Lookup support for serialized scope info. Returns the |
4628 // the stack slot index for a given slot name if the slot is | 4633 // the stack slot index for a given slot name if the slot is |
4629 // present; otherwise returns a value < 0. The name must be an internalized | 4634 // present; otherwise returns a value < 0. The name must be an internalized |
4630 // string. | 4635 // string. |
4631 int StackSlotIndex(String* name); | 4636 int StackSlotIndex(String* name); |
4632 | 4637 |
4633 // Lookup support for serialized scope info. Returns the | 4638 // Lookup support for serialized scope info. Returns the |
4634 // context slot index for a given slot name if the slot is present; otherwise | 4639 // context slot index for a given slot name if the slot is present; otherwise |
4635 // returns a value < 0. The name must be an internalized string. | 4640 // returns a value < 0. The name must be an internalized string. |
4636 // If the slot is present and mode != NULL, sets *mode to the corresponding | 4641 // If the slot is present and mode != NULL, sets *mode to the corresponding |
4637 // mode for that variable. | 4642 // mode for that variable. |
4638 static int ContextSlotIndex(Handle<ScopeInfo> scope_info, | 4643 static int ContextSlotIndex(Handle<ScopeInfo> scope_info, Handle<String> name, |
4639 Handle<String> name, | 4644 VariableMode* mode, InitializationFlag* init_flag, |
4640 VariableMode* mode, | 4645 MaybeAssignedFlag* maybe_assigned_flag); |
4641 InitializationFlag* init_flag); | |
4642 | 4646 |
4643 // Lookup support for serialized scope info. Returns the | 4647 // Lookup support for serialized scope info. Returns the |
4644 // parameter index for a given parameter name if the parameter is present; | 4648 // parameter index for a given parameter name if the parameter is present; |
4645 // otherwise returns a value < 0. The name must be an internalized string. | 4649 // otherwise returns a value < 0. The name must be an internalized string. |
4646 int ParameterIndex(String* name); | 4650 int ParameterIndex(String* name); |
4647 | 4651 |
4648 // Lookup support for serialized scope info. Returns the function context | 4652 // Lookup support for serialized scope info. Returns the function context |
4649 // slot index if the function name is present and context-allocated (named | 4653 // slot index if the function name is present and context-allocated (named |
4650 // function expressions, only), otherwise returns a value < 0. The name | 4654 // function expressions, only), otherwise returns a value < 0. The name |
4651 // must be an internalized string. | 4655 // must be an internalized string. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4749 class ScopeTypeField: public BitField<ScopeType, 0, 3> {}; | 4753 class ScopeTypeField: public BitField<ScopeType, 0, 3> {}; |
4750 class CallsEvalField: public BitField<bool, 3, 1> {}; | 4754 class CallsEvalField: public BitField<bool, 3, 1> {}; |
4751 class StrictModeField: public BitField<StrictMode, 4, 1> {}; | 4755 class StrictModeField: public BitField<StrictMode, 4, 1> {}; |
4752 class FunctionVariableField: public BitField<FunctionVariableInfo, 5, 2> {}; | 4756 class FunctionVariableField: public BitField<FunctionVariableInfo, 5, 2> {}; |
4753 class FunctionVariableMode: public BitField<VariableMode, 7, 3> {}; | 4757 class FunctionVariableMode: public BitField<VariableMode, 7, 3> {}; |
4754 | 4758 |
4755 // BitFields representing the encoded information for context locals in the | 4759 // BitFields representing the encoded information for context locals in the |
4756 // ContextLocalInfoEntries part. | 4760 // ContextLocalInfoEntries part. |
4757 class ContextLocalMode: public BitField<VariableMode, 0, 3> {}; | 4761 class ContextLocalMode: public BitField<VariableMode, 0, 3> {}; |
4758 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {}; | 4762 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {}; |
| 4763 class ContextLocalMaybeAssignedFlag |
| 4764 : public BitField<MaybeAssignedFlag, 4, 1> {}; |
4759 }; | 4765 }; |
4760 | 4766 |
4761 | 4767 |
4762 // The cache for maps used by normalized (dictionary mode) objects. | 4768 // The cache for maps used by normalized (dictionary mode) objects. |
4763 // Such maps do not have property descriptors, so a typical program | 4769 // Such maps do not have property descriptors, so a typical program |
4764 // needs very limited number of distinct normalized maps. | 4770 // needs very limited number of distinct normalized maps. |
4765 class NormalizedMapCache: public FixedArray { | 4771 class NormalizedMapCache: public FixedArray { |
4766 public: | 4772 public: |
4767 static Handle<NormalizedMapCache> New(Isolate* isolate); | 4773 static Handle<NormalizedMapCache> New(Isolate* isolate); |
4768 | 4774 |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5231 // DeoptimizationInputData is a fixed array used to hold the deoptimization | 5237 // DeoptimizationInputData is a fixed array used to hold the deoptimization |
5232 // data for code generated by the Hydrogen/Lithium compiler. It also | 5238 // data for code generated by the Hydrogen/Lithium compiler. It also |
5233 // contains information about functions that were inlined. If N different | 5239 // contains information about functions that were inlined. If N different |
5234 // functions were inlined then first N elements of the literal array will | 5240 // functions were inlined then first N elements of the literal array will |
5235 // contain these functions. | 5241 // contain these functions. |
5236 // | 5242 // |
5237 // It can be empty. | 5243 // It can be empty. |
5238 class DeoptimizationInputData: public FixedArray { | 5244 class DeoptimizationInputData: public FixedArray { |
5239 public: | 5245 public: |
5240 // Layout description. Indices in the array. | 5246 // Layout description. Indices in the array. |
5241 static const int kTranslationByteArrayIndex = 0; | 5247 static const int kDeoptEntryCountIndex = 0; |
5242 static const int kInlinedFunctionCountIndex = 1; | 5248 static const int kReturnAddressPatchEntryCountIndex = 1; |
5243 static const int kLiteralArrayIndex = 2; | 5249 static const int kTranslationByteArrayIndex = 2; |
5244 static const int kOsrAstIdIndex = 3; | 5250 static const int kInlinedFunctionCountIndex = 3; |
5245 static const int kOsrPcOffsetIndex = 4; | 5251 static const int kLiteralArrayIndex = 4; |
5246 static const int kOptimizationIdIndex = 5; | 5252 static const int kOsrAstIdIndex = 5; |
5247 static const int kSharedFunctionInfoIndex = 6; | 5253 static const int kOsrPcOffsetIndex = 6; |
5248 static const int kFirstDeoptEntryIndex = 7; | 5254 static const int kOptimizationIdIndex = 7; |
| 5255 static const int kSharedFunctionInfoIndex = 8; |
| 5256 static const int kFirstDeoptEntryIndex = 9; |
5249 | 5257 |
5250 // Offsets of deopt entry elements relative to the start of the entry. | 5258 // Offsets of deopt entry elements relative to the start of the entry. |
5251 static const int kAstIdRawOffset = 0; | 5259 static const int kAstIdRawOffset = 0; |
5252 static const int kTranslationIndexOffset = 1; | 5260 static const int kTranslationIndexOffset = 1; |
5253 static const int kArgumentsStackHeightOffset = 2; | 5261 static const int kArgumentsStackHeightOffset = 2; |
5254 static const int kPcOffset = 3; | 5262 static const int kPcOffset = 3; |
5255 static const int kDeoptEntrySize = 4; | 5263 static const int kDeoptEntrySize = 4; |
5256 | 5264 |
| 5265 // Offsets of return address patch entry elements relative to the start of the |
| 5266 // entry |
| 5267 static const int kReturnAddressPcOffset = 0; |
| 5268 static const int kPatchedAddressPcOffset = 1; |
| 5269 static const int kReturnAddressPatchEntrySize = 2; |
| 5270 |
5257 // Simple element accessors. | 5271 // Simple element accessors. |
5258 #define DEFINE_ELEMENT_ACCESSORS(name, type) \ | 5272 #define DEFINE_ELEMENT_ACCESSORS(name, type) \ |
5259 type* name() { \ | 5273 type* name() { \ |
5260 return type::cast(get(k##name##Index)); \ | 5274 return type::cast(get(k##name##Index)); \ |
5261 } \ | 5275 } \ |
5262 void Set##name(type* value) { \ | 5276 void Set##name(type* value) { \ |
5263 set(k##name##Index, value); \ | 5277 set(k##name##Index, value); \ |
5264 } | 5278 } |
5265 | 5279 |
5266 DEFINE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) | 5280 DEFINE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) |
5267 DEFINE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) | 5281 DEFINE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) |
5268 DEFINE_ELEMENT_ACCESSORS(LiteralArray, FixedArray) | 5282 DEFINE_ELEMENT_ACCESSORS(LiteralArray, FixedArray) |
5269 DEFINE_ELEMENT_ACCESSORS(OsrAstId, Smi) | 5283 DEFINE_ELEMENT_ACCESSORS(OsrAstId, Smi) |
5270 DEFINE_ELEMENT_ACCESSORS(OsrPcOffset, Smi) | 5284 DEFINE_ELEMENT_ACCESSORS(OsrPcOffset, Smi) |
5271 DEFINE_ELEMENT_ACCESSORS(OptimizationId, Smi) | 5285 DEFINE_ELEMENT_ACCESSORS(OptimizationId, Smi) |
5272 DEFINE_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) | 5286 DEFINE_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) |
5273 | 5287 |
5274 #undef DEFINE_ELEMENT_ACCESSORS | 5288 #undef DEFINE_ELEMENT_ACCESSORS |
5275 | 5289 |
5276 // Accessors for elements of the ith deoptimization entry. | 5290 // Accessors for elements of the ith deoptimization entry. |
5277 #define DEFINE_ENTRY_ACCESSORS(name, type) \ | 5291 #define DEFINE_DEOPT_ENTRY_ACCESSORS(name, type) \ |
5278 type* name(int i) { \ | 5292 type* name(int i) { \ |
5279 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ | 5293 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ |
5280 } \ | 5294 } \ |
5281 void Set##name(int i, type* value) { \ | 5295 void Set##name(int i, type* value) { \ |
5282 set(IndexForEntry(i) + k##name##Offset, value); \ | 5296 set(IndexForEntry(i) + k##name##Offset, value); \ |
5283 } | 5297 } |
5284 | 5298 |
5285 DEFINE_ENTRY_ACCESSORS(AstIdRaw, Smi) | 5299 DEFINE_DEOPT_ENTRY_ACCESSORS(AstIdRaw, Smi) |
5286 DEFINE_ENTRY_ACCESSORS(TranslationIndex, Smi) | 5300 DEFINE_DEOPT_ENTRY_ACCESSORS(TranslationIndex, Smi) |
5287 DEFINE_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) | 5301 DEFINE_DEOPT_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) |
5288 DEFINE_ENTRY_ACCESSORS(Pc, Smi) | 5302 DEFINE_DEOPT_ENTRY_ACCESSORS(Pc, Smi) |
5289 | 5303 |
5290 #undef DEFINE_ENTRY_ACCESSORS | 5304 #undef DEFINE_DEOPT_ENTRY_ACCESSORS |
| 5305 |
| 5306 // Accessors for elements of the ith deoptimization entry. |
| 5307 #define DEFINE_PATCH_ENTRY_ACCESSORS(name, type) \ |
| 5308 type* name(int i) { \ |
| 5309 return type::cast( \ |
| 5310 get(IndexForReturnAddressPatchEntry(i) + k##name##Offset)); \ |
| 5311 } \ |
| 5312 void Set##name(int i, type* value) { \ |
| 5313 set(IndexForReturnAddressPatchEntry(i) + k##name##Offset, value); \ |
| 5314 } |
| 5315 |
| 5316 DEFINE_PATCH_ENTRY_ACCESSORS(ReturnAddressPc, Smi) |
| 5317 DEFINE_PATCH_ENTRY_ACCESSORS(PatchedAddressPc, Smi) |
| 5318 |
| 5319 #undef DEFINE_PATCH_ENTRY_ACCESSORS |
5291 | 5320 |
5292 BailoutId AstId(int i) { | 5321 BailoutId AstId(int i) { |
5293 return BailoutId(AstIdRaw(i)->value()); | 5322 return BailoutId(AstIdRaw(i)->value()); |
5294 } | 5323 } |
5295 | 5324 |
5296 void SetAstId(int i, BailoutId value) { | 5325 void SetAstId(int i, BailoutId value) { |
5297 SetAstIdRaw(i, Smi::FromInt(value.ToInt())); | 5326 SetAstIdRaw(i, Smi::FromInt(value.ToInt())); |
5298 } | 5327 } |
5299 | 5328 |
5300 int DeoptCount() { | 5329 int DeoptCount() { |
5301 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize; | 5330 return length() == 0 ? 0 : Smi::cast(get(kDeoptEntryCountIndex))->value(); |
| 5331 } |
| 5332 |
| 5333 int ReturnAddressPatchCount() { |
| 5334 return length() == 0 |
| 5335 ? 0 |
| 5336 : Smi::cast(get(kReturnAddressPatchEntryCountIndex))->value(); |
5302 } | 5337 } |
5303 | 5338 |
5304 // Allocates a DeoptimizationInputData. | 5339 // Allocates a DeoptimizationInputData. |
5305 static Handle<DeoptimizationInputData> New(Isolate* isolate, | 5340 static Handle<DeoptimizationInputData> New(Isolate* isolate, |
5306 int deopt_entry_count, | 5341 int deopt_entry_count, |
| 5342 int return_address_patch_count, |
5307 PretenureFlag pretenure); | 5343 PretenureFlag pretenure); |
5308 | 5344 |
5309 DECLARE_CAST(DeoptimizationInputData) | 5345 DECLARE_CAST(DeoptimizationInputData) |
5310 | 5346 |
5311 #ifdef ENABLE_DISASSEMBLER | 5347 #ifdef ENABLE_DISASSEMBLER |
5312 void DeoptimizationInputDataPrint(OStream& os); // NOLINT | 5348 void DeoptimizationInputDataPrint(OStream& os); // NOLINT |
5313 #endif | 5349 #endif |
5314 | 5350 |
5315 private: | 5351 private: |
| 5352 friend class Object; // For accessing LengthFor. |
| 5353 |
5316 static int IndexForEntry(int i) { | 5354 static int IndexForEntry(int i) { |
5317 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); | 5355 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); |
5318 } | 5356 } |
5319 | 5357 |
5320 static int LengthFor(int entry_count) { | 5358 int IndexForReturnAddressPatchEntry(int i) { |
5321 return IndexForEntry(entry_count); | 5359 return kFirstDeoptEntryIndex + (DeoptCount() * kDeoptEntrySize) + |
| 5360 (i * kReturnAddressPatchEntrySize); |
| 5361 } |
| 5362 |
| 5363 static int LengthFor(int deopt_count, int return_address_patch_count) { |
| 5364 return kFirstDeoptEntryIndex + (deopt_count * kDeoptEntrySize) + |
| 5365 (return_address_patch_count * kReturnAddressPatchEntrySize); |
5322 } | 5366 } |
5323 }; | 5367 }; |
5324 | 5368 |
5325 | 5369 |
5326 // DeoptimizationOutputData is a fixed array used to hold the deoptimization | 5370 // DeoptimizationOutputData is a fixed array used to hold the deoptimization |
5327 // data for code generated by the full compiler. | 5371 // data for code generated by the full compiler. |
5328 // The format of the these objects is | 5372 // The format of the these objects is |
5329 // [i * 2]: Ast ID for ith deoptimization. | 5373 // [i * 2]: Ast ID for ith deoptimization. |
5330 // [i * 2 + 1]: PC and state of ith deoptimization | 5374 // [i * 2 + 1]: PC and state of ith deoptimization |
5331 class DeoptimizationOutputData: public FixedArray { | 5375 class DeoptimizationOutputData: public FixedArray { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5512 return (k == LOAD_IC || k == STORE_IC || k == KEYED_LOAD_IC || | 5556 return (k == LOAD_IC || k == STORE_IC || k == KEYED_LOAD_IC || |
5513 k == KEYED_STORE_IC || k == COMPARE_NIL_IC) && | 5557 k == KEYED_STORE_IC || k == COMPARE_NIL_IC) && |
5514 ic_state() == MONOMORPHIC; | 5558 ic_state() == MONOMORPHIC; |
5515 } | 5559 } |
5516 | 5560 |
5517 inline bool IsCodeStubOrIC(); | 5561 inline bool IsCodeStubOrIC(); |
5518 | 5562 |
5519 inline void set_raw_kind_specific_flags1(int value); | 5563 inline void set_raw_kind_specific_flags1(int value); |
5520 inline void set_raw_kind_specific_flags2(int value); | 5564 inline void set_raw_kind_specific_flags2(int value); |
5521 | 5565 |
5522 // For kind STUB or ICs, tells whether or not a code object was generated by | 5566 // [is_crankshafted]: For kind STUB or ICs, tells whether or not a code |
5523 // the optimizing compiler (but it may not be an optimized function). | 5567 // object was generated by either the hydrogen or the TurboFan optimizing |
5524 bool is_crankshafted(); | 5568 // compiler (but it may not be an optimized function). |
5525 bool is_hydrogen_stub(); // Crankshafted, but not a function. | 5569 inline bool is_crankshafted(); |
| 5570 inline bool is_hydrogen_stub(); // Crankshafted, but not a function. |
5526 inline void set_is_crankshafted(bool value); | 5571 inline void set_is_crankshafted(bool value); |
5527 | 5572 |
| 5573 // [is_turbofanned]: For kind STUB or OPTIMIZED_FUNCTION, tells whether the |
| 5574 // code object was generated by the TurboFan optimizing compiler. |
| 5575 inline bool is_turbofanned(); |
| 5576 inline void set_is_turbofanned(bool value); |
| 5577 |
5528 // [optimizable]: For FUNCTION kind, tells if it is optimizable. | 5578 // [optimizable]: For FUNCTION kind, tells if it is optimizable. |
5529 inline bool optimizable(); | 5579 inline bool optimizable(); |
5530 inline void set_optimizable(bool value); | 5580 inline void set_optimizable(bool value); |
5531 | 5581 |
5532 // [has_deoptimization_support]: For FUNCTION kind, tells if it has | 5582 // [has_deoptimization_support]: For FUNCTION kind, tells if it has |
5533 // deoptimization support. | 5583 // deoptimization support. |
5534 inline bool has_deoptimization_support(); | 5584 inline bool has_deoptimization_support(); |
5535 inline void set_has_deoptimization_support(bool value); | 5585 inline void set_has_deoptimization_support(bool value); |
5536 | 5586 |
5537 // [has_debug_break_slots]: For FUNCTION kind, tells if it has | 5587 // [has_debug_break_slots]: For FUNCTION kind, tells if it has |
(...skipping 20 matching lines...) Expand all Loading... |
5558 | 5608 |
5559 // [builtin_index]: For BUILTIN kind, tells which builtin index it has. | 5609 // [builtin_index]: For BUILTIN kind, tells which builtin index it has. |
5560 inline int builtin_index(); | 5610 inline int builtin_index(); |
5561 inline void set_builtin_index(int id); | 5611 inline void set_builtin_index(int id); |
5562 | 5612 |
5563 // [stack_slots]: For kind OPTIMIZED_FUNCTION, the number of stack slots | 5613 // [stack_slots]: For kind OPTIMIZED_FUNCTION, the number of stack slots |
5564 // reserved in the code prologue. | 5614 // reserved in the code prologue. |
5565 inline unsigned stack_slots(); | 5615 inline unsigned stack_slots(); |
5566 inline void set_stack_slots(unsigned slots); | 5616 inline void set_stack_slots(unsigned slots); |
5567 | 5617 |
5568 // [safepoint_table_start]: For kind OPTIMIZED_CODE, the offset in | 5618 // [safepoint_table_start]: For kind OPTIMIZED_FUNCTION, the offset in |
5569 // the instruction stream where the safepoint table starts. | 5619 // the instruction stream where the safepoint table starts. |
5570 inline unsigned safepoint_table_offset(); | 5620 inline unsigned safepoint_table_offset(); |
5571 inline void set_safepoint_table_offset(unsigned offset); | 5621 inline void set_safepoint_table_offset(unsigned offset); |
5572 | 5622 |
5573 // [back_edge_table_start]: For kind FUNCTION, the offset in the | 5623 // [back_edge_table_start]: For kind FUNCTION, the offset in the |
5574 // instruction stream where the back edge table starts. | 5624 // instruction stream where the back edge table starts. |
5575 inline unsigned back_edge_table_offset(); | 5625 inline unsigned back_edge_table_offset(); |
5576 inline void set_back_edge_table_offset(unsigned offset); | 5626 inline void set_back_edge_table_offset(unsigned offset); |
5577 | 5627 |
5578 inline bool back_edges_patched_for_osr(); | 5628 inline bool back_edges_patched_for_osr(); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5765 | 5815 |
5766 #ifdef VERIFY_HEAP | 5816 #ifdef VERIFY_HEAP |
5767 void VerifyEmbeddedObjectsDependency(); | 5817 void VerifyEmbeddedObjectsDependency(); |
5768 #endif | 5818 #endif |
5769 | 5819 |
5770 inline bool CanContainWeakObjects() { | 5820 inline bool CanContainWeakObjects() { |
5771 return is_optimized_code() || is_weak_stub(); | 5821 return is_optimized_code() || is_weak_stub(); |
5772 } | 5822 } |
5773 | 5823 |
5774 inline bool IsWeakObject(Object* object) { | 5824 inline bool IsWeakObject(Object* object) { |
5775 return (is_optimized_code() && IsWeakObjectInOptimizedCode(object)) || | 5825 return (is_optimized_code() && !is_turbofanned() && |
5776 (is_weak_stub() && IsWeakObjectInIC(object)); | 5826 IsWeakObjectInOptimizedCode(object)) || |
| 5827 (is_weak_stub() && |
| 5828 IsWeakObjectInIC(object)); |
5777 } | 5829 } |
5778 | 5830 |
5779 static inline bool IsWeakObjectInOptimizedCode(Object* object); | 5831 static inline bool IsWeakObjectInOptimizedCode(Object* object); |
5780 static inline bool IsWeakObjectInIC(Object* object); | 5832 static inline bool IsWeakObjectInIC(Object* object); |
5781 | 5833 |
5782 // Max loop nesting marker used to postpose OSR. We don't take loop | 5834 // Max loop nesting marker used to postpose OSR. We don't take loop |
5783 // nesting that is deeper than 5 levels into account. | 5835 // nesting that is deeper than 5 levels into account. |
5784 static const int kMaxLoopNestingMarker = 6; | 5836 static const int kMaxLoopNestingMarker = 6; |
5785 | 5837 |
5786 // Layout description. | 5838 // Layout description. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5827 class TypeField: public BitField<StubType, 3, 1> {}; | 5879 class TypeField: public BitField<StubType, 3, 1> {}; |
5828 class CacheHolderField : public BitField<CacheHolderFlag, 4, 2> {}; | 5880 class CacheHolderField : public BitField<CacheHolderFlag, 4, 2> {}; |
5829 class KindField: public BitField<Kind, 6, 4> {}; | 5881 class KindField: public BitField<Kind, 6, 4> {}; |
5830 // TODO(bmeurer): Bit 10 is available for free use. :-) | 5882 // TODO(bmeurer): Bit 10 is available for free use. :-) |
5831 class ExtraICStateField: public BitField<ExtraICState, 11, | 5883 class ExtraICStateField: public BitField<ExtraICState, 11, |
5832 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT | 5884 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT |
5833 | 5885 |
5834 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) | 5886 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) |
5835 static const int kStackSlotsFirstBit = 0; | 5887 static const int kStackSlotsFirstBit = 0; |
5836 static const int kStackSlotsBitCount = 24; | 5888 static const int kStackSlotsBitCount = 24; |
5837 static const int kHasFunctionCacheFirstBit = | 5889 static const int kHasFunctionCacheBit = |
5838 kStackSlotsFirstBit + kStackSlotsBitCount; | 5890 kStackSlotsFirstBit + kStackSlotsBitCount; |
5839 static const int kHasFunctionCacheBitCount = 1; | 5891 static const int kMarkedForDeoptimizationBit = |
5840 static const int kMarkedForDeoptimizationFirstBit = | 5892 kHasFunctionCacheBit + 1; |
5841 kStackSlotsFirstBit + kStackSlotsBitCount + 1; | 5893 static const int kWeakStubBit = kMarkedForDeoptimizationBit + 1; |
5842 static const int kMarkedForDeoptimizationBitCount = 1; | 5894 static const int kInvalidatedWeakStubBit = kWeakStubBit + 1; |
5843 static const int kWeakStubFirstBit = | 5895 static const int kIsTurbofannedBit = kInvalidatedWeakStubBit + 1; |
5844 kMarkedForDeoptimizationFirstBit + kMarkedForDeoptimizationBitCount; | |
5845 static const int kWeakStubBitCount = 1; | |
5846 static const int kInvalidatedWeakStubFirstBit = | |
5847 kWeakStubFirstBit + kWeakStubBitCount; | |
5848 static const int kInvalidatedWeakStubBitCount = 1; | |
5849 | 5896 |
5850 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); | 5897 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); |
5851 STATIC_ASSERT(kHasFunctionCacheFirstBit + kHasFunctionCacheBitCount <= 32); | 5898 STATIC_ASSERT(kIsTurbofannedBit + 1 <= 32); |
5852 STATIC_ASSERT(kInvalidatedWeakStubFirstBit + | |
5853 kInvalidatedWeakStubBitCount <= 32); | |
5854 | 5899 |
5855 class StackSlotsField: public BitField<int, | 5900 class StackSlotsField: public BitField<int, |
5856 kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT | 5901 kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT |
5857 class HasFunctionCacheField: public BitField<bool, | 5902 class HasFunctionCacheField: public BitField<bool, |
5858 kHasFunctionCacheFirstBit, kHasFunctionCacheBitCount> {}; // NOLINT | 5903 kHasFunctionCacheBit, 1> {}; // NOLINT |
5859 class MarkedForDeoptimizationField: public BitField<bool, | 5904 class MarkedForDeoptimizationField: public BitField<bool, |
5860 kMarkedForDeoptimizationFirstBit, | 5905 kMarkedForDeoptimizationBit, 1> {}; // NOLINT |
5861 kMarkedForDeoptimizationBitCount> {}; // NOLINT | |
5862 class WeakStubField: public BitField<bool, | 5906 class WeakStubField: public BitField<bool, |
5863 kWeakStubFirstBit, | 5907 kWeakStubBit, 1> {}; // NOLINT |
5864 kWeakStubBitCount> {}; // NOLINT | |
5865 class InvalidatedWeakStubField: public BitField<bool, | 5908 class InvalidatedWeakStubField: public BitField<bool, |
5866 kInvalidatedWeakStubFirstBit, | 5909 kInvalidatedWeakStubBit, 1> {}; // NOLINT |
5867 kInvalidatedWeakStubBitCount> {}; // NOLINT | 5910 class IsTurbofannedField: public BitField<bool, |
| 5911 kIsTurbofannedBit, 1> {}; // NOLINT |
5868 | 5912 |
5869 // KindSpecificFlags2 layout (ALL) | 5913 // KindSpecificFlags2 layout (ALL) |
5870 static const int kIsCrankshaftedBit = 0; | 5914 static const int kIsCrankshaftedBit = 0; |
5871 class IsCrankshaftedField: public BitField<bool, | 5915 class IsCrankshaftedField: public BitField<bool, |
5872 kIsCrankshaftedBit, 1> {}; // NOLINT | 5916 kIsCrankshaftedBit, 1> {}; // NOLINT |
5873 | 5917 |
5874 // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION) | 5918 // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION) |
5875 static const int kSafepointTableOffsetFirstBit = kIsCrankshaftedBit + 1; | 5919 static const int kSafepointTableOffsetFirstBit = kIsCrankshaftedBit + 1; |
5876 static const int kSafepointTableOffsetBitCount = 24; | 5920 static const int kSafepointTableOffsetBitCount = 24; |
5877 | 5921 |
(...skipping 5339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11217 } else { | 11261 } else { |
11218 value &= ~(1 << bit_position); | 11262 value &= ~(1 << bit_position); |
11219 } | 11263 } |
11220 return value; | 11264 return value; |
11221 } | 11265 } |
11222 }; | 11266 }; |
11223 | 11267 |
11224 } } // namespace v8::internal | 11268 } } // namespace v8::internal |
11225 | 11269 |
11226 #endif // V8_OBJECTS_H_ | 11270 #endif // V8_OBJECTS_H_ |
OLD | NEW |