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

Side by Side Diff: src/objects.h

Issue 817223003: Remove custom weak handling of monomorphic IC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/ic/ic-inl.h ('k') | src/objects.cc » ('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 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 // ... : ... 2683 // ... : ...
2684 // [first_index(CODE_PTR, EXTENDED_SECTION)]: code pointer entries 2684 // [first_index(CODE_PTR, EXTENDED_SECTION)]: code pointer entries
2685 // ... : ... 2685 // ... : ...
2686 // [first_index(HEAP_PTR, EXTENDED_SECTION)]: heap pointer entries 2686 // [first_index(HEAP_PTR, EXTENDED_SECTION)]: heap pointer entries
2687 // ... : ... 2687 // ... : ...
2688 // [first_index(INT32, EXTENDED_SECTION)] : 32 bit entries 2688 // [first_index(INT32, EXTENDED_SECTION)] : 32 bit entries
2689 // ... : ... 2689 // ... : ...
2690 // 2690 //
2691 class ConstantPoolArray: public HeapObject { 2691 class ConstantPoolArray: public HeapObject {
2692 public: 2692 public:
2693 enum WeakObjectState { 2693 enum WeakObjectState { NO_WEAK_OBJECTS, WEAK_OBJECTS_IN_OPTIMIZED_CODE };
2694 NO_WEAK_OBJECTS,
2695 WEAK_OBJECTS_IN_OPTIMIZED_CODE,
2696 WEAK_OBJECTS_IN_IC
2697 };
2698 2694
2699 enum Type { 2695 enum Type {
2700 INT64 = 0, 2696 INT64 = 0,
2701 CODE_PTR, 2697 CODE_PTR,
2702 HEAP_PTR, 2698 HEAP_PTR,
2703 INT32, 2699 INT32,
2704 // Number of types stored by the ConstantPoolArrays. 2700 // Number of types stored by the ConstantPoolArrays.
2705 NUMBER_OF_TYPES, 2701 NUMBER_OF_TYPES,
2706 FIRST_TYPE = INT64, 2702 FIRST_TYPE = INT64,
2707 LAST_TYPE = INT32 2703 LAST_TYPE = INT32
(...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after
5131 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } 5127 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
5132 inline bool is_store_stub() { return kind() == STORE_IC; } 5128 inline bool is_store_stub() { return kind() == STORE_IC; }
5133 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } 5129 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; }
5134 inline bool is_call_stub() { return kind() == CALL_IC; } 5130 inline bool is_call_stub() { return kind() == CALL_IC; }
5135 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; } 5131 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; }
5136 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } 5132 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; }
5137 inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; } 5133 inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; }
5138 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; } 5134 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; }
5139 inline bool is_keyed_stub(); 5135 inline bool is_keyed_stub();
5140 inline bool is_optimized_code() { return kind() == OPTIMIZED_FUNCTION; } 5136 inline bool is_optimized_code() { return kind() == OPTIMIZED_FUNCTION; }
5141 inline bool is_weak_stub(); 5137 inline bool embeds_maps_weakly() {
5142 inline void mark_as_weak_stub();
5143 inline bool is_invalidated_weak_stub();
5144 inline void mark_as_invalidated_weak_stub();
5145
5146 inline bool CanBeWeakStub() {
5147 Kind k = kind(); 5138 Kind k = kind();
5148 return (k == LOAD_IC || k == STORE_IC || k == KEYED_LOAD_IC || 5139 return (k == LOAD_IC || k == STORE_IC || k == KEYED_LOAD_IC ||
5149 k == KEYED_STORE_IC || k == COMPARE_NIL_IC) && 5140 k == KEYED_STORE_IC || k == COMPARE_NIL_IC) &&
5150 ic_state() == MONOMORPHIC; 5141 ic_state() == MONOMORPHIC;
5151 } 5142 }
5152 5143
5153 inline bool IsCodeStubOrIC(); 5144 inline bool IsCodeStubOrIC();
5154 5145
5155 inline void set_raw_kind_specific_flags1(int value); 5146 inline void set_raw_kind_specific_flags1(int value);
5156 inline void set_raw_kind_specific_flags2(int value); 5147 inline void set_raw_kind_specific_flags2(int value);
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
5417 bool CanDeoptAt(Address pc); 5408 bool CanDeoptAt(Address pc);
5418 5409
5419 #ifdef VERIFY_HEAP 5410 #ifdef VERIFY_HEAP
5420 void VerifyEmbeddedObjectsDependency(); 5411 void VerifyEmbeddedObjectsDependency();
5421 #endif 5412 #endif
5422 5413
5423 #ifdef DEBUG 5414 #ifdef DEBUG
5424 void VerifyEmbeddedObjectsInFullCode(); 5415 void VerifyEmbeddedObjectsInFullCode();
5425 #endif // DEBUG 5416 #endif // DEBUG
5426 5417
5427 inline bool CanContainWeakObjects() { 5418 inline bool CanContainWeakObjects() { return is_optimized_code(); }
5428 return is_optimized_code() || is_weak_stub();
5429 }
5430 5419
5431 inline bool IsWeakObject(Object* object) { 5420 inline bool IsWeakObject(Object* object) {
5432 return (is_optimized_code() && !is_turbofanned() && 5421 return (is_optimized_code() && !is_turbofanned() &&
5433 IsWeakObjectInOptimizedCode(object)) || 5422 IsWeakObjectInOptimizedCode(object));
5434 (is_weak_stub() && IsWeakObjectInIC(object));
5435 } 5423 }
5436 5424
5437 static inline bool IsWeakObjectInOptimizedCode(Object* object); 5425 static inline bool IsWeakObjectInOptimizedCode(Object* object);
5438 static inline bool IsWeakObjectInIC(Object* object);
5439 5426
5440 // Max loop nesting marker used to postpose OSR. We don't take loop 5427 // Max loop nesting marker used to postpose OSR. We don't take loop
5441 // nesting that is deeper than 5 levels into account. 5428 // nesting that is deeper than 5 levels into account.
5442 static const int kMaxLoopNestingMarker = 6; 5429 static const int kMaxLoopNestingMarker = 6;
5443 5430
5444 // Layout description. 5431 // Layout description.
5445 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; 5432 static const int kRelocationInfoOffset = HeapObject::kHeaderSize;
5446 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; 5433 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize;
5447 static const int kDeoptimizationDataOffset = 5434 static const int kDeoptimizationDataOffset =
5448 kHandlerTableOffset + kPointerSize; 5435 kHandlerTableOffset + kPointerSize;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
5490 class KindField : public BitField<Kind, 7, 4> {}; 5477 class KindField : public BitField<Kind, 7, 4> {};
5491 class ExtraICStateField: public BitField<ExtraICState, 11, 5478 class ExtraICStateField: public BitField<ExtraICState, 11,
5492 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT 5479 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT
5493 5480
5494 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) 5481 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION)
5495 static const int kStackSlotsFirstBit = 0; 5482 static const int kStackSlotsFirstBit = 0;
5496 static const int kStackSlotsBitCount = 24; 5483 static const int kStackSlotsBitCount = 24;
5497 static const int kHasFunctionCacheBit = 5484 static const int kHasFunctionCacheBit =
5498 kStackSlotsFirstBit + kStackSlotsBitCount; 5485 kStackSlotsFirstBit + kStackSlotsBitCount;
5499 static const int kMarkedForDeoptimizationBit = kHasFunctionCacheBit + 1; 5486 static const int kMarkedForDeoptimizationBit = kHasFunctionCacheBit + 1;
5500 static const int kWeakStubBit = kMarkedForDeoptimizationBit + 1; 5487 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1;
5501 static const int kInvalidatedWeakStubBit = kWeakStubBit + 1;
5502 static const int kIsTurbofannedBit = kInvalidatedWeakStubBit + 1;
5503 5488
5504 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); 5489 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32);
5505 STATIC_ASSERT(kIsTurbofannedBit + 1 <= 32); 5490 STATIC_ASSERT(kIsTurbofannedBit + 1 <= 32);
5506 5491
5507 class StackSlotsField: public BitField<int, 5492 class StackSlotsField: public BitField<int,
5508 kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT 5493 kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT
5509 class HasFunctionCacheField : public BitField<bool, kHasFunctionCacheBit, 1> { 5494 class HasFunctionCacheField : public BitField<bool, kHasFunctionCacheBit, 1> {
5510 }; // NOLINT 5495 }; // NOLINT
5511 class MarkedForDeoptimizationField 5496 class MarkedForDeoptimizationField
5512 : public BitField<bool, kMarkedForDeoptimizationBit, 1> {}; // NOLINT 5497 : public BitField<bool, kMarkedForDeoptimizationBit, 1> {}; // NOLINT
5513 class WeakStubField : public BitField<bool, kWeakStubBit, 1> {}; // NOLINT
5514 class InvalidatedWeakStubField
5515 : public BitField<bool, kInvalidatedWeakStubBit, 1> {}; // NOLINT
5516 class IsTurbofannedField : public BitField<bool, kIsTurbofannedBit, 1> { 5498 class IsTurbofannedField : public BitField<bool, kIsTurbofannedBit, 1> {
5517 }; // NOLINT 5499 }; // NOLINT
5518 5500
5519 // KindSpecificFlags2 layout (ALL) 5501 // KindSpecificFlags2 layout (ALL)
5520 static const int kIsCrankshaftedBit = 0; 5502 static const int kIsCrankshaftedBit = 0;
5521 class IsCrankshaftedField: public BitField<bool, 5503 class IsCrankshaftedField: public BitField<bool,
5522 kIsCrankshaftedBit, 1> {}; // NOLINT 5504 kIsCrankshaftedBit, 1> {}; // NOLINT
5523 5505
5524 // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION) 5506 // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION)
5525 static const int kSafepointTableOffsetFirstBit = kIsCrankshaftedBit + 1; 5507 static const int kSafepointTableOffsetFirstBit = kIsCrankshaftedBit + 1;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
5587 // the number of codes is less than the length of the array. The order of the 5569 // the number of codes is less than the length of the array. The order of the
5588 // code objects within a group is not preserved. 5570 // code objects within a group is not preserved.
5589 // 5571 //
5590 // All code indexes used in the class are counted starting from the first 5572 // All code indexes used in the class are counted starting from the first
5591 // code object of the first group. In other words, code index 0 corresponds 5573 // code object of the first group. In other words, code index 0 corresponds
5592 // to array index n = kCodesStartIndex. 5574 // to array index n = kCodesStartIndex.
5593 5575
5594 class DependentCode: public FixedArray { 5576 class DependentCode: public FixedArray {
5595 public: 5577 public:
5596 enum DependencyGroup { 5578 enum DependencyGroup {
5597 // Group of IC stubs that weakly embed this map and depend on being
5598 // invalidated when the map is garbage collected. Dependent IC stubs form
5599 // a linked list. This group stores only the head of the list. This means
5600 // that the number_of_entries(kWeakICGroup) is 0 or 1.
5601 kWeakICGroup,
5602 // Group of code that weakly embed this map and depend on being 5579 // Group of code that weakly embed this map and depend on being
5603 // deoptimized when the map is garbage collected. 5580 // deoptimized when the map is garbage collected.
5604 kWeakCodeGroup, 5581 kWeakCodeGroup,
5605 // Group of code that embed a transition to this map, and depend on being 5582 // Group of code that embed a transition to this map, and depend on being
5606 // deoptimized when the transition is replaced by a new version. 5583 // deoptimized when the transition is replaced by a new version.
5607 kTransitionGroup, 5584 kTransitionGroup,
5608 // Group of code that omit run-time prototype checks for prototypes 5585 // Group of code that omit run-time prototype checks for prototypes
5609 // described by this map. The group is deoptimized whenever an object 5586 // described by this map. The group is deoptimized whenever an object
5610 // described by this map changes shape (and transitions to a new map), 5587 // described by this map changes shape (and transitions to a new map),
5611 // possibly invalidating the assumptions embedded in the code. 5588 // possibly invalidating the assumptions embedded in the code.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5652 CompilationInfo* info, 5629 CompilationInfo* info,
5653 Code* code); 5630 Code* code);
5654 void RemoveCompilationInfo(DependentCode::DependencyGroup group, 5631 void RemoveCompilationInfo(DependentCode::DependencyGroup group,
5655 CompilationInfo* info); 5632 CompilationInfo* info);
5656 5633
5657 void DeoptimizeDependentCodeGroup(Isolate* isolate, 5634 void DeoptimizeDependentCodeGroup(Isolate* isolate,
5658 DependentCode::DependencyGroup group); 5635 DependentCode::DependencyGroup group);
5659 5636
5660 bool MarkCodeForDeoptimization(Isolate* isolate, 5637 bool MarkCodeForDeoptimization(Isolate* isolate,
5661 DependentCode::DependencyGroup group); 5638 DependentCode::DependencyGroup group);
5662 void AddToDependentICList(Handle<Code> stub);
5663 5639
5664 // The following low-level accessors should only be used by this class 5640 // The following low-level accessors should only be used by this class
5665 // and the mark compact collector. 5641 // and the mark compact collector.
5666 inline int number_of_entries(DependencyGroup group); 5642 inline int number_of_entries(DependencyGroup group);
5667 inline void set_number_of_entries(DependencyGroup group, int value); 5643 inline void set_number_of_entries(DependencyGroup group, int value);
5668 inline bool is_code_at(int i); 5644 inline bool is_code_at(int i);
5669 inline Code* code_at(int i); 5645 inline Code* code_at(int i);
5670 inline CompilationInfo* compilation_info_at(int i); 5646 inline CompilationInfo* compilation_info_at(int i);
5671 inline void set_object_at(int i, Object* object); 5647 inline void set_object_at(int i, Object* object);
5672 inline Object** slot_at(int i); 5648 inline Object** slot_at(int i);
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
6271 6247
6272 inline bool CanOmitMapChecks(); 6248 inline bool CanOmitMapChecks();
6273 6249
6274 static void AddDependentCompilationInfo(Handle<Map> map, 6250 static void AddDependentCompilationInfo(Handle<Map> map,
6275 DependentCode::DependencyGroup group, 6251 DependentCode::DependencyGroup group,
6276 CompilationInfo* info); 6252 CompilationInfo* info);
6277 6253
6278 static void AddDependentCode(Handle<Map> map, 6254 static void AddDependentCode(Handle<Map> map,
6279 DependentCode::DependencyGroup group, 6255 DependentCode::DependencyGroup group,
6280 Handle<Code> code); 6256 Handle<Code> code);
6281 static void AddDependentIC(Handle<Map> map,
6282 Handle<Code> stub);
6283 6257
6284 bool IsMapInArrayPrototypeChain(); 6258 bool IsMapInArrayPrototypeChain();
6285 6259
6286 static Handle<WeakCell> WeakCellForMap(Handle<Map> map); 6260 static Handle<WeakCell> WeakCellForMap(Handle<Map> map);
6287 6261
6288 // Dispatched behavior. 6262 // Dispatched behavior.
6289 DECLARE_PRINTER(Map) 6263 DECLARE_PRINTER(Map)
6290 DECLARE_VERIFIER(Map) 6264 DECLARE_VERIFIER(Map)
6291 6265
6292 #ifdef VERIFY_HEAP 6266 #ifdef VERIFY_HEAP
(...skipping 4800 matching lines...) Expand 10 before | Expand all | Expand 10 after
11093 } else { 11067 } else {
11094 value &= ~(1 << bit_position); 11068 value &= ~(1 << bit_position);
11095 } 11069 }
11096 return value; 11070 return value;
11097 } 11071 }
11098 }; 11072 };
11099 11073
11100 } } // namespace v8::internal 11074 } } // namespace v8::internal
11101 11075
11102 #endif // V8_OBJECTS_H_ 11076 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ic/ic-inl.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698