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

Side by Side Diff: src/hydrogen-instructions.h

Issue 61463005: Supported folding of constant size allocation followed by dynamic size allocation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Explicit propagation of allocation size upper bound Created 6 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 unified diff | Download patch | Annotate | Revision Log
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 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 virtual int operand_position(int index) const V8_OVERRIDE { 1230 virtual int operand_position(int index) const V8_OVERRIDE {
1231 const int pos = position_.operand_position(index); 1231 const int pos = position_.operand_position(index);
1232 return (pos != RelocInfo::kNoPosition) ? pos : position(); 1232 return (pos != RelocInfo::kNoPosition) ? pos : position();
1233 } 1233 }
1234 void set_operand_position(Zone* zone, int index, int pos) { 1234 void set_operand_position(Zone* zone, int index, int pos) {
1235 ASSERT(0 <= index && index < OperandCount()); 1235 ASSERT(0 <= index && index < OperandCount());
1236 position_.ensure_storage_for_operand_positions(zone, OperandCount()); 1236 position_.ensure_storage_for_operand_positions(zone, OperandCount());
1237 position_.set_operand_position(index, pos); 1237 position_.set_operand_position(index, pos);
1238 } 1238 }
1239 1239
1240 bool Dominates(HInstruction* other);
1241
1240 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } 1242 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); }
1241 1243
1242 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; 1244 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0;
1243 1245
1244 #ifdef DEBUG 1246 #ifdef DEBUG
1245 virtual void Verify() V8_OVERRIDE; 1247 virtual void Verify() V8_OVERRIDE;
1246 #endif 1248 #endif
1247 1249
1248 virtual bool HasStackCheck() { return false; } 1250 virtual bool HasStackCheck() { return false; }
1249 1251
(...skipping 4199 matching lines...) Expand 10 before | Expand all | Expand 10 after
5449 return new(zone) HAllocate(context, size, type, pretenure_flag, 5451 return new(zone) HAllocate(context, size, type, pretenure_flag,
5450 instance_type, allocation_site); 5452 instance_type, allocation_site);
5451 } 5453 }
5452 5454
5453 // Maximum instance size for which allocations will be inlined. 5455 // Maximum instance size for which allocations will be inlined.
5454 static const int kMaxInlineSize = 64 * kPointerSize; 5456 static const int kMaxInlineSize = 64 * kPointerSize;
5455 5457
5456 HValue* context() { return OperandAt(0); } 5458 HValue* context() { return OperandAt(0); }
5457 HValue* size() { return OperandAt(1); } 5459 HValue* size() { return OperandAt(1); }
5458 5460
5461 bool has_size_upper_bound() { return size_upper_bound_ != NULL; }
5462 HConstant* size_upper_bound() { return size_upper_bound_; }
5463 void set_size_upper_bound(HConstant* value) { size_upper_bound_ = value; }
Hannes Payer (out of office) 2014/01/16 12:58:39 I guess set_size_upper_bound should only be called
5464
5459 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5465 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5460 if (index == 0) { 5466 if (index == 0) {
5461 return Representation::Tagged(); 5467 return Representation::Tagged();
5462 } else { 5468 } else {
5463 return Representation::Integer32(); 5469 return Representation::Integer32();
5464 } 5470 }
5465 } 5471 }
5466 5472
5467 virtual Handle<Map> GetMonomorphicJSObjectMap() { 5473 virtual Handle<Map> GetMonomorphicJSObjectMap() {
5468 return known_initial_map_; 5474 return known_initial_map_;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
5519 HAllocate(HValue* context, 5525 HAllocate(HValue* context,
5520 HValue* size, 5526 HValue* size,
5521 HType type, 5527 HType type,
5522 PretenureFlag pretenure_flag, 5528 PretenureFlag pretenure_flag,
5523 InstanceType instance_type, 5529 InstanceType instance_type,
5524 Handle<AllocationSite> allocation_site = 5530 Handle<AllocationSite> allocation_site =
5525 Handle<AllocationSite>::null()) 5531 Handle<AllocationSite>::null())
5526 : HTemplateInstruction<2>(type), 5532 : HTemplateInstruction<2>(type),
5527 dominating_allocate_(NULL), 5533 dominating_allocate_(NULL),
5528 filler_free_space_size_(NULL), 5534 filler_free_space_size_(NULL),
5535 size_upper_bound_(NULL),
5529 clear_next_map_word_(false) { 5536 clear_next_map_word_(false) {
5530 SetOperandAt(0, context); 5537 SetOperandAt(0, context);
5531 SetOperandAt(1, size); 5538 UpdateSize(size);
5532 set_representation(Representation::Tagged()); 5539 set_representation(Representation::Tagged());
5533 SetFlag(kTrackSideEffectDominators); 5540 SetFlag(kTrackSideEffectDominators);
5534 SetGVNFlag(kChangesNewSpacePromotion); 5541 SetGVNFlag(kChangesNewSpacePromotion);
5535 SetGVNFlag(kDependsOnNewSpacePromotion); 5542 SetGVNFlag(kDependsOnNewSpacePromotion);
5536 flags_ = pretenure_flag == TENURED 5543 flags_ = pretenure_flag == TENURED
5537 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE 5544 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE
5538 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) 5545 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE)
5539 : ALLOCATE_IN_NEW_SPACE; 5546 : ALLOCATE_IN_NEW_SPACE;
5540 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { 5547 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) {
5541 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); 5548 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED);
(...skipping 13 matching lines...) Expand all
5555 PrintF("HAllocate with AllocationSite %p %s\n", 5562 PrintF("HAllocate with AllocationSite %p %s\n",
5556 allocation_site.is_null() 5563 allocation_site.is_null()
5557 ? static_cast<void*>(NULL) 5564 ? static_cast<void*>(NULL)
5558 : static_cast<void*>(*allocation_site), 5565 : static_cast<void*>(*allocation_site),
5559 pretenure_flag == TENURED ? "tenured" : "not tenured"); 5566 pretenure_flag == TENURED ? "tenured" : "not tenured");
5560 } 5567 }
5561 } 5568 }
5562 5569
5563 void UpdateSize(HValue* size) { 5570 void UpdateSize(HValue* size) {
5564 SetOperandAt(1, size); 5571 SetOperandAt(1, size);
5572 if (size->IsInteger32Constant()) {
5573 size_upper_bound_ = HConstant::cast(size);
5574 } else {
5575 size_upper_bound_ = NULL;
5576 }
5565 } 5577 }
5566 5578
5567 HAllocate* GetFoldableDominator(HAllocate* dominator); 5579 HAllocate* GetFoldableDominator(HAllocate* dominator);
5568 5580
5569 void UpdateFreeSpaceFiller(int32_t filler_size); 5581 void UpdateFreeSpaceFiller(int32_t filler_size);
5570 5582
5571 void CreateFreeSpaceFiller(int32_t filler_size); 5583 void CreateFreeSpaceFiller(int32_t filler_size);
5572 5584
5573 bool IsFoldable(HAllocate* allocate) { 5585 bool IsFoldable(HAllocate* allocate) {
5574 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) || 5586 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) ||
5575 (IsOldDataSpaceAllocation() && allocate->IsOldDataSpaceAllocation()) || 5587 (IsOldDataSpaceAllocation() && allocate->IsOldDataSpaceAllocation()) ||
5576 (IsOldPointerSpaceAllocation() && 5588 (IsOldPointerSpaceAllocation() &&
5577 allocate->IsOldPointerSpaceAllocation()); 5589 allocate->IsOldPointerSpaceAllocation());
5578 } 5590 }
5579 5591
5580 void ClearNextMapWord(int offset); 5592 void ClearNextMapWord(int offset);
5581 5593
5582 Flags flags_; 5594 Flags flags_;
5583 Handle<Map> known_initial_map_; 5595 Handle<Map> known_initial_map_;
5584 HAllocate* dominating_allocate_; 5596 HAllocate* dominating_allocate_;
5585 HStoreNamedField* filler_free_space_size_; 5597 HStoreNamedField* filler_free_space_size_;
5598 HConstant* size_upper_bound_;
5586 bool clear_next_map_word_; 5599 bool clear_next_map_word_;
5587 }; 5600 };
5588 5601
5589 5602
5590 class HStoreCodeEntry V8_FINAL: public HTemplateInstruction<2> { 5603 class HStoreCodeEntry V8_FINAL: public HTemplateInstruction<2> {
5591 public: 5604 public:
5592 static HStoreCodeEntry* New(Zone* zone, 5605 static HStoreCodeEntry* New(Zone* zone,
5593 HValue* context, 5606 HValue* context,
5594 HValue* function, 5607 HValue* function,
5595 HValue* code) { 5608 HValue* code) {
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
7543 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7556 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7544 }; 7557 };
7545 7558
7546 7559
7547 #undef DECLARE_INSTRUCTION 7560 #undef DECLARE_INSTRUCTION
7548 #undef DECLARE_CONCRETE_INSTRUCTION 7561 #undef DECLARE_CONCRETE_INSTRUCTION
7549 7562
7550 } } // namespace v8::internal 7563 } } // namespace v8::internal
7551 7564
7552 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7565 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698