| Index: src/hydrogen-instructions.h
|
| ===================================================================
|
| --- src/hydrogen-instructions.h (revision 10404)
|
| +++ src/hydrogen-instructions.h (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2011 the V8 project authors. All rights reserved.
|
| +// Copyright 2012 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -146,6 +146,7 @@
|
| V(Parameter) \
|
| V(Power) \
|
| V(PushArgument) \
|
| + V(Random) \
|
| V(RegExpLiteral) \
|
| V(Return) \
|
| V(Sar) \
|
| @@ -1130,12 +1131,16 @@
|
|
|
| virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
|
| virtual HType CalculateInferredType();
|
| + virtual HValue* Canonicalize();
|
|
|
| Representation from() { return value()->representation(); }
|
| Representation to() { return representation(); }
|
| bool deoptimize_on_undefined() const {
|
| return CheckFlag(kDeoptimizeOnUndefined);
|
| }
|
| + bool deoptimize_on_minus_zero() const {
|
| + return CheckFlag(kBailoutOnMinusZero);
|
| + }
|
| virtual Representation RequiredInputRepresentation(int index) {
|
| return from();
|
| }
|
| @@ -1921,8 +1926,11 @@
|
|
|
| class HCheckMap: public HTemplateInstruction<2> {
|
| public:
|
| - HCheckMap(HValue* value, Handle<Map> map, HValue* typecheck = NULL)
|
| - : map_(map) {
|
| + HCheckMap(HValue* value, Handle<Map> map,
|
| + HValue* typecheck = NULL,
|
| + CompareMapMode mode = REQUIRE_EXACT_MAP)
|
| + : map_(map),
|
| + mode_(mode) {
|
| SetOperandAt(0, value);
|
| // If callers don't depend on a typecheck, they can pass in NULL. In that
|
| // case we use a copy of the |value| argument as a dummy value.
|
| @@ -1930,6 +1938,9 @@
|
| set_representation(Representation::Tagged());
|
| SetFlag(kUseGVN);
|
| SetFlag(kDependsOnMaps);
|
| + has_element_transitions_ =
|
| + map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL) != NULL ||
|
| + map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL) != NULL;
|
| }
|
|
|
| virtual Representation RequiredInputRepresentation(int index) {
|
| @@ -1940,17 +1951,24 @@
|
|
|
| HValue* value() { return OperandAt(0); }
|
| Handle<Map> map() const { return map_; }
|
| + CompareMapMode mode() const { return mode_; }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(CheckMap)
|
|
|
| protected:
|
| virtual bool DataEquals(HValue* other) {
|
| HCheckMap* b = HCheckMap::cast(other);
|
| - return map_.is_identical_to(b->map());
|
| + // Two CheckMaps instructions are DataEqual if their maps are identical and
|
| + // they have the same mode. The mode comparison can be ignored if the map
|
| + // has no elements transitions.
|
| + return map_.is_identical_to(b->map()) &&
|
| + (b->mode() == mode() || !has_element_transitions_);
|
| }
|
|
|
| private:
|
| + bool has_element_transitions_;
|
| Handle<Map> map_;
|
| + CompareMapMode mode_;
|
| };
|
|
|
|
|
| @@ -2985,6 +3003,23 @@
|
| };
|
|
|
|
|
| +class HRandom: public HTemplateInstruction<1> {
|
| + public:
|
| + explicit HRandom(HValue* global_object) {
|
| + SetOperandAt(0, global_object);
|
| + set_representation(Representation::Double());
|
| + }
|
| +
|
| + HValue* global_object() { return OperandAt(0); }
|
| +
|
| + virtual Representation RequiredInputRepresentation(int index) {
|
| + return Representation::Tagged();
|
| + }
|
| +
|
| + DECLARE_CONCRETE_INSTRUCTION(Random)
|
| +};
|
| +
|
| +
|
| class HAdd: public HArithmeticBinaryOperation {
|
| public:
|
| HAdd(HValue* context, HValue* left, HValue* right)
|
| @@ -3138,6 +3173,8 @@
|
|
|
| virtual bool IsCommutative() const { return true; }
|
|
|
| + virtual HValue* Canonicalize();
|
| +
|
| static HInstruction* NewHBitwise(Zone* zone,
|
| Token::Value op,
|
| HValue* context,
|
|
|