| Index: src/hydrogen-instructions.h
|
| ===================================================================
|
| --- src/hydrogen-instructions.h (revision 6941)
|
| +++ src/hydrogen-instructions.h (working copy)
|
| @@ -73,10 +73,10 @@
|
| // HCompare
|
| // HCompareJSObjectEq
|
| // HInstanceOf
|
| +// HInstanceOfKnownGlobal
|
| // HLoadKeyed
|
| // HLoadKeyedFastElement
|
| // HLoadKeyedGeneric
|
| -// HLoadNamedGeneric
|
| // HPower
|
| // HStoreNamed
|
| // HStoreNamedField
|
| @@ -92,6 +92,7 @@
|
| // HCallNew
|
| // HCallRuntime
|
| // HCallStub
|
| +// HCheckPrototypeMaps
|
| // HConstant
|
| // HControlInstruction
|
| // HDeoptimize
|
| @@ -119,19 +120,21 @@
|
| // HStoreKeyedFastElement
|
| // HStoreKeyedGeneric
|
| // HUnaryOperation
|
| -// HArrayLength
|
| // HBitNot
|
| // HChange
|
| // HCheckFunction
|
| // HCheckInstanceType
|
| // HCheckMap
|
| // HCheckNonSmi
|
| -// HCheckPrototypeMaps
|
| // HCheckSmi
|
| // HDeleteProperty
|
| +// HFixedArrayLength
|
| +// HJSArrayLength
|
| // HLoadElements
|
| // HTypeofIs
|
| // HLoadNamedField
|
| +// HLoadNamedGeneric
|
| +// HLoadFunctionPrototype
|
| // HPushArgument
|
| // HTypeof
|
| // HUnaryMathOperation
|
| @@ -170,7 +173,6 @@
|
| V(ArgumentsElements) \
|
| V(ArgumentsLength) \
|
| V(ArgumentsObject) \
|
| - V(ArrayLength) \
|
| V(ArrayLiteral) \
|
| V(BitAnd) \
|
| V(BitNot) \
|
| @@ -203,16 +205,19 @@
|
| V(Deoptimize) \
|
| V(Div) \
|
| V(EnterInlined) \
|
| + V(FixedArrayLength) \
|
| V(FunctionLiteral) \
|
| V(GlobalObject) \
|
| V(GlobalReceiver) \
|
| V(Goto) \
|
| V(InstanceOf) \
|
| + V(InstanceOfKnownGlobal) \
|
| V(IsNull) \
|
| V(IsObject) \
|
| V(IsSmi) \
|
| V(HasInstanceType) \
|
| V(HasCachedArrayIndex) \
|
| + V(JSArrayLength) \
|
| V(ClassOfTest) \
|
| V(LeaveInlined) \
|
| V(LoadElements) \
|
| @@ -221,6 +226,7 @@
|
| V(LoadKeyedGeneric) \
|
| V(LoadNamedField) \
|
| V(LoadNamedGeneric) \
|
| + V(LoadFunctionPrototype) \
|
| V(Mod) \
|
| V(Mul) \
|
| V(ObjectLiteral) \
|
| @@ -256,6 +262,7 @@
|
| V(GlobalVars) \
|
| V(Maps) \
|
| V(ArrayLengths) \
|
| + V(FunctionPrototypes) \
|
| V(OsrEntries)
|
|
|
| #define DECLARE_INSTRUCTION(type) \
|
| @@ -905,6 +912,9 @@
|
| virtual HBasicBlock* FirstSuccessor() const { return true_destination_; }
|
| virtual HBasicBlock* SecondSuccessor() const { return false_destination_; }
|
|
|
| + HBasicBlock* true_destination() const { return true_destination_; }
|
| + HBasicBlock* false_destination() const { return false_destination_; }
|
| +
|
| virtual void PrintDataTo(StringStream* stream) const;
|
|
|
| Handle<Map> map() const { return map_; }
|
| @@ -1015,10 +1025,10 @@
|
|
|
| class HSimulate: public HInstruction {
|
| public:
|
| - HSimulate(int ast_id, int pop_count, int environment_height)
|
| + HSimulate(int ast_id, int pop_count, int environment_length)
|
| : ast_id_(ast_id),
|
| pop_count_(pop_count),
|
| - environment_height_(environment_height),
|
| + environment_length_(environment_length),
|
| values_(2),
|
| assigned_indexes_(2) {}
|
| virtual ~HSimulate() {}
|
| @@ -1032,7 +1042,7 @@
|
| ast_id_ = id;
|
| }
|
|
|
| - int environment_height() const { return environment_height_; }
|
| + int environment_length() const { return environment_length_; }
|
| int pop_count() const { return pop_count_; }
|
| const ZoneList<HValue*>* values() const { return &values_; }
|
| int GetAssignedIndexAt(int index) const {
|
| @@ -1074,7 +1084,7 @@
|
| }
|
| int ast_id_;
|
| int pop_count_;
|
| - int environment_height_;
|
| + int environment_length_;
|
| ZoneList<HValue*> values_;
|
| ZoneList<int> assigned_indexes_;
|
| };
|
| @@ -1337,9 +1347,9 @@
|
| };
|
|
|
|
|
| -class HArrayLength: public HUnaryOperation {
|
| +class HJSArrayLength: public HUnaryOperation {
|
| public:
|
| - explicit HArrayLength(HValue* value) : HUnaryOperation(value) {
|
| + explicit HJSArrayLength(HValue* value) : HUnaryOperation(value) {
|
| // The length of an array is stored as a tagged value in the array
|
| // object. It is guaranteed to be 32 bit integer, but it can be
|
| // represented as either a smi or heap number.
|
| @@ -1352,10 +1362,26 @@
|
| return Representation::Tagged();
|
| }
|
|
|
| - DECLARE_CONCRETE_INSTRUCTION(ArrayLength, "array_length")
|
| + DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length")
|
| };
|
|
|
|
|
| +class HFixedArrayLength: public HUnaryOperation {
|
| + public:
|
| + explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) {
|
| + set_representation(Representation::Tagged());
|
| + SetFlag(kDependsOnArrayLengths);
|
| + SetFlag(kUseGVN);
|
| + }
|
| +
|
| + virtual Representation RequiredInputRepresentation(int index) const {
|
| + return Representation::Tagged();
|
| + }
|
| +
|
| + DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length")
|
| +};
|
| +
|
| +
|
| class HBitNot: public HUnaryOperation {
|
| public:
|
| explicit HBitNot(HValue* value) : HUnaryOperation(value) {
|
| @@ -1597,42 +1623,40 @@
|
| };
|
|
|
|
|
| -class HCheckPrototypeMaps: public HUnaryOperation {
|
| +class HCheckPrototypeMaps: public HInstruction {
|
| public:
|
| - HCheckPrototypeMaps(HValue* value,
|
| - Handle<JSObject> holder,
|
| - Handle<Map> receiver_map)
|
| - : HUnaryOperation(value),
|
| - holder_(holder),
|
| - receiver_map_(receiver_map) {
|
| - set_representation(Representation::Tagged());
|
| + HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder)
|
| + : prototype_(prototype), holder_(holder) {
|
| SetFlag(kUseGVN);
|
| SetFlag(kDependsOnMaps);
|
| }
|
|
|
| - virtual Representation RequiredInputRepresentation(int index) const {
|
| - return Representation::Tagged();
|
| - }
|
| -
|
| #ifdef DEBUG
|
| virtual void Verify() const;
|
| #endif
|
|
|
| + Handle<JSObject> prototype() const { return prototype_; }
|
| Handle<JSObject> holder() const { return holder_; }
|
| - Handle<Map> receiver_map() const { return receiver_map_; }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps")
|
|
|
| + virtual intptr_t Hashcode() const {
|
| + ASSERT(!HEAP->IsAllocationAllowed());
|
| + intptr_t hash = reinterpret_cast<intptr_t>(*prototype());
|
| + hash = 17 * hash + reinterpret_cast<intptr_t>(*holder());
|
| + return hash;
|
| + }
|
| +
|
| protected:
|
| virtual bool DataEquals(HValue* other) const {
|
| HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other);
|
| - return holder_.is_identical_to(b->holder()) &&
|
| - receiver_map_.is_identical_to(b->receiver_map());
|
| + return prototype_.is_identical_to(b->prototype()) &&
|
| + holder_.is_identical_to(b->holder());
|
| }
|
|
|
| private:
|
| + Handle<JSObject> prototype_;
|
| Handle<JSObject> holder_;
|
| - Handle<Map> receiver_map_;
|
| };
|
|
|
|
|
| @@ -1767,6 +1791,8 @@
|
|
|
| Handle<Object> handle() const { return handle_; }
|
|
|
| + bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); }
|
| +
|
| virtual bool EmitAtUses() const { return !representation().IsDouble(); }
|
| virtual void PrintDataTo(StringStream* stream) const;
|
| virtual HType CalculateInferredType() const;
|
| @@ -2237,6 +2263,28 @@
|
| };
|
|
|
|
|
| +class HInstanceOfKnownGlobal: public HUnaryOperation {
|
| + public:
|
| + HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right)
|
| + : HUnaryOperation(left), function_(right) {
|
| + set_representation(Representation::Tagged());
|
| + SetFlagMask(AllSideEffects());
|
| + }
|
| +
|
| + Handle<JSFunction> function() { return function_; }
|
| +
|
| + virtual Representation RequiredInputRepresentation(int index) const {
|
| + return Representation::Tagged();
|
| + }
|
| +
|
| + DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
|
| + "instance_of_known_global")
|
| +
|
| + private:
|
| + Handle<JSFunction> function_;
|
| +};
|
| +
|
| +
|
| class HPower: public HBinaryOperation {
|
| public:
|
| HPower(HValue* left, HValue* right)
|
| @@ -2618,6 +2666,27 @@
|
| };
|
|
|
|
|
| +class HLoadFunctionPrototype: public HUnaryOperation {
|
| + public:
|
| + explicit HLoadFunctionPrototype(HValue* function)
|
| + : HUnaryOperation(function) {
|
| + set_representation(Representation::Tagged());
|
| + SetFlagMask(kDependsOnFunctionPrototypes);
|
| + }
|
| +
|
| + HValue* function() const { return OperandAt(0); }
|
| +
|
| + virtual Representation RequiredInputRepresentation(int index) const {
|
| + return Representation::Tagged();
|
| + }
|
| +
|
| + DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype")
|
| +
|
| + protected:
|
| + virtual bool DataEquals(HValue* other) const { return true; }
|
| +};
|
| +
|
| +
|
| class HLoadKeyed: public HBinaryOperation {
|
| public:
|
| HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) {
|
| @@ -2664,6 +2733,12 @@
|
| };
|
|
|
|
|
| +static inline bool StoringValueNeedsWriteBarrier(HValue* value) {
|
| + return !value->type().IsSmi() &&
|
| + !(value->IsConstant() && HConstant::cast(value)->InOldSpace());
|
| +}
|
| +
|
| +
|
| class HStoreNamed: public HBinaryOperation {
|
| public:
|
| HStoreNamed(HValue* obj, Handle<Object> name, HValue* val)
|
| @@ -2681,6 +2756,10 @@
|
| HValue* value() const { return OperandAt(1); }
|
| void set_value(HValue* value) { SetOperandAt(1, value); }
|
|
|
| + bool NeedsWriteBarrier() const {
|
| + return StoringValueNeedsWriteBarrier(value());
|
| + }
|
| +
|
| DECLARE_INSTRUCTION(StoreNamed)
|
|
|
| protected:
|
| @@ -2761,6 +2840,10 @@
|
| HValue* key() const { return OperandAt(1); }
|
| HValue* value() const { return OperandAt(2); }
|
|
|
| + bool NeedsWriteBarrier() const {
|
| + return StoringValueNeedsWriteBarrier(value());
|
| + }
|
| +
|
| DECLARE_INSTRUCTION(StoreKeyed)
|
|
|
| protected:
|
| @@ -2780,10 +2863,6 @@
|
| SetFlag(kChangesArrayElements);
|
| }
|
|
|
| - bool NeedsWriteBarrier() const {
|
| - return !value()->type().IsSmi();
|
| - }
|
| -
|
| virtual Representation RequiredInputRepresentation(int index) const {
|
| // The key is supposed to be Integer32.
|
| return (index == 1) ? Representation::Integer32()
|
|
|