OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 typedef compiler::Node Node; | 10 typedef compiler::Node Node; |
11 typedef compiler::CodeAssemblerState CodeAssemblerState; | 11 typedef compiler::CodeAssemblerState CodeAssemblerState; |
| 12 typedef compiler::CodeAssemblerLabel CodeAssemblerLabel; |
12 | 13 |
13 class ConstructorBuiltinsAssembler : public CodeStubAssembler { | 14 class ConstructorBuiltinsAssembler : public CodeStubAssembler { |
14 public: | 15 public: |
15 explicit ConstructorBuiltinsAssembler(CodeAssemblerState* state) | 16 explicit ConstructorBuiltinsAssembler(CodeAssemblerState* state) |
16 : CodeStubAssembler(state) {} | 17 : CodeStubAssembler(state) {} |
17 | 18 |
18 Node* EmitFastNewClosure(Node* shared_info, Node* context); | 19 Node* EmitFastNewClosure(Node* shared_info, Node* context); |
19 Node* EmitFastNewFunctionContext(Node* closure, Node* slots, Node* context, | 20 Node* EmitFastNewFunctionContext(Node* closure, Node* slots, Node* context, |
20 ScopeType scope_type); | 21 ScopeType scope_type); |
21 static int MaximumFunctionContextSlots(); | 22 static int MaximumFunctionContextSlots(); |
22 | 23 |
| 24 Node* EmitFastCloneRegExp(Node* closure, Node* literal_index, Node* pattern, |
| 25 Node* flags, Node* context); |
| 26 Node* EmitFastCloneShallowArray(Node* closure, Node* literal_index, |
| 27 Node* context, |
| 28 CodeAssemblerLabel* call_runtime, |
| 29 AllocationSiteMode allocation_site_mode); |
| 30 |
| 31 // Maximum number of elements in copied array (chosen so that even an array |
| 32 // backed by a double backing store will fit into new-space). |
| 33 static const int kMaximumClonedShallowArrayElements = |
| 34 JSArray::kInitialMaxFastElementArray * kPointerSize / kDoubleSize; |
| 35 |
| 36 void CreateFastCloneShallowArrayBuiltin( |
| 37 AllocationSiteMode allocation_site_mode); |
| 38 |
| 39 // Maximum number of properties in copied objects. |
| 40 static const int kMaximumClonedShallowObjectProperties = 6; |
| 41 static int FastCloneShallowObjectPropertiesCount(int literal_length); |
| 42 Node* EmitFastCloneShallowObject(CodeAssemblerLabel* call_runtime, |
| 43 Node* closure, Node* literals_index, |
| 44 Node* properties_count); |
| 45 void CreateFastCloneShallowObjectBuiltin(int properties_count); |
| 46 |
23 private: | 47 private: |
24 static const int kMaximumSlots = 0x8000; | 48 static const int kMaximumSlots = 0x8000; |
25 static const int kSmallMaximumSlots = 10; | 49 static const int kSmallMaximumSlots = 10; |
26 | 50 |
| 51 Node* NonEmptyShallowClone(Node* boilerplate, Node* boilerplate_map, |
| 52 Node* boilerplate_elements, Node* allocation_site, |
| 53 Node* capacity, ElementsKind kind); |
| 54 |
27 // FastNewFunctionContext can only allocate closures which fit in the | 55 // FastNewFunctionContext can only allocate closures which fit in the |
28 // new space. | 56 // new space. |
29 STATIC_ASSERT(((kMaximumSlots + Context::MIN_CONTEXT_SLOTS) * kPointerSize + | 57 STATIC_ASSERT(((kMaximumSlots + Context::MIN_CONTEXT_SLOTS) * kPointerSize + |
30 FixedArray::kHeaderSize) < kMaxRegularHeapObjectSize); | 58 FixedArray::kHeaderSize) < kMaxRegularHeapObjectSize); |
31 }; | 59 }; |
32 | 60 |
33 } // namespace internal | 61 } // namespace internal |
34 } // namespace v8 | 62 } // namespace v8 |
OLD | NEW |