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

Side by Side Diff: src/objects-inl.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/objects.cc ('k') | src/spaces.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 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after
3627 return result; 3627 return result;
3628 } 3628 }
3629 3629
3630 3630
3631 Code::ExtraICState Code::extra_ic_state() { 3631 Code::ExtraICState Code::extra_ic_state() {
3632 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB); 3632 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB);
3633 return ExtractExtraICStateFromFlags(flags()); 3633 return ExtractExtraICStateFromFlags(flags());
3634 } 3634 }
3635 3635
3636 3636
3637 Code::ExtraICState Code::extended_extra_ic_state() {
3638 ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB);
3639 return ExtractExtendedExtraICStateFromFlags(flags());
3640 }
3641
3642
3637 Code::StubType Code::type() { 3643 Code::StubType Code::type() {
3638 return ExtractTypeFromFlags(flags()); 3644 return ExtractTypeFromFlags(flags());
3639 } 3645 }
3640 3646
3641 3647
3642 int Code::arguments_count() { 3648 int Code::arguments_count() {
3643 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); 3649 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB);
3644 return ExtractArgumentsCountFromFlags(flags()); 3650 return ExtractArgumentsCountFromFlags(flags());
3645 } 3651 }
3646 3652
3647 3653
3648 inline bool Code::is_crankshafted() { 3654 inline bool Code::is_crankshafted() {
3649 return IsCrankshaftedField::decode( 3655 return IsCrankshaftedField::decode(
3650 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); 3656 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
3651 } 3657 }
3652 3658
3653 3659
3654 inline void Code::set_is_crankshafted(bool value) { 3660 inline void Code::set_is_crankshafted(bool value) {
3655 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); 3661 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
3656 int updated = IsCrankshaftedField::update(previous, value); 3662 int updated = IsCrankshaftedField::update(previous, value);
3657 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); 3663 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
3658 } 3664 }
3659 3665
3660 3666
3661 int Code::major_key() { 3667 int Code::major_key() {
3662 ASSERT(kind() == STUB || 3668 ASSERT(kind() == STUB ||
3663 kind() == UNARY_OP_IC || 3669 kind() == UNARY_OP_IC ||
3664 kind() == BINARY_OP_IC || 3670 kind() == BINARY_OP_IC ||
3665 kind() == COMPARE_IC || 3671 kind() == COMPARE_IC ||
3672 kind() == COMPARE_NIL_IC ||
3666 kind() == LOAD_IC || 3673 kind() == LOAD_IC ||
3667 kind() == KEYED_LOAD_IC || 3674 kind() == KEYED_LOAD_IC ||
3668 kind() == TO_BOOLEAN_IC); 3675 kind() == TO_BOOLEAN_IC);
3669 return StubMajorKeyField::decode( 3676 return StubMajorKeyField::decode(
3670 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); 3677 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
3671 } 3678 }
3672 3679
3673 3680
3674 void Code::set_major_key(int major) { 3681 void Code::set_major_key(int major) {
3675 ASSERT(kind() == STUB || 3682 ASSERT(kind() == STUB ||
3676 kind() == UNARY_OP_IC || 3683 kind() == UNARY_OP_IC ||
3677 kind() == BINARY_OP_IC || 3684 kind() == BINARY_OP_IC ||
3678 kind() == COMPARE_IC || 3685 kind() == COMPARE_IC ||
3686 kind() == COMPARE_NIL_IC ||
3679 kind() == LOAD_IC || 3687 kind() == LOAD_IC ||
3680 kind() == KEYED_LOAD_IC || 3688 kind() == KEYED_LOAD_IC ||
3681 kind() == STORE_IC || 3689 kind() == STORE_IC ||
3682 kind() == KEYED_STORE_IC || 3690 kind() == KEYED_STORE_IC ||
3683 kind() == TO_BOOLEAN_IC); 3691 kind() == TO_BOOLEAN_IC);
3684 ASSERT(0 <= major && major < 256); 3692 ASSERT(0 <= major && major < 256);
3685 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); 3693 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
3686 int updated = StubMajorKeyField::update(previous, major); 3694 int updated = StubMajorKeyField::update(previous, major);
3687 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); 3695 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
3688 } 3696 }
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
3933 } 3941 }
3934 3942
3935 3943
3936 Code::Flags Code::ComputeFlags(Kind kind, 3944 Code::Flags Code::ComputeFlags(Kind kind,
3937 InlineCacheState ic_state, 3945 InlineCacheState ic_state,
3938 ExtraICState extra_ic_state, 3946 ExtraICState extra_ic_state,
3939 StubType type, 3947 StubType type,
3940 int argc, 3948 int argc,
3941 InlineCacheHolderFlag holder) { 3949 InlineCacheHolderFlag holder) {
3942 ASSERT(argc <= Code::kMaxArguments); 3950 ASSERT(argc <= Code::kMaxArguments);
3951 // Since the extended extra ic state overlaps with the argument count
3952 // for CALL_ICs, do so checks to make sure that they don't interfere.
3953 ASSERT((kind != Code::CALL_IC &&
3954 kind != Code::KEYED_CALL_IC) ||
3955 (ExtraICStateField::encode(extra_ic_state) | true));
3943 // Compute the bit mask. 3956 // Compute the bit mask.
3944 unsigned int bits = KindField::encode(kind) 3957 unsigned int bits = KindField::encode(kind)
3945 | ICStateField::encode(ic_state) 3958 | ICStateField::encode(ic_state)
3946 | TypeField::encode(type) 3959 | TypeField::encode(type)
3947 | ExtraICStateField::encode(extra_ic_state) 3960 | ExtendedExtraICStateField::encode(extra_ic_state)
3948 | (argc << kArgumentsCountShift)
3949 | CacheHolderField::encode(holder); 3961 | CacheHolderField::encode(holder);
3962 // TODO(danno): This is a bit of a hack right now since there are still
3963 // clients of this API that pass "extra" values in for argc. These clients
3964 // should be retrofitted to used ExtendedExtraICState.
3965 if (kind != Code::COMPARE_NIL_IC) {
3966 bits |= (argc << kArgumentsCountShift);
3967 }
3950 return static_cast<Flags>(bits); 3968 return static_cast<Flags>(bits);
3951 } 3969 }
3952 3970
3953 3971
3954 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, 3972 Code::Flags Code::ComputeMonomorphicFlags(Kind kind,
3955 ExtraICState extra_ic_state, 3973 ExtraICState extra_ic_state,
3956 StubType type, 3974 StubType type,
3957 int argc, 3975 int argc,
3958 InlineCacheHolderFlag holder) { 3976 InlineCacheHolderFlag holder) {
3959 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, argc, holder); 3977 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, argc, holder);
3960 } 3978 }
3961 3979
3962 3980
3963 Code::Kind Code::ExtractKindFromFlags(Flags flags) { 3981 Code::Kind Code::ExtractKindFromFlags(Flags flags) {
3964 return KindField::decode(flags); 3982 return KindField::decode(flags);
3965 } 3983 }
3966 3984
3967 3985
3968 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { 3986 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) {
3969 return ICStateField::decode(flags); 3987 return ICStateField::decode(flags);
3970 } 3988 }
3971 3989
3972 3990
3973 Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { 3991 Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
3974 return ExtraICStateField::decode(flags); 3992 return ExtraICStateField::decode(flags);
3975 } 3993 }
3976 3994
3977 3995
3996 Code::ExtraICState Code::ExtractExtendedExtraICStateFromFlags(
3997 Flags flags) {
3998 return ExtendedExtraICStateField::decode(flags);
3999 }
4000
4001
3978 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { 4002 Code::StubType Code::ExtractTypeFromFlags(Flags flags) {
3979 return TypeField::decode(flags); 4003 return TypeField::decode(flags);
3980 } 4004 }
3981 4005
3982 4006
3983 int Code::ExtractArgumentsCountFromFlags(Flags flags) { 4007 int Code::ExtractArgumentsCountFromFlags(Flags flags) {
3984 return (flags & kArgumentsCountMask) >> kArgumentsCountShift; 4008 return (flags & kArgumentsCountMask) >> kArgumentsCountShift;
3985 } 4009 }
3986 4010
3987 4011
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
5117 5141
5118 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { 5142 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) {
5119 ASSERT(kind() == FUNCTION); 5143 ASSERT(kind() == FUNCTION);
5120 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); 5144 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value);
5121 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, 5145 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset,
5122 value, mode); 5146 value, mode);
5123 } 5147 }
5124 5148
5125 5149
5126 int Code::stub_info() { 5150 int Code::stub_info() {
5127 ASSERT(kind() == COMPARE_IC || kind() == BINARY_OP_IC || kind() == LOAD_IC); 5151 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC ||
5152 kind() == BINARY_OP_IC || kind() == LOAD_IC);
5128 Object* value = READ_FIELD(this, kTypeFeedbackInfoOffset); 5153 Object* value = READ_FIELD(this, kTypeFeedbackInfoOffset);
5129 return Smi::cast(value)->value(); 5154 return Smi::cast(value)->value();
5130 } 5155 }
5131 5156
5132 5157
5133 void Code::set_stub_info(int value) { 5158 void Code::set_stub_info(int value) {
5134 ASSERT(kind() == COMPARE_IC || 5159 ASSERT(kind() == COMPARE_IC ||
5160 kind() == COMPARE_NIL_IC ||
5135 kind() == BINARY_OP_IC || 5161 kind() == BINARY_OP_IC ||
5136 kind() == STUB || 5162 kind() == STUB ||
5137 kind() == LOAD_IC || 5163 kind() == LOAD_IC ||
5138 kind() == KEYED_LOAD_IC || 5164 kind() == KEYED_LOAD_IC ||
5139 kind() == STORE_IC || 5165 kind() == STORE_IC ||
5140 kind() == KEYED_STORE_IC); 5166 kind() == KEYED_STORE_IC);
5141 WRITE_FIELD(this, kTypeFeedbackInfoOffset, Smi::FromInt(value)); 5167 WRITE_FIELD(this, kTypeFeedbackInfoOffset, Smi::FromInt(value));
5142 } 5168 }
5143 5169
5144 5170
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
6119 #undef WRITE_UINT32_FIELD 6145 #undef WRITE_UINT32_FIELD
6120 #undef READ_SHORT_FIELD 6146 #undef READ_SHORT_FIELD
6121 #undef WRITE_SHORT_FIELD 6147 #undef WRITE_SHORT_FIELD
6122 #undef READ_BYTE_FIELD 6148 #undef READ_BYTE_FIELD
6123 #undef WRITE_BYTE_FIELD 6149 #undef WRITE_BYTE_FIELD
6124 6150
6125 6151
6126 } } // namespace v8::internal 6152 } } // namespace v8::internal
6127 6153
6128 #endif // V8_OBJECTS_INL_H_ 6154 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698