OLD | NEW |
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 4609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4620 | 4620 |
4621 | 4621 |
4622 void Code::set_marked_for_deoptimization(bool flag) { | 4622 void Code::set_marked_for_deoptimization(bool flag) { |
4623 ASSERT(kind() == OPTIMIZED_FUNCTION); | 4623 ASSERT(kind() == OPTIMIZED_FUNCTION); |
4624 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 4624 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
4625 int updated = MarkedForDeoptimizationField::update(previous, flag); | 4625 int updated = MarkedForDeoptimizationField::update(previous, flag); |
4626 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | 4626 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); |
4627 } | 4627 } |
4628 | 4628 |
4629 | 4629 |
| 4630 bool Code::is_weak_stub() { |
| 4631 return can_be_weak_stub() && WeakStubField::decode( |
| 4632 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
| 4633 } |
| 4634 |
| 4635 |
| 4636 void Code::mark_as_weak_stub() { |
| 4637 ASSERT(can_be_weak_stub()); |
| 4638 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
| 4639 int updated = WeakStubField::update(previous, true); |
| 4640 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); |
| 4641 } |
| 4642 |
| 4643 |
| 4644 bool Code::is_invalidated_weak_stub() { |
| 4645 return is_weak_stub() && InvalidatedWeakStubField::decode( |
| 4646 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
| 4647 } |
| 4648 |
| 4649 |
| 4650 void Code::mark_as_invalidated_weak_stub() { |
| 4651 ASSERT(is_inline_cache_stub()); |
| 4652 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
| 4653 int updated = InvalidatedWeakStubField::update(previous, true); |
| 4654 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); |
| 4655 } |
| 4656 |
| 4657 |
4630 bool Code::is_inline_cache_stub() { | 4658 bool Code::is_inline_cache_stub() { |
4631 Kind kind = this->kind(); | 4659 Kind kind = this->kind(); |
4632 switch (kind) { | 4660 switch (kind) { |
4633 #define CASE(name) case name: return true; | 4661 #define CASE(name) case name: return true; |
4634 IC_KIND_LIST(CASE) | 4662 IC_KIND_LIST(CASE) |
4635 #undef CASE | 4663 #undef CASE |
4636 default: return false; | 4664 default: return false; |
4637 } | 4665 } |
4638 } | 4666 } |
4639 | 4667 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4764 } | 4792 } |
4765 private: | 4793 private: |
4766 static const int kMaxCount = 4; | 4794 static const int kMaxCount = 4; |
4767 int count_; | 4795 int count_; |
4768 Handle<Map> find_[kMaxCount]; | 4796 Handle<Map> find_[kMaxCount]; |
4769 Handle<Object> replace_[kMaxCount]; | 4797 Handle<Object> replace_[kMaxCount]; |
4770 friend class Code; | 4798 friend class Code; |
4771 }; | 4799 }; |
4772 | 4800 |
4773 | 4801 |
| 4802 bool Code::IsWeakObjectInIC(Object* object) { |
| 4803 ASSERT(can_be_weak_stub()); |
| 4804 return object->IsMap() && Map::cast(object)->CanTransition() && |
| 4805 FLAG_collect_maps && |
| 4806 FLAG_weak_embedded_maps_in_ic; |
| 4807 } |
| 4808 |
| 4809 |
4774 Object* Map::prototype() { | 4810 Object* Map::prototype() { |
4775 return READ_FIELD(this, kPrototypeOffset); | 4811 return READ_FIELD(this, kPrototypeOffset); |
4776 } | 4812 } |
4777 | 4813 |
4778 | 4814 |
4779 void Map::set_prototype(Object* value, WriteBarrierMode mode) { | 4815 void Map::set_prototype(Object* value, WriteBarrierMode mode) { |
4780 ASSERT(value->IsNull() || value->IsJSReceiver()); | 4816 ASSERT(value->IsNull() || value->IsJSReceiver()); |
4781 WRITE_FIELD(this, kPrototypeOffset, value); | 4817 WRITE_FIELD(this, kPrototypeOffset, value); |
4782 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); | 4818 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); |
4783 } | 4819 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5014 | 5050 |
5015 HeapObject* Map::UncheckedPrototypeTransitions() { | 5051 HeapObject* Map::UncheckedPrototypeTransitions() { |
5016 ASSERT(HasTransitionArray()); | 5052 ASSERT(HasTransitionArray()); |
5017 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); | 5053 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); |
5018 return unchecked_transition_array()->UncheckedPrototypeTransitions(); | 5054 return unchecked_transition_array()->UncheckedPrototypeTransitions(); |
5019 } | 5055 } |
5020 | 5056 |
5021 | 5057 |
5022 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 5058 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
5023 ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset) | 5059 ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset) |
| 5060 ACCESSORS(Map, dependent_ic, Object, kDependentICOffset) |
5024 ACCESSORS(Map, constructor, Object, kConstructorOffset) | 5061 ACCESSORS(Map, constructor, Object, kConstructorOffset) |
5025 | 5062 |
5026 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) | 5063 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |
5027 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) | 5064 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) |
5028 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) | 5065 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) |
5029 | 5066 |
5030 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) | 5067 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) |
5031 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) | 5068 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) |
5032 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) | 5069 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) |
5033 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) | 5070 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) |
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6941 #undef READ_UINT32_FIELD | 6978 #undef READ_UINT32_FIELD |
6942 #undef WRITE_UINT32_FIELD | 6979 #undef WRITE_UINT32_FIELD |
6943 #undef READ_SHORT_FIELD | 6980 #undef READ_SHORT_FIELD |
6944 #undef WRITE_SHORT_FIELD | 6981 #undef WRITE_SHORT_FIELD |
6945 #undef READ_BYTE_FIELD | 6982 #undef READ_BYTE_FIELD |
6946 #undef WRITE_BYTE_FIELD | 6983 #undef WRITE_BYTE_FIELD |
6947 | 6984 |
6948 } } // namespace v8::internal | 6985 } } // namespace v8::internal |
6949 | 6986 |
6950 #endif // V8_OBJECTS_INL_H_ | 6987 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |