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

Side by Side Diff: src/objects-inl.h

Issue 400523007: Cache IC handlers on the prototype's map if possible (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 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/objects.cc ('k') | src/property.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 // 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 4948 matching lines...) Expand 10 before | Expand all | Expand 10 after
4959 } 4959 }
4960 4960
4961 4961
4962 void Code::set_constant_pool(Object* value) { 4962 void Code::set_constant_pool(Object* value) {
4963 ASSERT(value->IsConstantPoolArray()); 4963 ASSERT(value->IsConstantPoolArray());
4964 WRITE_FIELD(this, kConstantPoolOffset, value); 4964 WRITE_FIELD(this, kConstantPoolOffset, value);
4965 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value); 4965 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value);
4966 } 4966 }
4967 4967
4968 4968
4969 Code::Flags Code::ComputeFlags(Kind kind, 4969 Code::Flags Code::ComputeFlags(Kind kind, InlineCacheState ic_state,
4970 InlineCacheState ic_state, 4970 ExtraICState extra_ic_state, StubType type,
4971 ExtraICState extra_ic_state, 4971 CacheHolderFlag holder) {
4972 StubType type,
4973 InlineCacheHolderFlag holder) {
4974 // Compute the bit mask. 4972 // Compute the bit mask.
4975 unsigned int bits = KindField::encode(kind) 4973 unsigned int bits = KindField::encode(kind)
4976 | ICStateField::encode(ic_state) 4974 | ICStateField::encode(ic_state)
4977 | TypeField::encode(type) 4975 | TypeField::encode(type)
4978 | ExtraICStateField::encode(extra_ic_state) 4976 | ExtraICStateField::encode(extra_ic_state)
4979 | CacheHolderField::encode(holder); 4977 | CacheHolderField::encode(holder);
4980 return static_cast<Flags>(bits); 4978 return static_cast<Flags>(bits);
4981 } 4979 }
4982 4980
4983 4981
4984 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, 4982 Code::Flags Code::ComputeMonomorphicFlags(Kind kind,
4985 ExtraICState extra_ic_state, 4983 ExtraICState extra_ic_state,
4986 InlineCacheHolderFlag holder, 4984 CacheHolderFlag holder,
4987 StubType type) { 4985 StubType type) {
4988 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, holder); 4986 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, holder);
4989 } 4987 }
4990 4988
4991 4989
4992 Code::Flags Code::ComputeHandlerFlags(Kind handler_kind, 4990 Code::Flags Code::ComputeHandlerFlags(Kind handler_kind, StubType type,
4993 StubType type, 4991 CacheHolderFlag holder) {
4994 InlineCacheHolderFlag holder) {
4995 return ComputeFlags(Code::HANDLER, MONOMORPHIC, handler_kind, type, holder); 4992 return ComputeFlags(Code::HANDLER, MONOMORPHIC, handler_kind, type, holder);
4996 } 4993 }
4997 4994
4998 4995
4999 Code::Kind Code::ExtractKindFromFlags(Flags flags) { 4996 Code::Kind Code::ExtractKindFromFlags(Flags flags) {
5000 return KindField::decode(flags); 4997 return KindField::decode(flags);
5001 } 4998 }
5002 4999
5003 5000
5004 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { 5001 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) {
5005 return ICStateField::decode(flags); 5002 return ICStateField::decode(flags);
5006 } 5003 }
5007 5004
5008 5005
5009 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { 5006 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
5010 return ExtraICStateField::decode(flags); 5007 return ExtraICStateField::decode(flags);
5011 } 5008 }
5012 5009
5013 5010
5014 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { 5011 Code::StubType Code::ExtractTypeFromFlags(Flags flags) {
5015 return TypeField::decode(flags); 5012 return TypeField::decode(flags);
5016 } 5013 }
5017 5014
5018 5015
5019 InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { 5016 CacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) {
5020 return CacheHolderField::decode(flags); 5017 return CacheHolderField::decode(flags);
5021 } 5018 }
5022 5019
5023 5020
5024 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { 5021 Code::Flags Code::RemoveTypeFromFlags(Flags flags) {
5025 int bits = flags & ~TypeField::kMask; 5022 int bits = flags & ~TypeField::kMask;
5026 return static_cast<Flags>(bits); 5023 return static_cast<Flags>(bits);
5027 } 5024 }
5028 5025
5029 5026
5027 Code::Flags Code::RemoveTypeAndHolderFromFlags(Flags flags) {
5028 int bits = flags & ~TypeField::kMask & ~CacheHolderField::kMask;
5029 return static_cast<Flags>(bits);
5030 }
5031
5032
5030 Code* Code::GetCodeFromTargetAddress(Address address) { 5033 Code* Code::GetCodeFromTargetAddress(Address address) {
5031 HeapObject* code = HeapObject::FromAddress(address - Code::kHeaderSize); 5034 HeapObject* code = HeapObject::FromAddress(address - Code::kHeaderSize);
5032 // GetCodeFromTargetAddress might be called when marking objects during mark 5035 // GetCodeFromTargetAddress might be called when marking objects during mark
5033 // sweep. reinterpret_cast is therefore used instead of the more appropriate 5036 // sweep. reinterpret_cast is therefore used instead of the more appropriate
5034 // Code::cast. Code::cast does not work when the object's map is 5037 // Code::cast. Code::cast does not work when the object's map is
5035 // marked. 5038 // marked.
5036 Code* result = reinterpret_cast<Code*>(code); 5039 Code* result = reinterpret_cast<Code*>(code);
5037 return result; 5040 return result;
5038 } 5041 }
5039 5042
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after
7208 #undef READ_SHORT_FIELD 7211 #undef READ_SHORT_FIELD
7209 #undef WRITE_SHORT_FIELD 7212 #undef WRITE_SHORT_FIELD
7210 #undef READ_BYTE_FIELD 7213 #undef READ_BYTE_FIELD
7211 #undef WRITE_BYTE_FIELD 7214 #undef WRITE_BYTE_FIELD
7212 #undef NOBARRIER_READ_BYTE_FIELD 7215 #undef NOBARRIER_READ_BYTE_FIELD
7213 #undef NOBARRIER_WRITE_BYTE_FIELD 7216 #undef NOBARRIER_WRITE_BYTE_FIELD
7214 7217
7215 } } // namespace v8::internal 7218 } } // namespace v8::internal
7216 7219
7217 #endif // V8_OBJECTS_INL_H_ 7220 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698