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 | |
2022 class HEnterInlined: public HTemplateInstruction<0> { | 2019 class HEnterInlined: public HTemplateInstruction<0> { |
2023 public: | 2020 public: |
2024 HEnterInlined(Handle<JSFunction> closure, | 2021 HEnterInlined(Handle<JSFunction> closure, |
2025 int arguments_count, | 2022 int arguments_count, |
2026 FunctionLiteral* function, | 2023 FunctionLiteral* function, |
2027 InliningKind inlining_kind, | 2024 InliningKind inlining_kind, |
2028 Variable* arguments_var, | 2025 Variable* arguments_var, |
2029 HArgumentsObject* arguments_object, | 2026 ZoneList<HValue*>* arguments_values, |
2030 bool undefined_receiver, | 2027 bool undefined_receiver, |
2031 Zone* zone) | 2028 Zone* zone) |
2032 : closure_(closure), | 2029 : closure_(closure), |
2033 arguments_count_(arguments_count), | 2030 arguments_count_(arguments_count), |
2034 arguments_pushed_(false), | 2031 arguments_pushed_(false), |
2035 function_(function), | 2032 function_(function), |
2036 inlining_kind_(inlining_kind), | 2033 inlining_kind_(inlining_kind), |
2037 arguments_var_(arguments_var), | 2034 arguments_var_(arguments_var), |
2038 arguments_object_(arguments_object), | 2035 arguments_values_(arguments_values), |
2039 undefined_receiver_(undefined_receiver), | 2036 undefined_receiver_(undefined_receiver), |
2040 return_targets_(2, zone) { | 2037 return_targets_(2, zone) { |
2041 } | 2038 } |
2042 | 2039 |
2043 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); | 2040 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); |
2044 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } | 2041 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } |
2045 | 2042 |
2046 virtual void PrintDataTo(StringStream* stream); | 2043 virtual void PrintDataTo(StringStream* stream); |
2047 | 2044 |
2048 Handle<JSFunction> closure() const { return closure_; } | 2045 Handle<JSFunction> closure() const { return closure_; } |
2049 int arguments_count() const { return arguments_count_; } | 2046 int arguments_count() const { return arguments_count_; } |
2050 bool arguments_pushed() const { return arguments_pushed_; } | 2047 bool arguments_pushed() const { return arguments_pushed_; } |
2051 void set_arguments_pushed() { arguments_pushed_ = true; } | 2048 void set_arguments_pushed() { arguments_pushed_ = true; } |
2052 FunctionLiteral* function() const { return function_; } | 2049 FunctionLiteral* function() const { return function_; } |
2053 InliningKind inlining_kind() const { return inlining_kind_; } | 2050 InliningKind inlining_kind() const { return inlining_kind_; } |
2054 bool undefined_receiver() const { return undefined_receiver_; } | 2051 bool undefined_receiver() const { return undefined_receiver_; } |
2055 | 2052 |
2056 virtual Representation RequiredInputRepresentation(int index) { | 2053 virtual Representation RequiredInputRepresentation(int index) { |
2057 return Representation::None(); | 2054 return Representation::None(); |
2058 } | 2055 } |
2059 | 2056 |
2060 Variable* arguments_var() { return arguments_var_; } | 2057 Variable* arguments_var() { return arguments_var_; } |
2061 HArgumentsObject* arguments_object() { return arguments_object_; } | 2058 ZoneList<HValue*>* arguments_values() { return arguments_values_; } |
2062 | 2059 |
2063 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) | 2060 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) |
2064 | 2061 |
2065 private: | 2062 private: |
2066 Handle<JSFunction> closure_; | 2063 Handle<JSFunction> closure_; |
2067 int arguments_count_; | 2064 int arguments_count_; |
2068 bool arguments_pushed_; | 2065 bool arguments_pushed_; |
2069 FunctionLiteral* function_; | 2066 FunctionLiteral* function_; |
2070 InliningKind inlining_kind_; | 2067 InliningKind inlining_kind_; |
2071 Variable* arguments_var_; | 2068 Variable* arguments_var_; |
2072 HArgumentsObject* arguments_object_; | 2069 ZoneList<HValue*>* arguments_values_; |
2073 bool undefined_receiver_; | 2070 bool undefined_receiver_; |
2074 ZoneList<HBasicBlock*> return_targets_; | 2071 ZoneList<HBasicBlock*> return_targets_; |
2075 }; | 2072 }; |
2076 | 2073 |
2077 | 2074 |
2078 class HLeaveInlined: public HTemplateInstruction<0> { | 2075 class HLeaveInlined: public HTemplateInstruction<0> { |
2079 public: | 2076 public: |
2080 HLeaveInlined() { } | 2077 HLeaveInlined() { } |
2081 | 2078 |
2082 virtual Representation RequiredInputRepresentation(int index) { | 2079 virtual Representation RequiredInputRepresentation(int index) { |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3198 // the operand can change if a new idef of the phi is added between the phi | 3195 // the operand can change if a new idef of the phi is added between the phi |
3199 // and this instruction (inserting an idef updates every use). | 3196 // and this instruction (inserting an idef updates every use). |
3200 HPhi* phi_; | 3197 HPhi* phi_; |
3201 NumericRelation relation_; | 3198 NumericRelation relation_; |
3202 int operand_index_; | 3199 int operand_index_; |
3203 }; | 3200 }; |
3204 | 3201 |
3205 | 3202 |
3206 class HArgumentsObject: public HTemplateInstruction<0> { | 3203 class HArgumentsObject: public HTemplateInstruction<0> { |
3207 public: | 3204 public: |
3208 HArgumentsObject(int count, Zone* zone) : values_(count, zone) { | 3205 HArgumentsObject() { |
3209 set_representation(Representation::Tagged()); | 3206 set_representation(Representation::Tagged()); |
3210 SetFlag(kIsArguments); | 3207 SetFlag(kIsArguments); |
3211 } | 3208 } |
3212 | 3209 |
3213 const ZoneList<HValue*>* arguments_values() const { return &values_; } | |
3214 int arguments_count() const { return values_.length(); } | |
3215 | |
3216 void AddArgument(HValue* argument, Zone* zone) { | |
3217 values_.Add(NULL, zone); // Resize list. | |
3218 SetOperandAt(values_.length() - 1, argument); | |
3219 } | |
3220 | |
3221 virtual int OperandCount() { return values_.length(); } | |
3222 virtual HValue* OperandAt(int index) const { return values_[index]; } | |
3223 | |
3224 virtual Representation RequiredInputRepresentation(int index) { | 3210 virtual Representation RequiredInputRepresentation(int index) { |
3225 return Representation::None(); | 3211 return Representation::None(); |
3226 } | 3212 } |
3227 | 3213 |
3228 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | 3214 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
3229 | 3215 |
3230 protected: | |
3231 virtual void InternalSetOperandAt(int index, HValue* value) { | |
3232 values_[index] = value; | |
3233 } | |
3234 | |
3235 private: | 3216 private: |
3236 virtual bool IsDeletable() const { return true; } | 3217 virtual bool IsDeletable() const { return true; } |
3237 | |
3238 ZoneList<HValue*> values_; | |
3239 }; | 3218 }; |
3240 | 3219 |
3241 | 3220 |
3242 class HConstant: public HTemplateInstruction<0> { | 3221 class HConstant: public HTemplateInstruction<0> { |
3243 public: | 3222 public: |
3244 HConstant(Handle<Object> handle, Representation r = Representation::None()); | 3223 HConstant(Handle<Object> handle, Representation r); |
3245 HConstant(int32_t value, | 3224 HConstant(int32_t value, |
3246 Representation r = Representation::None(), | 3225 Representation r = Representation::None(), |
3247 bool is_not_in_new_space = true, | 3226 bool is_not_in_new_space = true, |
3248 Handle<Object> optional_handle = Handle<Object>::null()); | 3227 Handle<Object> optional_handle = Handle<Object>::null()); |
3249 HConstant(double value, | 3228 HConstant(double value, |
3250 Representation r = Representation::None(), | 3229 Representation r = Representation::None(), |
3251 bool is_not_in_new_space = true, | 3230 bool is_not_in_new_space = true, |
3252 Handle<Object> optional_handle = Handle<Object>::null()); | 3231 Handle<Object> optional_handle = Handle<Object>::null()); |
3253 HConstant(Handle<Object> handle, | 3232 HConstant(Handle<Object> handle, |
3254 UniqueValueId unique_id, | 3233 UniqueValueId unique_id, |
(...skipping 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6608 virtual bool IsDeletable() const { return true; } | 6587 virtual bool IsDeletable() const { return true; } |
6609 }; | 6588 }; |
6610 | 6589 |
6611 | 6590 |
6612 #undef DECLARE_INSTRUCTION | 6591 #undef DECLARE_INSTRUCTION |
6613 #undef DECLARE_CONCRETE_INSTRUCTION | 6592 #undef DECLARE_CONCRETE_INSTRUCTION |
6614 | 6593 |
6615 } } // namespace v8::internal | 6594 } } // namespace v8::internal |
6616 | 6595 |
6617 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6596 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |