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 103 matching lines...) Loading... |
114 V(In) \ | 114 V(In) \ |
115 V(InstanceOf) \ | 115 V(InstanceOf) \ |
116 V(InstanceOfKnownGlobal) \ | 116 V(InstanceOfKnownGlobal) \ |
117 V(InvokeFunction) \ | 117 V(InvokeFunction) \ |
118 V(IsConstructCallAndBranch) \ | 118 V(IsConstructCallAndBranch) \ |
119 V(IsNilAndBranch) \ | 119 V(IsNilAndBranch) \ |
120 V(IsObjectAndBranch) \ | 120 V(IsObjectAndBranch) \ |
121 V(IsStringAndBranch) \ | 121 V(IsStringAndBranch) \ |
122 V(IsSmiAndBranch) \ | 122 V(IsSmiAndBranch) \ |
123 V(IsUndetectableAndBranch) \ | 123 V(IsUndetectableAndBranch) \ |
124 V(StringCompareAndBranch) \ | 124 V(StringCompareAndBranch) \ |
125 V(JSArrayLength) \ | 125 V(JSArrayLength) \ |
126 V(LeaveInlined) \ | 126 V(LeaveInlined) \ |
127 V(LoadContextSlot) \ | 127 V(LoadContextSlot) \ |
128 V(LoadElements) \ | 128 V(LoadElements) \ |
129 V(LoadExternalArrayPointer) \ | 129 V(LoadExternalArrayPointer) \ |
130 V(LoadFunctionPrototype) \ | 130 V(LoadFunctionPrototype) \ |
131 V(LoadGlobalCell) \ | 131 V(LoadGlobalCell) \ |
132 V(LoadGlobalGeneric) \ | 132 V(LoadGlobalGeneric) \ |
133 V(LoadKeyedFastDoubleElement) \ | 133 V(LoadKeyedFastDoubleElement) \ |
134 V(LoadKeyedFastElement) \ | 134 V(LoadKeyedFastElement) \ |
135 V(LoadKeyedGeneric) \ | 135 V(LoadKeyedGeneric) \ |
136 V(LoadKeyedSpecializedArrayElement) \ | 136 V(LoadKeyedSpecializedArrayElement) \ |
137 V(LoadNamedField) \ | 137 V(LoadNamedField) \ |
138 V(LoadNamedFieldPolymorphic) \ | 138 V(LoadNamedFieldPolymorphic) \ |
139 V(LoadNamedGeneric) \ | 139 V(LoadNamedGeneric) \ |
140 V(Mod) \ | 140 V(Mod) \ |
141 V(Mul) \ | 141 V(Mul) \ |
142 V(ObjectLiteral) \ | 142 V(ObjectLiteralFast) \ |
| 143 V(ObjectLiteralGeneric) \ |
143 V(OsrEntry) \ | 144 V(OsrEntry) \ |
144 V(OuterContext) \ | 145 V(OuterContext) \ |
145 V(Parameter) \ | 146 V(Parameter) \ |
146 V(Power) \ | 147 V(Power) \ |
147 V(PushArgument) \ | 148 V(PushArgument) \ |
148 V(RegExpLiteral) \ | 149 V(RegExpLiteral) \ |
149 V(Return) \ | 150 V(Return) \ |
150 V(Sar) \ | 151 V(Sar) \ |
151 V(Shl) \ | 152 V(Shl) \ |
152 V(Shr) \ | 153 V(Shr) \ |
(...skipping 4035 matching lines...) Loading... |
4188 virtual HType CalculateInferredType(); | 4189 virtual HType CalculateInferredType(); |
4189 | 4190 |
4190 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) | 4191 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) |
4191 | 4192 |
4192 private: | 4193 private: |
4193 int length_; | 4194 int length_; |
4194 Handle<FixedArray> constant_elements_; | 4195 Handle<FixedArray> constant_elements_; |
4195 }; | 4196 }; |
4196 | 4197 |
4197 | 4198 |
4198 class HObjectLiteral: public HMaterializedLiteral<1> { | 4199 class HObjectLiteralFast: public HMaterializedLiteral<1> { |
4199 public: | 4200 public: |
4200 HObjectLiteral(HValue* context, | 4201 HObjectLiteralFast(HValue* context, |
4201 Handle<FixedArray> constant_properties, | 4202 Handle<JSObject> boilerplate, |
4202 bool fast_elements, | 4203 int total_size, |
4203 int literal_index, | 4204 int literal_index, |
4204 int depth, | 4205 int depth) |
4205 bool has_function) | 4206 : HMaterializedLiteral<1>(literal_index, depth), |
| 4207 boilerplate_(boilerplate), |
| 4208 total_size_(total_size) { |
| 4209 SetOperandAt(0, context); |
| 4210 } |
| 4211 |
| 4212 // Maximum depth and total number of properties for object literal |
| 4213 // graphs to be considered for fast deep-copying. |
| 4214 static const int kMaxObjectLiteralDepth = 3; |
| 4215 static const int kMaxObjectLiteralProperties = 8; |
| 4216 |
| 4217 HValue* context() { return OperandAt(0); } |
| 4218 Handle<JSObject> boilerplate() const { return boilerplate_; } |
| 4219 int total_size() const { return total_size_; } |
| 4220 |
| 4221 virtual Representation RequiredInputRepresentation(int index) { |
| 4222 return Representation::Tagged(); |
| 4223 } |
| 4224 virtual HType CalculateInferredType(); |
| 4225 |
| 4226 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralFast) |
| 4227 |
| 4228 private: |
| 4229 Handle<JSObject> boilerplate_; |
| 4230 int total_size_; |
| 4231 }; |
| 4232 |
| 4233 |
| 4234 class HObjectLiteralGeneric: public HMaterializedLiteral<1> { |
| 4235 public: |
| 4236 HObjectLiteralGeneric(HValue* context, |
| 4237 Handle<FixedArray> constant_properties, |
| 4238 bool fast_elements, |
| 4239 int literal_index, |
| 4240 int depth, |
| 4241 bool has_function) |
4206 : HMaterializedLiteral<1>(literal_index, depth), | 4242 : HMaterializedLiteral<1>(literal_index, depth), |
4207 constant_properties_(constant_properties), | 4243 constant_properties_(constant_properties), |
4208 fast_elements_(fast_elements), | 4244 fast_elements_(fast_elements), |
4209 has_function_(has_function) { | 4245 has_function_(has_function) { |
4210 SetOperandAt(0, context); | 4246 SetOperandAt(0, context); |
4211 } | 4247 } |
4212 | 4248 |
4213 HValue* context() { return OperandAt(0); } | 4249 HValue* context() { return OperandAt(0); } |
4214 Handle<FixedArray> constant_properties() const { | 4250 Handle<FixedArray> constant_properties() const { |
4215 return constant_properties_; | 4251 return constant_properties_; |
4216 } | 4252 } |
4217 bool fast_elements() const { return fast_elements_; } | 4253 bool fast_elements() const { return fast_elements_; } |
4218 bool has_function() const { return has_function_; } | 4254 bool has_function() const { return has_function_; } |
4219 | 4255 |
4220 virtual Representation RequiredInputRepresentation(int index) { | 4256 virtual Representation RequiredInputRepresentation(int index) { |
4221 return Representation::Tagged(); | 4257 return Representation::Tagged(); |
4222 } | 4258 } |
4223 virtual HType CalculateInferredType(); | 4259 virtual HType CalculateInferredType(); |
4224 | 4260 |
4225 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) | 4261 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralGeneric) |
4226 | 4262 |
4227 private: | 4263 private: |
4228 Handle<FixedArray> constant_properties_; | 4264 Handle<FixedArray> constant_properties_; |
4229 bool fast_elements_; | 4265 bool fast_elements_; |
4230 bool has_function_; | 4266 bool has_function_; |
4231 }; | 4267 }; |
4232 | 4268 |
4233 | 4269 |
4234 class HRegExpLiteral: public HMaterializedLiteral<1> { | 4270 class HRegExpLiteral: public HMaterializedLiteral<1> { |
4235 public: | 4271 public: |
(...skipping 74 matching lines...) Loading... |
4310 DECLARE_CONCRETE_INSTRUCTION(Typeof) | 4346 DECLARE_CONCRETE_INSTRUCTION(Typeof) |
4311 }; | 4347 }; |
4312 | 4348 |
4313 | 4349 |
4314 class HToFastProperties: public HUnaryOperation { | 4350 class HToFastProperties: public HUnaryOperation { |
4315 public: | 4351 public: |
4316 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { | 4352 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
4317 // This instruction is not marked as having side effects, but | 4353 // This instruction is not marked as having side effects, but |
4318 // changes the map of the input operand. Use it only when creating | 4354 // changes the map of the input operand. Use it only when creating |
4319 // object literals. | 4355 // object literals. |
4320 ASSERT(value->IsObjectLiteral()); | 4356 ASSERT(value->IsObjectLiteralGeneric()); |
4321 set_representation(Representation::Tagged()); | 4357 set_representation(Representation::Tagged()); |
4322 } | 4358 } |
4323 | 4359 |
4324 virtual Representation RequiredInputRepresentation(int index) { | 4360 virtual Representation RequiredInputRepresentation(int index) { |
4325 return Representation::Tagged(); | 4361 return Representation::Tagged(); |
4326 } | 4362 } |
4327 | 4363 |
4328 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | 4364 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
4329 }; | 4365 }; |
4330 | 4366 |
(...skipping 59 matching lines...) Loading... |
4390 | 4426 |
4391 DECLARE_CONCRETE_INSTRUCTION(In) | 4427 DECLARE_CONCRETE_INSTRUCTION(In) |
4392 }; | 4428 }; |
4393 | 4429 |
4394 #undef DECLARE_INSTRUCTION | 4430 #undef DECLARE_INSTRUCTION |
4395 #undef DECLARE_CONCRETE_INSTRUCTION | 4431 #undef DECLARE_CONCRETE_INSTRUCTION |
4396 | 4432 |
4397 } } // namespace v8::internal | 4433 } } // namespace v8::internal |
4398 | 4434 |
4399 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4435 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |