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 | |
1302 protected: | 1298 protected: |
1303 virtual bool BuildGraph() = 0; | 1299 virtual bool BuildGraph() = 0; |
1304 | 1300 |
1305 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 1301 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
1306 HBasicBlock* CreateLoopHeaderBlock(); | 1302 HBasicBlock* CreateLoopHeaderBlock(); |
1307 | 1303 |
1308 HValue* BuildCheckHeapObject(HValue* object); | 1304 HValue* BuildCheckHeapObject(HValue* object); |
1309 HValue* BuildCheckString(HValue* string); | 1305 HValue* BuildCheckString(HValue* string); |
1310 HValue* BuildWrapReceiver(HValue* object, HValue* function); | 1306 HValue* BuildWrapReceiver(HValue* object, HValue* function); |
1311 | 1307 |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 GlobalPropertyAccess LookupGlobalProperty(Variable* var, | 2235 GlobalPropertyAccess LookupGlobalProperty(Variable* var, |
2240 LookupResult* lookup, | 2236 LookupResult* lookup, |
2241 PropertyAccessType access_type); | 2237 PropertyAccessType access_type); |
2242 | 2238 |
2243 void EnsureArgumentsArePushedForAccess(); | 2239 void EnsureArgumentsArePushedForAccess(); |
2244 bool TryArgumentsAccess(Property* expr); | 2240 bool TryArgumentsAccess(Property* expr); |
2245 | 2241 |
2246 // Try to optimize fun.apply(receiver, arguments) pattern. | 2242 // Try to optimize fun.apply(receiver, arguments) pattern. |
2247 bool TryCallApply(Call* expr); | 2243 bool TryCallApply(Call* expr); |
2248 | 2244 |
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 | |
2254 HValue* ImplicitReceiverFor(HValue* function, | 2245 HValue* ImplicitReceiverFor(HValue* function, |
2255 Handle<JSFunction> target); | 2246 Handle<JSFunction> target); |
2256 | 2247 |
2257 int InliningAstSize(Handle<JSFunction> target); | 2248 int InliningAstSize(Handle<JSFunction> target); |
2258 bool TryInline(Handle<JSFunction> target, | 2249 bool TryInline(Handle<JSFunction> target, |
2259 int arguments_count, | 2250 int arguments_count, |
2260 HValue* implicit_return_value, | 2251 HValue* implicit_return_value, |
2261 BailoutId ast_id, | 2252 BailoutId ast_id, |
2262 BailoutId return_id, | 2253 BailoutId return_id, |
2263 InliningKind inlining_kind, | 2254 InliningKind inlining_kind, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 | 2318 |
2328 HValue* BuildAllocateExternalElements( | 2319 HValue* BuildAllocateExternalElements( |
2329 ExternalArrayType array_type, | 2320 ExternalArrayType array_type, |
2330 bool is_zero_byte_offset, | 2321 bool is_zero_byte_offset, |
2331 HValue* buffer, HValue* byte_offset, HValue* length); | 2322 HValue* buffer, HValue* byte_offset, HValue* length); |
2332 HValue* BuildAllocateFixedTypedArray( | 2323 HValue* BuildAllocateFixedTypedArray( |
2333 ExternalArrayType array_type, size_t element_size, | 2324 ExternalArrayType array_type, size_t element_size, |
2334 ElementsKind fixed_elements_kind, | 2325 ElementsKind fixed_elements_kind, |
2335 HValue* byte_length, HValue* length); | 2326 HValue* byte_length, HValue* length); |
2336 | 2327 |
2337 Handle<JSFunction> array_function() { | 2328 bool IsCallNewArrayInlineable(CallNew* expr); |
2338 return handle(isolate()->native_context()->array_function()); | 2329 void BuildInlinedCallNewArray(CallNew* expr); |
2339 } | |
2340 | |
2341 bool IsCallArrayInlineable(int argument_count, Handle<AllocationSite> site); | |
2342 void BuildInlinedCallArray(Expression* expression, int argument_count, | |
2343 Handle<AllocationSite> site); | |
2344 | 2330 |
2345 class PropertyAccessInfo { | 2331 class PropertyAccessInfo { |
2346 public: | 2332 public: |
2347 PropertyAccessInfo(HOptimizedGraphBuilder* builder, | 2333 PropertyAccessInfo(HOptimizedGraphBuilder* builder, |
2348 PropertyAccessType access_type, | 2334 PropertyAccessType access_type, |
2349 Type* type, | 2335 Type* type, |
2350 Handle<String> name) | 2336 Handle<String> name) |
2351 : lookup_(builder->isolate()), | 2337 : lookup_(builder->isolate()), |
2352 builder_(builder), | 2338 builder_(builder), |
2353 access_type_(access_type), | 2339 access_type_(access_type), |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2810 } | 2796 } |
2811 | 2797 |
2812 private: | 2798 private: |
2813 HGraphBuilder* builder_; | 2799 HGraphBuilder* builder_; |
2814 }; | 2800 }; |
2815 | 2801 |
2816 | 2802 |
2817 } } // namespace v8::internal | 2803 } } // namespace v8::internal |
2818 | 2804 |
2819 #endif // V8_HYDROGEN_H_ | 2805 #endif // V8_HYDROGEN_H_ |
OLD | NEW |