| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 21 matching lines...) Expand all Loading... |
| 32 #include "lithium-allocator.h" | 32 #include "lithium-allocator.h" |
| 33 #include "lithium.h" | 33 #include "lithium.h" |
| 34 #include "safepoint-table.h" | 34 #include "safepoint-table.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 // Forward declarations. | 39 // Forward declarations. |
| 40 class LCodeGen; | 40 class LCodeGen; |
| 41 | 41 |
| 42 | |
| 43 // Type hierarchy: | |
| 44 // | |
| 45 // LInstruction | |
| 46 // LTemplateInstruction | |
| 47 // LControlInstruction | |
| 48 // LBranch | |
| 49 // LClassOfTestAndBranch | |
| 50 // LCmpJSObjectEqAndBranch | |
| 51 // LCmpIDAndBranch | |
| 52 // LHasCachedArrayIndexAndBranch | |
| 53 // LHasInstanceTypeAndBranch | |
| 54 // LInstanceOfAndBranch | |
| 55 // LIsNullAndBranch | |
| 56 // LIsObjectAndBranch | |
| 57 // LIsSmiAndBranch | |
| 58 // LTypeofIsAndBranch | |
| 59 // LAccessArgumentsAt | |
| 60 // LArgumentsElements | |
| 61 // LArgumentsLength | |
| 62 // LAddI | |
| 63 // LApplyArguments | |
| 64 // LArithmeticD | |
| 65 // LArithmeticT | |
| 66 // LBitI | |
| 67 // LBoundsCheck | |
| 68 // LCmpID | |
| 69 // LCmpJSObjectEq | |
| 70 // LCmpT | |
| 71 // LDivI | |
| 72 // LInstanceOf | |
| 73 // LInstanceOfKnownGlobal | |
| 74 // LLoadKeyedFastElement | |
| 75 // LLoadKeyedGeneric | |
| 76 // LModI | |
| 77 // LMulI | |
| 78 // LPower | |
| 79 // LShiftI | |
| 80 // LSubI | |
| 81 // LCallConstantFunction | |
| 82 // LCallFunction | |
| 83 // LCallGlobal | |
| 84 // LCallKeyed | |
| 85 // LCallKnownGlobal | |
| 86 // LCallNamed | |
| 87 // LCallRuntime | |
| 88 // LCallStub | |
| 89 // LConstant | |
| 90 // LConstantD | |
| 91 // LConstantI | |
| 92 // LConstantT | |
| 93 // LDeoptimize | |
| 94 // LFunctionLiteral | |
| 95 // LGap | |
| 96 // LLabel | |
| 97 // LGlobalObject | |
| 98 // LGlobalReceiver | |
| 99 // LGoto | |
| 100 // LLazyBailout | |
| 101 // LLoadGlobal | |
| 102 // LCheckPrototypeMaps | |
| 103 // LLoadContextSlot | |
| 104 // LArrayLiteral | |
| 105 // LObjectLiteral | |
| 106 // LRegExpLiteral | |
| 107 // LOsrEntry | |
| 108 // LParameter | |
| 109 // LRegExpConstructResult | |
| 110 // LStackCheck | |
| 111 // LStoreKeyed | |
| 112 // LStoreKeyedFastElement | |
| 113 // LStoreKeyedGeneric | |
| 114 // LStoreNamed | |
| 115 // LStoreNamedField | |
| 116 // LStoreNamedGeneric | |
| 117 // LBitNotI | |
| 118 // LCallNew | |
| 119 // LCheckFunction | |
| 120 // LCheckPrototypeMaps | |
| 121 // LCheckInstanceType | |
| 122 // LCheckMap | |
| 123 // LCheckSmi | |
| 124 // LClassOfTest | |
| 125 // LDeleteProperty | |
| 126 // LDoubleToI | |
| 127 // LFixedArrayLength | |
| 128 // LHasCachedArrayIndex | |
| 129 // LHasInstanceType | |
| 130 // LInteger32ToDouble | |
| 131 // LIsNull | |
| 132 // LIsObject | |
| 133 // LIsSmi | |
| 134 // LJSArrayLength | |
| 135 // LLoadNamedField | |
| 136 // LLoadNamedGeneric | |
| 137 // LLoadFunctionPrototype | |
| 138 // LNumberTagD | |
| 139 // LNumberTagI | |
| 140 // LPushArgument | |
| 141 // LReturn | |
| 142 // LSmiTag | |
| 143 // LStoreGlobal | |
| 144 // LTaggedToI | |
| 145 // LThrow | |
| 146 // LTypeof | |
| 147 // LTypeofIs | |
| 148 // LUnaryMathOperation | |
| 149 // LValueOf | |
| 150 // LUnknownOSRValue | |
| 151 | |
| 152 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ | 42 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ |
| 153 V(ControlInstruction) \ | 43 V(ControlInstruction) \ |
| 154 V(Constant) \ | |
| 155 V(Call) \ | 44 V(Call) \ |
| 156 V(StoreKeyed) \ | 45 V(StoreKeyed) \ |
| 157 V(StoreNamed) \ | 46 V(StoreNamed) \ |
| 158 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) | 47 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) |
| 159 | 48 |
| 160 | 49 |
| 161 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ | 50 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
| 162 V(AccessArgumentsAt) \ | 51 V(AccessArgumentsAt) \ |
| 163 V(AddI) \ | 52 V(AddI) \ |
| 164 V(ApplyArguments) \ | 53 V(ApplyArguments) \ |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 V(StoreKeyedFastElement) \ | 141 V(StoreKeyedFastElement) \ |
| 253 V(StoreKeyedGeneric) \ | 142 V(StoreKeyedGeneric) \ |
| 254 V(StoreNamedField) \ | 143 V(StoreNamedField) \ |
| 255 V(StoreNamedGeneric) \ | 144 V(StoreNamedGeneric) \ |
| 256 V(SubI) \ | 145 V(SubI) \ |
| 257 V(TaggedToI) \ | 146 V(TaggedToI) \ |
| 258 V(Throw) \ | 147 V(Throw) \ |
| 259 V(Typeof) \ | 148 V(Typeof) \ |
| 260 V(TypeofIs) \ | 149 V(TypeofIs) \ |
| 261 V(TypeofIsAndBranch) \ | 150 V(TypeofIsAndBranch) \ |
| 151 V(IsConstructCall) \ |
| 152 V(IsConstructCallAndBranch) \ |
| 262 V(UnaryMathOperation) \ | 153 V(UnaryMathOperation) \ |
| 263 V(UnknownOSRValue) \ | 154 V(UnknownOSRValue) \ |
| 264 V(ValueOf) | 155 V(ValueOf) |
| 265 | 156 |
| 266 | 157 |
| 267 #define DECLARE_INSTRUCTION(type) \ | 158 #define DECLARE_INSTRUCTION(type) \ |
| 268 virtual bool Is##type() const { return true; } \ | 159 virtual bool Is##type() const { return true; } \ |
| 269 static L##type* cast(LInstruction* instr) { \ | 160 static L##type* cast(LInstruction* instr) { \ |
| 270 ASSERT(instr->Is##type()); \ | 161 ASSERT(instr->Is##type()); \ |
| 271 return reinterpret_cast<L##type*>(instr); \ | 162 return reinterpret_cast<L##type*>(instr); \ |
| 272 } | 163 } |
| 273 | 164 |
| 274 | 165 |
| 275 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ | 166 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ |
| 276 virtual void CompileToNative(LCodeGen* generator); \ | 167 virtual void CompileToNative(LCodeGen* generator); \ |
| 277 virtual const char* Mnemonic() const { return mnemonic; } \ | 168 virtual const char* Mnemonic() const { return mnemonic; } \ |
| 278 DECLARE_INSTRUCTION(type) | 169 DECLARE_INSTRUCTION(type) |
| 279 | 170 |
| 280 | 171 |
| 281 #define DECLARE_HYDROGEN_ACCESSOR(type) \ | 172 #define DECLARE_HYDROGEN_ACCESSOR(type) \ |
| 282 H##type* hydrogen() const { \ | 173 H##type* hydrogen() const { \ |
| 283 return H##type::cast(hydrogen_value()); \ | 174 return H##type::cast(hydrogen_value()); \ |
| 284 } | 175 } |
| 285 | 176 |
| 286 | 177 |
| 287 class LInstruction: public ZoneObject { | 178 class LInstruction: public ZoneObject { |
| 288 public: | 179 public: |
| 289 LInstruction() | 180 LInstruction() |
| 290 : hydrogen_value_(NULL) { } | 181 : environment_(NULL), |
| 182 hydrogen_value_(NULL), |
| 183 is_call_(false), |
| 184 is_save_doubles_(false) { } |
| 185 |
| 291 virtual ~LInstruction() { } | 186 virtual ~LInstruction() { } |
| 292 | 187 |
| 293 virtual void CompileToNative(LCodeGen* generator) = 0; | 188 virtual void CompileToNative(LCodeGen* generator) = 0; |
| 294 virtual const char* Mnemonic() const = 0; | 189 virtual const char* Mnemonic() const = 0; |
| 295 virtual void PrintTo(StringStream* stream); | 190 virtual void PrintTo(StringStream* stream); |
| 296 virtual void PrintDataTo(StringStream* stream) = 0; | 191 virtual void PrintDataTo(StringStream* stream) = 0; |
| 297 virtual void PrintOutputOperandTo(StringStream* stream) = 0; | 192 virtual void PrintOutputOperandTo(StringStream* stream) = 0; |
| 298 | 193 |
| 299 // Declare virtual type testers. | 194 // Declare virtual type testers. |
| 300 #define DECLARE_DO(type) virtual bool Is##type() const { return false; } | 195 #define DECLARE_DO(type) virtual bool Is##type() const { return false; } |
| 301 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO) | 196 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO) |
| 302 #undef DECLARE_DO | 197 #undef DECLARE_DO |
| 303 | 198 |
| 304 virtual bool IsControl() const { return false; } | 199 virtual bool IsControl() const { return false; } |
| 305 virtual void SetBranchTargets(int true_block_id, int false_block_id) { } | 200 virtual void SetBranchTargets(int true_block_id, int false_block_id) { } |
| 306 | 201 |
| 307 void set_environment(LEnvironment* env) { environment_.set(env); } | 202 void set_environment(LEnvironment* env) { environment_ = env; } |
| 308 LEnvironment* environment() const { return environment_.get(); } | 203 LEnvironment* environment() const { return environment_; } |
| 309 bool HasEnvironment() const { return environment_.is_set(); } | 204 bool HasEnvironment() const { return environment_ != NULL; } |
| 310 | 205 |
| 311 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 206 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
| 312 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 207 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
| 313 bool HasPointerMap() const { return pointer_map_.is_set(); } | 208 bool HasPointerMap() const { return pointer_map_.is_set(); } |
| 314 | 209 |
| 315 virtual bool HasResult() const = 0; | |
| 316 | |
| 317 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 210 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
| 318 HValue* hydrogen_value() const { return hydrogen_value_; } | 211 HValue* hydrogen_value() const { return hydrogen_value_; } |
| 319 | 212 |
| 320 void set_deoptimization_environment(LEnvironment* env) { | 213 void set_deoptimization_environment(LEnvironment* env) { |
| 321 deoptimization_environment_.set(env); | 214 deoptimization_environment_.set(env); |
| 322 } | 215 } |
| 323 LEnvironment* deoptimization_environment() const { | 216 LEnvironment* deoptimization_environment() const { |
| 324 return deoptimization_environment_.get(); | 217 return deoptimization_environment_.get(); |
| 325 } | 218 } |
| 326 bool HasDeoptimizationEnvironment() const { | 219 bool HasDeoptimizationEnvironment() const { |
| 327 return deoptimization_environment_.is_set(); | 220 return deoptimization_environment_.is_set(); |
| 328 } | 221 } |
| 329 | 222 |
| 223 void MarkAsCall() { is_call_ = true; } |
| 224 void MarkAsSaveDoubles() { is_save_doubles_ = true; } |
| 225 |
| 226 // Interface to the register allocator and iterators. |
| 227 bool IsMarkedAsCall() const { return is_call_; } |
| 228 bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; } |
| 229 |
| 230 virtual bool HasResult() const = 0; |
| 231 virtual LOperand* result() = 0; |
| 232 |
| 233 virtual int InputCount() = 0; |
| 234 virtual LOperand* InputAt(int i) = 0; |
| 235 virtual int TempCount() = 0; |
| 236 virtual LOperand* TempAt(int i) = 0; |
| 237 |
| 238 LOperand* FirstInput() { return InputAt(0); } |
| 239 LOperand* Output() { return HasResult() ? result() : NULL; } |
| 240 |
| 241 #ifdef DEBUG |
| 242 void VerifyCall(); |
| 243 #endif |
| 244 |
| 330 private: | 245 private: |
| 331 SetOncePointer<LEnvironment> environment_; | 246 LEnvironment* environment_; |
| 332 SetOncePointer<LPointerMap> pointer_map_; | 247 SetOncePointer<LPointerMap> pointer_map_; |
| 333 HValue* hydrogen_value_; | 248 HValue* hydrogen_value_; |
| 334 SetOncePointer<LEnvironment> deoptimization_environment_; | 249 SetOncePointer<LEnvironment> deoptimization_environment_; |
| 250 bool is_call_; |
| 251 bool is_save_doubles_; |
| 335 }; | 252 }; |
| 336 | 253 |
| 337 | 254 |
| 338 template<typename ElementType, int NumElements> | 255 template<typename ElementType, int NumElements> |
| 339 class OperandContainer { | 256 class OperandContainer { |
| 340 public: | 257 public: |
| 341 OperandContainer() { | 258 OperandContainer() { |
| 342 for (int i = 0; i < NumElements; i++) elems_[i] = NULL; | 259 for (int i = 0; i < NumElements; i++) elems_[i] = NULL; |
| 343 } | 260 } |
| 344 int length() { return NumElements; } | 261 int length() { return NumElements; } |
| 345 ElementType& operator[](int i) { | 262 ElementType& operator[](int i) { |
| 346 ASSERT(i < length()); | 263 ASSERT(i < length()); |
| 347 return elems_[i]; | 264 return elems_[i]; |
| 348 } | 265 } |
| 349 void PrintOperandsTo(StringStream* stream); | 266 void PrintOperandsTo(StringStream* stream); |
| 350 | 267 |
| 351 private: | 268 private: |
| 352 ElementType elems_[NumElements]; | 269 ElementType elems_[NumElements]; |
| 353 }; | 270 }; |
| 354 | 271 |
| 355 | 272 |
| 356 template<typename ElementType> | 273 template<typename ElementType> |
| 357 class OperandContainer<ElementType, 0> { | 274 class OperandContainer<ElementType, 0> { |
| 358 public: | 275 public: |
| 359 int length() { return 0; } | 276 int length() { return 0; } |
| 360 void PrintOperandsTo(StringStream* stream) { } | 277 void PrintOperandsTo(StringStream* stream) { } |
| 278 ElementType& operator[](int i) { |
| 279 UNREACHABLE(); |
| 280 static ElementType t = 0; |
| 281 return t; |
| 282 } |
| 361 }; | 283 }; |
| 362 | 284 |
| 363 | 285 |
| 364 // R = number of result operands (0 or 1). | 286 // R = number of result operands (0 or 1). |
| 365 // I = number of input operands. | 287 // I = number of input operands. |
| 366 // T = number of temporary operands. | 288 // T = number of temporary operands. |
| 367 template<int R, int I, int T> | 289 template<int R, int I, int T> |
| 368 class LTemplateInstruction: public LInstruction { | 290 class LTemplateInstruction: public LInstruction { |
| 369 public: | 291 public: |
| 370 // Allow 0 or 1 output operands. | 292 // Allow 0 or 1 output operands. |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 inputs_[0] = left; | 532 inputs_[0] = left; |
| 611 inputs_[1] = right; | 533 inputs_[1] = right; |
| 612 temps_[0] = temp; | 534 temps_[0] = temp; |
| 613 } | 535 } |
| 614 | 536 |
| 615 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") | 537 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") |
| 616 DECLARE_HYDROGEN_ACCESSOR(Div) | 538 DECLARE_HYDROGEN_ACCESSOR(Div) |
| 617 }; | 539 }; |
| 618 | 540 |
| 619 | 541 |
| 620 class LMulI: public LTemplateInstruction<1, 2, 1> { | 542 class LMulI: public LTemplateInstruction<1, 2, 0> { |
| 621 public: | 543 public: |
| 622 LMulI(LOperand* left, LOperand* right, LOperand* temp) { | 544 LMulI(LOperand* left, LOperand* right) { |
| 623 inputs_[0] = left; | 545 inputs_[0] = left; |
| 624 inputs_[1] = right; | 546 inputs_[1] = right; |
| 625 temps_[0] = temp; | |
| 626 } | 547 } |
| 627 | 548 |
| 628 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") | 549 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") |
| 629 DECLARE_HYDROGEN_ACCESSOR(Mul) | 550 DECLARE_HYDROGEN_ACCESSOR(Mul) |
| 630 }; | 551 }; |
| 631 | 552 |
| 632 | 553 |
| 633 class LCmpID: public LTemplateInstruction<1, 2, 0> { | 554 class LCmpID: public LTemplateInstruction<1, 2, 0> { |
| 634 public: | 555 public: |
| 635 LCmpID(LOperand* left, LOperand* right) { | 556 LCmpID(LOperand* left, LOperand* right) { |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 LSubI(LOperand* left, LOperand* right) { | 896 LSubI(LOperand* left, LOperand* right) { |
| 976 inputs_[0] = left; | 897 inputs_[0] = left; |
| 977 inputs_[1] = right; | 898 inputs_[1] = right; |
| 978 } | 899 } |
| 979 | 900 |
| 980 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") | 901 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") |
| 981 DECLARE_HYDROGEN_ACCESSOR(Sub) | 902 DECLARE_HYDROGEN_ACCESSOR(Sub) |
| 982 }; | 903 }; |
| 983 | 904 |
| 984 | 905 |
| 985 template <int temp_count> | 906 class LConstantI: public LTemplateInstruction<1, 0, 0> { |
| 986 class LConstant: public LTemplateInstruction<1, 0, temp_count> { | 907 public: |
| 987 DECLARE_INSTRUCTION(Constant) | 908 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") |
| 909 DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 910 |
| 911 int32_t value() const { return hydrogen()->Integer32Value(); } |
| 988 }; | 912 }; |
| 989 | 913 |
| 990 | 914 |
| 991 class LConstantI: public LConstant<0> { | 915 class LConstantD: public LTemplateInstruction<1, 0, 1> { |
| 992 public: | 916 public: |
| 993 explicit LConstantI(int32_t value) : value_(value) { } | 917 explicit LConstantD(LOperand* temp) { |
| 994 int32_t value() const { return value_; } | 918 temps_[0] = temp; |
| 919 } |
| 920 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") |
| 921 DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 995 | 922 |
| 996 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") | 923 double value() const { return hydrogen()->DoubleValue(); } |
| 997 | |
| 998 private: | |
| 999 int32_t value_; | |
| 1000 }; | 924 }; |
| 1001 | 925 |
| 1002 | 926 |
| 1003 class LConstantD: public LConstant<1> { | 927 class LConstantT: public LTemplateInstruction<1, 0, 0> { |
| 1004 public: | 928 public: |
| 1005 explicit LConstantD(double value, LOperand* temp) : value_(value) { | 929 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") |
| 1006 temps_[0] = temp; | 930 DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 1007 } | |
| 1008 double value() const { return value_; } | |
| 1009 | 931 |
| 1010 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") | 932 Handle<Object> value() const { return hydrogen()->handle(); } |
| 1011 | |
| 1012 private: | |
| 1013 double value_; | |
| 1014 }; | 933 }; |
| 1015 | 934 |
| 1016 | 935 |
| 1017 class LConstantT: public LConstant<0> { | |
| 1018 public: | |
| 1019 explicit LConstantT(Handle<Object> value) : value_(value) { } | |
| 1020 Handle<Object> value() const { return value_; } | |
| 1021 | |
| 1022 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") | |
| 1023 | |
| 1024 private: | |
| 1025 Handle<Object> value_; | |
| 1026 }; | |
| 1027 | |
| 1028 | |
| 1029 class LBranch: public LControlInstruction<1, 0> { | 936 class LBranch: public LControlInstruction<1, 0> { |
| 1030 public: | 937 public: |
| 1031 explicit LBranch(LOperand* value) { | 938 explicit LBranch(LOperand* value) { |
| 1032 inputs_[0] = value; | 939 inputs_[0] = value; |
| 1033 } | 940 } |
| 1034 | 941 |
| 1035 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") | 942 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") |
| 1036 DECLARE_HYDROGEN_ACCESSOR(Value) | 943 DECLARE_HYDROGEN_ACCESSOR(Value) |
| 1037 | 944 |
| 1038 virtual void PrintDataTo(StringStream* stream); | 945 virtual void PrintDataTo(StringStream* stream); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 }; | 1169 }; |
| 1263 | 1170 |
| 1264 | 1171 |
| 1265 class LLoadGlobal: public LTemplateInstruction<1, 0, 0> { | 1172 class LLoadGlobal: public LTemplateInstruction<1, 0, 0> { |
| 1266 public: | 1173 public: |
| 1267 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load-global") | 1174 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load-global") |
| 1268 DECLARE_HYDROGEN_ACCESSOR(LoadGlobal) | 1175 DECLARE_HYDROGEN_ACCESSOR(LoadGlobal) |
| 1269 }; | 1176 }; |
| 1270 | 1177 |
| 1271 | 1178 |
| 1272 class LStoreGlobal: public LTemplateInstruction<0, 1, 0> { | 1179 class LStoreGlobal: public LTemplateInstruction<0, 1, 1> { |
| 1273 public: | 1180 public: |
| 1274 explicit LStoreGlobal(LOperand* value) { | 1181 explicit LStoreGlobal(LOperand* value, LOperand* temp) { |
| 1275 inputs_[0] = value; | 1182 inputs_[0] = value; |
| 1183 temps_[0] = temp; |
| 1276 } | 1184 } |
| 1277 | 1185 |
| 1278 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global") | 1186 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global") |
| 1279 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal) | 1187 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal) |
| 1280 }; | 1188 }; |
| 1281 | 1189 |
| 1282 | 1190 |
| 1283 class LLoadContextSlot: public LTemplateInstruction<1, 0, 0> { | 1191 class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> { |
| 1284 public: | 1192 public: |
| 1193 explicit LLoadContextSlot(LOperand* context) { |
| 1194 inputs_[0] = context; |
| 1195 } |
| 1196 |
| 1285 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") | 1197 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") |
| 1286 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) | 1198 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) |
| 1287 | 1199 |
| 1288 int context_chain_length() { return hydrogen()->context_chain_length(); } | 1200 LOperand* context() { return InputAt(0); } |
| 1289 int slot_index() { return hydrogen()->slot_index(); } | 1201 int slot_index() { return hydrogen()->slot_index(); } |
| 1290 | 1202 |
| 1291 virtual void PrintDataTo(StringStream* stream); | 1203 virtual void PrintDataTo(StringStream* stream); |
| 1292 }; | 1204 }; |
| 1293 | 1205 |
| 1294 | 1206 |
| 1295 class LPushArgument: public LTemplateInstruction<0, 1, 0> { | 1207 class LPushArgument: public LTemplateInstruction<0, 1, 0> { |
| 1296 public: | 1208 public: |
| 1297 explicit LPushArgument(LOperand* value) { | 1209 explicit LPushArgument(LOperand* value) { |
| 1298 inputs_[0] = value; | 1210 inputs_[0] = value; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 public: | 1507 public: |
| 1596 explicit LCheckFunction(LOperand* value) { | 1508 explicit LCheckFunction(LOperand* value) { |
| 1597 inputs_[0] = value; | 1509 inputs_[0] = value; |
| 1598 } | 1510 } |
| 1599 | 1511 |
| 1600 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") | 1512 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") |
| 1601 DECLARE_HYDROGEN_ACCESSOR(CheckFunction) | 1513 DECLARE_HYDROGEN_ACCESSOR(CheckFunction) |
| 1602 }; | 1514 }; |
| 1603 | 1515 |
| 1604 | 1516 |
| 1605 class LCheckInstanceType: public LTemplateInstruction<0, 1, 1> { | 1517 class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> { |
| 1606 public: | 1518 public: |
| 1607 LCheckInstanceType(LOperand* value, LOperand* temp) { | 1519 explicit LCheckInstanceType(LOperand* value) { |
| 1608 inputs_[0] = value; | 1520 inputs_[0] = value; |
| 1609 temps_[0] = temp; | |
| 1610 } | 1521 } |
| 1611 | 1522 |
| 1612 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type") | 1523 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type") |
| 1613 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType) | 1524 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType) |
| 1614 }; | 1525 }; |
| 1615 | 1526 |
| 1616 | 1527 |
| 1617 class LCheckMap: public LTemplateInstruction<0, 1, 0> { | 1528 class LCheckMap: public LTemplateInstruction<0, 1, 0> { |
| 1618 public: | 1529 public: |
| 1619 explicit LCheckMap(LOperand* value) { | 1530 explicit LCheckMap(LOperand* value) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 | 1632 |
| 1722 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") | 1633 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") |
| 1723 DECLARE_HYDROGEN_ACCESSOR(TypeofIs) | 1634 DECLARE_HYDROGEN_ACCESSOR(TypeofIs) |
| 1724 | 1635 |
| 1725 Handle<String> type_literal() { return hydrogen()->type_literal(); } | 1636 Handle<String> type_literal() { return hydrogen()->type_literal(); } |
| 1726 | 1637 |
| 1727 virtual void PrintDataTo(StringStream* stream); | 1638 virtual void PrintDataTo(StringStream* stream); |
| 1728 }; | 1639 }; |
| 1729 | 1640 |
| 1730 | 1641 |
| 1642 class LIsConstructCall: public LTemplateInstruction<1, 0, 0> { |
| 1643 public: |
| 1644 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is-construct-call") |
| 1645 DECLARE_HYDROGEN_ACCESSOR(IsConstructCall) |
| 1646 }; |
| 1647 |
| 1648 |
| 1649 class LIsConstructCallAndBranch: public LControlInstruction<0, 1> { |
| 1650 public: |
| 1651 explicit LIsConstructCallAndBranch(LOperand* temp) { |
| 1652 temps_[0] = temp; |
| 1653 } |
| 1654 |
| 1655 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch, |
| 1656 "is-construct-call-and-branch") |
| 1657 }; |
| 1658 |
| 1659 |
| 1731 class LDeleteProperty: public LTemplateInstruction<1, 2, 0> { | 1660 class LDeleteProperty: public LTemplateInstruction<1, 2, 0> { |
| 1732 public: | 1661 public: |
| 1733 LDeleteProperty(LOperand* obj, LOperand* key) { | 1662 LDeleteProperty(LOperand* obj, LOperand* key) { |
| 1734 inputs_[0] = obj; | 1663 inputs_[0] = obj; |
| 1735 inputs_[1] = key; | 1664 inputs_[1] = key; |
| 1736 } | 1665 } |
| 1737 | 1666 |
| 1738 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") | 1667 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") |
| 1739 | 1668 |
| 1740 LOperand* object() { return inputs_[0]; } | 1669 LOperand* object() { return inputs_[0]; } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1774 class LChunkBuilder; | 1703 class LChunkBuilder; |
| 1775 class LChunk: public ZoneObject { | 1704 class LChunk: public ZoneObject { |
| 1776 public: | 1705 public: |
| 1777 explicit LChunk(HGraph* graph) | 1706 explicit LChunk(HGraph* graph) |
| 1778 : spill_slot_count_(0), | 1707 : spill_slot_count_(0), |
| 1779 graph_(graph), | 1708 graph_(graph), |
| 1780 instructions_(32), | 1709 instructions_(32), |
| 1781 pointer_maps_(8), | 1710 pointer_maps_(8), |
| 1782 inlined_closures_(1) { } | 1711 inlined_closures_(1) { } |
| 1783 | 1712 |
| 1784 int AddInstruction(LInstruction* instruction, HBasicBlock* block); | 1713 void AddInstruction(LInstruction* instruction, HBasicBlock* block); |
| 1785 LConstantOperand* DefineConstantOperand(HConstant* constant); | 1714 LConstantOperand* DefineConstantOperand(HConstant* constant); |
| 1786 Handle<Object> LookupLiteral(LConstantOperand* operand) const; | 1715 Handle<Object> LookupLiteral(LConstantOperand* operand) const; |
| 1787 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; | 1716 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; |
| 1788 | 1717 |
| 1789 int GetNextSpillIndex(bool is_double); | 1718 int GetNextSpillIndex(bool is_double); |
| 1790 LOperand* GetNextSpillSlot(bool is_double); | 1719 LOperand* GetNextSpillSlot(bool is_double); |
| 1791 | 1720 |
| 1792 int ParameterAt(int index); | 1721 int ParameterAt(int index); |
| 1793 int GetParameterStackSlot(int index) const; | 1722 int GetParameterStackSlot(int index) const; |
| 1794 int spill_slot_count() const { return spill_slot_count_; } | 1723 int spill_slot_count() const { return spill_slot_count_; } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1840 LChunkBuilder(HGraph* graph, LAllocator* allocator) | 1769 LChunkBuilder(HGraph* graph, LAllocator* allocator) |
| 1841 : chunk_(NULL), | 1770 : chunk_(NULL), |
| 1842 graph_(graph), | 1771 graph_(graph), |
| 1843 status_(UNUSED), | 1772 status_(UNUSED), |
| 1844 current_instruction_(NULL), | 1773 current_instruction_(NULL), |
| 1845 current_block_(NULL), | 1774 current_block_(NULL), |
| 1846 next_block_(NULL), | 1775 next_block_(NULL), |
| 1847 argument_count_(0), | 1776 argument_count_(0), |
| 1848 allocator_(allocator), | 1777 allocator_(allocator), |
| 1849 position_(RelocInfo::kNoPosition), | 1778 position_(RelocInfo::kNoPosition), |
| 1850 instructions_pending_deoptimization_environment_(NULL), | 1779 instruction_pending_deoptimization_environment_(NULL), |
| 1851 pending_deoptimization_ast_id_(AstNode::kNoNumber) { } | 1780 pending_deoptimization_ast_id_(AstNode::kNoNumber) { } |
| 1852 | 1781 |
| 1853 // Build the sequence for the graph. | 1782 // Build the sequence for the graph. |
| 1854 LChunk* Build(); | 1783 LChunk* Build(); |
| 1855 | 1784 |
| 1856 // Declare methods that deal with the individual node types. | 1785 // Declare methods that deal with the individual node types. |
| 1857 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | 1786 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
| 1858 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) | 1787 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
| 1859 #undef DECLARE_DO | 1788 #undef DECLARE_DO |
| 1860 | 1789 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 | 1903 |
| 1975 LChunk* chunk_; | 1904 LChunk* chunk_; |
| 1976 HGraph* const graph_; | 1905 HGraph* const graph_; |
| 1977 Status status_; | 1906 Status status_; |
| 1978 HInstruction* current_instruction_; | 1907 HInstruction* current_instruction_; |
| 1979 HBasicBlock* current_block_; | 1908 HBasicBlock* current_block_; |
| 1980 HBasicBlock* next_block_; | 1909 HBasicBlock* next_block_; |
| 1981 int argument_count_; | 1910 int argument_count_; |
| 1982 LAllocator* allocator_; | 1911 LAllocator* allocator_; |
| 1983 int position_; | 1912 int position_; |
| 1984 LInstruction* instructions_pending_deoptimization_environment_; | 1913 LInstruction* instruction_pending_deoptimization_environment_; |
| 1985 int pending_deoptimization_ast_id_; | 1914 int pending_deoptimization_ast_id_; |
| 1986 | 1915 |
| 1987 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 1916 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 1988 }; | 1917 }; |
| 1989 | 1918 |
| 1990 #undef DECLARE_HYDROGEN_ACCESSOR | 1919 #undef DECLARE_HYDROGEN_ACCESSOR |
| 1991 #undef DECLARE_INSTRUCTION | 1920 #undef DECLARE_INSTRUCTION |
| 1992 #undef DECLARE_CONCRETE_INSTRUCTION | 1921 #undef DECLARE_CONCRETE_INSTRUCTION |
| 1993 | 1922 |
| 1994 } } // namespace v8::int | 1923 } } // namespace v8::int |
| 1995 | 1924 |
| 1996 #endif // V8_X64_LITHIUM_X64_H_ | 1925 #endif // V8_X64_LITHIUM_X64_H_ |
| OLD | NEW |