| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 V(Allocate) \ | 47 V(Allocate) \ |
| 48 V(ApplyArguments) \ | 48 V(ApplyArguments) \ |
| 49 V(ArgumentsElements) \ | 49 V(ArgumentsElements) \ |
| 50 V(ArgumentsLength) \ | 50 V(ArgumentsLength) \ |
| 51 V(ArithmeticD) \ | 51 V(ArithmeticD) \ |
| 52 V(ArithmeticT) \ | 52 V(ArithmeticT) \ |
| 53 V(BitI) \ | 53 V(BitI) \ |
| 54 V(BitS) \ | 54 V(BitS) \ |
| 55 V(BoundsCheck) \ | 55 V(BoundsCheck) \ |
| 56 V(Branch) \ | 56 V(Branch) \ |
| 57 V(CallConstantFunction) \ | 57 V(CallJSFunction) \ |
| 58 V(CallWithDescriptor) \ |
| 58 V(CallFunction) \ | 59 V(CallFunction) \ |
| 59 V(CallGlobal) \ | |
| 60 V(CallKeyed) \ | |
| 61 V(CallKnownGlobal) \ | |
| 62 V(CallNamed) \ | |
| 63 V(CallNew) \ | 60 V(CallNew) \ |
| 64 V(CallNewArray) \ | 61 V(CallNewArray) \ |
| 65 V(CallRuntime) \ | 62 V(CallRuntime) \ |
| 66 V(CallStub) \ | 63 V(CallStub) \ |
| 67 V(CheckInstanceType) \ | 64 V(CheckInstanceType) \ |
| 68 V(CheckMaps) \ | 65 V(CheckMaps) \ |
| 69 V(CheckMapValue) \ | 66 V(CheckMapValue) \ |
| 70 V(CheckNonSmi) \ | 67 V(CheckNonSmi) \ |
| 71 V(CheckSmi) \ | 68 V(CheckSmi) \ |
| 72 V(CheckValue) \ | 69 V(CheckValue) \ |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 class IsCallBits: public BitField<bool, 0, 1> {}; | 294 class IsCallBits: public BitField<bool, 0, 1> {}; |
| 298 | 295 |
| 299 LEnvironment* environment_; | 296 LEnvironment* environment_; |
| 300 SetOncePointer<LPointerMap> pointer_map_; | 297 SetOncePointer<LPointerMap> pointer_map_; |
| 301 HValue* hydrogen_value_; | 298 HValue* hydrogen_value_; |
| 302 int32_t bit_field_; | 299 int32_t bit_field_; |
| 303 }; | 300 }; |
| 304 | 301 |
| 305 | 302 |
| 306 // R = number of result operands (0 or 1). | 303 // R = number of result operands (0 or 1). |
| 307 // I = number of input operands. | 304 template<int R> |
| 308 // T = number of temporary operands. | 305 class LTemplateResultInstruction : public LInstruction { |
| 309 template<int R, int I, int T> | |
| 310 class LTemplateInstruction : public LInstruction { | |
| 311 public: | 306 public: |
| 312 // Allow 0 or 1 output operands. | 307 // Allow 0 or 1 output operands. |
| 313 STATIC_ASSERT(R == 0 || R == 1); | 308 STATIC_ASSERT(R == 0 || R == 1); |
| 314 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { | 309 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { |
| 315 return (R != 0) && (result() != NULL); | 310 return (R != 0) && (result() != NULL); |
| 316 } | 311 } |
| 317 void set_result(LOperand* operand) { results_[0] = operand; } | 312 void set_result(LOperand* operand) { results_[0] = operand; } |
| 318 LOperand* result() const { return results_[0]; } | 313 LOperand* result() const { return results_[0]; } |
| 319 | 314 |
| 320 protected: | 315 protected: |
| 321 EmbeddedContainer<LOperand*, R> results_; | 316 EmbeddedContainer<LOperand*, R> results_; |
| 317 }; |
| 318 |
| 319 |
| 320 // R = number of result operands (0 or 1). |
| 321 // I = number of input operands. |
| 322 // T = number of temporary operands. |
| 323 template<int R, int I, int T> |
| 324 class LTemplateInstruction : public LTemplateResultInstruction<R> { |
| 325 protected: |
| 322 EmbeddedContainer<LOperand*, I> inputs_; | 326 EmbeddedContainer<LOperand*, I> inputs_; |
| 323 EmbeddedContainer<LOperand*, T> temps_; | 327 EmbeddedContainer<LOperand*, T> temps_; |
| 324 | 328 |
| 325 private: | 329 private: |
| 330 // Iterator support. |
| 326 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } | 331 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; } |
| 327 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } | 332 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 328 | 333 |
| 329 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } | 334 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; } |
| 330 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } | 335 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; } |
| 331 }; | 336 }; |
| 332 | 337 |
| 333 | 338 |
| 334 class LUnknownOSRValue V8_FINAL : public LTemplateInstruction<1, 0, 0> { | 339 class LUnknownOSRValue V8_FINAL : public LTemplateInstruction<1, 0, 0> { |
| 335 public: | 340 public: |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 LOperand* temp1() { return temps_[0]; } | 785 LOperand* temp1() { return temps_[0]; } |
| 781 LOperand* temp2() { return temps_[1]; } | 786 LOperand* temp2() { return temps_[1]; } |
| 782 | 787 |
| 783 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") | 788 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") |
| 784 DECLARE_HYDROGEN_ACCESSOR(Branch) | 789 DECLARE_HYDROGEN_ACCESSOR(Branch) |
| 785 | 790 |
| 786 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 791 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 787 }; | 792 }; |
| 788 | 793 |
| 789 | 794 |
| 790 class LCallConstantFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> { | 795 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 791 public: | 796 public: |
| 792 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") | 797 explicit LCallJSFunction(LOperand* function) { |
| 793 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) | 798 inputs_[0] = function; |
| 799 } |
| 800 |
| 801 LOperand* function() { return inputs_[0]; } |
| 802 |
| 803 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function") |
| 804 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction) |
| 794 | 805 |
| 795 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 806 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 796 | 807 |
| 797 Handle<JSFunction> function() { return hydrogen()->function(); } | |
| 798 int arity() const { return hydrogen()->argument_count() - 1; } | 808 int arity() const { return hydrogen()->argument_count() - 1; } |
| 799 }; | 809 }; |
| 800 | 810 |
| 801 | 811 |
| 802 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> { | 812 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 803 public: | 813 public: |
| 804 explicit LCallFunction(LOperand* function) { | 814 explicit LCallFunction(LOperand* function) { |
| 805 inputs_[0] = function; | 815 inputs_[0] = function; |
| 806 } | 816 } |
| 807 | 817 |
| 808 LOperand* function() { return inputs_[0]; } | 818 LOperand* function() { return inputs_[0]; } |
| 809 | 819 |
| 810 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") | 820 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") |
| 811 DECLARE_HYDROGEN_ACCESSOR(CallFunction) | 821 DECLARE_HYDROGEN_ACCESSOR(CallFunction) |
| 812 | 822 |
| 813 int arity() const { return hydrogen()->argument_count() - 1; } | 823 int arity() const { return hydrogen()->argument_count() - 1; } |
| 814 }; | 824 }; |
| 815 | 825 |
| 816 | 826 |
| 817 class LCallKnownGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> { | |
| 818 public: | |
| 819 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") | |
| 820 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) | |
| 821 | |
| 822 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 823 | |
| 824 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 825 }; | |
| 826 | |
| 827 | |
| 828 class LCallGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> { | |
| 829 public: | |
| 830 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") | |
| 831 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) | |
| 832 | |
| 833 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 834 | |
| 835 Handle<String> name() const { return hydrogen()->name(); } | |
| 836 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 837 }; | |
| 838 | |
| 839 | |
| 840 class LCallKeyed V8_FINAL : public LTemplateInstruction<1, 1, 0> { | |
| 841 public: | |
| 842 explicit LCallKeyed(LOperand* key) { | |
| 843 inputs_[0] = key; | |
| 844 } | |
| 845 | |
| 846 LOperand* key() { return inputs_[0]; } | |
| 847 | |
| 848 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") | |
| 849 DECLARE_HYDROGEN_ACCESSOR(CallKeyed) | |
| 850 | |
| 851 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 852 | |
| 853 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 854 }; | |
| 855 | |
| 856 | |
| 857 class LCallNamed V8_FINAL : public LTemplateInstruction<1, 0, 0> { | |
| 858 public: | |
| 859 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named") | |
| 860 DECLARE_HYDROGEN_ACCESSOR(CallNamed) | |
| 861 | |
| 862 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 863 | |
| 864 Handle<String> name() const { return hydrogen()->name(); } | |
| 865 int arity() const { return hydrogen()->argument_count() - 1; } | |
| 866 }; | |
| 867 | |
| 868 | |
| 869 class LCallNew V8_FINAL : public LTemplateInstruction<1, 1, 0> { | 827 class LCallNew V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 870 public: | 828 public: |
| 871 explicit LCallNew(LOperand* constructor) { | 829 explicit LCallNew(LOperand* constructor) { |
| 872 inputs_[0] = constructor; | 830 inputs_[0] = constructor; |
| 873 } | 831 } |
| 874 | 832 |
| 875 LOperand* constructor() { return inputs_[0]; } | 833 LOperand* constructor() { return inputs_[0]; } |
| 876 | 834 |
| 877 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") | 835 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") |
| 878 DECLARE_HYDROGEN_ACCESSOR(CallNew) | 836 DECLARE_HYDROGEN_ACCESSOR(CallNew) |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 inputs_[0] = value; | 1440 inputs_[0] = value; |
| 1483 } | 1441 } |
| 1484 | 1442 |
| 1485 LOperand* value() { return inputs_[0]; } | 1443 LOperand* value() { return inputs_[0]; } |
| 1486 | 1444 |
| 1487 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-smi") | 1445 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-smi") |
| 1488 DECLARE_HYDROGEN_ACCESSOR(Change) | 1446 DECLARE_HYDROGEN_ACCESSOR(Change) |
| 1489 }; | 1447 }; |
| 1490 | 1448 |
| 1491 | 1449 |
| 1450 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { |
| 1451 public: |
| 1452 LCallWithDescriptor(const CallInterfaceDescriptor* descriptor, |
| 1453 ZoneList<LOperand*>& operands, |
| 1454 Zone* zone) |
| 1455 : descriptor_(descriptor), |
| 1456 inputs_(descriptor->environment_length() + 1, zone) { |
| 1457 ASSERT(descriptor->environment_length() + 1 == operands.length()); |
| 1458 inputs_.AddAll(operands, zone); |
| 1459 } |
| 1460 |
| 1461 LOperand* target() const { return inputs_[0]; } |
| 1462 |
| 1463 const CallInterfaceDescriptor* descriptor() { return descriptor_; } |
| 1464 |
| 1465 private: |
| 1466 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor") |
| 1467 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor) |
| 1468 |
| 1469 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1470 |
| 1471 int arity() const { return hydrogen()->argument_count() - 1; } |
| 1472 |
| 1473 const CallInterfaceDescriptor* descriptor_; |
| 1474 ZoneList<LOperand*> inputs_; |
| 1475 |
| 1476 // Iterator support. |
| 1477 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); } |
| 1478 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; } |
| 1479 |
| 1480 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; } |
| 1481 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; } |
| 1482 }; |
| 1483 |
| 1484 |
| 1492 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> { | 1485 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> { |
| 1493 public: | 1486 public: |
| 1494 explicit LInvokeFunction(LOperand* function) { | 1487 explicit LInvokeFunction(LOperand* function) { |
| 1495 inputs_[0] = function; | 1488 inputs_[0] = function; |
| 1496 } | 1489 } |
| 1497 | 1490 |
| 1498 LOperand* function() { return inputs_[0]; } | 1491 LOperand* function() { return inputs_[0]; } |
| 1499 | 1492 |
| 1500 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") | 1493 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") |
| 1501 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) | 1494 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) |
| (...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2912 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value); | 2905 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value); |
| 2913 | 2906 |
| 2914 // Temporary operand that must be in a register. | 2907 // Temporary operand that must be in a register. |
| 2915 MUST_USE_RESULT LUnallocated* TempRegister(); | 2908 MUST_USE_RESULT LUnallocated* TempRegister(); |
| 2916 | 2909 |
| 2917 // Temporary operand that must be in a fixed double register. | 2910 // Temporary operand that must be in a fixed double register. |
| 2918 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); | 2911 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); |
| 2919 | 2912 |
| 2920 // Methods for setting up define-use relationships. | 2913 // Methods for setting up define-use relationships. |
| 2921 // Return the same instruction that they are passed. | 2914 // Return the same instruction that they are passed. |
| 2922 template<int I, int T> | 2915 LInstruction* Define(LTemplateResultInstruction<1>* instr, |
| 2923 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, | 2916 LUnallocated* result); |
| 2924 LUnallocated* result); | 2917 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr); |
| 2925 template<int I, int T> | 2918 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr, |
| 2926 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); | 2919 int index); |
| 2927 | 2920 |
| 2928 template<int I, int T> | 2921 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr); |
| 2929 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, | 2922 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr, |
| 2930 int index); | 2923 Register reg); |
| 2931 | 2924 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr, |
| 2932 template<int I, int T> | 2925 DoubleRegister reg); |
| 2933 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); | |
| 2934 | |
| 2935 template<int I, int T> | |
| 2936 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr, | |
| 2937 Register reg); | |
| 2938 template<int I, int T> | |
| 2939 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr, | |
| 2940 DoubleRegister reg); | |
| 2941 | 2926 |
| 2942 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2927 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2943 | 2928 |
| 2944 // By default we assume that instruction sequences generated for calls | 2929 // By default we assume that instruction sequences generated for calls |
| 2945 // cannot deoptimize eagerly and we do not attach environment to this | 2930 // cannot deoptimize eagerly and we do not attach environment to this |
| 2946 // instruction. | 2931 // instruction. |
| 2947 LInstruction* MarkAsCall( | 2932 LInstruction* MarkAsCall( |
| 2948 LInstruction* instr, | 2933 LInstruction* instr, |
| 2949 HInstruction* hinstr, | 2934 HInstruction* hinstr, |
| 2950 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); | 2935 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2974 | 2959 |
| 2975 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2960 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2976 }; | 2961 }; |
| 2977 | 2962 |
| 2978 #undef DECLARE_HYDROGEN_ACCESSOR | 2963 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2979 #undef DECLARE_CONCRETE_INSTRUCTION | 2964 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2980 | 2965 |
| 2981 } } // namespace v8::internal | 2966 } } // namespace v8::internal |
| 2982 | 2967 |
| 2983 #endif // V8_A64_LITHIUM_A64_H_ | 2968 #endif // V8_A64_LITHIUM_A64_H_ |
| OLD | NEW |