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

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

Issue 1009603003: Add debug checks to catch crashes with WeakCell::cast(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/objects.cc ('k') | src/transitions.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 2331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 void FixedDoubleArray::FillWithHoles(int from, int to) { 2342 void FixedDoubleArray::FillWithHoles(int from, int to) {
2343 for (int i = from; i < to; i++) { 2343 for (int i = from; i < to; i++) {
2344 set_the_hole(i); 2344 set_the_hole(i);
2345 } 2345 }
2346 } 2346 }
2347 2347
2348 2348
2349 Object* WeakFixedArray::Get(int index) const { 2349 Object* WeakFixedArray::Get(int index) const {
2350 Object* raw = FixedArray::cast(this)->get(index + kFirstIndex); 2350 Object* raw = FixedArray::cast(this)->get(index + kFirstIndex);
2351 if (raw->IsSmi()) return raw; 2351 if (raw->IsSmi()) return raw;
2352 DCHECK(raw->IsWeakCell());
2352 return WeakCell::cast(raw)->value(); 2353 return WeakCell::cast(raw)->value();
2353 } 2354 }
2354 2355
2355 2356
2356 bool WeakFixedArray::IsEmptySlot(int index) const { 2357 bool WeakFixedArray::IsEmptySlot(int index) const {
2357 DCHECK(index < Length()); 2358 DCHECK(index < Length());
2358 return Get(index)->IsSmi(); 2359 return Get(index)->IsSmi();
2359 } 2360 }
2360 2361
2361 2362
(...skipping 5134 matching lines...) Expand 10 before | Expand all | Expand 10 after
7496 #undef READ_SHORT_FIELD 7497 #undef READ_SHORT_FIELD
7497 #undef WRITE_SHORT_FIELD 7498 #undef WRITE_SHORT_FIELD
7498 #undef READ_BYTE_FIELD 7499 #undef READ_BYTE_FIELD
7499 #undef WRITE_BYTE_FIELD 7500 #undef WRITE_BYTE_FIELD
7500 #undef NOBARRIER_READ_BYTE_FIELD 7501 #undef NOBARRIER_READ_BYTE_FIELD
7501 #undef NOBARRIER_WRITE_BYTE_FIELD 7502 #undef NOBARRIER_WRITE_BYTE_FIELD
7502 7503
7503 } } // namespace v8::internal 7504 } } // namespace v8::internal
7504 7505
7505 #endif // V8_OBJECTS_INL_H_ 7506 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/transitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698