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

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

Issue 188783003: Make maps in monomorphic IC stubs weak. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase, address comments Created 6 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-debug.cc ('k') | src/objects-visiting.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 // 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 4753 matching lines...) Expand 10 before | Expand all | Expand 10 after
4764 4764
4765 4765
4766 void Code::set_marked_for_deoptimization(bool flag) { 4766 void Code::set_marked_for_deoptimization(bool flag) {
4767 ASSERT(kind() == OPTIMIZED_FUNCTION); 4767 ASSERT(kind() == OPTIMIZED_FUNCTION);
4768 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); 4768 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
4769 int updated = MarkedForDeoptimizationField::update(previous, flag); 4769 int updated = MarkedForDeoptimizationField::update(previous, flag);
4770 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); 4770 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
4771 } 4771 }
4772 4772
4773 4773
4774 bool Code::is_weak_stub() {
4775 return CanBeWeakStub() && WeakStubField::decode(
4776 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
4777 }
4778
4779
4780 void Code::mark_as_weak_stub() {
4781 ASSERT(CanBeWeakStub());
4782 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
4783 int updated = WeakStubField::update(previous, true);
4784 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
4785 }
4786
4787
4788 bool Code::is_invalidated_weak_stub() {
4789 return is_weak_stub() && InvalidatedWeakStubField::decode(
4790 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
4791 }
4792
4793
4794 void Code::mark_as_invalidated_weak_stub() {
4795 ASSERT(is_inline_cache_stub());
4796 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
4797 int updated = InvalidatedWeakStubField::update(previous, true);
4798 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
4799 }
4800
4801
4774 bool Code::is_inline_cache_stub() { 4802 bool Code::is_inline_cache_stub() {
4775 Kind kind = this->kind(); 4803 Kind kind = this->kind();
4776 switch (kind) { 4804 switch (kind) {
4777 #define CASE(name) case name: return true; 4805 #define CASE(name) case name: return true;
4778 IC_KIND_LIST(CASE) 4806 IC_KIND_LIST(CASE)
4779 #undef CASE 4807 #undef CASE
4780 default: return false; 4808 default: return false;
4781 } 4809 }
4782 } 4810 }
4783 4811
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
4907 } 4935 }
4908 private: 4936 private:
4909 static const int kMaxCount = 4; 4937 static const int kMaxCount = 4;
4910 int count_; 4938 int count_;
4911 Handle<Map> find_[kMaxCount]; 4939 Handle<Map> find_[kMaxCount];
4912 Handle<Object> replace_[kMaxCount]; 4940 Handle<Object> replace_[kMaxCount];
4913 friend class Code; 4941 friend class Code;
4914 }; 4942 };
4915 4943
4916 4944
4945 bool Code::IsWeakObjectInIC(Object* object) {
4946 return object->IsMap() && Map::cast(object)->CanTransition() &&
4947 FLAG_collect_maps &&
4948 FLAG_weak_embedded_maps_in_ic;
4949 }
4950
4951
4917 Object* Map::prototype() { 4952 Object* Map::prototype() {
4918 return READ_FIELD(this, kPrototypeOffset); 4953 return READ_FIELD(this, kPrototypeOffset);
4919 } 4954 }
4920 4955
4921 4956
4922 void Map::set_prototype(Object* value, WriteBarrierMode mode) { 4957 void Map::set_prototype(Object* value, WriteBarrierMode mode) {
4923 ASSERT(value->IsNull() || value->IsJSReceiver()); 4958 ASSERT(value->IsNull() || value->IsJSReceiver());
4924 WRITE_FIELD(this, kPrototypeOffset, value); 4959 WRITE_FIELD(this, kPrototypeOffset, value);
4925 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); 4960 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode);
4926 } 4961 }
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after
7053 #undef READ_SHORT_FIELD 7088 #undef READ_SHORT_FIELD
7054 #undef WRITE_SHORT_FIELD 7089 #undef WRITE_SHORT_FIELD
7055 #undef READ_BYTE_FIELD 7090 #undef READ_BYTE_FIELD
7056 #undef WRITE_BYTE_FIELD 7091 #undef WRITE_BYTE_FIELD
7057 #undef NOBARRIER_READ_BYTE_FIELD 7092 #undef NOBARRIER_READ_BYTE_FIELD
7058 #undef NOBARRIER_WRITE_BYTE_FIELD 7093 #undef NOBARRIER_WRITE_BYTE_FIELD
7059 7094
7060 } } // namespace v8::internal 7095 } } // namespace v8::internal
7061 7096
7062 #endif // V8_OBJECTS_INL_H_ 7097 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698