OLD | NEW |
| (Empty) |
1 # Copyright 2012 the V8 project authors. All rights reserved. | |
2 # Redistribution and use in source and binary forms, with or without | |
3 # modification, are permitted provided that the following conditions are | |
4 # met: | |
5 # | |
6 # * Redistributions of source code must retain the above copyright | |
7 # notice, this list of conditions and the following disclaimer. | |
8 # * Redistributions in binary form must reproduce the above | |
9 # copyright notice, this list of conditions and the following | |
10 # disclaimer in the documentation and/or other materials provided | |
11 # with the distribution. | |
12 # * Neither the name of Google Inc. nor the names of its | |
13 # contributors may be used to endorse or promote products derived | |
14 # from this software without specific prior written permission. | |
15 # | |
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | |
28 import sys | |
29 from os.path import join, dirname, abspath | |
30 root_dir = dirname(File('SConstruct').rfile().abspath) | |
31 sys.path.append(join(root_dir, 'tools')) | |
32 import js2c | |
33 Import('context') | |
34 Import('tools') | |
35 Import('d8_env') | |
36 | |
37 | |
38 SOURCES = { | |
39 'all': Split(""" | |
40 accessors.cc | |
41 allocation.cc | |
42 api.cc | |
43 assembler.cc | |
44 ast.cc | |
45 atomicops_internals_x86_gcc.cc | |
46 bignum-dtoa.cc | |
47 bignum.cc | |
48 bootstrapper.cc | |
49 builtins.cc | |
50 cached-powers.cc | |
51 checks.cc | |
52 circular-queue.cc | |
53 code-stubs.cc | |
54 codegen.cc | |
55 compilation-cache.cc | |
56 compiler.cc | |
57 contexts.cc | |
58 conversions.cc | |
59 counters.cc | |
60 cpu-profiler.cc | |
61 data-flow.cc | |
62 date.cc | |
63 dateparser.cc | |
64 debug-agent.cc | |
65 debug.cc | |
66 deoptimizer.cc | |
67 disassembler.cc | |
68 diy-fp.cc | |
69 dtoa.cc | |
70 elements-kind.cc | |
71 elements.cc | |
72 execution.cc | |
73 extensions/externalize-string-extension.cc | |
74 extensions/gc-extension.cc | |
75 extensions/statistics-extension.cc | |
76 factory.cc | |
77 fast-dtoa.cc | |
78 fixed-dtoa.cc | |
79 flags.cc | |
80 frames.cc | |
81 full-codegen.cc | |
82 func-name-inferrer.cc | |
83 gdb-jit.cc | |
84 global-handles.cc | |
85 handles.cc | |
86 heap-profiler.cc | |
87 heap-snapshot-generator.cc | |
88 heap.cc | |
89 hydrogen-instructions.cc | |
90 hydrogen.cc | |
91 ic.cc | |
92 incremental-marking.cc | |
93 interface.cc | |
94 interpreter-irregexp.cc | |
95 isolate.cc | |
96 jsregexp.cc | |
97 lithium-allocator.cc | |
98 lithium.cc | |
99 liveedit.cc | |
100 log-utils.cc | |
101 log.cc | |
102 mark-compact.cc | |
103 messages.cc | |
104 objects-printer.cc | |
105 objects-visiting.cc | |
106 objects.cc | |
107 once.cc | |
108 optimizing-compiler-thread.cc | |
109 parser.cc | |
110 preparse-data.cc | |
111 preparser.cc | |
112 profile-generator.cc | |
113 property.cc | |
114 regexp-macro-assembler-irregexp.cc | |
115 regexp-macro-assembler.cc | |
116 regexp-stack.cc | |
117 rewriter.cc | |
118 runtime-profiler.cc | |
119 runtime.cc | |
120 safepoint-table.cc | |
121 scanner-character-streams.cc | |
122 scanner.cc | |
123 scopeinfo.cc | |
124 scopes.cc | |
125 serialize.cc | |
126 snapshot-common.cc | |
127 spaces.cc | |
128 store-buffer.cc | |
129 string-search.cc | |
130 string-stream.cc | |
131 strtod.cc | |
132 stub-cache.cc | |
133 token.cc | |
134 transitions.cc | |
135 type-info.cc | |
136 unicode.cc | |
137 utils.cc | |
138 v8-counters.cc | |
139 v8.cc | |
140 v8conversions.cc | |
141 v8threads.cc | |
142 v8utils.cc | |
143 variables.cc | |
144 version.cc | |
145 zone.cc | |
146 """), | |
147 'arch:arm': Split(""" | |
148 arm/builtins-arm.cc | |
149 arm/code-stubs-arm.cc | |
150 arm/codegen-arm.cc | |
151 arm/constants-arm.cc | |
152 arm/cpu-arm.cc | |
153 arm/debug-arm.cc | |
154 arm/deoptimizer-arm.cc | |
155 arm/disasm-arm.cc | |
156 arm/frames-arm.cc | |
157 arm/full-codegen-arm.cc | |
158 arm/ic-arm.cc | |
159 arm/lithium-arm.cc | |
160 arm/lithium-codegen-arm.cc | |
161 arm/lithium-gap-resolver-arm.cc | |
162 arm/macro-assembler-arm.cc | |
163 arm/regexp-macro-assembler-arm.cc | |
164 arm/stub-cache-arm.cc | |
165 arm/assembler-arm.cc | |
166 """), | |
167 'arch:mips': Split(""" | |
168 mips/assembler-mips.cc | |
169 mips/builtins-mips.cc | |
170 mips/code-stubs-mips.cc | |
171 mips/codegen-mips.cc | |
172 mips/constants-mips.cc | |
173 mips/cpu-mips.cc | |
174 mips/debug-mips.cc | |
175 mips/deoptimizer-mips.cc | |
176 mips/disasm-mips.cc | |
177 mips/frames-mips.cc | |
178 mips/full-codegen-mips.cc | |
179 mips/ic-mips.cc | |
180 mips/lithium-codegen-mips.cc | |
181 mips/lithium-gap-resolver-mips.cc | |
182 mips/lithium-mips.cc | |
183 mips/macro-assembler-mips.cc | |
184 mips/regexp-macro-assembler-mips.cc | |
185 mips/stub-cache-mips.cc | |
186 """), | |
187 'arch:ia32': Split(""" | |
188 ia32/assembler-ia32.cc | |
189 ia32/builtins-ia32.cc | |
190 ia32/code-stubs-ia32.cc | |
191 ia32/codegen-ia32.cc | |
192 ia32/cpu-ia32.cc | |
193 ia32/debug-ia32.cc | |
194 ia32/deoptimizer-ia32.cc | |
195 ia32/disasm-ia32.cc | |
196 ia32/frames-ia32.cc | |
197 ia32/full-codegen-ia32.cc | |
198 ia32/ic-ia32.cc | |
199 ia32/lithium-codegen-ia32.cc | |
200 ia32/lithium-gap-resolver-ia32.cc | |
201 ia32/lithium-ia32.cc | |
202 ia32/macro-assembler-ia32.cc | |
203 ia32/regexp-macro-assembler-ia32.cc | |
204 ia32/stub-cache-ia32.cc | |
205 """), | |
206 'arch:x64': Split(""" | |
207 x64/assembler-x64.cc | |
208 x64/builtins-x64.cc | |
209 x64/code-stubs-x64.cc | |
210 x64/codegen-x64.cc | |
211 x64/cpu-x64.cc | |
212 x64/debug-x64.cc | |
213 x64/deoptimizer-x64.cc | |
214 x64/disasm-x64.cc | |
215 x64/frames-x64.cc | |
216 x64/full-codegen-x64.cc | |
217 x64/ic-x64.cc | |
218 x64/lithium-codegen-x64.cc | |
219 x64/lithium-gap-resolver-x64.cc | |
220 x64/lithium-x64.cc | |
221 x64/macro-assembler-x64.cc | |
222 x64/regexp-macro-assembler-x64.cc | |
223 x64/stub-cache-x64.cc | |
224 """), | |
225 'simulator:arm': ['arm/simulator-arm.cc'], | |
226 'simulator:mips': ['mips/simulator-mips.cc'], | |
227 'os:freebsd': ['platform-freebsd.cc', 'platform-posix.cc'], | |
228 'os:openbsd': ['platform-openbsd.cc', 'platform-posix.cc'], | |
229 'os:linux': ['platform-linux.cc', 'platform-posix.cc'], | |
230 'os:android': ['platform-linux.cc', 'platform-posix.cc'], | |
231 'os:macos': ['platform-macos.cc', 'platform-posix.cc'], | |
232 'os:solaris': ['platform-solaris.cc', 'platform-posix.cc'], | |
233 'os:cygwin': ['platform-cygwin.cc', 'platform-posix.cc'], | |
234 'os:nullos': ['platform-nullos.cc'], | |
235 'os:win32': ['platform-win32.cc', 'win32-math.cc'], | |
236 'mode:release': [], | |
237 'mode:debug': [ | |
238 'objects-debug.cc', 'prettyprinter.cc', 'regexp-macro-assembler-tracer.cc' | |
239 ] | |
240 } | |
241 | |
242 | |
243 PREPARSER_SOURCES = { | |
244 'all': Split(""" | |
245 allocation.cc | |
246 bignum.cc | |
247 bignum-dtoa.cc | |
248 cached-powers.cc | |
249 conversions.cc | |
250 diy-fp.cc | |
251 dtoa.cc | |
252 fast-dtoa.cc | |
253 fixed-dtoa.cc | |
254 preparse-data.cc | |
255 preparser.cc | |
256 preparser-api.cc | |
257 scanner.cc | |
258 strtod.cc | |
259 token.cc | |
260 unicode.cc | |
261 utils.cc | |
262 """), | |
263 'os:win32': ['win32-math.cc'] | |
264 } | |
265 | |
266 | |
267 D8_LIGHT_FILES = { | |
268 'all': [ | |
269 'd8.cc' | |
270 ] | |
271 } | |
272 | |
273 | |
274 D8_FULL_FILES = { | |
275 'all': [ | |
276 'd8.cc', 'd8-debug.cc' | |
277 ], | |
278 'os:linux': [ | |
279 'd8-posix.cc' | |
280 ], | |
281 'os:macos': [ | |
282 'd8-posix.cc' | |
283 ], | |
284 'os:android': [ | |
285 'd8-posix.cc' | |
286 ], | |
287 'os:freebsd': [ | |
288 'd8-posix.cc' | |
289 ], | |
290 'os:openbsd': [ | |
291 'd8-posix.cc' | |
292 ], | |
293 'os:solaris': [ | |
294 'd8-posix.cc' | |
295 ], | |
296 'os:cygwin': [ | |
297 'd8-posix.cc' | |
298 ], | |
299 'os:win32': [ | |
300 'd8-windows.cc' | |
301 ], | |
302 'os:nullos': [ | |
303 'd8-windows.cc' # Empty implementation at the moment. | |
304 ], | |
305 'console:readline': [ | |
306 'd8-readline.cc' | |
307 ] | |
308 } | |
309 | |
310 | |
311 LIBRARY_FILES = ''' | |
312 runtime.js | |
313 v8natives.js | |
314 array.js | |
315 string.js | |
316 uri.js | |
317 math.js | |
318 messages.js | |
319 apinatives.js | |
320 date.js | |
321 regexp.js | |
322 json.js | |
323 liveedit-debugger.js | |
324 mirror-debugger.js | |
325 debug-debugger.js | |
326 '''.split() | |
327 | |
328 | |
329 EXPERIMENTAL_LIBRARY_FILES = ''' | |
330 symbol.js | |
331 proxy.js | |
332 collection.js | |
333 '''.split() | |
334 | |
335 | |
336 def Abort(message): | |
337 print message | |
338 sys.exit(1) | |
339 | |
340 | |
341 def ConfigureObjectFiles(): | |
342 env = Environment(tools=tools) | |
343 env.Replace(**context.flags['v8']) | |
344 context.ApplyEnvOverrides(env) | |
345 env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C) | |
346 env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile "$LOGF
ILE" --log-snapshot-positions') | |
347 | |
348 def BuildJS2CEnv(type): | |
349 js2c_env = { 'TYPE': type, 'COMPRESSION': 'off' } | |
350 if 'COMPRESS_STARTUP_DATA_BZ2' in env['CPPDEFINES']: | |
351 js2c_env['COMPRESSION'] = 'bz2' | |
352 return js2c_env | |
353 | |
354 # Build the standard platform-independent source files. | |
355 source_files = context.GetRelevantSources(SOURCES) | |
356 d8_js = env.JS2C('d8-js.cc', 'd8.js', **{'TYPE': 'D8', 'COMPRESSION': 'off'}) | |
357 d8_js_obj = context.ConfigureObject(env, d8_js, CPPPATH=['.']) | |
358 if context.options['library'] == 'shared': | |
359 d8_files = context.GetRelevantSources(D8_LIGHT_FILES) | |
360 d8_objs = [] | |
361 else: | |
362 d8_files = context.GetRelevantSources(D8_FULL_FILES) | |
363 d8_objs = [d8_js_obj] | |
364 d8_objs.append(context.ConfigureObject(d8_env, [d8_files])) | |
365 | |
366 # Combine the JavaScript library files into a single C++ file and | |
367 # compile it. | |
368 library_files = [s for s in LIBRARY_FILES] | |
369 library_files.append('macros.py') | |
370 libraries_src = env.JS2C( | |
371 ['libraries.cc'], library_files, **BuildJS2CEnv('CORE')) | |
372 libraries_obj = context.ConfigureObject(env, libraries_src, CPPPATH=['.']) | |
373 | |
374 # Combine the experimental JavaScript library files into a C++ file | |
375 # and compile it. | |
376 experimental_library_files = [ s for s in EXPERIMENTAL_LIBRARY_FILES ] | |
377 experimental_library_files.append('macros.py') | |
378 experimental_libraries_src = env.JS2C(['experimental-libraries.cc'], | |
379 experimental_library_files, | |
380 **BuildJS2CEnv('EXPERIMENTAL')) | |
381 experimental_libraries_obj = context.ConfigureObject(env, experimental_librari
es_src, CPPPATH=['.']) | |
382 | |
383 source_objs = context.ConfigureObject(env, source_files) | |
384 non_snapshot_files = [source_objs] | |
385 | |
386 preparser_source_files = context.GetRelevantSources(PREPARSER_SOURCES) | |
387 preparser_objs = context.ConfigureObject(env, preparser_source_files) | |
388 | |
389 # Create snapshot if necessary. For cross compilation you should either | |
390 # do without snapshots and take the performance hit or you should build a | |
391 # host VM with the simulator=arm and snapshot=on options and then take the | |
392 # resulting snapshot.cc file from obj/release and put it in the src | |
393 # directory. Then rebuild the VM with the cross compiler and specify | |
394 # snapshot=nobuild on the scons command line. | |
395 empty_snapshot_obj = context.ConfigureObject(env, 'snapshot-empty.cc') | |
396 mksnapshot_env = env.Copy() | |
397 mksnapshot_env.Replace(**context.flags['mksnapshot']) | |
398 mksnapshot_src = 'mksnapshot.cc' | |
399 mksnapshot = mksnapshot_env.Program('mksnapshot', [mksnapshot_src, libraries_o
bj, experimental_libraries_obj, non_snapshot_files, empty_snapshot_obj], PDB='m
ksnapshot.exe.pdb') | |
400 if context.use_snapshot: | |
401 if context.build_snapshot: | |
402 snapshot_cc = env.Snapshot('snapshot.cc', mksnapshot, LOGFILE=File('snapsh
ot.log').abspath) | |
403 else: | |
404 snapshot_cc = 'snapshot.cc' | |
405 snapshot_obj = context.ConfigureObject(env, snapshot_cc, CPPPATH=['.']) | |
406 else: | |
407 snapshot_obj = empty_snapshot_obj | |
408 library_objs = [non_snapshot_files, libraries_obj, experimental_libraries_obj,
snapshot_obj] | |
409 return (library_objs, d8_objs, [mksnapshot], preparser_objs) | |
410 | |
411 | |
412 (library_objs, d8_objs, mksnapshot, preparser_objs) = ConfigureObjectFiles() | |
413 Return('library_objs d8_objs mksnapshot preparser_objs') | |
OLD | NEW |