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 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 | 2009 |
2010 enum InliningKind { | 2010 enum InliningKind { |
2011 NORMAL_RETURN, // Normal function/method call and return. | 2011 NORMAL_RETURN, // Normal function/method call and return. |
2012 DROP_EXTRA_ON_RETURN, // Drop an extra value from the environment on return. | 2012 DROP_EXTRA_ON_RETURN, // Drop an extra value from the environment on return. |
2013 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. | 2013 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. |
2014 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. | 2014 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. |
2015 SETTER_CALL_RETURN // Use the RHS of the assignment as the return value. | 2015 SETTER_CALL_RETURN // Use the RHS of the assignment as the return value. |
2016 }; | 2016 }; |
2017 | 2017 |
2018 | 2018 |
| 2019 class HArgumentsObject; |
| 2020 |
| 2021 |
2019 class HEnterInlined: public HTemplateInstruction<0> { | 2022 class HEnterInlined: public HTemplateInstruction<0> { |
2020 public: | 2023 public: |
2021 HEnterInlined(Handle<JSFunction> closure, | 2024 HEnterInlined(Handle<JSFunction> closure, |
2022 int arguments_count, | 2025 int arguments_count, |
2023 FunctionLiteral* function, | 2026 FunctionLiteral* function, |
2024 InliningKind inlining_kind, | 2027 InliningKind inlining_kind, |
2025 Variable* arguments_var, | 2028 Variable* arguments_var, |
2026 ZoneList<HValue*>* arguments_values, | 2029 HArgumentsObject* arguments_object, |
2027 bool undefined_receiver, | 2030 bool undefined_receiver, |
2028 Zone* zone) | 2031 Zone* zone) |
2029 : closure_(closure), | 2032 : closure_(closure), |
2030 arguments_count_(arguments_count), | 2033 arguments_count_(arguments_count), |
2031 arguments_pushed_(false), | 2034 arguments_pushed_(false), |
2032 function_(function), | 2035 function_(function), |
2033 inlining_kind_(inlining_kind), | 2036 inlining_kind_(inlining_kind), |
2034 arguments_var_(arguments_var), | 2037 arguments_var_(arguments_var), |
2035 arguments_values_(arguments_values), | 2038 arguments_object_(arguments_object), |
2036 undefined_receiver_(undefined_receiver), | 2039 undefined_receiver_(undefined_receiver), |
2037 return_targets_(2, zone) { | 2040 return_targets_(2, zone) { |
2038 } | 2041 } |
2039 | 2042 |
2040 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); | 2043 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); |
2041 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } | 2044 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } |
2042 | 2045 |
2043 virtual void PrintDataTo(StringStream* stream); | 2046 virtual void PrintDataTo(StringStream* stream); |
2044 | 2047 |
2045 Handle<JSFunction> closure() const { return closure_; } | 2048 Handle<JSFunction> closure() const { return closure_; } |
2046 int arguments_count() const { return arguments_count_; } | 2049 int arguments_count() const { return arguments_count_; } |
2047 bool arguments_pushed() const { return arguments_pushed_; } | 2050 bool arguments_pushed() const { return arguments_pushed_; } |
2048 void set_arguments_pushed() { arguments_pushed_ = true; } | 2051 void set_arguments_pushed() { arguments_pushed_ = true; } |
2049 FunctionLiteral* function() const { return function_; } | 2052 FunctionLiteral* function() const { return function_; } |
2050 InliningKind inlining_kind() const { return inlining_kind_; } | 2053 InliningKind inlining_kind() const { return inlining_kind_; } |
2051 bool undefined_receiver() const { return undefined_receiver_; } | 2054 bool undefined_receiver() const { return undefined_receiver_; } |
2052 | 2055 |
2053 virtual Representation RequiredInputRepresentation(int index) { | 2056 virtual Representation RequiredInputRepresentation(int index) { |
2054 return Representation::None(); | 2057 return Representation::None(); |
2055 } | 2058 } |
2056 | 2059 |
2057 Variable* arguments_var() { return arguments_var_; } | 2060 Variable* arguments_var() { return arguments_var_; } |
2058 ZoneList<HValue*>* arguments_values() { return arguments_values_; } | 2061 HArgumentsObject* arguments_object() { return arguments_object_; } |
2059 | 2062 |
2060 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) | 2063 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) |
2061 | 2064 |
2062 private: | 2065 private: |
2063 Handle<JSFunction> closure_; | 2066 Handle<JSFunction> closure_; |
2064 int arguments_count_; | 2067 int arguments_count_; |
2065 bool arguments_pushed_; | 2068 bool arguments_pushed_; |
2066 FunctionLiteral* function_; | 2069 FunctionLiteral* function_; |
2067 InliningKind inlining_kind_; | 2070 InliningKind inlining_kind_; |
2068 Variable* arguments_var_; | 2071 Variable* arguments_var_; |
2069 ZoneList<HValue*>* arguments_values_; | 2072 HArgumentsObject* arguments_object_; |
2070 bool undefined_receiver_; | 2073 bool undefined_receiver_; |
2071 ZoneList<HBasicBlock*> return_targets_; | 2074 ZoneList<HBasicBlock*> return_targets_; |
2072 }; | 2075 }; |
2073 | 2076 |
2074 | 2077 |
2075 class HLeaveInlined: public HTemplateInstruction<0> { | 2078 class HLeaveInlined: public HTemplateInstruction<0> { |
2076 public: | 2079 public: |
2077 HLeaveInlined() { } | 2080 HLeaveInlined() { } |
2078 | 2081 |
2079 virtual Representation RequiredInputRepresentation(int index) { | 2082 virtual Representation RequiredInputRepresentation(int index) { |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3187 // the operand can change if a new idef of the phi is added between the phi | 3190 // the operand can change if a new idef of the phi is added between the phi |
3188 // and this instruction (inserting an idef updates every use). | 3191 // and this instruction (inserting an idef updates every use). |
3189 HPhi* phi_; | 3192 HPhi* phi_; |
3190 NumericRelation relation_; | 3193 NumericRelation relation_; |
3191 int operand_index_; | 3194 int operand_index_; |
3192 }; | 3195 }; |
3193 | 3196 |
3194 | 3197 |
3195 class HArgumentsObject: public HTemplateInstruction<0> { | 3198 class HArgumentsObject: public HTemplateInstruction<0> { |
3196 public: | 3199 public: |
3197 HArgumentsObject() { | 3200 HArgumentsObject(int count, Zone* zone) : values_(count, zone) { |
3198 set_representation(Representation::Tagged()); | 3201 set_representation(Representation::Tagged()); |
3199 SetFlag(kIsArguments); | 3202 SetFlag(kIsArguments); |
3200 } | 3203 } |
3201 | 3204 |
| 3205 const ZoneList<HValue*>* arguments_values() const { return &values_; } |
| 3206 int arguments_count() const { return values_.length(); } |
| 3207 |
| 3208 void AddArgument(HValue* argument, Zone* zone) { |
| 3209 values_.Add(NULL, zone); // Resize list. |
| 3210 SetOperandAt(values_.length() - 1, argument); |
| 3211 } |
| 3212 |
| 3213 virtual int OperandCount() { return values_.length(); } |
| 3214 virtual HValue* OperandAt(int index) const { return values_[index]; } |
| 3215 |
3202 virtual Representation RequiredInputRepresentation(int index) { | 3216 virtual Representation RequiredInputRepresentation(int index) { |
3203 return Representation::None(); | 3217 return Representation::None(); |
3204 } | 3218 } |
3205 | 3219 |
3206 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | 3220 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
3207 | 3221 |
| 3222 protected: |
| 3223 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 3224 values_[index] = value; |
| 3225 } |
| 3226 |
3208 private: | 3227 private: |
3209 virtual bool IsDeletable() const { return true; } | 3228 virtual bool IsDeletable() const { return true; } |
| 3229 |
| 3230 ZoneList<HValue*> values_; |
3210 }; | 3231 }; |
3211 | 3232 |
3212 | 3233 |
3213 class HConstant: public HTemplateInstruction<0> { | 3234 class HConstant: public HTemplateInstruction<0> { |
3214 public: | 3235 public: |
3215 HConstant(Handle<Object> handle, Representation r); | 3236 HConstant(Handle<Object> handle, Representation r); |
3216 HConstant(int32_t value, | 3237 HConstant(int32_t value, |
3217 Representation r = Representation::None(), | 3238 Representation r = Representation::None(), |
3218 bool is_not_in_new_space = true, | 3239 bool is_not_in_new_space = true, |
3219 Handle<Object> optional_handle = Handle<Object>::null()); | 3240 Handle<Object> optional_handle = Handle<Object>::null()); |
(...skipping 3352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6572 virtual bool IsDeletable() const { return true; } | 6593 virtual bool IsDeletable() const { return true; } |
6573 }; | 6594 }; |
6574 | 6595 |
6575 | 6596 |
6576 #undef DECLARE_INSTRUCTION | 6597 #undef DECLARE_INSTRUCTION |
6577 #undef DECLARE_CONCRETE_INSTRUCTION | 6598 #undef DECLARE_CONCRETE_INSTRUCTION |
6578 | 6599 |
6579 } } // namespace v8::internal | 6600 } } // namespace v8::internal |
6580 | 6601 |
6581 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6602 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |