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

Unified Diff: src/hydrogen-instructions.h

Issue 16026023: Avoid Unnecessary Smi Checks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 7554fd85bad5a136e387698eb704159008be7bdd..4415eef0fdd425a9b0a63519be26633e01ec1d31 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -88,9 +88,9 @@ class LChunkBuilder;
V(CallStub) \
V(Change) \
V(CheckFunction) \
+ V(CheckHeapObject) \
V(CheckInstanceType) \
V(CheckMaps) \
- V(CheckNonSmi) \
V(CheckPrototypeMaps) \
V(ClampToUint8) \
V(ClassOfTestAndBranch) \
@@ -433,7 +433,7 @@ class HType {
bool IsHeapObject() const {
ASSERT(type_ != kUninitialized);
- return IsHeapNumber() || IsString() || IsNonPrimitive();
+ return IsHeapNumber() || IsString() || IsBoolean() || IsNonPrimitive();
}
static HType TypeFromValue(Handle<Object> value);
@@ -915,6 +915,10 @@ class HValue: public ZoneObject {
type_ = new_type;
}
+ bool IsHeapObject() {
+ return representation_.IsHeapObject() || type_.IsHeapObject();
ulan 2013/06/20 07:53:54 I am not sure that this guarantees that we can saf
Toon Verwaest 2013/06/20 12:38:42 This is safe. representation_.IsHeapObject() never
+ }
+
// An operation needs to override this function iff:
// 1) it can produce an int32 output.
// 2) the true value of its output can potentially be minus zero.
@@ -2941,9 +2945,9 @@ class HCheckInstanceType: public HUnaryOperation {
};
-class HCheckNonSmi: public HUnaryOperation {
+class HCheckHeapObject: public HUnaryOperation {
public:
- explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) {
+ explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
}
@@ -2960,17 +2964,13 @@ class HCheckNonSmi: public HUnaryOperation {
virtual HValue* Canonicalize() {
HType value_type = value()->type();
- if (!value_type.IsUninitialized() &&
- (value_type.IsHeapNumber() ||
- value_type.IsString() ||
- value_type.IsBoolean() ||
- value_type.IsNonPrimitive())) {
+ if (!value_type.IsUninitialized() && value_type.IsHeapObject()) {
return NULL;
}
return this;
}
- DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi)
+ DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject)
protected:
virtual bool DataEquals(HValue* other) { return true; }

Powered by Google App Engine
This is Rietveld 408576698