OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HYDROGEN_H_ | 5 #ifndef V8_HYDROGEN_H_ |
6 #define V8_HYDROGEN_H_ | 6 #define V8_HYDROGEN_H_ |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "accessors.h" | 10 #include "accessors.h" |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 } | 1288 } |
1289 | 1289 |
1290 template<class I, class P1, class P2, class P3, class P4, | 1290 template<class I, class P1, class P2, class P3, class P4, |
1291 class P5, class P6, class P7, class P8> | 1291 class P5, class P6, class P7, class P8> |
1292 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { | 1292 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { |
1293 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8)); | 1293 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8)); |
1294 } | 1294 } |
1295 | 1295 |
1296 void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE); | 1296 void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE); |
1297 | 1297 |
| 1298 // When initializing arrays, we'll unfold the loop if the number of elements |
| 1299 // is known at compile time and is <= kElementLoopUnrollThreshold. |
| 1300 static const int kElementLoopUnrollThreshold = 8; |
| 1301 |
1298 protected: | 1302 protected: |
1299 virtual bool BuildGraph() = 0; | 1303 virtual bool BuildGraph() = 0; |
1300 | 1304 |
1301 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 1305 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
1302 HBasicBlock* CreateLoopHeaderBlock(); | 1306 HBasicBlock* CreateLoopHeaderBlock(); |
1303 | 1307 |
1304 HValue* BuildCheckHeapObject(HValue* object); | 1308 HValue* BuildCheckHeapObject(HValue* object); |
1305 HValue* BuildCheckString(HValue* string); | 1309 HValue* BuildCheckString(HValue* string); |
1306 HValue* BuildWrapReceiver(HValue* object, HValue* function); | 1310 HValue* BuildWrapReceiver(HValue* object, HValue* function); |
1307 | 1311 |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 GlobalPropertyAccess LookupGlobalProperty(Variable* var, | 2239 GlobalPropertyAccess LookupGlobalProperty(Variable* var, |
2236 LookupResult* lookup, | 2240 LookupResult* lookup, |
2237 PropertyAccessType access_type); | 2241 PropertyAccessType access_type); |
2238 | 2242 |
2239 void EnsureArgumentsArePushedForAccess(); | 2243 void EnsureArgumentsArePushedForAccess(); |
2240 bool TryArgumentsAccess(Property* expr); | 2244 bool TryArgumentsAccess(Property* expr); |
2241 | 2245 |
2242 // Try to optimize fun.apply(receiver, arguments) pattern. | 2246 // Try to optimize fun.apply(receiver, arguments) pattern. |
2243 bool TryCallApply(Call* expr); | 2247 bool TryCallApply(Call* expr); |
2244 | 2248 |
| 2249 bool TryHandleArrayCall(Call* expr, HValue* function); |
| 2250 bool TryHandleArrayCallNew(CallNew* expr, HValue* function); |
| 2251 void BuildArrayCall(Expression* expr, int arguments_count, HValue* function, |
| 2252 Handle<AllocationSite> cell); |
| 2253 |
2245 HValue* ImplicitReceiverFor(HValue* function, | 2254 HValue* ImplicitReceiverFor(HValue* function, |
2246 Handle<JSFunction> target); | 2255 Handle<JSFunction> target); |
2247 | 2256 |
2248 int InliningAstSize(Handle<JSFunction> target); | 2257 int InliningAstSize(Handle<JSFunction> target); |
2249 bool TryInline(Handle<JSFunction> target, | 2258 bool TryInline(Handle<JSFunction> target, |
2250 int arguments_count, | 2259 int arguments_count, |
2251 HValue* implicit_return_value, | 2260 HValue* implicit_return_value, |
2252 BailoutId ast_id, | 2261 BailoutId ast_id, |
2253 BailoutId return_id, | 2262 BailoutId return_id, |
2254 InliningKind inlining_kind, | 2263 InliningKind inlining_kind, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 | 2327 |
2319 HValue* BuildAllocateExternalElements( | 2328 HValue* BuildAllocateExternalElements( |
2320 ExternalArrayType array_type, | 2329 ExternalArrayType array_type, |
2321 bool is_zero_byte_offset, | 2330 bool is_zero_byte_offset, |
2322 HValue* buffer, HValue* byte_offset, HValue* length); | 2331 HValue* buffer, HValue* byte_offset, HValue* length); |
2323 HValue* BuildAllocateFixedTypedArray( | 2332 HValue* BuildAllocateFixedTypedArray( |
2324 ExternalArrayType array_type, size_t element_size, | 2333 ExternalArrayType array_type, size_t element_size, |
2325 ElementsKind fixed_elements_kind, | 2334 ElementsKind fixed_elements_kind, |
2326 HValue* byte_length, HValue* length); | 2335 HValue* byte_length, HValue* length); |
2327 | 2336 |
2328 bool IsCallNewArrayInlineable(CallNew* expr); | 2337 Handle<JSFunction> array_function() { |
2329 void BuildInlinedCallNewArray(CallNew* expr); | 2338 return handle(isolate()->native_context()->array_function()); |
| 2339 } |
| 2340 |
| 2341 bool IsCallArrayInlineable(int argument_count, Handle<AllocationSite> site); |
| 2342 void BuildInlinedCallArray(Expression* expression, int argument_count, |
| 2343 Handle<AllocationSite> site); |
2330 | 2344 |
2331 class PropertyAccessInfo { | 2345 class PropertyAccessInfo { |
2332 public: | 2346 public: |
2333 PropertyAccessInfo(HOptimizedGraphBuilder* builder, | 2347 PropertyAccessInfo(HOptimizedGraphBuilder* builder, |
2334 PropertyAccessType access_type, | 2348 PropertyAccessType access_type, |
2335 Type* type, | 2349 Type* type, |
2336 Handle<String> name) | 2350 Handle<String> name) |
2337 : lookup_(builder->isolate()), | 2351 : lookup_(builder->isolate()), |
2338 builder_(builder), | 2352 builder_(builder), |
2339 access_type_(access_type), | 2353 access_type_(access_type), |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2796 } | 2810 } |
2797 | 2811 |
2798 private: | 2812 private: |
2799 HGraphBuilder* builder_; | 2813 HGraphBuilder* builder_; |
2800 }; | 2814 }; |
2801 | 2815 |
2802 | 2816 |
2803 } } // namespace v8::internal | 2817 } } // namespace v8::internal |
2804 | 2818 |
2805 #endif // V8_HYDROGEN_H_ | 2819 #endif // V8_HYDROGEN_H_ |
OLD | NEW |