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 #include "src/snapshot/serialize.h" | 5 #include "src/snapshot/serialize.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1967 } | 1967 } |
1968 | 1968 |
1969 | 1969 |
1970 // Clear and later restore the next link in the weak cell, if the object is one. | 1970 // Clear and later restore the next link in the weak cell, if the object is one. |
1971 class UnlinkWeakCellScope { | 1971 class UnlinkWeakCellScope { |
1972 public: | 1972 public: |
1973 explicit UnlinkWeakCellScope(HeapObject* object) : weak_cell_(NULL) { | 1973 explicit UnlinkWeakCellScope(HeapObject* object) : weak_cell_(NULL) { |
1974 if (object->IsWeakCell()) { | 1974 if (object->IsWeakCell()) { |
1975 weak_cell_ = WeakCell::cast(object); | 1975 weak_cell_ = WeakCell::cast(object); |
1976 next_ = weak_cell_->next(); | 1976 next_ = weak_cell_->next(); |
1977 weak_cell_->clear_next(object->GetHeap()); | 1977 weak_cell_->clear_next(object->GetHeap()->the_hole_value()); |
Yang
2015/12/01 11:21:40
Why does the caller need to know with what sentine
ulan
2015/12/01 12:49:52
For efficiency, this function is used in a hot loo
| |
1978 } | 1978 } |
1979 } | 1979 } |
1980 | 1980 |
1981 ~UnlinkWeakCellScope() { | 1981 ~UnlinkWeakCellScope() { |
1982 if (weak_cell_) weak_cell_->set_next(next_, UPDATE_WEAK_WRITE_BARRIER); | 1982 if (weak_cell_) weak_cell_->set_next(next_, UPDATE_WEAK_WRITE_BARRIER); |
1983 } | 1983 } |
1984 | 1984 |
1985 private: | 1985 private: |
1986 WeakCell* weak_cell_; | 1986 WeakCell* weak_cell_; |
1987 Object* next_; | 1987 Object* next_; |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2856 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2856 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2857 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2857 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2858 if (r == CHECK_SUCCESS) return scd; | 2858 if (r == CHECK_SUCCESS) return scd; |
2859 cached_data->Reject(); | 2859 cached_data->Reject(); |
2860 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2860 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2861 delete scd; | 2861 delete scd; |
2862 return NULL; | 2862 return NULL; |
2863 } | 2863 } |
2864 } // namespace internal | 2864 } // namespace internal |
2865 } // namespace v8 | 2865 } // namespace v8 |
OLD | NEW |