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

Side by Side Diff: src/objects.h

Issue 10701106: Make room in Code flags to support compiled stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 5 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/ic.cc ('k') | src/objects-inl.h » ('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 // 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // array as input. 174 // array as input.
175 enum SearchMode { 175 enum SearchMode {
176 EXPECT_SORTED, 176 EXPECT_SORTED,
177 EXPECT_UNSORTED 177 EXPECT_UNSORTED
178 }; 178 };
179 179
180 180
181 // Instance size sentinel for objects of variable size. 181 // Instance size sentinel for objects of variable size.
182 const int kVariableSizeSentinel = 0; 182 const int kVariableSizeSentinel = 0;
183 183
184 const int kStubMajorKeyBits = 6;
185 const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits;
184 186
185 // All Maps have a field instance_type containing a InstanceType. 187 // All Maps have a field instance_type containing a InstanceType.
186 // It describes the type of the instances. 188 // It describes the type of the instances.
187 // 189 //
188 // As an example, a JavaScript object is a heap object and its map 190 // As an example, a JavaScript object is a heap object and its map
189 // instance_type is JS_OBJECT_TYPE. 191 // instance_type is JS_OBJECT_TYPE.
190 // 192 //
191 // The names of the string instance types are intended to systematically 193 // The names of the string instance types are intended to systematically
192 // mirror their encoding in the instance_type field of the map. The default 194 // mirror their encoding in the instance_type field of the map. The default
193 // encoding is considered TWO_BYTE. It is not mentioned in the name. ASCII 195 // encoding is considered TWO_BYTE. It is not mentioned in the name. ASCII
(...skipping 4319 matching lines...) Expand 10 before | Expand all | Expand 10 after
4513 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; 4515 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize;
4514 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; 4516 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize;
4515 static const int kDeoptimizationDataOffset = 4517 static const int kDeoptimizationDataOffset =
4516 kHandlerTableOffset + kPointerSize; 4518 kHandlerTableOffset + kPointerSize;
4517 static const int kTypeFeedbackInfoOffset = 4519 static const int kTypeFeedbackInfoOffset =
4518 kDeoptimizationDataOffset + kPointerSize; 4520 kDeoptimizationDataOffset + kPointerSize;
4519 static const int kGCMetadataOffset = kTypeFeedbackInfoOffset + kPointerSize; 4521 static const int kGCMetadataOffset = kTypeFeedbackInfoOffset + kPointerSize;
4520 static const int kICAgeOffset = 4522 static const int kICAgeOffset =
4521 kGCMetadataOffset + kPointerSize; 4523 kGCMetadataOffset + kPointerSize;
4522 static const int kFlagsOffset = kICAgeOffset + kIntSize; 4524 static const int kFlagsOffset = kICAgeOffset + kIntSize;
4523 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; 4525 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize;
4524 static const int kKindSpecificFlagsSize = 2 * kIntSize; 4526 static const int kKindSpecificFlags2Offset =
4527 kKindSpecificFlags1Offset + kIntSize;
4525 4528
4526 static const int kHeaderPaddingStart = kKindSpecificFlagsOffset + 4529 static const int kHeaderPaddingStart = kKindSpecificFlags2Offset + kIntSize;
4527 kKindSpecificFlagsSize;
4528 4530
4529 // Add padding to align the instruction start following right after 4531 // Add padding to align the instruction start following right after
4530 // the Code object header. 4532 // the Code object header.
4531 static const int kHeaderSize = 4533 static const int kHeaderSize =
4532 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; 4534 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask;
4533 4535
4534 // Byte offsets within kKindSpecificFlagsOffset. 4536 // Byte offsets within kKindSpecificFlags1Offset.
4535 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset; 4537 static const int kOptimizableOffset = kKindSpecificFlags1Offset;
4536 static const int kOptimizableOffset = kKindSpecificFlagsOffset; 4538 static const int kCheckTypeOffset = kKindSpecificFlags1Offset;
4537 static const int kStackSlotsOffset = kKindSpecificFlagsOffset;
4538 static const int kCheckTypeOffset = kKindSpecificFlagsOffset;
4539
4540 static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1;
4541 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1;
4542 static const int kCompareStateOffset = kStubMajorKeyOffset + 1;
4543 static const int kToBooleanTypeOffset = kStubMajorKeyOffset + 1;
4544 static const int kHasFunctionCacheOffset = kStubMajorKeyOffset + 1;
4545 4539
4546 static const int kFullCodeFlags = kOptimizableOffset + 1; 4540 static const int kFullCodeFlags = kOptimizableOffset + 1;
4547 class FullCodeFlagsHasDeoptimizationSupportField: 4541 class FullCodeFlagsHasDeoptimizationSupportField:
4548 public BitField<bool, 0, 1> {}; // NOLINT 4542 public BitField<bool, 0, 1> {}; // NOLINT
4549 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; 4543 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {};
4550 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; 4544 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {};
4551 4545
4552 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1;
4553
4554 static const int kCompareOperationOffset = kCompareStateOffset + 1;
4555
4556 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; 4546 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1;
4557 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; 4547 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1;
4558 4548
4559 static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize;
4560 static const int kStackCheckTableOffsetOffset = kStackSlotsOffset + kIntSize;
4561
4562 // Flags layout. BitField<type, shift, size>. 4549 // Flags layout. BitField<type, shift, size>.
4563 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; 4550 class ICStateField: public BitField<InlineCacheState, 0, 3> {};
4564 class TypeField: public BitField<StubType, 3, 3> {}; 4551 class TypeField: public BitField<StubType, 3, 3> {};
4565 class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {}; 4552 class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {};
4566 class KindField: public BitField<Kind, 7, 4> {}; 4553 class KindField: public BitField<Kind, 7, 4> {};
4567 class ExtraICStateField: public BitField<ExtraICState, 11, 2> {}; 4554 class ExtraICStateField: public BitField<ExtraICState, 11, 2> {};
4568 class IsPregeneratedField: public BitField<bool, 13, 1> {}; 4555 class IsPregeneratedField: public BitField<bool, 13, 1> {};
4569 4556
4557 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION)
4558 static const int kStackSlotsFirstBit = 0;
4559 static const int kStackSlotsBitCount = 24;
4560 static const int kUnaryOpTypeFirstBit =
4561 kStackSlotsFirstBit + kStackSlotsBitCount;
4562 static const int kUnaryOpTypeBitCount = 3;
4563 static const int kBinaryOpTypeFirstBit =
4564 kStackSlotsFirstBit + kStackSlotsBitCount;
4565 static const int kBinaryOpTypeBitCount = 3;
4566 static const int kBinaryOpResultTypeFirstBit =
4567 kBinaryOpTypeFirstBit + kBinaryOpTypeBitCount;
4568 static const int kBinaryOpResultTypeBitCount = 3;
4569 static const int kCompareStateFirstBit =
4570 kStackSlotsFirstBit + kStackSlotsBitCount;
4571 static const int kCompareStateBitCount = 3;
4572 static const int kCompareOperationFirstBit =
4573 kCompareStateFirstBit + kCompareStateBitCount;
4574 static const int kCompareOperationBitCount = 4;
4575 static const int kToBooleanStateFirstBit =
4576 kStackSlotsFirstBit + kStackSlotsBitCount;
4577 static const int kToBooleanStateBitCount = 8;
4578 static const int kHasFunctionCacheFirstBit =
4579 kStackSlotsFirstBit + kStackSlotsBitCount;
4580 static const int kHasFunctionCacheBitCount = 1;
4581
4582 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32);
4583 STATIC_ASSERT(kUnaryOpTypeFirstBit + kUnaryOpTypeBitCount <= 32);
4584 STATIC_ASSERT(kBinaryOpTypeFirstBit + kBinaryOpTypeBitCount <= 32);
4585 STATIC_ASSERT(kBinaryOpResultTypeFirstBit +
4586 kBinaryOpResultTypeBitCount <= 32);
4587 STATIC_ASSERT(kCompareStateFirstBit + kCompareStateBitCount <= 32);
4588 STATIC_ASSERT(kCompareOperationFirstBit + kCompareOperationBitCount <= 32);
4589 STATIC_ASSERT(kToBooleanStateFirstBit + kToBooleanStateBitCount <= 32);
4590 STATIC_ASSERT(kHasFunctionCacheFirstBit + kHasFunctionCacheBitCount <= 32);
4591
4592 class StackSlotsField: public BitField<int,
4593 kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT
4594 class UnaryOpTypeField: public BitField<int,
4595 kUnaryOpTypeFirstBit, kUnaryOpTypeBitCount> {}; // NOLINT
4596 class BinaryOpTypeField: public BitField<int,
4597 kBinaryOpTypeFirstBit, kBinaryOpTypeBitCount> {}; // NOLINT
4598 class BinaryOpResultTypeField: public BitField<int,
4599 kBinaryOpResultTypeFirstBit, kBinaryOpResultTypeBitCount> {}; // NOLINT
4600 class CompareStateField: public BitField<int,
4601 kCompareStateFirstBit, kCompareStateBitCount> {}; // NOLINT
4602 class CompareOperationField: public BitField<int,
4603 kCompareOperationFirstBit, kCompareOperationBitCount> {}; // NOLINT
4604 class ToBooleanStateField: public BitField<int,
4605 kToBooleanStateFirstBit, kToBooleanStateBitCount> {}; // NOLINT
4606 class HasFunctionCacheField: public BitField<bool,
4607 kHasFunctionCacheFirstBit, kHasFunctionCacheBitCount> {}; // NOLINT
4608
4609 // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION)
4610 static const int kStubMajorKeyFirstBit = 0;
4611 static const int kSafepointTableOffsetFirstBit =
4612 kStubMajorKeyFirstBit + kStubMajorKeyBits;
4613 static const int kSafepointTableOffsetBitCount = 26;
4614
4615 STATIC_ASSERT(kStubMajorKeyFirstBit + kStubMajorKeyBits <= 32);
4616 STATIC_ASSERT(kSafepointTableOffsetFirstBit +
4617 kSafepointTableOffsetBitCount <= 32);
4618
4619 class SafepointTableOffsetField: public BitField<int,
4620 kSafepointTableOffsetFirstBit,
4621 kSafepointTableOffsetBitCount> {}; // NOLINT
4622 class StubMajorKeyField: public BitField<int,
4623 kStubMajorKeyFirstBit, kStubMajorKeyBits> {}; // NOLINT
4624
4625 // KindSpecificFlags2 layout (FUNCTION)
4626 class StackCheckTableOffsetField: public BitField<int, 0, 31> {};
4627
4570 // Signed field cannot be encoded using the BitField class. 4628 // Signed field cannot be encoded using the BitField class.
4571 static const int kArgumentsCountShift = 14; 4629 static const int kArgumentsCountShift = 14;
4572 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); 4630 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1);
4573 4631
4574 // This constant should be encodable in an ARM instruction. 4632 // This constant should be encodable in an ARM instruction.
4575 static const int kFlagsNotUsedInLookup = 4633 static const int kFlagsNotUsedInLookup =
4576 TypeField::kMask | CacheHolderField::kMask; 4634 TypeField::kMask | CacheHolderField::kMask;
4577 4635
4578 private: 4636 private:
4579 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); 4637 DISALLOW_IMPLICIT_CONSTRUCTORS(Code);
(...skipping 4244 matching lines...) Expand 10 before | Expand all | Expand 10 after
8824 } else { 8882 } else {
8825 value &= ~(1 << bit_position); 8883 value &= ~(1 << bit_position);
8826 } 8884 }
8827 return value; 8885 return value;
8828 } 8886 }
8829 }; 8887 };
8830 8888
8831 } } // namespace v8::internal 8889 } } // namespace v8::internal
8832 8890
8833 #endif // V8_OBJECTS_H_ 8891 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698