| OLD | NEW |
| 1 // Copyright 2010 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_IA32_LITHIUM_IA32_H_ | 28 #ifndef V8_IA32_LITHIUM_IA32_H_ |
| 29 #define V8_IA32_LITHIUM_IA32_H_ | 29 #define V8_IA32_LITHIUM_IA32_H_ |
| 30 | 30 |
| 31 #include "hydrogen.h" | 31 #include "hydrogen.h" |
| 32 #include "lithium-allocator.h" | 32 #include "lithium-allocator.h" |
| 33 #include "lithium.h" |
| 33 #include "safepoint-table.h" | 34 #include "safepoint-table.h" |
| 34 | 35 |
| 35 namespace v8 { | 36 namespace v8 { |
| 36 namespace internal { | 37 namespace internal { |
| 37 | 38 |
| 38 // Forward declarations. | 39 // Forward declarations. |
| 39 class LCodeGen; | 40 class LCodeGen; |
| 40 class LEnvironment; | 41 class LEnvironment; |
| 41 class Translation; | 42 class Translation; |
| 42 class LGapNode; | |
| 43 | 43 |
| 44 | 44 |
| 45 // Type hierarchy: | 45 // Type hierarchy: |
| 46 // | 46 // |
| 47 // LInstruction | 47 // LInstruction |
| 48 // LAccessArgumentsAt | 48 // LAccessArgumentsAt |
| 49 // LArgumentsElements | 49 // LArgumentsElements |
| 50 // LArgumentsLength | 50 // LArgumentsLength |
| 51 // LBinaryOperation | 51 // LBinaryOperation |
| 52 // LAddI | 52 // LAddI |
| 53 // LApplyArguments | 53 // LApplyArguments |
| 54 // LArithmeticD | 54 // LArithmeticD |
| 55 // LArithmeticT | 55 // LArithmeticT |
| 56 // LBitI | 56 // LBitI |
| 57 // LBoundsCheck | 57 // LBoundsCheck |
| 58 // LCmpID | 58 // LCmpID |
| 59 // LCmpIDAndBranch | 59 // LCmpIDAndBranch |
| 60 // LCmpJSObjectEq | 60 // LCmpJSObjectEq |
| 61 // LCmpJSObjectEqAndBranch | 61 // LCmpJSObjectEqAndBranch |
| 62 // LCmpT | 62 // LCmpT |
| 63 // LDivI | 63 // LDivI |
| 64 // LInstanceOf | 64 // LInstanceOf |
| 65 // LInstanceOfAndBranch | 65 // LInstanceOfAndBranch |
| 66 // LInstanceOfKnownGlobal |
| 66 // LLoadKeyedFastElement | 67 // LLoadKeyedFastElement |
| 67 // LLoadKeyedGeneric | 68 // LLoadKeyedGeneric |
| 68 // LModI | 69 // LModI |
| 69 // LMulI | 70 // LMulI |
| 70 // LPower | 71 // LPower |
| 71 // LShiftI | 72 // LShiftI |
| 72 // LSubI | 73 // LSubI |
| 73 // LCallConstantFunction | 74 // LCallConstantFunction |
| 74 // LCallFunction | 75 // LCallFunction |
| 75 // LCallGlobal | 76 // LCallGlobal |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 V(DivI) \ | 201 V(DivI) \ |
| 201 V(DoubleToI) \ | 202 V(DoubleToI) \ |
| 202 V(FunctionLiteral) \ | 203 V(FunctionLiteral) \ |
| 203 V(Gap) \ | 204 V(Gap) \ |
| 204 V(GlobalObject) \ | 205 V(GlobalObject) \ |
| 205 V(GlobalReceiver) \ | 206 V(GlobalReceiver) \ |
| 206 V(Goto) \ | 207 V(Goto) \ |
| 207 V(FixedArrayLength) \ | 208 V(FixedArrayLength) \ |
| 208 V(InstanceOf) \ | 209 V(InstanceOf) \ |
| 209 V(InstanceOfAndBranch) \ | 210 V(InstanceOfAndBranch) \ |
| 211 V(InstanceOfKnownGlobal) \ |
| 210 V(Integer32ToDouble) \ | 212 V(Integer32ToDouble) \ |
| 211 V(IsNull) \ | 213 V(IsNull) \ |
| 212 V(IsNullAndBranch) \ | 214 V(IsNullAndBranch) \ |
| 213 V(IsObject) \ | 215 V(IsObject) \ |
| 214 V(IsObjectAndBranch) \ | 216 V(IsObjectAndBranch) \ |
| 215 V(IsSmi) \ | 217 V(IsSmi) \ |
| 216 V(IsSmiAndBranch) \ | 218 V(IsSmiAndBranch) \ |
| 217 V(JSArrayLength) \ | 219 V(JSArrayLength) \ |
| 218 V(HasInstanceType) \ | 220 V(HasInstanceType) \ |
| 219 V(HasInstanceTypeAndBranch) \ | 221 V(HasInstanceTypeAndBranch) \ |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 328 |
| 327 private: | 329 private: |
| 328 SetOncePointer<LEnvironment> environment_; | 330 SetOncePointer<LEnvironment> environment_; |
| 329 SetOncePointer<LPointerMap> pointer_map_; | 331 SetOncePointer<LPointerMap> pointer_map_; |
| 330 SetOncePointer<LOperand> result_; | 332 SetOncePointer<LOperand> result_; |
| 331 HValue* hydrogen_value_; | 333 HValue* hydrogen_value_; |
| 332 SetOncePointer<LEnvironment> deoptimization_environment_; | 334 SetOncePointer<LEnvironment> deoptimization_environment_; |
| 333 }; | 335 }; |
| 334 | 336 |
| 335 | 337 |
| 336 class LGapResolver BASE_EMBEDDED { | |
| 337 public: | |
| 338 LGapResolver(const ZoneList<LMoveOperands>* moves, LOperand* marker_operand); | |
| 339 const ZoneList<LMoveOperands>* ResolveInReverseOrder(); | |
| 340 | |
| 341 private: | |
| 342 LGapNode* LookupNode(LOperand* operand); | |
| 343 bool CanReach(LGapNode* a, LGapNode* b, int visited_id); | |
| 344 bool CanReach(LGapNode* a, LGapNode* b); | |
| 345 void RegisterMove(LMoveOperands move); | |
| 346 void AddResultMove(LOperand* from, LOperand* to); | |
| 347 void AddResultMove(LGapNode* from, LGapNode* to); | |
| 348 void ResolveCycle(LGapNode* start); | |
| 349 | |
| 350 ZoneList<LGapNode*> nodes_; | |
| 351 ZoneList<LGapNode*> identified_cycles_; | |
| 352 ZoneList<LMoveOperands> result_; | |
| 353 LOperand* marker_operand_; | |
| 354 int next_visited_id_; | |
| 355 int bailout_after_ast_id_; | |
| 356 }; | |
| 357 | |
| 358 | |
| 359 class LParallelMove : public ZoneObject { | 338 class LParallelMove : public ZoneObject { |
| 360 public: | 339 public: |
| 361 LParallelMove() : move_operands_(4) { } | 340 LParallelMove() : move_operands_(4) { } |
| 362 | 341 |
| 363 void AddMove(LOperand* from, LOperand* to) { | 342 void AddMove(LOperand* from, LOperand* to) { |
| 364 move_operands_.Add(LMoveOperands(from, to)); | 343 move_operands_.Add(LMoveOperands(from, to)); |
| 365 } | 344 } |
| 366 | 345 |
| 367 bool IsRedundant() const; | 346 bool IsRedundant() const; |
| 368 | 347 |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 | 980 |
| 1002 int true_block_id() const { return true_block_id_; } | 981 int true_block_id() const { return true_block_id_; } |
| 1003 int false_block_id() const { return false_block_id_; } | 982 int false_block_id() const { return false_block_id_; } |
| 1004 | 983 |
| 1005 private: | 984 private: |
| 1006 int true_block_id_; | 985 int true_block_id_; |
| 1007 int false_block_id_; | 986 int false_block_id_; |
| 1008 }; | 987 }; |
| 1009 | 988 |
| 1010 | 989 |
| 990 class LInstanceOfKnownGlobal: public LUnaryOperation { |
| 991 public: |
| 992 LInstanceOfKnownGlobal(LOperand* left, LOperand* temp) |
| 993 : LUnaryOperation(left), temp_(temp) { } |
| 994 |
| 995 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, |
| 996 "instance-of-known-global") |
| 997 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) |
| 998 |
| 999 Handle<JSFunction> function() const { return hydrogen()->function(); } |
| 1000 LOperand* temp() const { return temp_; } |
| 1001 |
| 1002 private: |
| 1003 LOperand* temp_; |
| 1004 }; |
| 1005 |
| 1006 |
| 1011 class LBoundsCheck: public LBinaryOperation { | 1007 class LBoundsCheck: public LBinaryOperation { |
| 1012 public: | 1008 public: |
| 1013 LBoundsCheck(LOperand* index, LOperand* length) | 1009 LBoundsCheck(LOperand* index, LOperand* length) |
| 1014 : LBinaryOperation(index, length) { } | 1010 : LBinaryOperation(index, length) { } |
| 1015 | 1011 |
| 1016 LOperand* index() const { return left(); } | 1012 LOperand* index() const { return left(); } |
| 1017 LOperand* length() const { return right(); } | 1013 LOperand* length() const { return right(); } |
| 1018 | 1014 |
| 1019 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check") | 1015 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check") |
| 1020 }; | 1016 }; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 int false_block_id() const { return false_block_id_; } | 1115 int false_block_id() const { return false_block_id_; } |
| 1120 | 1116 |
| 1121 private: | 1117 private: |
| 1122 int true_block_id_; | 1118 int true_block_id_; |
| 1123 int false_block_id_; | 1119 int false_block_id_; |
| 1124 }; | 1120 }; |
| 1125 | 1121 |
| 1126 | 1122 |
| 1127 class LCmpMapAndBranch: public LUnaryOperation { | 1123 class LCmpMapAndBranch: public LUnaryOperation { |
| 1128 public: | 1124 public: |
| 1129 LCmpMapAndBranch(LOperand* value, | 1125 explicit LCmpMapAndBranch(LOperand* value) : LUnaryOperation(value) { } |
| 1130 Handle<Map> map, | |
| 1131 int true_block_id, | |
| 1132 int false_block_id) | |
| 1133 : LUnaryOperation(value), | |
| 1134 map_(map), | |
| 1135 true_block_id_(true_block_id), | |
| 1136 false_block_id_(false_block_id) { } | |
| 1137 | 1126 |
| 1138 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") | 1127 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") |
| 1128 DECLARE_HYDROGEN_ACCESSOR(CompareMapAndBranch) |
| 1139 | 1129 |
| 1140 virtual bool IsControl() const { return true; } | 1130 virtual bool IsControl() const { return true; } |
| 1141 | 1131 |
| 1142 Handle<Map> map() const { return map_; } | 1132 Handle<Map> map() const { return hydrogen()->map(); } |
| 1143 int true_block_id() const { return true_block_id_; } | 1133 int true_block_id() const { |
| 1144 int false_block_id() const { return false_block_id_; } | 1134 return hydrogen()->true_destination()->block_id(); |
| 1145 | 1135 } |
| 1146 private: | 1136 int false_block_id() const { |
| 1147 Handle<Map> map_; | 1137 return hydrogen()->false_destination()->block_id(); |
| 1148 int true_block_id_; | 1138 } |
| 1149 int false_block_id_; | |
| 1150 }; | 1139 }; |
| 1151 | 1140 |
| 1152 | 1141 |
| 1153 class LJSArrayLength: public LUnaryOperation { | 1142 class LJSArrayLength: public LUnaryOperation { |
| 1154 public: | 1143 public: |
| 1155 explicit LJSArrayLength(LOperand* input) : LUnaryOperation(input) { } | 1144 explicit LJSArrayLength(LOperand* input) : LUnaryOperation(input) { } |
| 1156 | 1145 |
| 1157 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length") | 1146 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length") |
| 1158 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength) | 1147 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength) |
| 1159 }; | 1148 }; |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1945 // that do not correspond to an OSR entry. | 1934 // that do not correspond to an OSR entry. |
| 1946 LOperand** spilled_registers_; | 1935 LOperand** spilled_registers_; |
| 1947 LOperand** spilled_double_registers_; | 1936 LOperand** spilled_double_registers_; |
| 1948 | 1937 |
| 1949 LEnvironment* outer_; | 1938 LEnvironment* outer_; |
| 1950 }; | 1939 }; |
| 1951 | 1940 |
| 1952 class LChunkBuilder; | 1941 class LChunkBuilder; |
| 1953 class LChunk: public ZoneObject { | 1942 class LChunk: public ZoneObject { |
| 1954 public: | 1943 public: |
| 1955 explicit LChunk(HGraph* graph); | 1944 explicit LChunk(HGraph* graph) |
| 1945 : spill_slot_count_(0), |
| 1946 graph_(graph), |
| 1947 instructions_(32), |
| 1948 pointer_maps_(8), |
| 1949 inlined_closures_(1) { } |
| 1956 | 1950 |
| 1957 int AddInstruction(LInstruction* instruction, HBasicBlock* block); | 1951 int AddInstruction(LInstruction* instruction, HBasicBlock* block); |
| 1958 LConstantOperand* DefineConstantOperand(HConstant* constant); | 1952 LConstantOperand* DefineConstantOperand(HConstant* constant); |
| 1959 Handle<Object> LookupLiteral(LConstantOperand* operand) const; | 1953 Handle<Object> LookupLiteral(LConstantOperand* operand) const; |
| 1960 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; | 1954 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; |
| 1961 | 1955 |
| 1962 int GetNextSpillIndex(bool is_double); | 1956 int GetNextSpillIndex(bool is_double); |
| 1963 LOperand* GetNextSpillSlot(bool is_double); | 1957 LOperand* GetNextSpillSlot(bool is_double); |
| 1964 | 1958 |
| 1965 int ParameterAt(int index); | 1959 int ParameterAt(int index); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 | 2089 |
| 2096 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2090 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2097 | 2091 |
| 2098 // By default we assume that instruction sequences generated for calls | 2092 // By default we assume that instruction sequences generated for calls |
| 2099 // cannot deoptimize eagerly and we do not attach environment to this | 2093 // cannot deoptimize eagerly and we do not attach environment to this |
| 2100 // instruction. | 2094 // instruction. |
| 2101 LInstruction* MarkAsCall( | 2095 LInstruction* MarkAsCall( |
| 2102 LInstruction* instr, | 2096 LInstruction* instr, |
| 2103 HInstruction* hinstr, | 2097 HInstruction* hinstr, |
| 2104 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); | 2098 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); |
| 2099 LInstruction* MarkAsSaveDoubles(LInstruction* instr); |
| 2105 | 2100 |
| 2106 LInstruction* SetInstructionPendingDeoptimizationEnvironment( | 2101 LInstruction* SetInstructionPendingDeoptimizationEnvironment( |
| 2107 LInstruction* instr, int ast_id); | 2102 LInstruction* instr, int ast_id); |
| 2108 void ClearInstructionPendingDeoptimizationEnvironment(); | 2103 void ClearInstructionPendingDeoptimizationEnvironment(); |
| 2109 | 2104 |
| 2110 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env); | 2105 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env); |
| 2111 | 2106 |
| 2112 // Temporary operand that may be a memory location. | 2107 // Temporary operand that may be a memory location. |
| 2113 LOperand* Temp(); | 2108 LOperand* Temp(); |
| 2114 // Temporary operand that must be in a register. | 2109 // Temporary operand that must be in a register. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2141 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2136 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2142 }; | 2137 }; |
| 2143 | 2138 |
| 2144 #undef DECLARE_HYDROGEN_ACCESSOR | 2139 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2145 #undef DECLARE_INSTRUCTION | 2140 #undef DECLARE_INSTRUCTION |
| 2146 #undef DECLARE_CONCRETE_INSTRUCTION | 2141 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2147 | 2142 |
| 2148 } } // namespace v8::internal | 2143 } } // namespace v8::internal |
| 2149 | 2144 |
| 2150 #endif // V8_IA32_LITHIUM_IA32_H_ | 2145 #endif // V8_IA32_LITHIUM_IA32_H_ |
| OLD | NEW |