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

Unified Diff: src/hydrogen-instructions.h

Issue 12315005: Constant fold math and string operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 64910c8d55ff8a70b27b6b97b49e0fc5038917db..98925e7d24308e97931ffbfab6af27f987cbaed6 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -2402,6 +2402,9 @@ class HUnaryMathOperation: public HTemplateInstruction<2> {
SetFlag(kUseGVN);
}
+ static HInstruction* NewHUnaryMathOperation(
Jakob Kummerow 2013/02/20 15:31:04 idea: You could shorten this to just "New", as it'
+ Zone* zone, HValue* context, HValue* value, BuiltinFunctionId op);
+
HValue* context() { return OperandAt(0); }
HValue* value() { return OperandAt(1); }
@@ -2418,7 +2421,6 @@ class HUnaryMathOperation: public HTemplateInstruction<2> {
switch (op_) {
case kMathFloor:
case kMathRound:
- case kMathCeil:
case kMathSqrt:
case kMathPowHalf:
case kMathLog:
@@ -3064,6 +3066,15 @@ class HConstant: public HTemplateInstruction<0> {
// representation of the number in int32_value_.
return int32_value_;
}
+ bool HasStringValue() const {
+ if (has_double_value_ || has_int32_value_) return false;
+ ASSERT(!handle_.is_null());
+ return handle_->IsString();
+ }
+ Handle<String> StringValue() const {
+ ASSERT(HasStringValue());
+ return Handle<String>::cast(handle_);
+ }
bool ToBoolean();
@@ -3892,6 +3903,9 @@ class HPower: public HTemplateInstruction<2> {
SetGVNFlag(kChangesNewSpacePromotion);
}
+ static HInstruction* NewHPower(
+ Zone* zone, HValue* left, HValue* right);
+
HValue* left() { return OperandAt(0); }
HValue* right() const { return OperandAt(1); }
@@ -4125,6 +4139,9 @@ class HMathMinMax: public HArithmeticBinaryOperation {
: HArithmeticBinaryOperation(context, left, right),
operation_(op) { }
+ static HInstruction* NewHMathMinMax(
+ Zone* zone, HValue* context, HValue* left, HValue* right, Operation op);
+
virtual Representation RequiredInputRepresentation(int index) {
return index == 0 ? Representation::Tagged()
: representation();
@@ -5402,6 +5419,11 @@ class HStringAdd: public HBinaryOperation {
SetGVNFlag(kChangesNewSpacePromotion);
}
+ static HInstruction* NewHStringAdd(Zone* zone,
+ HValue* context,
+ HValue* left,
+ HValue* right);
+
virtual Representation RequiredInputRepresentation(int index) {
return Representation::Tagged();
}
@@ -5469,6 +5491,9 @@ class HStringCharFromCode: public HTemplateInstruction<2> {
SetGVNFlag(kChangesNewSpacePromotion);
}
+ static HInstruction* NewHStringCharFromCode(
+ Zone* zone, HValue* context, HValue* char_code);
+
virtual Representation RequiredInputRepresentation(int index) {
return index == 0
? Representation::Tagged()
@@ -5497,6 +5522,8 @@ class HStringLength: public HUnaryOperation {
SetGVNFlag(kDependsOnMaps);
}
+ static HInstruction* NewHStringLength(Zone* zone, HValue* string);
+
virtual Representation RequiredInputRepresentation(int index) {
return Representation::Tagged();
}

Powered by Google App Engine
This is Rietveld 408576698