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

Unified Diff: src/hydrogen-instructions.h

Issue 1124443004: New hydrogen instruction to reduce cost of growing an array on keyed stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 5 years, 7 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 fcd7c2c24bfb5647cf17b2e51a0fe1a8ebebf297..ff02212dcb892945caa1a9c538d2da43f3bc3ae8 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -127,6 +127,7 @@ class LChunkBuilder;
V(MapEnumLength) \
V(MathFloorOfDiv) \
V(MathMinMax) \
+ V(MaybeGrowElements) \
V(Mod) \
V(Mul) \
V(OsrEntry) \
@@ -965,6 +966,12 @@ std::ostream& operator<<(std::ostream& os, const ChangesOf& v);
return new (zone) I(context, p1, p2, p3, p4, p5); \
}
+#define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P6(I, P1, P2, P3, P4, P5, P6) \
+ static I* New(Isolate* isolate, Zone* zone, HValue* context, P1 p1, P2 p2, \
+ P3 p3, P4 p4, P5 p5, P6 p6) { \
+ return new (zone) I(context, p1, p2, p3, p4, p5, p6); \
+ }
+
// A helper class to represent per-operand position information attached to
// the HInstruction in the compact form. Uses tagging to distinguish between
@@ -7558,6 +7565,58 @@ class HTrapAllocationMemento final : public HTemplateInstruction<1> {
};
+class HMaybeGrowElements final : public HTemplateInstruction<5> {
+ public:
+ DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P6(HMaybeGrowElements, HValue*,
+ HValue*, HValue*, HValue*, bool,
+ ElementsKind);
+
+ Representation RequiredInputRepresentation(int index) override {
+ if (index < 3) {
+ return Representation::Tagged();
+ }
+ DCHECK(index == 3 || index == 4);
+ return Representation::Integer32();
+ }
+
+ HValue* context() const { return OperandAt(0); }
+ HValue* object() const { return OperandAt(1); }
+ HValue* elements() const { return OperandAt(2); }
+ HValue* key() const { return OperandAt(3); }
+ HValue* current_capacity() const { return OperandAt(4); }
+
+ bool is_js_array() const { return is_js_array_; }
+ ElementsKind kind() const { return kind_; }
+
+ DECLARE_CONCRETE_INSTRUCTION(MaybeGrowElements)
+
+ protected:
+ bool DataEquals(HValue* other) override { return true; }
+
+ private:
+ explicit HMaybeGrowElements(HValue* context, HValue* object, HValue* elements,
+ HValue* key, HValue* current_capacity,
+ bool is_js_array, ElementsKind kind) {
+ is_js_array_ = is_js_array;
+ kind_ = kind;
+
+ SetOperandAt(0, context);
+ SetOperandAt(1, object);
+ SetOperandAt(2, elements);
+ SetOperandAt(3, key);
+ SetOperandAt(4, current_capacity);
+
+ SetFlag(kUseGVN);
+ SetChangesFlag(kElementsPointer);
+ SetChangesFlag(kNewSpacePromotion);
+ set_representation(Representation::Tagged());
+ }
+
+ bool is_js_array_;
+ ElementsKind kind_;
+};
+
+
class HToFastProperties final : public HUnaryOperation {
public:
DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*);
« 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