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

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

Issue 2869683004: [arm] Share constant pool entries in snapshot. (Closed)
Patch Set: 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 CanonicalHandleScope canonical(isolate);
44 const size_t buffer_size = 32 * KB; 45 const size_t buffer_size = 32 * KB;
45 byte buffer[buffer_size]; // NOLINT(runtime/arrays) 46 byte buffer[buffer_size]; // NOLINT(runtime/arrays)
46 MacroAssembler masm(isolate, buffer, buffer_size, CodeObjectRequired::kYes); 47 MacroAssembler masm(isolate, buffer, buffer_size, CodeObjectRequired::kYes);
47 DCHECK(!masm.has_frame()); 48 DCHECK(!masm.has_frame());
48 generator(&masm); 49 generator(&masm);
49 CodeDesc desc; 50 CodeDesc desc;
50 masm.GetCode(&desc); 51 masm.GetCode(&desc);
51 Handle<Code> code = 52 Handle<Code> code =
52 isolate->factory()->NewCode(desc, flags, masm.CodeObject()); 53 isolate->factory()->NewCode(desc, flags, masm.CodeObject());
53 PostBuildProfileAndTracing(isolate, *code, s_name); 54 PostBuildProfileAndTracing(isolate, *code, s_name);
54 return *code; 55 return *code;
55 } 56 }
56 57
57 Code* BuildAdaptor(Isolate* isolate, Address builtin_address, 58 Code* BuildAdaptor(Isolate* isolate, Address builtin_address,
58 Builtins::ExitFrameType exit_frame_type, Code::Flags flags, 59 Builtins::ExitFrameType exit_frame_type, Code::Flags flags,
59 const char* name) { 60 const char* name) {
60 HandleScope scope(isolate); 61 HandleScope scope(isolate);
62 CanonicalHandleScope canonical(isolate);
61 const size_t buffer_size = 32 * KB; 63 const size_t buffer_size = 32 * KB;
62 byte buffer[buffer_size]; // NOLINT(runtime/arrays) 64 byte buffer[buffer_size]; // NOLINT(runtime/arrays)
63 MacroAssembler masm(isolate, buffer, buffer_size, CodeObjectRequired::kYes); 65 MacroAssembler masm(isolate, buffer, buffer_size, CodeObjectRequired::kYes);
64 DCHECK(!masm.has_frame()); 66 DCHECK(!masm.has_frame());
65 Builtins::Generate_Adaptor(&masm, builtin_address, exit_frame_type); 67 Builtins::Generate_Adaptor(&masm, builtin_address, exit_frame_type);
66 CodeDesc desc; 68 CodeDesc desc;
67 masm.GetCode(&desc); 69 masm.GetCode(&desc);
68 Handle<Code> code = 70 Handle<Code> code =
69 isolate->factory()->NewCode(desc, flags, masm.CodeObject()); 71 isolate->factory()->NewCode(desc, flags, masm.CodeObject());
70 PostBuildProfileAndTracing(isolate, *code, name); 72 PostBuildProfileAndTracing(isolate, *code, name);
71 return *code; 73 return *code;
72 } 74 }
73 75
74 // Builder for builtins implemented in TurboFan with JS linkage. 76 // Builder for builtins implemented in TurboFan with JS linkage.
75 Code* BuildWithCodeStubAssemblerJS(Isolate* isolate, 77 Code* BuildWithCodeStubAssemblerJS(Isolate* isolate,
76 CodeAssemblerGenerator generator, int argc, 78 CodeAssemblerGenerator generator, int argc,
77 Code::Flags flags, const char* name) { 79 Code::Flags flags, const char* name) {
78 HandleScope scope(isolate); 80 HandleScope scope(isolate);
81 CanonicalHandleScope canonical(isolate);
79 Zone zone(isolate->allocator(), ZONE_NAME); 82 Zone zone(isolate->allocator(), ZONE_NAME);
80 const int argc_with_recv = 83 const int argc_with_recv =
81 (argc == SharedFunctionInfo::kDontAdaptArgumentsSentinel) ? 0 : argc + 1; 84 (argc == SharedFunctionInfo::kDontAdaptArgumentsSentinel) ? 0 : argc + 1;
82 compiler::CodeAssemblerState state(isolate, &zone, argc_with_recv, flags, 85 compiler::CodeAssemblerState state(isolate, &zone, argc_with_recv, flags,
83 name); 86 name);
84 generator(&state); 87 generator(&state);
85 Handle<Code> code = compiler::CodeAssembler::GenerateCode(&state); 88 Handle<Code> code = compiler::CodeAssembler::GenerateCode(&state);
86 PostBuildProfileAndTracing(isolate, *code, name); 89 PostBuildProfileAndTracing(isolate, *code, name);
87 return *code; 90 return *code;
88 } 91 }
89 92
90 // Builder for builtins implemented in TurboFan with CallStub linkage. 93 // Builder for builtins implemented in TurboFan with CallStub linkage.
91 Code* BuildWithCodeStubAssemblerCS(Isolate* isolate, 94 Code* BuildWithCodeStubAssemblerCS(Isolate* isolate,
92 CodeAssemblerGenerator generator, 95 CodeAssemblerGenerator generator,
93 CallDescriptors::Key interface_descriptor, 96 CallDescriptors::Key interface_descriptor,
94 Code::Flags flags, const char* name, 97 Code::Flags flags, const char* name,
95 int result_size) { 98 int result_size) {
96 HandleScope scope(isolate); 99 HandleScope scope(isolate);
100 CanonicalHandleScope canonical(isolate);
97 Zone zone(isolate->allocator(), ZONE_NAME); 101 Zone zone(isolate->allocator(), ZONE_NAME);
98 // The interface descriptor with given key must be initialized at this point 102 // The interface descriptor with given key must be initialized at this point
99 // and this construction just queries the details from the descriptors table. 103 // and this construction just queries the details from the descriptors table.
100 CallInterfaceDescriptor descriptor(isolate, interface_descriptor); 104 CallInterfaceDescriptor descriptor(isolate, interface_descriptor);
101 // Ensure descriptor is already initialized. 105 // Ensure descriptor is already initialized.
102 DCHECK_LE(0, descriptor.GetRegisterParameterCount()); 106 DCHECK_LE(0, descriptor.GetRegisterParameterCount());
103 compiler::CodeAssemblerState state(isolate, &zone, descriptor, flags, name, 107 compiler::CodeAssemblerState state(isolate, &zone, descriptor, flags, name,
104 result_size); 108 result_size);
105 generator(&state); 109 generator(&state);
106 Handle<Code> code = compiler::CodeAssembler::GenerateCode(&state); 110 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); 197 ->set_has_tagged_params(false);
194 198
195 BUILTINS_WITH_UNTAGGED_PARAMS(SET_CODE_NON_TAGGED_PARAMS) 199 BUILTINS_WITH_UNTAGGED_PARAMS(SET_CODE_NON_TAGGED_PARAMS)
196 #undef SET_CODE_NON_TAGGED_PARAMS 200 #undef SET_CODE_NON_TAGGED_PARAMS
197 201
198 isolate->builtins()->MarkInitialized(); 202 isolate->builtins()->MarkInitialized();
199 } 203 }
200 204
201 } // namespace internal 205 } // namespace internal
202 } // namespace v8 206 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698