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

Unified Diff: src/hydrogen-instructions.h

Issue 21089006: Allocation space decisions are precisely made in hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index e71b7cdf41a1b483e22320eecddd5a569fe0a541..34e069b1b4e3dd34502bb61d16d0f3f0132f4ce5 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -5241,15 +5241,18 @@ class HLoadGlobalGeneric: public HTemplateInstruction<2> {
class HAllocate: public HTemplateInstruction<2> {
public:
enum Flags {
- CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0,
- CAN_ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1,
- CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2,
+ ALLOCATE_IN_NEW_SPACE = 1 << 0,
+ ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1,
+ ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2,
ALLOCATE_DOUBLE_ALIGNED = 1 << 3,
PREFILL_WITH_FILLER = 1 << 4
};
HAllocate(HValue* context, HValue* size, HType type, Flags flags)
: flags_(flags) {
+ ASSERT(((flags & kAllocationFlagsMask) == ALLOCATE_IN_NEW_SPACE) ||
+ ((flags & kAllocationFlagsMask) == ALLOCATE_IN_OLD_DATA_SPACE) ||
+ ((flags & kAllocationFlagsMask) == ALLOCATE_IN_OLD_POINTER_SPACE));
SetOperandAt(0, context);
SetOperandAt(1, size);
set_type(type);
@@ -5263,11 +5266,11 @@ class HAllocate: public HTemplateInstruction<2> {
static const int kMaxInlineSize = 64 * kPointerSize;
static Flags DefaultFlags() {
- return CAN_ALLOCATE_IN_NEW_SPACE;
+ return ALLOCATE_IN_NEW_SPACE;
}
static Flags DefaultFlags(ElementsKind kind) {
- Flags flags = CAN_ALLOCATE_IN_NEW_SPACE;
+ Flags flags = ALLOCATE_IN_NEW_SPACE;
if (IsFastDoubleElementsKind(kind)) {
flags = static_cast<HAllocate::Flags>(
flags | HAllocate::ALLOCATE_DOUBLE_ALIGNED);
@@ -5275,6 +5278,14 @@ class HAllocate: public HTemplateInstruction<2> {
return flags;
}
+ static Flags SetAllocationFlag(Flags flags, Flags allocation_flag) {
Michael Starzinger 2013/07/30 12:50:41 As discussed offline: I don't like this helper ver
Hannes Payer (out of office) 2013/07/30 15:23:05 I took that idea even further and made the HAlloca
+ ASSERT(allocation_flag == ALLOCATE_IN_NEW_SPACE ||
+ allocation_flag == ALLOCATE_IN_OLD_DATA_SPACE ||
+ allocation_flag == ALLOCATE_IN_OLD_POINTER_SPACE);
+ flags = static_cast<HAllocate::Flags>(flags & ~kAllocationFlagsMask);
+ return static_cast<HAllocate::Flags>(flags | allocation_flag);
+ }
+
HValue* context() { return OperandAt(0); }
HValue* size() { return OperandAt(1); }
@@ -5294,25 +5305,16 @@ class HAllocate: public HTemplateInstruction<2> {
known_initial_map_ = known_initial_map;
}
- bool CanAllocateInNewSpace() const {
- return (flags_ & CAN_ALLOCATE_IN_NEW_SPACE) != 0;
- }
-
- bool CanAllocateInOldDataSpace() const {
- return (flags_ & CAN_ALLOCATE_IN_OLD_DATA_SPACE) != 0;
- }
-
- bool CanAllocateInOldPointerSpace() const {
- return (flags_ & CAN_ALLOCATE_IN_OLD_POINTER_SPACE) != 0;
+ bool AllocateInNewSpace() const {
+ return (flags_ & ALLOCATE_IN_NEW_SPACE) != 0;
}
- bool CanAllocateInOldSpace() const {
- return CanAllocateInOldDataSpace() ||
- CanAllocateInOldPointerSpace();
+ bool AllocateInOldDataSpace() const {
+ return (flags_ & ALLOCATE_IN_OLD_DATA_SPACE) != 0;
}
- bool GuaranteedInNewSpace() const {
- return CanAllocateInNewSpace() && !CanAllocateInOldSpace();
+ bool AllocateInOldPointerSpace() const {
+ return (flags_ & ALLOCATE_IN_OLD_POINTER_SPACE) != 0;
}
bool MustAllocateDoubleAligned() const {
@@ -5325,6 +5327,9 @@ class HAllocate: public HTemplateInstruction<2> {
void SetFlags(Flags flags) {
flags_ = static_cast<HAllocate::Flags>(flags_ | flags);
+ ASSERT(((flags_ & kAllocationFlagsMask) == ALLOCATE_IN_NEW_SPACE) ||
+ ((flags_ & kAllocationFlagsMask) == ALLOCATE_IN_OLD_DATA_SPACE) ||
+ ((flags_ & kAllocationFlagsMask) == ALLOCATE_IN_OLD_POINTER_SPACE));
}
void UpdateSize(HValue* size) {
@@ -5339,6 +5344,7 @@ class HAllocate: public HTemplateInstruction<2> {
DECLARE_CONCRETE_INSTRUCTION(Allocate)
private:
+ static const int kAllocationFlagsMask = 0x7;
Michael Starzinger 2013/07/30 12:50:41 Better compute this using the above three enum val
Hannes Payer (out of office) 2013/07/30 15:23:05 Removed, not needed anymore
Flags flags_;
Handle<Map> known_initial_map_;
};
@@ -5389,7 +5395,7 @@ inline bool ReceiverObjectNeedsWriteBarrier(HValue* object,
}
if (object != new_space_dominator) return true;
if (object->IsAllocate()) {
- return !HAllocate::cast(object)->GuaranteedInNewSpace();
+ return !HAllocate::cast(object)->AllocateInNewSpace();
}
return true;
}
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698