| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 V(FunctionLiteral) \ | 100 V(FunctionLiteral) \ |
| 101 V(GetCachedArrayIndex) \ | 101 V(GetCachedArrayIndex) \ |
| 102 V(GlobalObject) \ | 102 V(GlobalObject) \ |
| 103 V(GlobalReceiver) \ | 103 V(GlobalReceiver) \ |
| 104 V(Goto) \ | 104 V(Goto) \ |
| 105 V(HasCachedArrayIndexAndBranch) \ | 105 V(HasCachedArrayIndexAndBranch) \ |
| 106 V(HasInstanceTypeAndBranch) \ | 106 V(HasInstanceTypeAndBranch) \ |
| 107 V(InnerAllocatedObject) \ | 107 V(InnerAllocatedObject) \ |
| 108 V(InstanceOf) \ | 108 V(InstanceOf) \ |
| 109 V(InstanceOfKnownGlobal) \ | 109 V(InstanceOfKnownGlobal) \ |
| 110 V(InstanceSize) \ | |
| 111 V(InstructionGap) \ | 110 V(InstructionGap) \ |
| 112 V(Integer32ToDouble) \ | 111 V(Integer32ToDouble) \ |
| 113 V(Integer32ToSmi) \ | 112 V(Integer32ToSmi) \ |
| 114 V(InvokeFunction) \ | 113 V(InvokeFunction) \ |
| 115 V(IsConstructCallAndBranch) \ | 114 V(IsConstructCallAndBranch) \ |
| 116 V(IsObjectAndBranch) \ | 115 V(IsObjectAndBranch) \ |
| 117 V(IsStringAndBranch) \ | 116 V(IsStringAndBranch) \ |
| 118 V(IsSmiAndBranch) \ | 117 V(IsSmiAndBranch) \ |
| 119 V(IsUndetectableAndBranch) \ | 118 V(IsUndetectableAndBranch) \ |
| 120 V(Label) \ | 119 V(Label) \ |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 V(SubI) \ | 176 V(SubI) \ |
| 178 V(TaggedToI) \ | 177 V(TaggedToI) \ |
| 179 V(ThisFunction) \ | 178 V(ThisFunction) \ |
| 180 V(Throw) \ | 179 V(Throw) \ |
| 181 V(ToFastProperties) \ | 180 V(ToFastProperties) \ |
| 182 V(TransitionElementsKind) \ | 181 V(TransitionElementsKind) \ |
| 183 V(TrapAllocationMemento) \ | 182 V(TrapAllocationMemento) \ |
| 184 V(Typeof) \ | 183 V(Typeof) \ |
| 185 V(TypeofIsAndBranch) \ | 184 V(TypeofIsAndBranch) \ |
| 186 V(Uint32ToDouble) \ | 185 V(Uint32ToDouble) \ |
| 186 V(Uint32ToSmi) \ |
| 187 V(UnknownOSRValue) \ | 187 V(UnknownOSRValue) \ |
| 188 V(ValueOf) \ | 188 V(ValueOf) \ |
| 189 V(WrapReceiver) | 189 V(WrapReceiver) |
| 190 | 190 |
| 191 | 191 |
| 192 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ | 192 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ |
| 193 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ | 193 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ |
| 194 return LInstruction::k##type; \ | 194 return LInstruction::k##type; \ |
| 195 } \ | 195 } \ |
| 196 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \ | 196 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 208 return H##type::cast(hydrogen_value()); \ | 208 return H##type::cast(hydrogen_value()); \ |
| 209 } | 209 } |
| 210 | 210 |
| 211 | 211 |
| 212 class LInstruction : public ZoneObject { | 212 class LInstruction : public ZoneObject { |
| 213 public: | 213 public: |
| 214 LInstruction() | 214 LInstruction() |
| 215 : environment_(NULL), | 215 : environment_(NULL), |
| 216 hydrogen_value_(NULL), | 216 hydrogen_value_(NULL), |
| 217 bit_field_(IsCallBits::encode(false)) { | 217 bit_field_(IsCallBits::encode(false)) { |
| 218 set_position(RelocInfo::kNoPosition); | |
| 219 } | 218 } |
| 220 | 219 |
| 221 virtual ~LInstruction() {} | 220 virtual ~LInstruction() {} |
| 222 | 221 |
| 223 virtual void CompileToNative(LCodeGen* generator) = 0; | 222 virtual void CompileToNative(LCodeGen* generator) = 0; |
| 224 virtual const char* Mnemonic() const = 0; | 223 virtual const char* Mnemonic() const = 0; |
| 225 virtual void PrintTo(StringStream* stream); | 224 virtual void PrintTo(StringStream* stream); |
| 226 virtual void PrintDataTo(StringStream* stream); | 225 virtual void PrintDataTo(StringStream* stream); |
| 227 virtual void PrintOutputOperandTo(StringStream* stream); | 226 virtual void PrintOutputOperandTo(StringStream* stream); |
| 228 | 227 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 249 virtual bool IsControl() const { return false; } | 248 virtual bool IsControl() const { return false; } |
| 250 | 249 |
| 251 void set_environment(LEnvironment* env) { environment_ = env; } | 250 void set_environment(LEnvironment* env) { environment_ = env; } |
| 252 LEnvironment* environment() const { return environment_; } | 251 LEnvironment* environment() const { return environment_; } |
| 253 bool HasEnvironment() const { return environment_ != NULL; } | 252 bool HasEnvironment() const { return environment_ != NULL; } |
| 254 | 253 |
| 255 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 254 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
| 256 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 255 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
| 257 bool HasPointerMap() const { return pointer_map_.is_set(); } | 256 bool HasPointerMap() const { return pointer_map_.is_set(); } |
| 258 | 257 |
| 259 // The 31 bits PositionBits is used to store the int position value. And the | |
| 260 // position value may be RelocInfo::kNoPosition (-1). The accessor always | |
| 261 // +1/-1 so that the encoded value of position in bit_field_ is always >= 0 | |
| 262 // and can fit into the 31 bits PositionBits. | |
| 263 void set_position(int pos) { | |
| 264 bit_field_ = PositionBits::update(bit_field_, pos + 1); | |
| 265 } | |
| 266 int position() { return PositionBits::decode(bit_field_) - 1; } | |
| 267 | |
| 268 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 258 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
| 269 HValue* hydrogen_value() const { return hydrogen_value_; } | 259 HValue* hydrogen_value() const { return hydrogen_value_; } |
| 270 | 260 |
| 271 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } | 261 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
| 272 | 262 |
| 273 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } | 263 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } |
| 274 bool IsCall() const { return IsCallBits::decode(bit_field_); } | 264 bool IsCall() const { return IsCallBits::decode(bit_field_); } |
| 275 | 265 |
| 276 // Interface to the register allocator and iterators. | 266 // Interface to the register allocator and iterators. |
| 277 bool ClobbersTemps() const { return IsCall(); } | 267 bool ClobbersTemps() const { return IsCall(); } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 303 // Iterator support. | 293 // Iterator support. |
| 304 friend class InputIterator; | 294 friend class InputIterator; |
| 305 virtual int InputCount() = 0; | 295 virtual int InputCount() = 0; |
| 306 virtual LOperand* InputAt(int i) = 0; | 296 virtual LOperand* InputAt(int i) = 0; |
| 307 | 297 |
| 308 friend class TempIterator; | 298 friend class TempIterator; |
| 309 virtual int TempCount() = 0; | 299 virtual int TempCount() = 0; |
| 310 virtual LOperand* TempAt(int i) = 0; | 300 virtual LOperand* TempAt(int i) = 0; |
| 311 | 301 |
| 312 class IsCallBits: public BitField<bool, 0, 1> {}; | 302 class IsCallBits: public BitField<bool, 0, 1> {}; |
| 313 class PositionBits: public BitField<int, 1, 31> {}; | |
| 314 | 303 |
| 315 LEnvironment* environment_; | 304 LEnvironment* environment_; |
| 316 SetOncePointer<LPointerMap> pointer_map_; | 305 SetOncePointer<LPointerMap> pointer_map_; |
| 317 HValue* hydrogen_value_; | 306 HValue* hydrogen_value_; |
| 318 int bit_field_; | 307 int bit_field_; |
| 319 }; | 308 }; |
| 320 | 309 |
| 321 | 310 |
| 322 // R = number of result operands (0 or 1). | 311 // R = number of result operands (0 or 1). |
| 323 // I = number of input operands. | 312 // I = number of input operands. |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 virtual void SetDeferredLazyDeoptimizationEnvironment( | 1113 virtual void SetDeferredLazyDeoptimizationEnvironment( |
| 1125 LEnvironment* env) V8_OVERRIDE { | 1114 LEnvironment* env) V8_OVERRIDE { |
| 1126 lazy_deopt_env_ = env; | 1115 lazy_deopt_env_ = env; |
| 1127 } | 1116 } |
| 1128 | 1117 |
| 1129 private: | 1118 private: |
| 1130 LEnvironment* lazy_deopt_env_; | 1119 LEnvironment* lazy_deopt_env_; |
| 1131 }; | 1120 }; |
| 1132 | 1121 |
| 1133 | 1122 |
| 1134 class LInstanceSize V8_FINAL : public LTemplateInstruction<1, 1, 0> { | |
| 1135 public: | |
| 1136 explicit LInstanceSize(LOperand* object) { | |
| 1137 inputs_[0] = object; | |
| 1138 } | |
| 1139 | |
| 1140 LOperand* object() { return inputs_[0]; } | |
| 1141 | |
| 1142 DECLARE_CONCRETE_INSTRUCTION(InstanceSize, "instance-size") | |
| 1143 DECLARE_HYDROGEN_ACCESSOR(InstanceSize) | |
| 1144 }; | |
| 1145 | |
| 1146 | |
| 1147 class LBoundsCheck V8_FINAL : public LTemplateInstruction<0, 2, 0> { | 1123 class LBoundsCheck V8_FINAL : public LTemplateInstruction<0, 2, 0> { |
| 1148 public: | 1124 public: |
| 1149 LBoundsCheck(LOperand* index, LOperand* length) { | 1125 LBoundsCheck(LOperand* index, LOperand* length) { |
| 1150 inputs_[0] = index; | 1126 inputs_[0] = index; |
| 1151 inputs_[1] = length; | 1127 inputs_[1] = length; |
| 1152 } | 1128 } |
| 1153 | 1129 |
| 1154 LOperand* index() { return inputs_[0]; } | 1130 LOperand* index() { return inputs_[0]; } |
| 1155 LOperand* length() { return inputs_[1]; } | 1131 LOperand* length() { return inputs_[1]; } |
| 1156 | 1132 |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 temps_[0] = temp; | 2070 temps_[0] = temp; |
| 2095 } | 2071 } |
| 2096 | 2072 |
| 2097 LOperand* value() { return inputs_[0]; } | 2073 LOperand* value() { return inputs_[0]; } |
| 2098 LOperand* temp() { return temps_[0]; } | 2074 LOperand* temp() { return temps_[0]; } |
| 2099 | 2075 |
| 2100 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double") | 2076 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double") |
| 2101 }; | 2077 }; |
| 2102 | 2078 |
| 2103 | 2079 |
| 2080 class LUint32ToSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 2081 public: |
| 2082 explicit LUint32ToSmi(LOperand* value) { |
| 2083 inputs_[0] = value; |
| 2084 } |
| 2085 |
| 2086 LOperand* value() { return inputs_[0]; } |
| 2087 |
| 2088 DECLARE_CONCRETE_INSTRUCTION(Uint32ToSmi, "uint32-to-smi") |
| 2089 DECLARE_HYDROGEN_ACCESSOR(Change) |
| 2090 }; |
| 2091 |
| 2092 |
| 2104 class LNumberTagI V8_FINAL : public LTemplateInstruction<1, 1, 0> { | 2093 class LNumberTagI V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 2105 public: | 2094 public: |
| 2106 explicit LNumberTagI(LOperand* value) { | 2095 explicit LNumberTagI(LOperand* value) { |
| 2107 inputs_[0] = value; | 2096 inputs_[0] = value; |
| 2108 } | 2097 } |
| 2109 | 2098 |
| 2110 LOperand* value() { return inputs_[0]; } | 2099 LOperand* value() { return inputs_[0]; } |
| 2111 | 2100 |
| 2112 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") | 2101 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") |
| 2113 }; | 2102 }; |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2757 : chunk_(NULL), | 2746 : chunk_(NULL), |
| 2758 info_(info), | 2747 info_(info), |
| 2759 graph_(graph), | 2748 graph_(graph), |
| 2760 zone_(graph->zone()), | 2749 zone_(graph->zone()), |
| 2761 status_(UNUSED), | 2750 status_(UNUSED), |
| 2762 current_instruction_(NULL), | 2751 current_instruction_(NULL), |
| 2763 current_block_(NULL), | 2752 current_block_(NULL), |
| 2764 next_block_(NULL), | 2753 next_block_(NULL), |
| 2765 argument_count_(0), | 2754 argument_count_(0), |
| 2766 allocator_(allocator), | 2755 allocator_(allocator), |
| 2767 position_(RelocInfo::kNoPosition), | |
| 2768 instruction_pending_deoptimization_environment_(NULL), | 2756 instruction_pending_deoptimization_environment_(NULL), |
| 2769 pending_deoptimization_ast_id_(BailoutId::None()) { } | 2757 pending_deoptimization_ast_id_(BailoutId::None()) { } |
| 2770 | 2758 |
| 2771 // Build the sequence for the graph. | 2759 // Build the sequence for the graph. |
| 2772 LPlatformChunk* Build(); | 2760 LPlatformChunk* Build(); |
| 2773 | 2761 |
| 2774 LInstruction* CheckElideControlInstruction(HControlInstruction* instr); | 2762 LInstruction* CheckElideControlInstruction(HControlInstruction* instr); |
| 2775 | 2763 |
| 2776 // Declare methods that deal with the individual node types. | 2764 // Declare methods that deal with the individual node types. |
| 2777 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | 2765 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2915 LPlatformChunk* chunk_; | 2903 LPlatformChunk* chunk_; |
| 2916 CompilationInfo* info_; | 2904 CompilationInfo* info_; |
| 2917 HGraph* const graph_; | 2905 HGraph* const graph_; |
| 2918 Zone* zone_; | 2906 Zone* zone_; |
| 2919 Status status_; | 2907 Status status_; |
| 2920 HInstruction* current_instruction_; | 2908 HInstruction* current_instruction_; |
| 2921 HBasicBlock* current_block_; | 2909 HBasicBlock* current_block_; |
| 2922 HBasicBlock* next_block_; | 2910 HBasicBlock* next_block_; |
| 2923 int argument_count_; | 2911 int argument_count_; |
| 2924 LAllocator* allocator_; | 2912 LAllocator* allocator_; |
| 2925 int position_; | |
| 2926 LInstruction* instruction_pending_deoptimization_environment_; | 2913 LInstruction* instruction_pending_deoptimization_environment_; |
| 2927 BailoutId pending_deoptimization_ast_id_; | 2914 BailoutId pending_deoptimization_ast_id_; |
| 2928 | 2915 |
| 2929 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2916 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2930 }; | 2917 }; |
| 2931 | 2918 |
| 2932 #undef DECLARE_HYDROGEN_ACCESSOR | 2919 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2933 #undef DECLARE_CONCRETE_INSTRUCTION | 2920 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2934 | 2921 |
| 2935 } } // namespace v8::internal | 2922 } } // namespace v8::internal |
| 2936 | 2923 |
| 2937 #endif // V8_IA32_LITHIUM_IA32_H_ | 2924 #endif // V8_IA32_LITHIUM_IA32_H_ |
| OLD | NEW |