| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 V(FunctionLiteral) \ | 98 V(FunctionLiteral) \ |
| 99 V(GetCachedArrayIndex) \ | 99 V(GetCachedArrayIndex) \ |
| 100 V(GlobalObject) \ | 100 V(GlobalObject) \ |
| 101 V(GlobalReceiver) \ | 101 V(GlobalReceiver) \ |
| 102 V(Goto) \ | 102 V(Goto) \ |
| 103 V(HasCachedArrayIndexAndBranch) \ | 103 V(HasCachedArrayIndexAndBranch) \ |
| 104 V(HasInstanceTypeAndBranch) \ | 104 V(HasInstanceTypeAndBranch) \ |
| 105 V(InnerAllocatedObject) \ | 105 V(InnerAllocatedObject) \ |
| 106 V(InstanceOf) \ | 106 V(InstanceOf) \ |
| 107 V(InstanceOfKnownGlobal) \ | 107 V(InstanceOfKnownGlobal) \ |
| 108 V(InstanceSize) \ | |
| 109 V(InstructionGap) \ | 108 V(InstructionGap) \ |
| 110 V(Integer32ToDouble) \ | 109 V(Integer32ToDouble) \ |
| 111 V(Integer32ToSmi) \ | 110 V(Integer32ToSmi) \ |
| 112 V(InvokeFunction) \ | 111 V(InvokeFunction) \ |
| 113 V(IsConstructCallAndBranch) \ | 112 V(IsConstructCallAndBranch) \ |
| 114 V(IsObjectAndBranch) \ | 113 V(IsObjectAndBranch) \ |
| 115 V(IsStringAndBranch) \ | 114 V(IsStringAndBranch) \ |
| 116 V(IsSmiAndBranch) \ | 115 V(IsSmiAndBranch) \ |
| 117 V(IsUndetectableAndBranch) \ | 116 V(IsUndetectableAndBranch) \ |
| 118 V(Label) \ | 117 V(Label) \ |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 V(SubI) \ | 174 V(SubI) \ |
| 176 V(TaggedToI) \ | 175 V(TaggedToI) \ |
| 177 V(ThisFunction) \ | 176 V(ThisFunction) \ |
| 178 V(Throw) \ | 177 V(Throw) \ |
| 179 V(ToFastProperties) \ | 178 V(ToFastProperties) \ |
| 180 V(TransitionElementsKind) \ | 179 V(TransitionElementsKind) \ |
| 181 V(TrapAllocationMemento) \ | 180 V(TrapAllocationMemento) \ |
| 182 V(Typeof) \ | 181 V(Typeof) \ |
| 183 V(TypeofIsAndBranch) \ | 182 V(TypeofIsAndBranch) \ |
| 184 V(Uint32ToDouble) \ | 183 V(Uint32ToDouble) \ |
| 184 V(Uint32ToSmi) \ |
| 185 V(UnknownOSRValue) \ | 185 V(UnknownOSRValue) \ |
| 186 V(ValueOf) \ | 186 V(ValueOf) \ |
| 187 V(WrapReceiver) | 187 V(WrapReceiver) |
| 188 | 188 |
| 189 | 189 |
| 190 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ | 190 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ |
| 191 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ | 191 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ |
| 192 return LInstruction::k##type; \ | 192 return LInstruction::k##type; \ |
| 193 } \ | 193 } \ |
| 194 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \ | 194 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 206 return H##type::cast(hydrogen_value()); \ | 206 return H##type::cast(hydrogen_value()); \ |
| 207 } | 207 } |
| 208 | 208 |
| 209 | 209 |
| 210 class LInstruction : public ZoneObject { | 210 class LInstruction : public ZoneObject { |
| 211 public: | 211 public: |
| 212 LInstruction() | 212 LInstruction() |
| 213 : environment_(NULL), | 213 : environment_(NULL), |
| 214 hydrogen_value_(NULL), | 214 hydrogen_value_(NULL), |
| 215 bit_field_(IsCallBits::encode(false)) { | 215 bit_field_(IsCallBits::encode(false)) { |
| 216 set_position(RelocInfo::kNoPosition); | |
| 217 } | 216 } |
| 218 | 217 |
| 219 virtual ~LInstruction() {} | 218 virtual ~LInstruction() {} |
| 220 | 219 |
| 221 virtual void CompileToNative(LCodeGen* generator) = 0; | 220 virtual void CompileToNative(LCodeGen* generator) = 0; |
| 222 virtual const char* Mnemonic() const = 0; | 221 virtual const char* Mnemonic() const = 0; |
| 223 virtual void PrintTo(StringStream* stream); | 222 virtual void PrintTo(StringStream* stream); |
| 224 virtual void PrintDataTo(StringStream* stream); | 223 virtual void PrintDataTo(StringStream* stream); |
| 225 virtual void PrintOutputOperandTo(StringStream* stream); | 224 virtual void PrintOutputOperandTo(StringStream* stream); |
| 226 | 225 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 247 virtual bool IsControl() const { return false; } | 246 virtual bool IsControl() const { return false; } |
| 248 | 247 |
| 249 void set_environment(LEnvironment* env) { environment_ = env; } | 248 void set_environment(LEnvironment* env) { environment_ = env; } |
| 250 LEnvironment* environment() const { return environment_; } | 249 LEnvironment* environment() const { return environment_; } |
| 251 bool HasEnvironment() const { return environment_ != NULL; } | 250 bool HasEnvironment() const { return environment_ != NULL; } |
| 252 | 251 |
| 253 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 252 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
| 254 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 253 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
| 255 bool HasPointerMap() const { return pointer_map_.is_set(); } | 254 bool HasPointerMap() const { return pointer_map_.is_set(); } |
| 256 | 255 |
| 257 // The 31 bits PositionBits is used to store the int position value. And the | |
| 258 // position value may be RelocInfo::kNoPosition (-1). The accessor always | |
| 259 // +1/-1 so that the encoded value of position in bit_field_ is always >= 0 | |
| 260 // and can fit into the 31 bits PositionBits. | |
| 261 void set_position(int pos) { | |
| 262 bit_field_ = PositionBits::update(bit_field_, pos + 1); | |
| 263 } | |
| 264 int position() { return PositionBits::decode(bit_field_) - 1; } | |
| 265 | |
| 266 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 256 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
| 267 HValue* hydrogen_value() const { return hydrogen_value_; } | 257 HValue* hydrogen_value() const { return hydrogen_value_; } |
| 268 | 258 |
| 269 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } | 259 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } |
| 270 bool IsCall() const { return IsCallBits::decode(bit_field_); } | 260 bool IsCall() const { return IsCallBits::decode(bit_field_); } |
| 271 | 261 |
| 272 // Interface to the register allocator and iterators. | 262 // Interface to the register allocator and iterators. |
| 273 bool ClobbersTemps() const { return IsCall(); } | 263 bool ClobbersTemps() const { return IsCall(); } |
| 274 bool ClobbersRegisters() const { return IsCall(); } | 264 bool ClobbersRegisters() const { return IsCall(); } |
| 275 virtual bool ClobbersDoubleRegisters() const { return IsCall(); } | 265 virtual bool ClobbersDoubleRegisters() const { return IsCall(); } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 295 // Iterator support. | 285 // Iterator support. |
| 296 friend class InputIterator; | 286 friend class InputIterator; |
| 297 virtual int InputCount() = 0; | 287 virtual int InputCount() = 0; |
| 298 virtual LOperand* InputAt(int i) = 0; | 288 virtual LOperand* InputAt(int i) = 0; |
| 299 | 289 |
| 300 friend class TempIterator; | 290 friend class TempIterator; |
| 301 virtual int TempCount() = 0; | 291 virtual int TempCount() = 0; |
| 302 virtual LOperand* TempAt(int i) = 0; | 292 virtual LOperand* TempAt(int i) = 0; |
| 303 | 293 |
| 304 class IsCallBits: public BitField<bool, 0, 1> {}; | 294 class IsCallBits: public BitField<bool, 0, 1> {}; |
| 305 class PositionBits: public BitField<int, 1, 31> {}; | |
| 306 | 295 |
| 307 LEnvironment* environment_; | 296 LEnvironment* environment_; |
| 308 SetOncePointer<LPointerMap> pointer_map_; | 297 SetOncePointer<LPointerMap> pointer_map_; |
| 309 HValue* hydrogen_value_; | 298 HValue* hydrogen_value_; |
| 310 int bit_field_; | 299 int bit_field_; |
| 311 }; | 300 }; |
| 312 | 301 |
| 313 | 302 |
| 314 // R = number of result operands (0 or 1). | 303 // R = number of result operands (0 or 1). |
| 315 // I = number of input operands. | 304 // I = number of input operands. |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 virtual void SetDeferredLazyDeoptimizationEnvironment( | 1060 virtual void SetDeferredLazyDeoptimizationEnvironment( |
| 1072 LEnvironment* env) V8_OVERRIDE { | 1061 LEnvironment* env) V8_OVERRIDE { |
| 1073 lazy_deopt_env_ = env; | 1062 lazy_deopt_env_ = env; |
| 1074 } | 1063 } |
| 1075 | 1064 |
| 1076 private: | 1065 private: |
| 1077 LEnvironment* lazy_deopt_env_; | 1066 LEnvironment* lazy_deopt_env_; |
| 1078 }; | 1067 }; |
| 1079 | 1068 |
| 1080 | 1069 |
| 1081 class LInstanceSize V8_FINAL : public LTemplateInstruction<1, 1, 0> { | |
| 1082 public: | |
| 1083 explicit LInstanceSize(LOperand* object) { | |
| 1084 inputs_[0] = object; | |
| 1085 } | |
| 1086 | |
| 1087 LOperand* object() { return inputs_[0]; } | |
| 1088 | |
| 1089 DECLARE_CONCRETE_INSTRUCTION(InstanceSize, "instance-size") | |
| 1090 DECLARE_HYDROGEN_ACCESSOR(InstanceSize) | |
| 1091 }; | |
| 1092 | |
| 1093 | |
| 1094 class LBoundsCheck V8_FINAL : public LTemplateInstruction<0, 2, 0> { | 1070 class LBoundsCheck V8_FINAL : public LTemplateInstruction<0, 2, 0> { |
| 1095 public: | 1071 public: |
| 1096 LBoundsCheck(LOperand* index, LOperand* length) { | 1072 LBoundsCheck(LOperand* index, LOperand* length) { |
| 1097 inputs_[0] = index; | 1073 inputs_[0] = index; |
| 1098 inputs_[1] = length; | 1074 inputs_[1] = length; |
| 1099 } | 1075 } |
| 1100 | 1076 |
| 1101 LOperand* index() { return inputs_[0]; } | 1077 LOperand* index() { return inputs_[0]; } |
| 1102 LOperand* length() { return inputs_[1]; } | 1078 LOperand* length() { return inputs_[1]; } |
| 1103 | 1079 |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 temps_[0] = temp; | 1937 temps_[0] = temp; |
| 1962 } | 1938 } |
| 1963 | 1939 |
| 1964 LOperand* value() { return inputs_[0]; } | 1940 LOperand* value() { return inputs_[0]; } |
| 1965 LOperand* temp() { return temps_[0]; } | 1941 LOperand* temp() { return temps_[0]; } |
| 1966 | 1942 |
| 1967 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double") | 1943 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double") |
| 1968 }; | 1944 }; |
| 1969 | 1945 |
| 1970 | 1946 |
| 1947 class LUint32ToSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 1948 public: |
| 1949 explicit LUint32ToSmi(LOperand* value) { |
| 1950 inputs_[0] = value; |
| 1951 } |
| 1952 |
| 1953 LOperand* value() { return inputs_[0]; } |
| 1954 |
| 1955 DECLARE_CONCRETE_INSTRUCTION(Uint32ToSmi, "uint32-to-smi") |
| 1956 DECLARE_HYDROGEN_ACCESSOR(Change) |
| 1957 }; |
| 1958 |
| 1959 |
| 1971 class LNumberTagI V8_FINAL : public LTemplateInstruction<1, 1, 0> { | 1960 class LNumberTagI V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 1972 public: | 1961 public: |
| 1973 explicit LNumberTagI(LOperand* value) { | 1962 explicit LNumberTagI(LOperand* value) { |
| 1974 inputs_[0] = value; | 1963 inputs_[0] = value; |
| 1975 } | 1964 } |
| 1976 | 1965 |
| 1977 LOperand* value() { return inputs_[0]; } | 1966 LOperand* value() { return inputs_[0]; } |
| 1978 | 1967 |
| 1979 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") | 1968 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") |
| 1980 }; | 1969 }; |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 : chunk_(NULL), | 2547 : chunk_(NULL), |
| 2559 info_(info), | 2548 info_(info), |
| 2560 graph_(graph), | 2549 graph_(graph), |
| 2561 zone_(graph->zone()), | 2550 zone_(graph->zone()), |
| 2562 status_(UNUSED), | 2551 status_(UNUSED), |
| 2563 current_instruction_(NULL), | 2552 current_instruction_(NULL), |
| 2564 current_block_(NULL), | 2553 current_block_(NULL), |
| 2565 next_block_(NULL), | 2554 next_block_(NULL), |
| 2566 argument_count_(0), | 2555 argument_count_(0), |
| 2567 allocator_(allocator), | 2556 allocator_(allocator), |
| 2568 position_(RelocInfo::kNoPosition), | |
| 2569 instruction_pending_deoptimization_environment_(NULL), | 2557 instruction_pending_deoptimization_environment_(NULL), |
| 2570 pending_deoptimization_ast_id_(BailoutId::None()) { } | 2558 pending_deoptimization_ast_id_(BailoutId::None()) { } |
| 2571 | 2559 |
| 2572 // Build the sequence for the graph. | 2560 // Build the sequence for the graph. |
| 2573 LPlatformChunk* Build(); | 2561 LPlatformChunk* Build(); |
| 2574 | 2562 |
| 2575 LInstruction* CheckElideControlInstruction(HControlInstruction* instr); | 2563 LInstruction* CheckElideControlInstruction(HControlInstruction* instr); |
| 2576 | 2564 |
| 2577 // Declare methods that deal with the individual node types. | 2565 // Declare methods that deal with the individual node types. |
| 2578 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | 2566 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2711 LPlatformChunk* chunk_; | 2699 LPlatformChunk* chunk_; |
| 2712 CompilationInfo* info_; | 2700 CompilationInfo* info_; |
| 2713 HGraph* const graph_; | 2701 HGraph* const graph_; |
| 2714 Zone* zone_; | 2702 Zone* zone_; |
| 2715 Status status_; | 2703 Status status_; |
| 2716 HInstruction* current_instruction_; | 2704 HInstruction* current_instruction_; |
| 2717 HBasicBlock* current_block_; | 2705 HBasicBlock* current_block_; |
| 2718 HBasicBlock* next_block_; | 2706 HBasicBlock* next_block_; |
| 2719 int argument_count_; | 2707 int argument_count_; |
| 2720 LAllocator* allocator_; | 2708 LAllocator* allocator_; |
| 2721 int position_; | |
| 2722 LInstruction* instruction_pending_deoptimization_environment_; | 2709 LInstruction* instruction_pending_deoptimization_environment_; |
| 2723 BailoutId pending_deoptimization_ast_id_; | 2710 BailoutId pending_deoptimization_ast_id_; |
| 2724 | 2711 |
| 2725 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2712 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2726 }; | 2713 }; |
| 2727 | 2714 |
| 2728 #undef DECLARE_HYDROGEN_ACCESSOR | 2715 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2729 #undef DECLARE_CONCRETE_INSTRUCTION | 2716 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2730 | 2717 |
| 2731 } } // namespace v8::int | 2718 } } // namespace v8::int |
| 2732 | 2719 |
| 2733 #endif // V8_X64_LITHIUM_X64_H_ | 2720 #endif // V8_X64_LITHIUM_X64_H_ |
| OLD | NEW |