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

Side by Side Diff: src/objects.h

Issue 14367018: Add monomorphic CompareNilICs and Crankshaft support (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 8 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/log.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 // 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 4335 matching lines...) Expand 10 before | Expand all | Expand 10 after
4346 V(BUILTIN) \ 4346 V(BUILTIN) \
4347 V(LOAD_IC) \ 4347 V(LOAD_IC) \
4348 V(KEYED_LOAD_IC) \ 4348 V(KEYED_LOAD_IC) \
4349 V(CALL_IC) \ 4349 V(CALL_IC) \
4350 V(KEYED_CALL_IC) \ 4350 V(KEYED_CALL_IC) \
4351 V(STORE_IC) \ 4351 V(STORE_IC) \
4352 V(KEYED_STORE_IC) \ 4352 V(KEYED_STORE_IC) \
4353 V(UNARY_OP_IC) \ 4353 V(UNARY_OP_IC) \
4354 V(BINARY_OP_IC) \ 4354 V(BINARY_OP_IC) \
4355 V(COMPARE_IC) \ 4355 V(COMPARE_IC) \
4356 V(COMPARE_NIL_IC) \
4356 V(TO_BOOLEAN_IC) 4357 V(TO_BOOLEAN_IC)
4357 4358
4358 enum Kind { 4359 enum Kind {
4359 #define DEFINE_CODE_KIND_ENUM(name) name, 4360 #define DEFINE_CODE_KIND_ENUM(name) name,
4360 CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM) 4361 CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM)
4361 #undef DEFINE_CODE_KIND_ENUM 4362 #undef DEFINE_CODE_KIND_ENUM
4362 4363
4363 // Pseudo-kinds. 4364 // Pseudo-kinds.
4364 LAST_CODE_KIND = TO_BOOLEAN_IC, 4365 LAST_CODE_KIND = TO_BOOLEAN_IC,
4365 REGEXP = BUILTIN, 4366 REGEXP = BUILTIN,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
4457 inline int relocation_size(); 4458 inline int relocation_size();
4458 4459
4459 // [flags]: Various code flags. 4460 // [flags]: Various code flags.
4460 inline Flags flags(); 4461 inline Flags flags();
4461 inline void set_flags(Flags flags); 4462 inline void set_flags(Flags flags);
4462 4463
4463 // [flags]: Access to specific code flags. 4464 // [flags]: Access to specific code flags.
4464 inline Kind kind(); 4465 inline Kind kind();
4465 inline InlineCacheState ic_state(); // Only valid for IC stubs. 4466 inline InlineCacheState ic_state(); // Only valid for IC stubs.
4466 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. 4467 inline ExtraICState extra_ic_state(); // Only valid for IC stubs.
4468 inline ExtraICState extended_extra_ic_state(); // Only valid for
4469 // non-call IC stubs.
4467 inline StubType type(); // Only valid for monomorphic IC stubs. 4470 inline StubType type(); // Only valid for monomorphic IC stubs.
4468 inline int arguments_count(); // Only valid for call IC stubs. 4471 inline int arguments_count(); // Only valid for call IC stubs.
4469 4472
4470 // Testers for IC stub kinds. 4473 // Testers for IC stub kinds.
4471 inline bool is_inline_cache_stub(); 4474 inline bool is_inline_cache_stub();
4472 inline bool is_debug_break(); 4475 inline bool is_debug_break();
4473 inline bool is_load_stub() { return kind() == LOAD_IC; } 4476 inline bool is_load_stub() { return kind() == LOAD_IC; }
4474 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } 4477 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
4475 inline bool is_store_stub() { return kind() == STORE_IC; } 4478 inline bool is_store_stub() { return kind() == STORE_IC; }
4476 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } 4479 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; }
4477 inline bool is_call_stub() { return kind() == CALL_IC; } 4480 inline bool is_call_stub() { return kind() == CALL_IC; }
4478 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; } 4481 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; }
4479 inline bool is_unary_op_stub() { return kind() == UNARY_OP_IC; } 4482 inline bool is_unary_op_stub() { return kind() == UNARY_OP_IC; }
4480 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; } 4483 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; }
4481 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } 4484 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; }
4485 inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; }
4482 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; } 4486 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; }
4483 4487
4484 // [major_key]: For kind STUB or BINARY_OP_IC, the major key. 4488 // [major_key]: For kind STUB or BINARY_OP_IC, the major key.
4485 inline int major_key(); 4489 inline int major_key();
4486 inline void set_major_key(int value); 4490 inline void set_major_key(int value);
4487 4491
4488 // For kind STUB or ICs, tells whether or not a code object was generated by 4492 // For kind STUB or ICs, tells whether or not a code object was generated by
4489 // the optimizing compiler (but it may not be an optimized function). 4493 // the optimizing compiler (but it may not be an optimized function).
4490 bool is_crankshafted(); 4494 bool is_crankshafted();
4491 inline void set_is_crankshafted(bool value); 4495 inline void set_is_crankshafted(bool value);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
4550 inline void set_check_type(CheckType value); 4554 inline void set_check_type(CheckType value);
4551 4555
4552 // [type-recording unary op type]: For kind UNARY_OP_IC. 4556 // [type-recording unary op type]: For kind UNARY_OP_IC.
4553 inline byte unary_op_type(); 4557 inline byte unary_op_type();
4554 inline void set_unary_op_type(byte value); 4558 inline void set_unary_op_type(byte value);
4555 4559
4556 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in. 4560 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in.
4557 inline byte to_boolean_state(); 4561 inline byte to_boolean_state();
4558 inline void set_to_boolean_state(byte value); 4562 inline void set_to_boolean_state(byte value);
4559 4563
4564 // [compare_nil]: For kind COMPARE_NIL_IC tells what state the stub is in.
4565 byte compare_nil_state();
4566
4560 // [has_function_cache]: For kind STUB tells whether there is a function 4567 // [has_function_cache]: For kind STUB tells whether there is a function
4561 // cache is passed to the stub. 4568 // cache is passed to the stub.
4562 inline bool has_function_cache(); 4569 inline bool has_function_cache();
4563 inline void set_has_function_cache(bool flag); 4570 inline void set_has_function_cache(bool flag);
4564 4571
4565 4572
4566 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether 4573 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether
4567 // the code is going to be deoptimized because of dead embedded maps. 4574 // the code is going to be deoptimized because of dead embedded maps.
4568 inline bool marked_for_deoptimization(); 4575 inline bool marked_for_deoptimization();
4569 inline void set_marked_for_deoptimization(bool flag); 4576 inline void set_marked_for_deoptimization(bool flag);
4570 4577
4571 bool allowed_in_shared_map_code_cache(); 4578 bool allowed_in_shared_map_code_cache();
4572 4579
4573 // Get the safepoint entry for the given pc. 4580 // Get the safepoint entry for the given pc.
4574 SafepointEntry GetSafepointEntry(Address pc); 4581 SafepointEntry GetSafepointEntry(Address pc);
4575 4582
4576 // Find the first map in an IC stub. 4583 // Find the first map in an IC stub.
4577 Map* FindFirstMap(); 4584 Map* FindFirstMap();
4578 void FindAllMaps(MapHandleList* maps); 4585 void FindAllMaps(MapHandleList* maps);
4586 void ReplaceFirstMap(Map* replace);
4579 4587
4580 // Find the first code in an IC stub. 4588 // Find the first code in an IC stub.
4581 Code* FindFirstCode(); 4589 Code* FindFirstCode();
4582 void FindAllCode(CodeHandleList* code_list, int length); 4590 void FindAllCode(CodeHandleList* code_list, int length);
4583 4591
4584 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; 4592 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {};
4585 class ExtraICStateKeyedAccessStoreMode: 4593 class ExtraICStateKeyedAccessStoreMode:
4586 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT 4594 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT
4587 4595
4588 class ExtraICStateStubHolder: public BitField<StubHolder, 0, 1> {}; 4596 class ExtraICStateStubHolder: public BitField<StubHolder, 0, 1> {};
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4621 ExtraICState extra_ic_state = kNoExtraICState, 4629 ExtraICState extra_ic_state = kNoExtraICState,
4622 StubType type = NORMAL, 4630 StubType type = NORMAL,
4623 int argc = -1, 4631 int argc = -1,
4624 InlineCacheHolderFlag holder = OWN_MAP); 4632 InlineCacheHolderFlag holder = OWN_MAP);
4625 4633
4626 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); 4634 static inline InlineCacheState ExtractICStateFromFlags(Flags flags);
4627 static inline StubType ExtractTypeFromFlags(Flags flags); 4635 static inline StubType ExtractTypeFromFlags(Flags flags);
4628 static inline Kind ExtractKindFromFlags(Flags flags); 4636 static inline Kind ExtractKindFromFlags(Flags flags);
4629 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); 4637 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags);
4630 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); 4638 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags);
4639 static inline ExtraICState ExtractExtendedExtraICStateFromFlags(Flags flags);
4631 static inline int ExtractArgumentsCountFromFlags(Flags flags); 4640 static inline int ExtractArgumentsCountFromFlags(Flags flags);
4632 4641
4633 static inline Flags RemoveTypeFromFlags(Flags flags); 4642 static inline Flags RemoveTypeFromFlags(Flags flags);
4634 4643
4635 // Convert a target address into a code object. 4644 // Convert a target address into a code object.
4636 static inline Code* GetCodeFromTargetAddress(Address address); 4645 static inline Code* GetCodeFromTargetAddress(Address address);
4637 4646
4638 // Convert an entry address into an object. 4647 // Convert an entry address into an object.
4639 static inline Object* GetObjectFromEntryAddress(Address location_of_address); 4648 static inline Object* GetObjectFromEntryAddress(Address location_of_address);
4640 4649
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
4760 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; 4769 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {};
4761 4770
4762 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; 4771 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1;
4763 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; 4772 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1;
4764 4773
4765 // Flags layout. BitField<type, shift, size>. 4774 // Flags layout. BitField<type, shift, size>.
4766 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; 4775 class ICStateField: public BitField<InlineCacheState, 0, 3> {};
4767 class TypeField: public BitField<StubType, 3, 3> {}; 4776 class TypeField: public BitField<StubType, 3, 3> {};
4768 class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {}; 4777 class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {};
4769 class KindField: public BitField<Kind, 7, 4> {}; 4778 class KindField: public BitField<Kind, 7, 4> {};
4770 class ExtraICStateField: public BitField<ExtraICState, 11, 5> {}; 4779 class IsPregeneratedField: public BitField<bool, 11, 1> {};
4771 class IsPregeneratedField: public BitField<bool, 16, 1> {}; 4780 class ExtraICStateField: public BitField<ExtraICState, 12, 5> {};
4781 class ExtendedExtraICStateField: public BitField<ExtraICState, 12,
4782 PlatformSmiTagging::kSmiValueSize - 12 + 1> {}; // NOLINT
4783 STATIC_ASSERT(ExtraICStateField::kShift == ExtendedExtraICStateField::kShift);
4772 4784
4773 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) 4785 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION)
4774 static const int kStackSlotsFirstBit = 0; 4786 static const int kStackSlotsFirstBit = 0;
4775 static const int kStackSlotsBitCount = 24; 4787 static const int kStackSlotsBitCount = 24;
4776 static const int kUnaryOpTypeFirstBit = 4788 static const int kUnaryOpTypeFirstBit =
4777 kStackSlotsFirstBit + kStackSlotsBitCount; 4789 kStackSlotsFirstBit + kStackSlotsBitCount;
4778 static const int kUnaryOpTypeBitCount = 3; 4790 static const int kUnaryOpTypeBitCount = 3;
4779 static const int kToBooleanStateFirstBit = 4791 static const int kToBooleanStateFirstBit =
4780 kStackSlotsFirstBit + kStackSlotsBitCount; 4792 kStackSlotsFirstBit + kStackSlotsBitCount;
4781 static const int kToBooleanStateBitCount = 8; 4793 static const int kToBooleanStateBitCount = 8;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
4834 class BackEdgesPatchedForOSRField: public BitField<bool, 4846 class BackEdgesPatchedForOSRField: public BitField<bool,
4835 kIsCrankshaftedBit + 1 + 29, 1> {}; // NOLINT 4847 kIsCrankshaftedBit + 1 + 29, 1> {}; // NOLINT
4836 4848
4837 // Signed field cannot be encoded using the BitField class. 4849 // Signed field cannot be encoded using the BitField class.
4838 static const int kArgumentsCountShift = 17; 4850 static const int kArgumentsCountShift = 17;
4839 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); 4851 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1);
4840 static const int kArgumentsBits = 4852 static const int kArgumentsBits =
4841 PlatformSmiTagging::kSmiValueSize - Code::kArgumentsCountShift + 1; 4853 PlatformSmiTagging::kSmiValueSize - Code::kArgumentsCountShift + 1;
4842 static const int kMaxArguments = (1 << kArgumentsBits) - 1; 4854 static const int kMaxArguments = (1 << kArgumentsBits) - 1;
4843 4855
4856 // ICs can use either argument count or ExtendedExtraIC, since their storage
4857 // overlaps.
4858 STATIC_ASSERT(ExtraICStateField::kShift +
4859 ExtraICStateField::kSize + kArgumentsBits ==
4860 ExtendedExtraICStateField::kShift +
4861 ExtendedExtraICStateField::kSize);
4862
4844 // This constant should be encodable in an ARM instruction. 4863 // This constant should be encodable in an ARM instruction.
4845 static const int kFlagsNotUsedInLookup = 4864 static const int kFlagsNotUsedInLookup =
4846 TypeField::kMask | CacheHolderField::kMask; 4865 TypeField::kMask | CacheHolderField::kMask;
4847 4866
4848 private: 4867 private:
4849 friend class RelocIterator; 4868 friend class RelocIterator;
4850 4869
4851 // Code aging 4870 // Code aging
4852 byte* FindCodeAgeSequence(); 4871 byte* FindCodeAgeSequence();
4853 static void GetCodeAgeAndParity(Code* code, Age* age, 4872 static void GetCodeAgeAndParity(Code* code, Age* age,
(...skipping 4575 matching lines...) Expand 10 before | Expand all | Expand 10 after
9429 } else { 9448 } else {
9430 value &= ~(1 << bit_position); 9449 value &= ~(1 << bit_position);
9431 } 9450 }
9432 return value; 9451 return value;
9433 } 9452 }
9434 }; 9453 };
9435 9454
9436 } } // namespace v8::internal 9455 } } // namespace v8::internal
9437 9456
9438 #endif // V8_OBJECTS_H_ 9457 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698