Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: src/crankshaft/hydrogen.h

Issue 2117383002: Cleanup array constructor inlining in crankshaft (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CRANKSHAFT_HYDROGEN_H_ 5 #ifndef V8_CRANKSHAFT_HYDROGEN_H_
6 #define V8_CRANKSHAFT_HYDROGEN_H_ 6 #define V8_CRANKSHAFT_HYDROGEN_H_
7 7
8 #include "src/accessors.h" 8 #include "src/accessors.h"
9 #include "src/allocation.h" 9 #include "src/allocation.h"
10 #include "src/ast/ast-type-bounds.h" 10 #include "src/ast/ast-type-bounds.h"
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 HBasicBlock* header_block_; 1772 HBasicBlock* header_block_;
1773 HBasicBlock* body_block_; 1773 HBasicBlock* body_block_;
1774 HBasicBlock* exit_block_; 1774 HBasicBlock* exit_block_;
1775 HBasicBlock* exit_trampoline_block_; 1775 HBasicBlock* exit_trampoline_block_;
1776 Direction direction_; 1776 Direction direction_;
1777 bool finished_; 1777 bool finished_;
1778 }; 1778 };
1779 1779
1780 HValue* BuildNewElementsCapacity(HValue* old_capacity); 1780 HValue* BuildNewElementsCapacity(HValue* old_capacity);
1781 1781
1782 class JSArrayBuilder final {
1783 public:
1784 JSArrayBuilder(HGraphBuilder* builder,
1785 ElementsKind kind,
1786 HValue* allocation_site_payload,
1787 HValue* constructor_function,
1788 AllocationSiteOverrideMode override_mode);
1789
1790 JSArrayBuilder(HGraphBuilder* builder,
1791 ElementsKind kind,
1792 HValue* constructor_function = NULL);
1793
1794 enum FillMode {
1795 DONT_FILL_WITH_HOLE,
1796 FILL_WITH_HOLE
1797 };
1798
1799 ElementsKind kind() { return kind_; }
1800 HAllocate* elements_location() { return elements_location_; }
1801
1802 HAllocate* AllocateEmptyArray();
1803 HAllocate* AllocateArray(HValue* capacity,
1804 HValue* length_field,
1805 FillMode fill_mode = FILL_WITH_HOLE);
1806 HValue* GetElementsLocation() { return elements_location_; }
1807 HValue* EmitMapCode();
1808
1809 private:
1810 Zone* zone() const { return builder_->zone(); }
1811 int elements_size() const {
1812 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize;
1813 }
1814 HGraphBuilder* builder() { return builder_; }
1815 HGraph* graph() { return builder_->graph(); }
1816 int initial_capacity() {
1817 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0);
1818 return JSArray::kPreallocatedArrayElements;
1819 }
1820
1821 HValue* EmitInternalMapCode();
1822
1823 HGraphBuilder* builder_;
1824 ElementsKind kind_;
1825 AllocationSiteMode mode_;
1826 HValue* allocation_site_payload_;
1827 HValue* constructor_function_;
1828 HAllocate* elements_location_;
1829 };
1830
1831 HValue* BuildAllocateArrayFromLength(JSArrayBuilder* array_builder,
1832 HValue* length_argument);
1833 HValue* BuildCalculateElementsSize(ElementsKind kind, 1782 HValue* BuildCalculateElementsSize(ElementsKind kind,
1834 HValue* capacity); 1783 HValue* capacity);
1835 HAllocate* AllocateJSArrayObject(AllocationSiteMode mode); 1784 HAllocate* AllocateJSArrayObject(AllocationSiteMode mode);
1836 HConstant* EstablishElementsAllocationSize(ElementsKind kind, int capacity); 1785 HConstant* EstablishElementsAllocationSize(ElementsKind kind, int capacity);
1837 1786
1838 HAllocate* BuildAllocateElements(ElementsKind kind, HValue* size_in_bytes); 1787 HAllocate* BuildAllocateElements(ElementsKind kind, HValue* size_in_bytes);
1839 1788
1840 void BuildInitializeElementsHeader(HValue* elements, 1789 void BuildInitializeElementsHeader(HValue* elements,
1841 ElementsKind kind, 1790 ElementsKind kind,
1842 HValue* capacity); 1791 HValue* capacity);
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 bool TryArgumentsAccess(Property* expr); 2381 bool TryArgumentsAccess(Property* expr);
2433 2382
2434 // Shared code for .call and .apply optimizations. 2383 // Shared code for .call and .apply optimizations.
2435 void HandleIndirectCall(Call* expr, HValue* function, int arguments_count); 2384 void HandleIndirectCall(Call* expr, HValue* function, int arguments_count);
2436 // Try to optimize indirect calls such as fun.apply(receiver, arguments) 2385 // Try to optimize indirect calls such as fun.apply(receiver, arguments)
2437 // or fun.call(...). 2386 // or fun.call(...).
2438 bool TryIndirectCall(Call* expr); 2387 bool TryIndirectCall(Call* expr);
2439 void BuildFunctionApply(Call* expr); 2388 void BuildFunctionApply(Call* expr);
2440 void BuildFunctionCall(Call* expr); 2389 void BuildFunctionCall(Call* expr);
2441 2390
2442 bool TryHandleArrayCall(Call* expr, HValue* function); 2391 template <class T>
2443 bool TryHandleArrayCallNew(CallNew* expr, HValue* function); 2392 bool TryHandleArrayCall(T* expr, HValue* function);
2444 void BuildArrayCall(Expression* expr, int arguments_count, HValue* function,
2445 Handle<AllocationSite> cell);
2446 2393
2447 enum ArrayIndexOfMode { kFirstIndexOf, kLastIndexOf }; 2394 enum ArrayIndexOfMode { kFirstIndexOf, kLastIndexOf };
2448 HValue* BuildArrayIndexOf(HValue* receiver, 2395 HValue* BuildArrayIndexOf(HValue* receiver,
2449 HValue* search_element, 2396 HValue* search_element,
2450 ElementsKind kind, 2397 ElementsKind kind,
2451 ArrayIndexOfMode mode); 2398 ArrayIndexOfMode mode);
2452 2399
2453 HValue* ImplicitReceiverFor(HValue* function, 2400 HValue* ImplicitReceiverFor(HValue* function,
2454 Handle<JSFunction> target); 2401 Handle<JSFunction> target);
2455 2402
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 template <typename CollectionType> 2494 template <typename CollectionType>
2548 void BuildJSCollectionHas(CallRuntime* call, 2495 void BuildJSCollectionHas(CallRuntime* call,
2549 const Runtime::Function* c_function); 2496 const Runtime::Function* c_function);
2550 HValue* BuildStringHashLoadIfIsStringAndHashComputed( 2497 HValue* BuildStringHashLoadIfIsStringAndHashComputed(
2551 HValue* object, HIfContinuation* continuation); 2498 HValue* object, HIfContinuation* continuation);
2552 2499
2553 Handle<JSFunction> array_function() { 2500 Handle<JSFunction> array_function() {
2554 return handle(isolate()->native_context()->array_function()); 2501 return handle(isolate()->native_context()->array_function());
2555 } 2502 }
2556 2503
2557 bool IsCallArrayInlineable(int argument_count, Handle<AllocationSite> site); 2504 bool TryInlineArrayCall(Expression* expression, int argument_count,
2558 void BuildInlinedCallArray(Expression* expression, int argument_count, 2505 Handle<AllocationSite> site);
2559 Handle<AllocationSite> site);
2560 2506
2561 void BuildInitializeInobjectProperties(HValue* receiver, 2507 void BuildInitializeInobjectProperties(HValue* receiver,
2562 Handle<Map> initial_map); 2508 Handle<Map> initial_map);
2563 2509
2564 class PropertyAccessInfo { 2510 class PropertyAccessInfo {
2565 public: 2511 public:
2566 PropertyAccessInfo(HOptimizedGraphBuilder* builder, 2512 PropertyAccessInfo(HOptimizedGraphBuilder* builder,
2567 PropertyAccessType access_type, Handle<Map> map, 2513 PropertyAccessType access_type, Handle<Map> map,
2568 Handle<Name> name) 2514 Handle<Name> name)
2569 : builder_(builder), 2515 : builder_(builder),
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 } 3042 }
3097 3043
3098 private: 3044 private:
3099 HOptimizedGraphBuilder* builder_; 3045 HOptimizedGraphBuilder* builder_;
3100 }; 3046 };
3101 3047
3102 } // namespace internal 3048 } // namespace internal
3103 } // namespace v8 3049 } // namespace v8
3104 3050
3105 #endif // V8_CRANKSHAFT_HYDROGEN_H_ 3051 #endif // V8_CRANKSHAFT_HYDROGEN_H_
OLDNEW
« no previous file with comments | « no previous file | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698