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

Unified Diff: src/objects.h

Issue 866723002: Treat pointers in optimized code as strong before all weak dependencies are registered. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix check Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/lithium-codegen-mips64.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 3f485e5dfa334c6aaf1024194c44529721e8320e..5658c8f0acef3e8d676aa30aee750984ee21f31b 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -5132,6 +5132,11 @@ class Code: public HeapObject {
inline bool is_turbofanned();
inline void set_is_turbofanned(bool value);
+ // [can_have_weak_objects]: For kind OPTIMIZED_FUNCTION, tells whether the
+ // embedded objects in code should be treated weakly.
+ inline bool can_have_weak_objects();
+ inline void set_can_have_weak_objects(bool value);
+
// [optimizable]: For FUNCTION kind, tells if it is optimizable.
inline bool optimizable();
inline void set_optimizable(bool value);
@@ -5389,11 +5394,15 @@ class Code: public HeapObject {
void VerifyEmbeddedObjectsInFullCode();
#endif // DEBUG
- inline bool CanContainWeakObjects() { return is_optimized_code(); }
+ inline bool CanContainWeakObjects() {
+ // is_turbofanned() implies !can_have_weak_objects().
+ DCHECK(!is_optimized_code() || !is_turbofanned() ||
+ !can_have_weak_objects());
+ return is_optimized_code() && can_have_weak_objects();
+ }
inline bool IsWeakObject(Object* object) {
- return (is_optimized_code() && !is_turbofanned() &&
- IsWeakObjectInOptimizedCode(object));
+ return (CanContainWeakObjects() && IsWeakObjectInOptimizedCode(object));
}
static inline bool IsWeakObjectInOptimizedCode(Object* object);
@@ -5459,9 +5468,10 @@ class Code: public HeapObject {
kStackSlotsFirstBit + kStackSlotsBitCount;
static const int kMarkedForDeoptimizationBit = kHasFunctionCacheBit + 1;
static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1;
+ static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1;
STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32);
- STATIC_ASSERT(kIsTurbofannedBit + 1 <= 32);
+ STATIC_ASSERT(kCanHaveWeakObjects + 1 <= 32);
class StackSlotsField: public BitField<int,
kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT
@@ -5471,6 +5481,8 @@ class Code: public HeapObject {
: public BitField<bool, kMarkedForDeoptimizationBit, 1> {}; // NOLINT
class IsTurbofannedField : public BitField<bool, kIsTurbofannedBit, 1> {
}; // NOLINT
+ class CanHaveWeakObjectsField
+ : public BitField<bool, kCanHaveWeakObjects, 1> {}; // NOLINT
// KindSpecificFlags2 layout (ALL)
static const int kIsCrankshaftedBit = 0;
« no previous file with comments | « src/mips64/lithium-codegen-mips64.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698