| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 V(CheckInstanceType) \ | 93 V(CheckInstanceType) \ |
| 94 V(CheckMaps) \ | 94 V(CheckMaps) \ |
| 95 V(CheckMapValue) \ | 95 V(CheckMapValue) \ |
| 96 V(CheckSmi) \ | 96 V(CheckSmi) \ |
| 97 V(CheckValue) \ | 97 V(CheckValue) \ |
| 98 V(ClampToUint8) \ | 98 V(ClampToUint8) \ |
| 99 V(ClassOfTestAndBranch) \ | 99 V(ClassOfTestAndBranch) \ |
| 100 V(CompareNumericAndBranch) \ | 100 V(CompareNumericAndBranch) \ |
| 101 V(CompareHoleAndBranch) \ | 101 V(CompareHoleAndBranch) \ |
| 102 V(CompareGeneric) \ | 102 V(CompareGeneric) \ |
| 103 V(CompareMinusZeroAndBranch) \ |
| 103 V(CompareObjectEqAndBranch) \ | 104 V(CompareObjectEqAndBranch) \ |
| 104 V(CompareMap) \ | 105 V(CompareMap) \ |
| 105 V(Constant) \ | 106 V(Constant) \ |
| 106 V(Context) \ | 107 V(Context) \ |
| 107 V(DateField) \ | 108 V(DateField) \ |
| 108 V(DebugBreak) \ | 109 V(DebugBreak) \ |
| 109 V(DeclareGlobals) \ | 110 V(DeclareGlobals) \ |
| 110 V(Deoptimize) \ | 111 V(Deoptimize) \ |
| 111 V(Div) \ | 112 V(Div) \ |
| 112 V(DummyUse) \ | 113 V(DummyUse) \ |
| (...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 | 2279 |
| 2279 private: | 2280 private: |
| 2280 HCallNamed(HValue* context, Handle<String> name, int argument_count) | 2281 HCallNamed(HValue* context, Handle<String> name, int argument_count) |
| 2281 : HUnaryCall(context, argument_count), name_(name) { | 2282 : HUnaryCall(context, argument_count), name_(name) { |
| 2282 } | 2283 } |
| 2283 | 2284 |
| 2284 Handle<String> name_; | 2285 Handle<String> name_; |
| 2285 }; | 2286 }; |
| 2286 | 2287 |
| 2287 | 2288 |
| 2289 enum CallMode { |
| 2290 NORMAL_CALL, |
| 2291 TAIL_CALL |
| 2292 }; |
| 2293 |
| 2294 |
| 2288 class HCallFunction V8_FINAL : public HBinaryCall { | 2295 class HCallFunction V8_FINAL : public HBinaryCall { |
| 2289 public: | 2296 public: |
| 2290 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); | 2297 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); |
| 2298 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3( |
| 2299 HCallFunction, HValue*, int, CallMode); |
| 2300 |
| 2301 bool IsTailCall() const { return call_mode_ == TAIL_CALL; } |
| 2291 | 2302 |
| 2292 HValue* context() { return first(); } | 2303 HValue* context() { return first(); } |
| 2293 HValue* function() { return second(); } | 2304 HValue* function() { return second(); } |
| 2294 | 2305 |
| 2295 DECLARE_CONCRETE_INSTRUCTION(CallFunction) | 2306 DECLARE_CONCRETE_INSTRUCTION(CallFunction) |
| 2296 | 2307 |
| 2308 virtual int argument_delta() const V8_OVERRIDE { |
| 2309 if (IsTailCall()) return 0; |
| 2310 return -argument_count(); |
| 2311 } |
| 2312 |
| 2297 private: | 2313 private: |
| 2298 HCallFunction(HValue* context, HValue* function, int argument_count) | 2314 HCallFunction(HValue* context, |
| 2299 : HBinaryCall(context, function, argument_count) { | 2315 HValue* function, |
| 2316 int argument_count, |
| 2317 CallMode mode = NORMAL_CALL) |
| 2318 : HBinaryCall(context, function, argument_count), call_mode_(mode) { |
| 2300 } | 2319 } |
| 2320 CallMode call_mode_; |
| 2301 }; | 2321 }; |
| 2302 | 2322 |
| 2303 | 2323 |
| 2304 class HCallGlobal V8_FINAL : public HUnaryCall { | 2324 class HCallGlobal V8_FINAL : public HUnaryCall { |
| 2305 public: | 2325 public: |
| 2306 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallGlobal, Handle<String>, int); | 2326 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallGlobal, Handle<String>, int); |
| 2307 | 2327 |
| 2308 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2328 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 2309 | 2329 |
| 2310 HValue* context() { return value(); } | 2330 HValue* context() { return value(); } |
| (...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4158 HCompareHoleAndBranch(HValue* value, | 4178 HCompareHoleAndBranch(HValue* value, |
| 4159 HBasicBlock* true_target = NULL, | 4179 HBasicBlock* true_target = NULL, |
| 4160 HBasicBlock* false_target = NULL) | 4180 HBasicBlock* false_target = NULL) |
| 4161 : HUnaryControlInstruction(value, true_target, false_target) { | 4181 : HUnaryControlInstruction(value, true_target, false_target) { |
| 4162 SetFlag(kFlexibleRepresentation); | 4182 SetFlag(kFlexibleRepresentation); |
| 4163 SetFlag(kAllowUndefinedAsNaN); | 4183 SetFlag(kAllowUndefinedAsNaN); |
| 4164 } | 4184 } |
| 4165 }; | 4185 }; |
| 4166 | 4186 |
| 4167 | 4187 |
| 4188 class HCompareMinusZeroAndBranch V8_FINAL : public HUnaryControlInstruction { |
| 4189 public: |
| 4190 DECLARE_INSTRUCTION_FACTORY_P1(HCompareMinusZeroAndBranch, HValue*); |
| 4191 |
| 4192 virtual void InferRepresentation( |
| 4193 HInferRepresentationPhase* h_infer) V8_OVERRIDE; |
| 4194 |
| 4195 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 4196 return representation(); |
| 4197 } |
| 4198 |
| 4199 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
| 4200 |
| 4201 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch) |
| 4202 |
| 4203 private: |
| 4204 explicit HCompareMinusZeroAndBranch(HValue* value) |
| 4205 : HUnaryControlInstruction(value, NULL, NULL) { |
| 4206 } |
| 4207 }; |
| 4208 |
| 4209 |
| 4168 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { | 4210 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { |
| 4169 public: | 4211 public: |
| 4170 HCompareObjectEqAndBranch(HValue* left, | 4212 HCompareObjectEqAndBranch(HValue* left, |
| 4171 HValue* right, | 4213 HValue* right, |
| 4172 HBasicBlock* true_target = NULL, | 4214 HBasicBlock* true_target = NULL, |
| 4173 HBasicBlock* false_target = NULL) { | 4215 HBasicBlock* false_target = NULL) { |
| 4174 // TODO(danno): make this private when the IfBuilder properly constructs | 4216 // TODO(danno): make this private when the IfBuilder properly constructs |
| 4175 // control flow instructions. | 4217 // control flow instructions. |
| 4176 ASSERT(!left->IsConstant() || | 4218 ASSERT(!left->IsConstant() || |
| 4177 (!HConstant::cast(left)->HasInteger32Value() || | 4219 (!HConstant::cast(left)->HasInteger32Value() || |
| (...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6092 SetFlag(kUseGVN); | 6134 SetFlag(kUseGVN); |
| 6093 SetGVNFlag(kDependsOnCalls); | 6135 SetGVNFlag(kDependsOnCalls); |
| 6094 } | 6136 } |
| 6095 }; | 6137 }; |
| 6096 | 6138 |
| 6097 class ArrayInstructionInterface { | 6139 class ArrayInstructionInterface { |
| 6098 public: | 6140 public: |
| 6099 virtual HValue* GetKey() = 0; | 6141 virtual HValue* GetKey() = 0; |
| 6100 virtual void SetKey(HValue* key) = 0; | 6142 virtual void SetKey(HValue* key) = 0; |
| 6101 virtual void SetIndexOffset(uint32_t index_offset) = 0; | 6143 virtual void SetIndexOffset(uint32_t index_offset) = 0; |
| 6144 virtual int MaxIndexOffsetBits() = 0; |
| 6102 virtual bool IsDehoisted() = 0; | 6145 virtual bool IsDehoisted() = 0; |
| 6103 virtual void SetDehoisted(bool is_dehoisted) = 0; | 6146 virtual void SetDehoisted(bool is_dehoisted) = 0; |
| 6104 virtual ~ArrayInstructionInterface() { }; | 6147 virtual ~ArrayInstructionInterface() { }; |
| 6105 | 6148 |
| 6106 static Representation KeyedAccessIndexRequirement(Representation r) { | 6149 static Representation KeyedAccessIndexRequirement(Representation r) { |
| 6107 return r.IsInteger32() || SmiValuesAre32Bits() | 6150 return r.IsInteger32() || SmiValuesAre32Bits() |
| 6108 ? Representation::Integer32() : Representation::Smi(); | 6151 ? Representation::Integer32() : Representation::Smi(); |
| 6109 } | 6152 } |
| 6110 }; | 6153 }; |
| 6111 | 6154 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6131 HValue* key() { return OperandAt(1); } | 6174 HValue* key() { return OperandAt(1); } |
| 6132 HValue* dependency() { | 6175 HValue* dependency() { |
| 6133 ASSERT(HasDependency()); | 6176 ASSERT(HasDependency()); |
| 6134 return OperandAt(2); | 6177 return OperandAt(2); |
| 6135 } | 6178 } |
| 6136 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } | 6179 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } |
| 6137 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); } | 6180 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); } |
| 6138 void SetIndexOffset(uint32_t index_offset) { | 6181 void SetIndexOffset(uint32_t index_offset) { |
| 6139 bit_field_ = IndexOffsetField::update(bit_field_, index_offset); | 6182 bit_field_ = IndexOffsetField::update(bit_field_, index_offset); |
| 6140 } | 6183 } |
| 6184 virtual int MaxIndexOffsetBits() { |
| 6185 return kBitsForIndexOffset; |
| 6186 } |
| 6141 HValue* GetKey() { return key(); } | 6187 HValue* GetKey() { return key(); } |
| 6142 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6188 void SetKey(HValue* key) { SetOperandAt(1, key); } |
| 6143 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } | 6189 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } |
| 6144 void SetDehoisted(bool is_dehoisted) { | 6190 void SetDehoisted(bool is_dehoisted) { |
| 6145 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 6191 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
| 6146 } | 6192 } |
| 6147 ElementsKind elements_kind() const { | 6193 ElementsKind elements_kind() const { |
| 6148 return ElementsKindField::decode(bit_field_); | 6194 return ElementsKindField::decode(bit_field_); |
| 6149 } | 6195 } |
| 6150 LoadKeyedHoleMode hole_mode() const { | 6196 LoadKeyedHoleMode hole_mode() const { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6517 | 6563 |
| 6518 HValue* elements() { return OperandAt(0); } | 6564 HValue* elements() { return OperandAt(0); } |
| 6519 HValue* key() { return OperandAt(1); } | 6565 HValue* key() { return OperandAt(1); } |
| 6520 HValue* value() { return OperandAt(2); } | 6566 HValue* value() { return OperandAt(2); } |
| 6521 bool value_is_smi() const { | 6567 bool value_is_smi() const { |
| 6522 return IsFastSmiElementsKind(elements_kind_); | 6568 return IsFastSmiElementsKind(elements_kind_); |
| 6523 } | 6569 } |
| 6524 ElementsKind elements_kind() const { return elements_kind_; } | 6570 ElementsKind elements_kind() const { return elements_kind_; } |
| 6525 uint32_t index_offset() { return index_offset_; } | 6571 uint32_t index_offset() { return index_offset_; } |
| 6526 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } | 6572 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } |
| 6573 virtual int MaxIndexOffsetBits() { |
| 6574 return 31 - ElementsKindToShiftSize(elements_kind_); |
| 6575 } |
| 6527 HValue* GetKey() { return key(); } | 6576 HValue* GetKey() { return key(); } |
| 6528 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6577 void SetKey(HValue* key) { SetOperandAt(1, key); } |
| 6529 bool IsDehoisted() { return is_dehoisted_; } | 6578 bool IsDehoisted() { return is_dehoisted_; } |
| 6530 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 6579 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
| 6531 bool IsUninitialized() { return is_uninitialized_; } | 6580 bool IsUninitialized() { return is_uninitialized_; } |
| 6532 void SetUninitialized(bool is_uninitialized) { | 6581 void SetUninitialized(bool is_uninitialized) { |
| 6533 is_uninitialized_ = is_uninitialized; | 6582 is_uninitialized_ = is_uninitialized; |
| 6534 } | 6583 } |
| 6535 | 6584 |
| 6536 bool IsConstantHoleStore() { | 6585 bool IsConstantHoleStore() { |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7150 virtual HType CalculateInferredType() V8_OVERRIDE { | 7199 virtual HType CalculateInferredType() V8_OVERRIDE { |
| 7151 return HType::Tagged(); | 7200 return HType::Tagged(); |
| 7152 } | 7201 } |
| 7153 | 7202 |
| 7154 HValue* value() { return OperandAt(0); } | 7203 HValue* value() { return OperandAt(0); } |
| 7155 HValue* map() { return OperandAt(1); } | 7204 HValue* map() { return OperandAt(1); } |
| 7156 | 7205 |
| 7157 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) | 7206 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) |
| 7158 | 7207 |
| 7159 protected: | 7208 protected: |
| 7209 virtual int RedefinedOperandIndex() { return 0; } |
| 7210 |
| 7160 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 7211 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
| 7161 return true; | 7212 return true; |
| 7162 } | 7213 } |
| 7163 | 7214 |
| 7164 private: | 7215 private: |
| 7165 HCheckMapValue(HValue* value, | 7216 HCheckMapValue(HValue* value, |
| 7166 HValue* map) { | 7217 HValue* map) { |
| 7167 SetOperandAt(0, value); | 7218 SetOperandAt(0, value); |
| 7168 SetOperandAt(1, map); | 7219 SetOperandAt(1, map); |
| 7169 set_representation(Representation::Tagged()); | 7220 set_representation(Representation::Tagged()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7274 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7325 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7275 }; | 7326 }; |
| 7276 | 7327 |
| 7277 | 7328 |
| 7278 #undef DECLARE_INSTRUCTION | 7329 #undef DECLARE_INSTRUCTION |
| 7279 #undef DECLARE_CONCRETE_INSTRUCTION | 7330 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7280 | 7331 |
| 7281 } } // namespace v8::internal | 7332 } } // namespace v8::internal |
| 7282 | 7333 |
| 7283 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7334 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |