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

Side by Side Diff: src/builtins/builtins-constructor.h

Issue 2760953002: [builtins] Move more files into v8_builtins_generators source set (Closed)
Patch Set: rebased Created 3 years, 9 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 | « src/builtins/builtins-async-iterator-gen.cc ('k') | src/builtins/builtins-constructor-gen.h » ('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 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 #ifndef V8_BUILTINS_BUILTINS_CONSTRUCTOR_H_
6 #define V8_BUILTINS_BUILTINS_CONSTRUCTOR_H_
7
8 #include "src/contexts.h"
9 #include "src/objects.h"
6 10
7 namespace v8 { 11 namespace v8 {
8 namespace internal { 12 namespace internal {
9 13
10 class ConstructorBuiltinsAssembler : public CodeStubAssembler { 14 class ConstructorBuiltins {
11 public: 15 public:
12 explicit ConstructorBuiltinsAssembler(compiler::CodeAssemblerState* state) 16 static int MaximumFunctionContextSlots() {
13 : CodeStubAssembler(state) {} 17 return FLAG_test_small_max_function_context_stub_size ? kSmallMaximumSlots
14 18 : kMaximumSlots;
15 Node* EmitFastNewClosure(Node* shared_info, Node* feedback_vector, Node* slot, 19 }
16 Node* context);
17 Node* EmitFastNewFunctionContext(Node* closure, Node* slots, Node* context,
18 ScopeType scope_type);
19 static int MaximumFunctionContextSlots();
20
21 Node* EmitFastCloneRegExp(Node* closure, Node* literal_index, Node* pattern,
22 Node* flags, Node* context);
23 Node* EmitFastCloneShallowArray(Node* closure, Node* literal_index,
24 Node* context, Label* call_runtime,
25 AllocationSiteMode allocation_site_mode);
26 20
27 // Maximum number of elements in copied array (chosen so that even an array 21 // Maximum number of elements in copied array (chosen so that even an array
28 // backed by a double backing store will fit into new-space). 22 // backed by a double backing store will fit into new-space).
29 static const int kMaximumClonedShallowArrayElements = 23 static const int kMaximumClonedShallowArrayElements =
30 JSArray::kInitialMaxFastElementArray * kPointerSize / kDoubleSize; 24 JSArray::kInitialMaxFastElementArray * kPointerSize / kDoubleSize;
31 25
32 void CreateFastCloneShallowArrayBuiltin(
33 AllocationSiteMode allocation_site_mode);
34
35 // Maximum number of properties in copied objects. 26 // Maximum number of properties in copied objects.
36 static const int kMaximumClonedShallowObjectProperties = 6; 27 static const int kMaximumClonedShallowObjectProperties = 6;
37 static int FastCloneShallowObjectPropertiesCount(int literal_length); 28 static int FastCloneShallowObjectPropertiesCount(int literal_length) {
38 Node* EmitFastCloneShallowObject(Label* call_runtime, Node* closure, 29 // This heuristic of setting empty literals to have
39 Node* literals_index, 30 // kInitialGlobalObjectUnusedPropertiesCount must remain in-sync with the
40 Node* properties_count); 31 // runtime.
41 void CreateFastCloneShallowObjectBuiltin(int properties_count); 32 // TODO(verwaest): Unify this with the heuristic in the runtime.
42 33 return literal_length == 0
43 Node* EmitFastNewObject(Node* context, Node* target, Node* new_target); 34 ? JSObject::kInitialGlobalObjectUnusedPropertiesCount
44 35 : literal_length;
45 Node* EmitFastNewObject(Node* context, Node* target, Node* new_target, 36 }
46 Label* call_runtime);
47 37
48 private: 38 private:
49 static const int kMaximumSlots = 0x8000; 39 static const int kMaximumSlots = 0x8000;
50 static const int kSmallMaximumSlots = 10; 40 static const int kSmallMaximumSlots = 10;
51 41
52 Node* NonEmptyShallowClone(Node* boilerplate, Node* boilerplate_map,
53 Node* boilerplate_elements, Node* allocation_site,
54 Node* capacity, ElementsKind kind);
55
56 // FastNewFunctionContext can only allocate closures which fit in the 42 // FastNewFunctionContext can only allocate closures which fit in the
57 // new space. 43 // new space.
58 STATIC_ASSERT(((kMaximumSlots + Context::MIN_CONTEXT_SLOTS) * kPointerSize + 44 STATIC_ASSERT(((kMaximumSlots + Context::MIN_CONTEXT_SLOTS) * kPointerSize +
59 FixedArray::kHeaderSize) < kMaxRegularHeapObjectSize); 45 FixedArray::kHeaderSize) < kMaxRegularHeapObjectSize);
60 }; 46 };
61 47
62 } // namespace internal 48 } // namespace internal
63 } // namespace v8 49 } // namespace v8
50
51 #endif // V8_BUILTINS_BUILTINS_CONSTRUCTOR_H_
OLDNEW
« no previous file with comments | « src/builtins/builtins-async-iterator-gen.cc ('k') | src/builtins/builtins-constructor-gen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698