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

Side by Side Diff: src/builtins/setup-builtins-internal.cc

Issue 2869683004: [arm] Share constant pool entries in snapshot. (Closed)
Patch Set: Update tools/v8heapconst.py Created 3 years, 7 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
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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/setup-isolate.h" 5 #include "src/setup-isolate.h"
6 6
7 #include "src/builtins/builtins.h" 7 #include "src/builtins/builtins.h"
8 #include "src/code-events.h" 8 #include "src/code-events.h"
9 #include "src/compiler/code-assembler.h" 9 #include "src/compiler/code-assembler.h"
10 #include "src/interface-descriptors.h" 10 #include "src/interface-descriptors.h"
(...skipping 23 matching lines...) Expand all
34 #endif 34 #endif
35 } 35 }
36 36
37 typedef void (*MacroAssemblerGenerator)(MacroAssembler*); 37 typedef void (*MacroAssemblerGenerator)(MacroAssembler*);
38 typedef void (*CodeAssemblerGenerator)(compiler::CodeAssemblerState*); 38 typedef void (*CodeAssemblerGenerator)(compiler::CodeAssemblerState*);
39 39
40 Code* BuildWithMacroAssembler(Isolate* isolate, 40 Code* BuildWithMacroAssembler(Isolate* isolate,
41 MacroAssemblerGenerator generator, 41 MacroAssemblerGenerator generator,
42 Code::Flags flags, const char* s_name) { 42 Code::Flags flags, const char* s_name) {
43 HandleScope scope(isolate); 43 HandleScope scope(isolate);
44 // Canonicalize handles, so that we can share constant pool entries pointing
45 // to code targets without dereferencing their handles.
46 CanonicalHandleScope canonical(isolate);
44 const size_t buffer_size = 32 * KB; 47 const size_t buffer_size = 32 * KB;
45 byte buffer[buffer_size]; // NOLINT(runtime/arrays) 48 byte buffer[buffer_size]; // NOLINT(runtime/arrays)
46 MacroAssembler masm(isolate, buffer, buffer_size, CodeObjectRequired::kYes); 49 MacroAssembler masm(isolate, buffer, buffer_size, CodeObjectRequired::kYes);
47 DCHECK(!masm.has_frame()); 50 DCHECK(!masm.has_frame());
48 generator(&masm); 51 generator(&masm);
49 CodeDesc desc; 52 CodeDesc desc;
50 masm.GetCode(&desc); 53 masm.GetCode(&desc);
51 Handle<Code> code = 54 Handle<Code> code =
52 isolate->factory()->NewCode(desc, flags, masm.CodeObject()); 55 isolate->factory()->NewCode(desc, flags, masm.CodeObject());
53 PostBuildProfileAndTracing(isolate, *code, s_name); 56 PostBuildProfileAndTracing(isolate, *code, s_name);
54 return *code; 57 return *code;
55 } 58 }
56 59
57 Code* BuildAdaptor(Isolate* isolate, Address builtin_address, 60 Code* BuildAdaptor(Isolate* isolate, Address builtin_address,
58 Builtins::ExitFrameType exit_frame_type, Code::Flags flags, 61 Builtins::ExitFrameType exit_frame_type, Code::Flags flags,
59 const char* name) { 62 const char* name) {
60 HandleScope scope(isolate); 63 HandleScope scope(isolate);
64 // Canonicalize handles, so that we can share constant pool entries pointing
65 // to code targets without dereferencing their handles.
66 CanonicalHandleScope canonical(isolate);
61 const size_t buffer_size = 32 * KB; 67 const size_t buffer_size = 32 * KB;
62 byte buffer[buffer_size]; // NOLINT(runtime/arrays) 68 byte buffer[buffer_size]; // NOLINT(runtime/arrays)
63 MacroAssembler masm(isolate, buffer, buffer_size, CodeObjectRequired::kYes); 69 MacroAssembler masm(isolate, buffer, buffer_size, CodeObjectRequired::kYes);
64 DCHECK(!masm.has_frame()); 70 DCHECK(!masm.has_frame());
65 Builtins::Generate_Adaptor(&masm, builtin_address, exit_frame_type); 71 Builtins::Generate_Adaptor(&masm, builtin_address, exit_frame_type);
66 CodeDesc desc; 72 CodeDesc desc;
67 masm.GetCode(&desc); 73 masm.GetCode(&desc);
68 Handle<Code> code = 74 Handle<Code> code =
69 isolate->factory()->NewCode(desc, flags, masm.CodeObject()); 75 isolate->factory()->NewCode(desc, flags, masm.CodeObject());
70 PostBuildProfileAndTracing(isolate, *code, name); 76 PostBuildProfileAndTracing(isolate, *code, name);
71 return *code; 77 return *code;
72 } 78 }
73 79
74 // Builder for builtins implemented in TurboFan with JS linkage. 80 // Builder for builtins implemented in TurboFan with JS linkage.
75 Code* BuildWithCodeStubAssemblerJS(Isolate* isolate, 81 Code* BuildWithCodeStubAssemblerJS(Isolate* isolate,
76 CodeAssemblerGenerator generator, int argc, 82 CodeAssemblerGenerator generator, int argc,
77 Code::Flags flags, const char* name) { 83 Code::Flags flags, const char* name) {
78 HandleScope scope(isolate); 84 HandleScope scope(isolate);
85 // Canonicalize handles, so that we can share constant pool entries pointing
86 // to code targets without dereferencing their handles.
87 CanonicalHandleScope canonical(isolate);
79 Zone zone(isolate->allocator(), ZONE_NAME); 88 Zone zone(isolate->allocator(), ZONE_NAME);
80 const int argc_with_recv = 89 const int argc_with_recv =
81 (argc == SharedFunctionInfo::kDontAdaptArgumentsSentinel) ? 0 : argc + 1; 90 (argc == SharedFunctionInfo::kDontAdaptArgumentsSentinel) ? 0 : argc + 1;
82 compiler::CodeAssemblerState state(isolate, &zone, argc_with_recv, flags, 91 compiler::CodeAssemblerState state(isolate, &zone, argc_with_recv, flags,
83 name); 92 name);
84 generator(&state); 93 generator(&state);
85 Handle<Code> code = compiler::CodeAssembler::GenerateCode(&state); 94 Handle<Code> code = compiler::CodeAssembler::GenerateCode(&state);
86 PostBuildProfileAndTracing(isolate, *code, name); 95 PostBuildProfileAndTracing(isolate, *code, name);
87 return *code; 96 return *code;
88 } 97 }
89 98
90 // Builder for builtins implemented in TurboFan with CallStub linkage. 99 // Builder for builtins implemented in TurboFan with CallStub linkage.
91 Code* BuildWithCodeStubAssemblerCS(Isolate* isolate, 100 Code* BuildWithCodeStubAssemblerCS(Isolate* isolate,
92 CodeAssemblerGenerator generator, 101 CodeAssemblerGenerator generator,
93 CallDescriptors::Key interface_descriptor, 102 CallDescriptors::Key interface_descriptor,
94 Code::Flags flags, const char* name, 103 Code::Flags flags, const char* name,
95 int result_size) { 104 int result_size) {
96 HandleScope scope(isolate); 105 HandleScope scope(isolate);
106 // Canonicalize handles, so that we can share constant pool entries pointing
107 // to code targets without dereferencing their handles.
108 CanonicalHandleScope canonical(isolate);
97 Zone zone(isolate->allocator(), ZONE_NAME); 109 Zone zone(isolate->allocator(), ZONE_NAME);
98 // The interface descriptor with given key must be initialized at this point 110 // The interface descriptor with given key must be initialized at this point
99 // and this construction just queries the details from the descriptors table. 111 // and this construction just queries the details from the descriptors table.
100 CallInterfaceDescriptor descriptor(isolate, interface_descriptor); 112 CallInterfaceDescriptor descriptor(isolate, interface_descriptor);
101 // Ensure descriptor is already initialized. 113 // Ensure descriptor is already initialized.
102 DCHECK_LE(0, descriptor.GetRegisterParameterCount()); 114 DCHECK_LE(0, descriptor.GetRegisterParameterCount());
103 compiler::CodeAssemblerState state(isolate, &zone, descriptor, flags, name, 115 compiler::CodeAssemblerState state(isolate, &zone, descriptor, flags, name,
104 result_size); 116 result_size);
105 generator(&state); 117 generator(&state);
106 Handle<Code> code = compiler::CodeAssembler::GenerateCode(&state); 118 Handle<Code> code = compiler::CodeAssembler::GenerateCode(&state);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 ->set_has_tagged_params(false); 205 ->set_has_tagged_params(false);
194 206
195 BUILTINS_WITH_UNTAGGED_PARAMS(SET_CODE_NON_TAGGED_PARAMS) 207 BUILTINS_WITH_UNTAGGED_PARAMS(SET_CODE_NON_TAGGED_PARAMS)
196 #undef SET_CODE_NON_TAGGED_PARAMS 208 #undef SET_CODE_NON_TAGGED_PARAMS
197 209
198 isolate->builtins()->MarkInitialized(); 210 isolate->builtins()->MarkInitialized();
199 } 211 }
200 212
201 } // namespace internal 213 } // namespace internal
202 } // namespace v8 214 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/code-stubs.cc » ('j') | src/disassembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698