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 // 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 5050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5061 | 5061 |
5062 void Code::set_marked_for_deoptimization(bool flag) { | 5062 void Code::set_marked_for_deoptimization(bool flag) { |
5063 DCHECK(kind() == OPTIMIZED_FUNCTION); | 5063 DCHECK(kind() == OPTIMIZED_FUNCTION); |
5064 DCHECK(!flag || AllowDeoptimization::IsAllowed(GetIsolate())); | 5064 DCHECK(!flag || AllowDeoptimization::IsAllowed(GetIsolate())); |
5065 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 5065 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
5066 int updated = MarkedForDeoptimizationField::update(previous, flag); | 5066 int updated = MarkedForDeoptimizationField::update(previous, flag); |
5067 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | 5067 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); |
5068 } | 5068 } |
5069 | 5069 |
5070 | 5070 |
5071 bool Code::is_weak_stub() { | |
5072 return CanBeWeakStub() && WeakStubField::decode( | |
5073 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | |
5074 } | |
5075 | |
5076 | |
5077 void Code::mark_as_weak_stub() { | |
5078 DCHECK(CanBeWeakStub()); | |
5079 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | |
5080 int updated = WeakStubField::update(previous, true); | |
5081 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | |
5082 } | |
5083 | |
5084 | |
5085 bool Code::is_invalidated_weak_stub() { | |
5086 return is_weak_stub() && InvalidatedWeakStubField::decode( | |
5087 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | |
5088 } | |
5089 | |
5090 | |
5091 void Code::mark_as_invalidated_weak_stub() { | |
5092 DCHECK(is_inline_cache_stub()); | |
5093 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | |
5094 int updated = InvalidatedWeakStubField::update(previous, true); | |
5095 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | |
5096 } | |
5097 | |
5098 | |
5099 bool Code::is_inline_cache_stub() { | 5071 bool Code::is_inline_cache_stub() { |
5100 Kind kind = this->kind(); | 5072 Kind kind = this->kind(); |
5101 switch (kind) { | 5073 switch (kind) { |
5102 #define CASE(name) case name: return true; | 5074 #define CASE(name) case name: return true; |
5103 IC_KIND_LIST(CASE) | 5075 IC_KIND_LIST(CASE) |
5104 #undef CASE | 5076 #undef CASE |
5105 default: return false; | 5077 default: return false; |
5106 } | 5078 } |
5107 } | 5079 } |
5108 | 5080 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5235 } | 5207 } |
5236 private: | 5208 private: |
5237 static const int kMaxCount = 4; | 5209 static const int kMaxCount = 4; |
5238 int count_; | 5210 int count_; |
5239 Handle<Map> find_[kMaxCount]; | 5211 Handle<Map> find_[kMaxCount]; |
5240 Handle<Object> replace_[kMaxCount]; | 5212 Handle<Object> replace_[kMaxCount]; |
5241 friend class Code; | 5213 friend class Code; |
5242 }; | 5214 }; |
5243 | 5215 |
5244 | 5216 |
5245 bool Code::IsWeakObjectInIC(Object* object) { | |
5246 return object->IsMap() && Map::cast(object)->CanTransition() && | |
5247 FLAG_collect_maps && | |
5248 FLAG_weak_embedded_maps_in_ic; | |
5249 } | |
5250 | |
5251 | |
5252 Object* Map::prototype() const { | 5217 Object* Map::prototype() const { |
5253 return READ_FIELD(this, kPrototypeOffset); | 5218 return READ_FIELD(this, kPrototypeOffset); |
5254 } | 5219 } |
5255 | 5220 |
5256 | 5221 |
5257 void Map::set_prototype(Object* value, WriteBarrierMode mode) { | 5222 void Map::set_prototype(Object* value, WriteBarrierMode mode) { |
5258 DCHECK(value->IsNull() || value->IsJSReceiver()); | 5223 DCHECK(value->IsNull() || value->IsJSReceiver()); |
5259 WRITE_FIELD(this, kPrototypeOffset, value); | 5224 WRITE_FIELD(this, kPrototypeOffset, value); |
5260 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); | 5225 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); |
5261 } | 5226 } |
(...skipping 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7553 #undef READ_SHORT_FIELD | 7518 #undef READ_SHORT_FIELD |
7554 #undef WRITE_SHORT_FIELD | 7519 #undef WRITE_SHORT_FIELD |
7555 #undef READ_BYTE_FIELD | 7520 #undef READ_BYTE_FIELD |
7556 #undef WRITE_BYTE_FIELD | 7521 #undef WRITE_BYTE_FIELD |
7557 #undef NOBARRIER_READ_BYTE_FIELD | 7522 #undef NOBARRIER_READ_BYTE_FIELD |
7558 #undef NOBARRIER_WRITE_BYTE_FIELD | 7523 #undef NOBARRIER_WRITE_BYTE_FIELD |
7559 | 7524 |
7560 } } // namespace v8::internal | 7525 } } // namespace v8::internal |
7561 | 7526 |
7562 #endif // V8_OBJECTS_INL_H_ | 7527 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |