mustang 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/Isolate +9 -0
- data/README.md +6 -12
- data/Rakefile +30 -4
- data/TODO.md +9 -0
- data/ext/v8/extconf.rb +56 -0
- data/ext/v8/v8.cpp +37 -0
- data/ext/v8/v8_array.cpp +161 -0
- data/ext/v8/v8_array.h +17 -0
- data/ext/v8/v8_base.cpp +147 -0
- data/ext/v8/v8_base.h +23 -0
- data/ext/v8/v8_cast.cpp +151 -0
- data/ext/v8/v8_cast.h +64 -0
- data/ext/v8/v8_context.cpp +174 -0
- data/ext/v8/v8_context.h +12 -0
- data/ext/v8/v8_date.cpp +61 -0
- data/ext/v8/v8_date.h +16 -0
- data/ext/v8/v8_errors.cpp +147 -0
- data/ext/v8/v8_errors.h +19 -0
- data/ext/v8/v8_external.cpp +66 -0
- data/ext/v8/v8_external.h +16 -0
- data/ext/v8/v8_function.cpp +182 -0
- data/ext/v8/v8_function.h +14 -0
- data/ext/v8/v8_integer.cpp +70 -0
- data/ext/v8/v8_integer.h +16 -0
- data/ext/v8/v8_macros.h +30 -0
- data/ext/v8/v8_main.cpp +53 -0
- data/ext/v8/v8_main.h +13 -0
- data/ext/v8/v8_number.cpp +62 -0
- data/ext/v8/v8_number.h +16 -0
- data/ext/v8/v8_object.cpp +172 -0
- data/ext/v8/v8_object.h +17 -0
- data/ext/v8/v8_ref.cpp +72 -0
- data/ext/v8/v8_ref.h +43 -0
- data/ext/v8/v8_regexp.cpp +148 -0
- data/ext/v8/v8_regexp.h +16 -0
- data/ext/v8/v8_string.cpp +78 -0
- data/ext/v8/v8_string.h +16 -0
- data/ext/v8/v8_value.cpp +370 -0
- data/ext/v8/v8_value.h +19 -0
- data/gemspec.yml +2 -1
- data/lib/core_ext/class.rb +14 -0
- data/lib/core_ext/object.rb +12 -0
- data/lib/core_ext/symbol.rb +23 -0
- data/lib/mustang.rb +44 -0
- data/lib/mustang/context.rb +69 -0
- data/lib/mustang/errors.rb +36 -0
- data/lib/support/delegated.rb +25 -0
- data/lib/v8/array.rb +21 -0
- data/lib/v8/context.rb +13 -0
- data/lib/v8/date.rb +20 -0
- data/lib/v8/error.rb +15 -0
- data/lib/v8/external.rb +16 -0
- data/lib/v8/function.rb +11 -0
- data/lib/v8/integer.rb +16 -0
- data/lib/v8/number.rb +16 -0
- data/lib/v8/object.rb +66 -0
- data/lib/v8/regexp.rb +23 -0
- data/lib/v8/string.rb +27 -0
- data/mustang.gemspec +3 -0
- data/spec/core_ext/class_spec.rb +19 -0
- data/spec/core_ext/object_spec.rb +19 -0
- data/spec/core_ext/symbol_spec.rb +27 -0
- data/spec/fixtures/test1.js +2 -0
- data/spec/fixtures/test2.js +2 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/v8/array_spec.rb +88 -0
- data/spec/v8/cast_spec.rb +151 -0
- data/spec/v8/context_spec.rb +78 -0
- data/spec/v8/data_spec.rb +39 -0
- data/spec/v8/date_spec.rb +45 -0
- data/spec/v8/empty_spec.rb +27 -0
- data/spec/v8/errors_spec.rb +142 -0
- data/spec/v8/external_spec.rb +44 -0
- data/spec/v8/function_spec.rb +170 -0
- data/spec/v8/integer_spec.rb +41 -0
- data/spec/v8/main_spec.rb +18 -0
- data/spec/v8/null_spec.rb +27 -0
- data/spec/v8/number_spec.rb +40 -0
- data/spec/v8/object_spec.rb +79 -0
- data/spec/v8/primitive_spec.rb +9 -0
- data/spec/v8/regexp_spec.rb +65 -0
- data/spec/v8/string_spec.rb +48 -0
- data/spec/v8/undefined_spec.rb +27 -0
- data/spec/v8/value_spec.rb +215 -0
- data/vendor/v8/.gitignore +2 -0
- data/vendor/v8/AUTHORS +3 -1
- data/vendor/v8/ChangeLog +117 -0
- data/vendor/v8/SConstruct +334 -53
- data/vendor/v8/include/v8-debug.h +21 -11
- data/vendor/v8/include/v8-preparser.h +1 -1
- data/vendor/v8/include/v8-profiler.h +122 -43
- data/vendor/v8/include/v8-testing.h +5 -0
- data/vendor/v8/include/v8.h +171 -17
- data/vendor/v8/preparser/SConscript +38 -0
- data/vendor/v8/preparser/preparser-process.cc +77 -114
- data/vendor/v8/samples/shell.cc +232 -46
- data/vendor/v8/src/SConscript +29 -5
- data/vendor/v8/src/accessors.cc +70 -211
- data/vendor/v8/{test/cctest/test-mips.cc → src/allocation-inl.h} +15 -18
- data/vendor/v8/src/allocation.cc +0 -82
- data/vendor/v8/src/allocation.h +9 -42
- data/vendor/v8/src/api.cc +1645 -1156
- data/vendor/v8/src/api.h +76 -12
- data/vendor/v8/src/apiutils.h +0 -7
- data/vendor/v8/src/arguments.h +15 -4
- data/vendor/v8/src/arm/assembler-arm-inl.h +10 -9
- data/vendor/v8/src/arm/assembler-arm.cc +62 -23
- data/vendor/v8/src/arm/assembler-arm.h +76 -11
- data/vendor/v8/src/arm/builtins-arm.cc +39 -33
- data/vendor/v8/src/arm/code-stubs-arm.cc +1182 -402
- data/vendor/v8/src/arm/code-stubs-arm.h +20 -54
- data/vendor/v8/src/arm/codegen-arm.cc +159 -106
- data/vendor/v8/src/arm/codegen-arm.h +6 -6
- data/vendor/v8/src/arm/constants-arm.h +16 -1
- data/vendor/v8/src/arm/cpu-arm.cc +7 -5
- data/vendor/v8/src/arm/debug-arm.cc +6 -4
- data/vendor/v8/src/arm/deoptimizer-arm.cc +51 -14
- data/vendor/v8/src/arm/disasm-arm.cc +47 -15
- data/vendor/v8/src/arm/frames-arm.h +1 -1
- data/vendor/v8/src/arm/full-codegen-arm.cc +724 -408
- data/vendor/v8/src/arm/ic-arm.cc +90 -85
- data/vendor/v8/src/arm/lithium-arm.cc +140 -69
- data/vendor/v8/src/arm/lithium-arm.h +161 -46
- data/vendor/v8/src/arm/lithium-codegen-arm.cc +567 -297
- data/vendor/v8/src/arm/lithium-codegen-arm.h +21 -9
- data/vendor/v8/src/arm/lithium-gap-resolver-arm.cc +2 -0
- data/vendor/v8/src/arm/macro-assembler-arm.cc +457 -96
- data/vendor/v8/src/arm/macro-assembler-arm.h +115 -18
- data/vendor/v8/src/arm/regexp-macro-assembler-arm.cc +20 -13
- data/vendor/v8/src/arm/regexp-macro-assembler-arm.h +1 -0
- data/vendor/v8/src/arm/simulator-arm.cc +184 -101
- data/vendor/v8/src/arm/simulator-arm.h +26 -21
- data/vendor/v8/src/arm/stub-cache-arm.cc +450 -467
- data/vendor/v8/src/arm/virtual-frame-arm.cc +14 -12
- data/vendor/v8/src/arm/virtual-frame-arm.h +11 -8
- data/vendor/v8/src/array.js +35 -18
- data/vendor/v8/src/assembler.cc +186 -92
- data/vendor/v8/src/assembler.h +106 -69
- data/vendor/v8/src/ast-inl.h +5 -0
- data/vendor/v8/src/ast.cc +46 -35
- data/vendor/v8/src/ast.h +107 -50
- data/vendor/v8/src/atomicops.h +2 -0
- data/vendor/v8/src/atomicops_internals_mips_gcc.h +169 -0
- data/vendor/v8/src/bootstrapper.cc +649 -399
- data/vendor/v8/src/bootstrapper.h +94 -27
- data/vendor/v8/src/builtins.cc +359 -227
- data/vendor/v8/src/builtins.h +157 -123
- data/vendor/v8/src/checks.cc +2 -2
- data/vendor/v8/src/checks.h +4 -0
- data/vendor/v8/src/code-stubs.cc +27 -17
- data/vendor/v8/src/code-stubs.h +38 -17
- data/vendor/v8/src/codegen-inl.h +5 -1
- data/vendor/v8/src/codegen.cc +27 -17
- data/vendor/v8/src/codegen.h +9 -9
- data/vendor/v8/src/compilation-cache.cc +92 -206
- data/vendor/v8/src/compilation-cache.h +205 -30
- data/vendor/v8/src/compiler.cc +107 -120
- data/vendor/v8/src/compiler.h +17 -2
- data/vendor/v8/src/contexts.cc +22 -15
- data/vendor/v8/src/contexts.h +14 -8
- data/vendor/v8/src/conversions.cc +86 -30
- data/vendor/v8/src/counters.cc +19 -4
- data/vendor/v8/src/counters.h +28 -16
- data/vendor/v8/src/cpu-profiler-inl.h +4 -3
- data/vendor/v8/src/cpu-profiler.cc +123 -72
- data/vendor/v8/src/cpu-profiler.h +33 -19
- data/vendor/v8/src/cpu.h +2 -0
- data/vendor/v8/src/d8-debug.cc +3 -3
- data/vendor/v8/src/d8-debug.h +7 -6
- data/vendor/v8/src/d8-posix.cc +2 -0
- data/vendor/v8/src/d8.cc +22 -12
- data/vendor/v8/src/d8.gyp +3 -0
- data/vendor/v8/src/d8.js +618 -0
- data/vendor/v8/src/data-flow.h +3 -3
- data/vendor/v8/src/dateparser.h +4 -2
- data/vendor/v8/src/debug-agent.cc +10 -9
- data/vendor/v8/src/debug-agent.h +9 -11
- data/vendor/v8/src/debug-debugger.js +121 -0
- data/vendor/v8/src/debug.cc +331 -227
- data/vendor/v8/src/debug.h +248 -219
- data/vendor/v8/src/deoptimizer.cc +173 -62
- data/vendor/v8/src/deoptimizer.h +119 -19
- data/vendor/v8/src/disasm.h +3 -0
- data/vendor/v8/src/disassembler.cc +10 -9
- data/vendor/v8/src/execution.cc +185 -129
- data/vendor/v8/src/execution.h +47 -78
- data/vendor/v8/src/extensions/experimental/break-iterator.cc +250 -0
- data/vendor/v8/src/extensions/experimental/break-iterator.h +89 -0
- data/vendor/v8/src/extensions/experimental/experimental.gyp +2 -0
- data/vendor/v8/src/extensions/experimental/i18n-extension.cc +22 -2
- data/vendor/v8/src/extensions/externalize-string-extension.cc +2 -2
- data/vendor/v8/src/extensions/gc-extension.cc +1 -1
- data/vendor/v8/src/factory.cc +261 -154
- data/vendor/v8/src/factory.h +162 -158
- data/vendor/v8/src/flag-definitions.h +17 -11
- data/vendor/v8/src/frame-element.cc +0 -5
- data/vendor/v8/src/frame-element.h +9 -13
- data/vendor/v8/src/frames-inl.h +7 -0
- data/vendor/v8/src/frames.cc +56 -46
- data/vendor/v8/src/frames.h +36 -25
- data/vendor/v8/src/full-codegen.cc +15 -24
- data/vendor/v8/src/full-codegen.h +13 -41
- data/vendor/v8/src/func-name-inferrer.cc +7 -6
- data/vendor/v8/src/func-name-inferrer.h +1 -1
- data/vendor/v8/src/gdb-jit.cc +1 -0
- data/vendor/v8/src/global-handles.cc +118 -56
- data/vendor/v8/src/global-handles.h +98 -40
- data/vendor/v8/src/globals.h +2 -2
- data/vendor/v8/src/handles-inl.h +106 -9
- data/vendor/v8/src/handles.cc +220 -157
- data/vendor/v8/src/handles.h +38 -59
- data/vendor/v8/src/hashmap.h +3 -3
- data/vendor/v8/src/heap-inl.h +141 -25
- data/vendor/v8/src/heap-profiler.cc +117 -63
- data/vendor/v8/src/heap-profiler.h +38 -21
- data/vendor/v8/src/heap.cc +805 -564
- data/vendor/v8/src/heap.h +640 -594
- data/vendor/v8/src/hydrogen-instructions.cc +216 -73
- data/vendor/v8/src/hydrogen-instructions.h +259 -124
- data/vendor/v8/src/hydrogen.cc +996 -1171
- data/vendor/v8/src/hydrogen.h +163 -144
- data/vendor/v8/src/ia32/assembler-ia32-inl.h +12 -11
- data/vendor/v8/src/ia32/assembler-ia32.cc +85 -39
- data/vendor/v8/src/ia32/assembler-ia32.h +82 -16
- data/vendor/v8/src/ia32/builtins-ia32.cc +64 -58
- data/vendor/v8/src/ia32/code-stubs-ia32.cc +248 -324
- data/vendor/v8/src/ia32/code-stubs-ia32.h +3 -44
- data/vendor/v8/src/ia32/codegen-ia32.cc +217 -165
- data/vendor/v8/src/ia32/codegen-ia32.h +3 -0
- data/vendor/v8/src/ia32/cpu-ia32.cc +6 -5
- data/vendor/v8/src/ia32/debug-ia32.cc +8 -5
- data/vendor/v8/src/ia32/deoptimizer-ia32.cc +124 -14
- data/vendor/v8/src/ia32/disasm-ia32.cc +85 -62
- data/vendor/v8/src/ia32/frames-ia32.h +1 -1
- data/vendor/v8/src/ia32/full-codegen-ia32.cc +348 -435
- data/vendor/v8/src/ia32/ic-ia32.cc +91 -91
- data/vendor/v8/src/ia32/lithium-codegen-ia32.cc +500 -255
- data/vendor/v8/src/ia32/lithium-codegen-ia32.h +13 -4
- data/vendor/v8/src/ia32/lithium-gap-resolver-ia32.cc +6 -0
- data/vendor/v8/src/ia32/lithium-ia32.cc +122 -45
- data/vendor/v8/src/ia32/lithium-ia32.h +128 -41
- data/vendor/v8/src/ia32/macro-assembler-ia32.cc +109 -84
- data/vendor/v8/src/ia32/macro-assembler-ia32.h +18 -9
- data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.cc +26 -15
- data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.h +1 -0
- data/vendor/v8/src/ia32/register-allocator-ia32.cc +30 -30
- data/vendor/v8/src/ia32/simulator-ia32.h +4 -4
- data/vendor/v8/src/ia32/stub-cache-ia32.cc +383 -400
- data/vendor/v8/src/ia32/virtual-frame-ia32.cc +36 -13
- data/vendor/v8/src/ia32/virtual-frame-ia32.h +11 -5
- data/vendor/v8/src/ic-inl.h +12 -2
- data/vendor/v8/src/ic.cc +304 -221
- data/vendor/v8/src/ic.h +115 -58
- data/vendor/v8/src/interpreter-irregexp.cc +25 -21
- data/vendor/v8/src/interpreter-irregexp.h +2 -1
- data/vendor/v8/src/isolate.cc +883 -0
- data/vendor/v8/src/isolate.h +1304 -0
- data/vendor/v8/src/json.js +10 -10
- data/vendor/v8/src/jsregexp.cc +111 -80
- data/vendor/v8/src/jsregexp.h +6 -7
- data/vendor/v8/src/jump-target-heavy.cc +5 -8
- data/vendor/v8/src/jump-target-heavy.h +0 -6
- data/vendor/v8/src/jump-target-inl.h +1 -1
- data/vendor/v8/src/jump-target-light.cc +3 -3
- data/vendor/v8/src/lithium-allocator-inl.h +2 -0
- data/vendor/v8/src/lithium-allocator.cc +42 -30
- data/vendor/v8/src/lithium-allocator.h +8 -22
- data/vendor/v8/src/lithium.cc +1 -0
- data/vendor/v8/src/liveedit.cc +141 -99
- data/vendor/v8/src/liveedit.h +7 -2
- data/vendor/v8/src/liveobjectlist-inl.h +90 -0
- data/vendor/v8/src/liveobjectlist.cc +2537 -1
- data/vendor/v8/src/liveobjectlist.h +245 -35
- data/vendor/v8/src/log-utils.cc +122 -35
- data/vendor/v8/src/log-utils.h +33 -36
- data/vendor/v8/src/log.cc +299 -241
- data/vendor/v8/src/log.h +177 -110
- data/vendor/v8/src/mark-compact.cc +612 -470
- data/vendor/v8/src/mark-compact.h +153 -80
- data/vendor/v8/src/messages.cc +16 -14
- data/vendor/v8/src/messages.js +30 -7
- data/vendor/v8/src/mips/assembler-mips-inl.h +155 -35
- data/vendor/v8/src/mips/assembler-mips.cc +1093 -219
- data/vendor/v8/src/mips/assembler-mips.h +552 -153
- data/vendor/v8/src/mips/builtins-mips.cc +43 -100
- data/vendor/v8/src/mips/code-stubs-mips.cc +752 -0
- data/vendor/v8/src/mips/code-stubs-mips.h +511 -0
- data/vendor/v8/src/mips/codegen-mips-inl.h +8 -14
- data/vendor/v8/src/mips/codegen-mips.cc +672 -896
- data/vendor/v8/src/mips/codegen-mips.h +271 -69
- data/vendor/v8/src/mips/constants-mips.cc +44 -20
- data/vendor/v8/src/mips/constants-mips.h +238 -40
- data/vendor/v8/src/mips/cpu-mips.cc +20 -3
- data/vendor/v8/src/mips/debug-mips.cc +35 -7
- data/vendor/v8/src/mips/deoptimizer-mips.cc +91 -0
- data/vendor/v8/src/mips/disasm-mips.cc +329 -93
- data/vendor/v8/src/mips/frames-mips.cc +2 -50
- data/vendor/v8/src/mips/frames-mips.h +24 -9
- data/vendor/v8/src/mips/full-codegen-mips.cc +473 -23
- data/vendor/v8/src/mips/ic-mips.cc +81 -45
- data/vendor/v8/src/mips/jump-target-mips.cc +11 -106
- data/vendor/v8/src/mips/lithium-codegen-mips.h +65 -0
- data/vendor/v8/src/mips/lithium-mips.h +304 -0
- data/vendor/v8/src/mips/macro-assembler-mips.cc +2391 -390
- data/vendor/v8/src/mips/macro-assembler-mips.h +718 -121
- data/vendor/v8/src/mips/regexp-macro-assembler-mips.cc +478 -0
- data/vendor/v8/src/mips/regexp-macro-assembler-mips.h +250 -0
- data/vendor/v8/src/mips/register-allocator-mips-inl.h +0 -3
- data/vendor/v8/src/mips/register-allocator-mips.h +3 -2
- data/vendor/v8/src/mips/simulator-mips.cc +1009 -221
- data/vendor/v8/src/mips/simulator-mips.h +119 -36
- data/vendor/v8/src/mips/stub-cache-mips.cc +331 -148
- data/vendor/v8/src/mips/{fast-codegen-mips.cc → virtual-frame-mips-inl.h} +11 -30
- data/vendor/v8/src/mips/virtual-frame-mips.cc +137 -149
- data/vendor/v8/src/mips/virtual-frame-mips.h +294 -312
- data/vendor/v8/src/mirror-debugger.js +9 -8
- data/vendor/v8/src/mksnapshot.cc +2 -2
- data/vendor/v8/src/objects-debug.cc +16 -16
- data/vendor/v8/src/objects-inl.h +421 -195
- data/vendor/v8/src/objects-printer.cc +7 -7
- data/vendor/v8/src/objects-visiting.cc +1 -1
- data/vendor/v8/src/objects-visiting.h +33 -12
- data/vendor/v8/src/objects.cc +935 -658
- data/vendor/v8/src/objects.h +234 -139
- data/vendor/v8/src/parser.cc +484 -439
- data/vendor/v8/src/parser.h +35 -14
- data/vendor/v8/src/platform-cygwin.cc +173 -107
- data/vendor/v8/src/platform-freebsd.cc +224 -72
- data/vendor/v8/src/platform-linux.cc +234 -95
- data/vendor/v8/src/platform-macos.cc +215 -82
- data/vendor/v8/src/platform-nullos.cc +9 -3
- data/vendor/v8/src/platform-openbsd.cc +22 -7
- data/vendor/v8/src/platform-posix.cc +30 -5
- data/vendor/v8/src/platform-solaris.cc +120 -38
- data/vendor/v8/src/platform-tls-mac.h +62 -0
- data/vendor/v8/src/platform-tls-win32.h +62 -0
- data/vendor/v8/src/platform-tls.h +50 -0
- data/vendor/v8/src/platform-win32.cc +195 -97
- data/vendor/v8/src/platform.h +72 -15
- data/vendor/v8/src/preparse-data.cc +2 -0
- data/vendor/v8/src/preparser-api.cc +8 -2
- data/vendor/v8/src/preparser.cc +1 -1
- data/vendor/v8/src/prettyprinter.cc +43 -52
- data/vendor/v8/src/prettyprinter.h +1 -1
- data/vendor/v8/src/profile-generator-inl.h +0 -28
- data/vendor/v8/src/profile-generator.cc +942 -685
- data/vendor/v8/src/profile-generator.h +210 -176
- data/vendor/v8/src/property.cc +6 -0
- data/vendor/v8/src/property.h +14 -3
- data/vendor/v8/src/regexp-macro-assembler-irregexp.cc +1 -1
- data/vendor/v8/src/regexp-macro-assembler.cc +28 -19
- data/vendor/v8/src/regexp-macro-assembler.h +11 -6
- data/vendor/v8/src/regexp-stack.cc +18 -10
- data/vendor/v8/src/regexp-stack.h +45 -21
- data/vendor/v8/src/regexp.js +3 -3
- data/vendor/v8/src/register-allocator-inl.h +3 -3
- data/vendor/v8/src/register-allocator.cc +1 -7
- data/vendor/v8/src/register-allocator.h +5 -15
- data/vendor/v8/src/rewriter.cc +2 -1
- data/vendor/v8/src/runtime-profiler.cc +158 -128
- data/vendor/v8/src/runtime-profiler.h +131 -15
- data/vendor/v8/src/runtime.cc +2409 -1692
- data/vendor/v8/src/runtime.h +93 -17
- data/vendor/v8/src/safepoint-table.cc +3 -0
- data/vendor/v8/src/safepoint-table.h +9 -3
- data/vendor/v8/src/scanner-base.cc +21 -28
- data/vendor/v8/src/scanner-base.h +22 -11
- data/vendor/v8/src/scanner.cc +3 -5
- data/vendor/v8/src/scanner.h +4 -2
- data/vendor/v8/src/scopeinfo.cc +11 -16
- data/vendor/v8/src/scopeinfo.h +26 -15
- data/vendor/v8/src/scopes.cc +67 -37
- data/vendor/v8/src/scopes.h +26 -12
- data/vendor/v8/src/serialize.cc +193 -154
- data/vendor/v8/src/serialize.h +41 -36
- data/vendor/v8/src/small-pointer-list.h +163 -0
- data/vendor/v8/src/snapshot-common.cc +1 -1
- data/vendor/v8/src/snapshot.h +3 -1
- data/vendor/v8/src/spaces-inl.h +30 -25
- data/vendor/v8/src/spaces.cc +263 -370
- data/vendor/v8/src/spaces.h +178 -166
- data/vendor/v8/src/string-search.cc +4 -3
- data/vendor/v8/src/string-search.h +21 -20
- data/vendor/v8/src/string-stream.cc +32 -24
- data/vendor/v8/src/string.js +7 -7
- data/vendor/v8/src/stub-cache.cc +324 -248
- data/vendor/v8/src/stub-cache.h +181 -155
- data/vendor/v8/src/token.cc +3 -3
- data/vendor/v8/src/token.h +3 -3
- data/vendor/v8/src/top.cc +218 -390
- data/vendor/v8/src/type-info.cc +98 -32
- data/vendor/v8/src/type-info.h +10 -3
- data/vendor/v8/src/unicode.cc +1 -1
- data/vendor/v8/src/unicode.h +1 -1
- data/vendor/v8/src/utils.h +3 -0
- data/vendor/v8/src/v8-counters.cc +18 -11
- data/vendor/v8/src/v8-counters.h +34 -13
- data/vendor/v8/src/v8.cc +66 -121
- data/vendor/v8/src/v8.h +7 -4
- data/vendor/v8/src/v8globals.h +18 -12
- data/vendor/v8/src/{memory.h → v8memory.h} +0 -0
- data/vendor/v8/src/v8natives.js +59 -18
- data/vendor/v8/src/v8threads.cc +127 -114
- data/vendor/v8/src/v8threads.h +42 -35
- data/vendor/v8/src/v8utils.h +2 -39
- data/vendor/v8/src/variables.h +1 -1
- data/vendor/v8/src/version.cc +26 -5
- data/vendor/v8/src/version.h +4 -0
- data/vendor/v8/src/virtual-frame-heavy-inl.h +2 -4
- data/vendor/v8/src/virtual-frame-light-inl.h +5 -4
- data/vendor/v8/src/vm-state-inl.h +21 -17
- data/vendor/v8/src/vm-state.h +7 -5
- data/vendor/v8/src/win32-headers.h +1 -0
- data/vendor/v8/src/x64/assembler-x64-inl.h +12 -11
- data/vendor/v8/src/x64/assembler-x64.cc +80 -40
- data/vendor/v8/src/x64/assembler-x64.h +67 -17
- data/vendor/v8/src/x64/builtins-x64.cc +34 -33
- data/vendor/v8/src/x64/code-stubs-x64.cc +636 -377
- data/vendor/v8/src/x64/code-stubs-x64.h +14 -48
- data/vendor/v8/src/x64/codegen-x64-inl.h +1 -1
- data/vendor/v8/src/x64/codegen-x64.cc +158 -136
- data/vendor/v8/src/x64/codegen-x64.h +4 -1
- data/vendor/v8/src/x64/cpu-x64.cc +7 -5
- data/vendor/v8/src/x64/debug-x64.cc +8 -6
- data/vendor/v8/src/x64/deoptimizer-x64.cc +195 -20
- data/vendor/v8/src/x64/disasm-x64.cc +42 -23
- data/vendor/v8/src/x64/frames-x64.cc +1 -1
- data/vendor/v8/src/x64/frames-x64.h +2 -2
- data/vendor/v8/src/x64/full-codegen-x64.cc +780 -218
- data/vendor/v8/src/x64/ic-x64.cc +77 -79
- data/vendor/v8/src/x64/jump-target-x64.cc +1 -1
- data/vendor/v8/src/x64/lithium-codegen-x64.cc +698 -181
- data/vendor/v8/src/x64/lithium-codegen-x64.h +31 -6
- data/vendor/v8/src/x64/lithium-x64.cc +136 -54
- data/vendor/v8/src/x64/lithium-x64.h +142 -51
- data/vendor/v8/src/x64/macro-assembler-x64.cc +456 -187
- data/vendor/v8/src/x64/macro-assembler-x64.h +166 -34
- data/vendor/v8/src/x64/regexp-macro-assembler-x64.cc +44 -28
- data/vendor/v8/src/x64/regexp-macro-assembler-x64.h +8 -4
- data/vendor/v8/src/x64/register-allocator-x64-inl.h +3 -3
- data/vendor/v8/src/x64/register-allocator-x64.cc +12 -8
- data/vendor/v8/src/x64/simulator-x64.h +5 -5
- data/vendor/v8/src/x64/stub-cache-x64.cc +299 -344
- data/vendor/v8/src/x64/virtual-frame-x64.cc +37 -13
- data/vendor/v8/src/x64/virtual-frame-x64.h +13 -7
- data/vendor/v8/src/zone-inl.h +49 -3
- data/vendor/v8/src/zone.cc +42 -41
- data/vendor/v8/src/zone.h +37 -34
- data/vendor/v8/test/benchmarks/testcfg.py +100 -0
- data/vendor/v8/test/cctest/SConscript +5 -4
- data/vendor/v8/test/cctest/cctest.h +3 -2
- data/vendor/v8/test/cctest/cctest.status +6 -11
- data/vendor/v8/test/cctest/test-accessors.cc +3 -3
- data/vendor/v8/test/cctest/test-alloc.cc +39 -33
- data/vendor/v8/test/cctest/test-api.cc +1092 -205
- data/vendor/v8/test/cctest/test-assembler-arm.cc +39 -25
- data/vendor/v8/test/cctest/test-assembler-ia32.cc +36 -37
- data/vendor/v8/test/cctest/test-assembler-mips.cc +1098 -40
- data/vendor/v8/test/cctest/test-assembler-x64.cc +32 -25
- data/vendor/v8/test/cctest/test-ast.cc +1 -0
- data/vendor/v8/test/cctest/test-circular-queue.cc +8 -5
- data/vendor/v8/test/cctest/test-compiler.cc +24 -24
- data/vendor/v8/test/cctest/test-cpu-profiler.cc +140 -5
- data/vendor/v8/test/cctest/test-dataflow.cc +1 -0
- data/vendor/v8/test/cctest/test-debug.cc +136 -77
- data/vendor/v8/test/cctest/test-decls.cc +1 -1
- data/vendor/v8/test/cctest/test-deoptimization.cc +25 -24
- data/vendor/v8/test/cctest/test-disasm-arm.cc +9 -4
- data/vendor/v8/test/cctest/test-disasm-ia32.cc +10 -8
- data/vendor/v8/test/cctest/test-func-name-inference.cc +10 -4
- data/vendor/v8/test/cctest/test-heap-profiler.cc +226 -164
- data/vendor/v8/test/cctest/test-heap.cc +240 -217
- data/vendor/v8/test/cctest/test-liveedit.cc +1 -0
- data/vendor/v8/test/cctest/test-log-stack-tracer.cc +18 -20
- data/vendor/v8/test/cctest/test-log.cc +114 -108
- data/vendor/v8/test/cctest/test-macro-assembler-x64.cc +247 -177
- data/vendor/v8/test/cctest/test-mark-compact.cc +129 -90
- data/vendor/v8/test/cctest/test-parsing.cc +15 -14
- data/vendor/v8/test/cctest/test-platform-linux.cc +1 -0
- data/vendor/v8/test/cctest/test-platform-tls.cc +66 -0
- data/vendor/v8/test/cctest/test-platform-win32.cc +1 -0
- data/vendor/v8/test/cctest/test-profile-generator.cc +1 -1
- data/vendor/v8/test/cctest/test-regexp.cc +53 -41
- data/vendor/v8/test/cctest/test-reloc-info.cc +18 -11
- data/vendor/v8/test/cctest/test-serialize.cc +44 -43
- data/vendor/v8/test/cctest/test-sockets.cc +8 -3
- data/vendor/v8/test/cctest/test-spaces.cc +47 -29
- data/vendor/v8/test/cctest/test-strings.cc +20 -20
- data/vendor/v8/test/cctest/test-thread-termination.cc +8 -3
- data/vendor/v8/test/cctest/test-threads.cc +5 -3
- data/vendor/v8/test/cctest/test-utils.cc +5 -4
- data/vendor/v8/test/cctest/testcfg.py +7 -3
- data/vendor/v8/test/es5conform/es5conform.status +2 -77
- data/vendor/v8/test/es5conform/testcfg.py +1 -1
- data/vendor/v8/test/message/testcfg.py +1 -1
- data/vendor/v8/test/mjsunit/accessors-on-global-object.js +3 -3
- data/vendor/v8/test/mjsunit/array-concat.js +43 -1
- data/vendor/v8/test/mjsunit/array-join.js +25 -0
- data/vendor/v8/test/mjsunit/bitops-info.js +7 -1
- data/vendor/v8/test/mjsunit/compiler/array-length.js +2 -2
- data/vendor/v8/test/mjsunit/compiler/global-accessors.js +47 -0
- data/vendor/v8/test/mjsunit/compiler/pic.js +1 -1
- data/vendor/v8/test/mjsunit/compiler/regress-loadfield.js +65 -0
- data/vendor/v8/test/mjsunit/math-sqrt.js +5 -1
- data/vendor/v8/test/mjsunit/mjsunit.js +59 -8
- data/vendor/v8/test/mjsunit/mjsunit.status +0 -12
- data/vendor/v8/test/mjsunit/mul-exhaustive.js +129 -11
- data/vendor/v8/test/mjsunit/negate-zero.js +1 -1
- data/vendor/v8/test/mjsunit/object-freeze.js +5 -13
- data/vendor/v8/test/mjsunit/object-prevent-extensions.js +9 -50
- data/vendor/v8/test/mjsunit/object-seal.js +4 -13
- data/vendor/v8/test/mjsunit/override-eval-with-non-function.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-1145.js +54 -0
- data/vendor/v8/test/mjsunit/regress/regress-1172-bis.js +37 -0
- data/vendor/v8/test/mjsunit/regress/regress-1181.js +54 -0
- data/vendor/v8/test/mjsunit/regress/regress-1207.js +35 -0
- data/vendor/v8/test/mjsunit/regress/regress-1209.js +34 -0
- data/vendor/v8/test/mjsunit/regress/regress-1210.js +48 -0
- data/vendor/v8/test/mjsunit/regress/regress-1213.js +43 -0
- data/vendor/v8/test/mjsunit/regress/regress-1218.js +29 -0
- data/vendor/v8/test/mjsunit/regress/regress-1229.js +79 -0
- data/vendor/v8/test/mjsunit/regress/regress-1233.js +47 -0
- data/vendor/v8/test/mjsunit/regress/regress-1236.js +34 -0
- data/vendor/v8/test/mjsunit/regress/regress-1237.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-1240.js +39 -0
- data/vendor/v8/test/mjsunit/regress/regress-1257.js +58 -0
- data/vendor/v8/test/mjsunit/regress/regress-1278.js +69 -0
- data/vendor/v8/test/mjsunit/regress/regress-create-exception.js +1 -0
- data/vendor/v8/test/mjsunit/regress/regress-lazy-deopt-reloc.js +52 -0
- data/vendor/v8/test/mjsunit/sin-cos.js +15 -10
- data/vendor/v8/test/mjsunit/smi-negative-zero.js +2 -2
- data/vendor/v8/test/mjsunit/str-to-num.js +1 -1
- data/vendor/v8/test/mjsunit/strict-mode.js +435 -0
- data/vendor/v8/test/mjsunit/testcfg.py +23 -6
- data/vendor/v8/test/mozilla/mozilla.status +0 -2
- data/vendor/v8/test/mozilla/testcfg.py +1 -1
- data/vendor/v8/test/preparser/empty.js +28 -0
- data/vendor/v8/test/preparser/functions-only.js +38 -0
- data/vendor/v8/test/preparser/non-alphanum.js +34 -0
- data/vendor/v8/test/preparser/symbols-only.js +49 -0
- data/vendor/v8/test/preparser/testcfg.py +90 -0
- data/vendor/v8/test/sputnik/testcfg.py +1 -1
- data/vendor/v8/test/test262/README +16 -0
- data/vendor/v8/test/test262/harness-adapt.js +80 -0
- data/vendor/v8/test/test262/test262.status +1506 -0
- data/vendor/v8/test/test262/testcfg.py +123 -0
- data/vendor/v8/tools/freebsd-tick-processor +10 -0
- data/vendor/v8/tools/gyp/v8.gyp +8 -33
- data/vendor/v8/tools/linux-tick-processor +5 -3
- data/vendor/v8/tools/test.py +37 -14
- data/vendor/v8/tools/tickprocessor.js +22 -8
- data/vendor/v8/tools/visual_studio/v8_base.vcproj +13 -1
- data/vendor/v8/tools/visual_studio/v8_base_arm.vcproj +5 -1
- data/vendor/v8/tools/visual_studio/v8_base_x64.vcproj +5 -1
- data/vendor/v8/tools/visual_studio/x64.vsprops +1 -0
- metadata +1495 -1341
- data/ext/extconf.rb +0 -22
- data/ext/mustang.cpp +0 -58
- data/vendor/v8/src/top.h +0 -608
data/vendor/v8/src/log-utils.h
CHANGED
@@ -33,6 +33,8 @@ namespace internal {
|
|
33
33
|
|
34
34
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
35
35
|
|
36
|
+
class Logger;
|
37
|
+
|
36
38
|
// A memory buffer that increments its size as you write in it. Size
|
37
39
|
// is incremented with 'block_size' steps, never exceeding 'max_size'.
|
38
40
|
// During growth, memory contents are never copied. At the end of the
|
@@ -89,28 +91,23 @@ class LogDynamicBuffer {
|
|
89
91
|
|
90
92
|
|
91
93
|
// Functions and data for performing output of log messages.
|
92
|
-
class Log
|
94
|
+
class Log {
|
93
95
|
public:
|
94
|
-
// Opens stdout for logging.
|
95
|
-
static void OpenStdout();
|
96
96
|
|
97
|
-
//
|
98
|
-
|
99
|
-
|
100
|
-
// Opens memory buffer for logging.
|
101
|
-
static void OpenMemoryBuffer();
|
97
|
+
// Performs process-wide initialization.
|
98
|
+
void Initialize();
|
102
99
|
|
103
100
|
// Disables logging, but preserves acquired resources.
|
104
|
-
|
101
|
+
void stop() { is_stopped_ = true; }
|
105
102
|
|
106
|
-
// Frees all resources acquired in Open... functions.
|
107
|
-
|
103
|
+
// Frees all resources acquired in Initialize and Open... functions.
|
104
|
+
void Close();
|
108
105
|
|
109
106
|
// See description in include/v8.h.
|
110
|
-
|
107
|
+
int GetLogLines(int from_pos, char* dest_buf, int max_size);
|
111
108
|
|
112
109
|
// Returns whether logging is enabled.
|
113
|
-
|
110
|
+
bool IsEnabled() {
|
114
111
|
return !is_stopped_ && (output_handle_ != NULL || output_buffer_ != NULL);
|
115
112
|
}
|
116
113
|
|
@@ -118,16 +115,19 @@ class Log : public AllStatic {
|
|
118
115
|
static const int kMessageBufferSize = v8::V8::kMinimumSizeForLogLinesBuffer;
|
119
116
|
|
120
117
|
private:
|
121
|
-
|
118
|
+
explicit Log(Logger* logger);
|
119
|
+
|
120
|
+
// Opens stdout for logging.
|
121
|
+
void OpenStdout();
|
122
122
|
|
123
|
-
//
|
124
|
-
|
123
|
+
// Opens file for logging.
|
124
|
+
void OpenFile(const char* name);
|
125
125
|
|
126
|
-
//
|
127
|
-
|
126
|
+
// Opens memory buffer for logging.
|
127
|
+
void OpenMemoryBuffer();
|
128
128
|
|
129
129
|
// Implementation of writing to a log file.
|
130
|
-
|
130
|
+
int WriteToFile(const char* msg, int length) {
|
131
131
|
ASSERT(output_handle_ != NULL);
|
132
132
|
size_t rv = fwrite(msg, 1, length, output_handle_);
|
133
133
|
ASSERT(static_cast<size_t>(length) == rv);
|
@@ -137,25 +137,27 @@ class Log : public AllStatic {
|
|
137
137
|
}
|
138
138
|
|
139
139
|
// Implementation of writing to a memory buffer.
|
140
|
-
|
140
|
+
int WriteToMemory(const char* msg, int length) {
|
141
141
|
ASSERT(output_buffer_ != NULL);
|
142
142
|
return output_buffer_->Write(msg, length);
|
143
143
|
}
|
144
144
|
|
145
|
+
bool write_to_file_;
|
146
|
+
|
145
147
|
// Whether logging is stopped (e.g. due to insufficient resources).
|
146
|
-
|
148
|
+
bool is_stopped_;
|
147
149
|
|
148
150
|
// When logging is active, either output_handle_ or output_buffer_ is used
|
149
151
|
// to store a pointer to log destination. If logging was opened via OpenStdout
|
150
152
|
// or OpenFile, then output_handle_ is used. If logging was opened
|
151
153
|
// via OpenMemoryBuffer, then output_buffer_ is used.
|
152
154
|
// mutex_ should be acquired before using output_handle_ or output_buffer_.
|
153
|
-
|
155
|
+
FILE* output_handle_;
|
154
156
|
|
155
157
|
// Used when low-level profiling is active to save code object contents.
|
156
|
-
|
158
|
+
FILE* output_code_handle_;
|
157
159
|
|
158
|
-
|
160
|
+
LogDynamicBuffer* output_buffer_;
|
159
161
|
|
160
162
|
// Size of dynamic buffer block (and dynamic buffer initial size).
|
161
163
|
static const int kDynamicBufferBlockSize = 65536;
|
@@ -164,15 +166,17 @@ class Log : public AllStatic {
|
|
164
166
|
static const int kMaxDynamicBufferSize = 50 * 1024 * 1024;
|
165
167
|
|
166
168
|
// Message to "seal" dynamic buffer with.
|
167
|
-
static const char* kDynamicBufferSeal;
|
169
|
+
static const char* const kDynamicBufferSeal;
|
168
170
|
|
169
171
|
// mutex_ is a Mutex used for enforcing exclusive
|
170
172
|
// access to the formatting buffer and the log file or log memory buffer.
|
171
|
-
|
173
|
+
Mutex* mutex_;
|
172
174
|
|
173
175
|
// Buffer used for formatting log messages. This is a singleton buffer and
|
174
176
|
// mutex_ should be acquired before using it.
|
175
|
-
|
177
|
+
char* message_buffer_;
|
178
|
+
|
179
|
+
Logger* logger_;
|
176
180
|
|
177
181
|
friend class Logger;
|
178
182
|
friend class LogMessageBuilder;
|
@@ -185,7 +189,7 @@ class LogMessageBuilder BASE_EMBEDDED {
|
|
185
189
|
public:
|
186
190
|
// Create a message builder starting from position 0. This acquires the mutex
|
187
191
|
// in the log as well.
|
188
|
-
explicit LogMessageBuilder();
|
192
|
+
explicit LogMessageBuilder(Logger* logger);
|
189
193
|
~LogMessageBuilder() { }
|
190
194
|
|
191
195
|
// Append string data to the log message.
|
@@ -211,16 +215,9 @@ class LogMessageBuilder BASE_EMBEDDED {
|
|
211
215
|
// Write the log message to the log file currently opened.
|
212
216
|
void WriteToLogFile();
|
213
217
|
|
214
|
-
// A handler that is called when Log::Write fails.
|
215
|
-
typedef void (*WriteFailureHandler)();
|
216
|
-
|
217
|
-
static void set_write_failure_handler(WriteFailureHandler handler) {
|
218
|
-
write_failure_handler = handler;
|
219
|
-
}
|
220
|
-
|
221
218
|
private:
|
222
|
-
static WriteFailureHandler write_failure_handler;
|
223
219
|
|
220
|
+
Log* log_;
|
224
221
|
ScopedLock sl;
|
225
222
|
int pos_;
|
226
223
|
};
|
data/vendor/v8/src/log.cc
CHANGED
@@ -52,24 +52,25 @@ namespace internal {
|
|
52
52
|
//
|
53
53
|
class SlidingStateWindow {
|
54
54
|
public:
|
55
|
-
SlidingStateWindow();
|
55
|
+
explicit SlidingStateWindow(Isolate* isolate);
|
56
56
|
~SlidingStateWindow();
|
57
57
|
void AddState(StateTag state);
|
58
58
|
|
59
59
|
private:
|
60
60
|
static const int kBufferSize = 256;
|
61
|
+
Counters* counters_;
|
61
62
|
int current_index_;
|
62
63
|
bool is_full_;
|
63
64
|
byte buffer_[kBufferSize];
|
64
65
|
|
65
66
|
|
66
67
|
void IncrementStateCounter(StateTag state) {
|
67
|
-
|
68
|
+
counters_->state_counters(state)->Increment();
|
68
69
|
}
|
69
70
|
|
70
71
|
|
71
72
|
void DecrementStateCounter(StateTag state) {
|
72
|
-
|
73
|
+
counters_->state_counters(state)->Decrement();
|
73
74
|
}
|
74
75
|
};
|
75
76
|
|
@@ -82,7 +83,7 @@ class SlidingStateWindow {
|
|
82
83
|
//
|
83
84
|
class Profiler: public Thread {
|
84
85
|
public:
|
85
|
-
Profiler();
|
86
|
+
explicit Profiler(Isolate* isolate);
|
86
87
|
void Engage();
|
87
88
|
void Disengage();
|
88
89
|
|
@@ -113,9 +114,9 @@ class Profiler: public Thread {
|
|
113
114
|
void Run();
|
114
115
|
|
115
116
|
// Pause and Resume TickSample data collection.
|
116
|
-
|
117
|
-
|
118
|
-
|
117
|
+
bool paused() const { return paused_; }
|
118
|
+
void pause() { paused_ = true; }
|
119
|
+
void resume() { paused_ = false; }
|
119
120
|
|
120
121
|
private:
|
121
122
|
// Returns the next index in the cyclic buffer.
|
@@ -137,43 +138,45 @@ class Profiler: public Thread {
|
|
137
138
|
bool running_;
|
138
139
|
|
139
140
|
// Tells whether we are currently recording tick samples.
|
140
|
-
|
141
|
+
bool paused_;
|
141
142
|
};
|
142
143
|
|
143
|
-
bool Profiler::paused_ = false;
|
144
|
-
|
145
144
|
|
146
145
|
//
|
147
146
|
// StackTracer implementation
|
148
147
|
//
|
149
|
-
void StackTracer::Trace(TickSample* sample) {
|
148
|
+
void StackTracer::Trace(Isolate* isolate, TickSample* sample) {
|
149
|
+
ASSERT(isolate->IsInitialized());
|
150
|
+
|
150
151
|
sample->tos = NULL;
|
151
152
|
sample->frames_count = 0;
|
153
|
+
sample->has_external_callback = false;
|
152
154
|
|
153
155
|
// Avoid collecting traces while doing GC.
|
154
156
|
if (sample->state == GC) return;
|
155
157
|
|
156
|
-
const Address js_entry_sp =
|
158
|
+
const Address js_entry_sp =
|
159
|
+
Isolate::js_entry_sp(isolate->thread_local_top());
|
157
160
|
if (js_entry_sp == 0) {
|
158
161
|
// Not executing JS now.
|
159
162
|
return;
|
160
163
|
}
|
161
164
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
if (callback != NULL && callback != sample->pc) {
|
172
|
-
sample->stack[i++] = callback;
|
165
|
+
const Address callback = isolate->external_callback();
|
166
|
+
if (callback != NULL) {
|
167
|
+
sample->external_callback = callback;
|
168
|
+
sample->has_external_callback = true;
|
169
|
+
} else {
|
170
|
+
// Sample potential return address value for frameless invocation of
|
171
|
+
// stubs (we'll figure out later, if this value makes sense).
|
172
|
+
sample->tos = Memory::Address_at(sample->sp);
|
173
|
+
sample->has_external_callback = false;
|
173
174
|
}
|
174
175
|
|
175
|
-
SafeStackTraceFrameIterator it(
|
176
|
+
SafeStackTraceFrameIterator it(isolate,
|
177
|
+
sample->fp, sample->sp,
|
176
178
|
sample->sp, js_entry_sp);
|
179
|
+
int i = 0;
|
177
180
|
while (!it.done() && i < TickSample::kMaxFramesCount) {
|
178
181
|
sample->stack[i++] = it.frame()->pc();
|
179
182
|
it.Advance();
|
@@ -188,8 +191,8 @@ void StackTracer::Trace(TickSample* sample) {
|
|
188
191
|
//
|
189
192
|
class Ticker: public Sampler {
|
190
193
|
public:
|
191
|
-
explicit Ticker(int interval)
|
192
|
-
Sampler(interval),
|
194
|
+
explicit Ticker(Isolate* isolate, int interval):
|
195
|
+
Sampler(isolate, interval),
|
193
196
|
window_(NULL),
|
194
197
|
profiler_(NULL) {}
|
195
198
|
|
@@ -225,7 +228,7 @@ class Ticker: public Sampler {
|
|
225
228
|
|
226
229
|
protected:
|
227
230
|
virtual void DoSampleStack(TickSample* sample) {
|
228
|
-
StackTracer::Trace(sample);
|
231
|
+
StackTracer::Trace(isolate(), sample);
|
229
232
|
}
|
230
233
|
|
231
234
|
private:
|
@@ -237,16 +240,17 @@ class Ticker: public Sampler {
|
|
237
240
|
//
|
238
241
|
// SlidingStateWindow implementation.
|
239
242
|
//
|
240
|
-
SlidingStateWindow::SlidingStateWindow(
|
243
|
+
SlidingStateWindow::SlidingStateWindow(Isolate* isolate)
|
244
|
+
: counters_(isolate->counters()), current_index_(0), is_full_(false) {
|
241
245
|
for (int i = 0; i < kBufferSize; i++) {
|
242
246
|
buffer_[i] = static_cast<byte>(OTHER);
|
243
247
|
}
|
244
|
-
|
248
|
+
isolate->logger()->ticker_->SetWindow(this);
|
245
249
|
}
|
246
250
|
|
247
251
|
|
248
252
|
SlidingStateWindow::~SlidingStateWindow() {
|
249
|
-
|
253
|
+
LOGGER->ticker_->ClearWindow();
|
250
254
|
}
|
251
255
|
|
252
256
|
|
@@ -266,14 +270,15 @@ void SlidingStateWindow::AddState(StateTag state) {
|
|
266
270
|
//
|
267
271
|
// Profiler implementation.
|
268
272
|
//
|
269
|
-
Profiler::Profiler()
|
270
|
-
: Thread("v8:Profiler"),
|
273
|
+
Profiler::Profiler(Isolate* isolate)
|
274
|
+
: Thread(isolate, "v8:Profiler"),
|
271
275
|
head_(0),
|
272
276
|
tail_(0),
|
273
277
|
overflow_(false),
|
274
278
|
buffer_semaphore_(OS::CreateSemaphore(0)),
|
275
279
|
engaged_(false),
|
276
|
-
running_(false)
|
280
|
+
running_(false),
|
281
|
+
paused_(false) {
|
277
282
|
}
|
278
283
|
|
279
284
|
|
@@ -292,9 +297,9 @@ void Profiler::Engage() {
|
|
292
297
|
Start();
|
293
298
|
|
294
299
|
// Register to get ticks.
|
295
|
-
|
300
|
+
LOGGER->ticker_->SetProfiler(this);
|
296
301
|
|
297
|
-
|
302
|
+
LOGGER->ProfilerBeginEvent();
|
298
303
|
}
|
299
304
|
|
300
305
|
|
@@ -302,7 +307,7 @@ void Profiler::Disengage() {
|
|
302
307
|
if (!engaged_) return;
|
303
308
|
|
304
309
|
// Stop receiving ticks.
|
305
|
-
|
310
|
+
LOGGER->ticker_->ClearProfiler();
|
306
311
|
|
307
312
|
// Terminate the worker thread by setting running_ to false,
|
308
313
|
// inserting a fake element in the queue and then wait for
|
@@ -314,15 +319,16 @@ void Profiler::Disengage() {
|
|
314
319
|
Insert(&sample);
|
315
320
|
Join();
|
316
321
|
|
317
|
-
LOG(UncheckedStringEvent("profiler", "end"));
|
322
|
+
LOG(ISOLATE, UncheckedStringEvent("profiler", "end"));
|
318
323
|
}
|
319
324
|
|
320
325
|
|
321
326
|
void Profiler::Run() {
|
322
327
|
TickSample sample;
|
323
328
|
bool overflow = Remove(&sample);
|
329
|
+
i::Isolate* isolate = ISOLATE;
|
324
330
|
while (running_) {
|
325
|
-
LOG(TickEvent(&sample, overflow));
|
331
|
+
LOG(isolate, TickEvent(&sample, overflow));
|
326
332
|
overflow = Remove(&sample);
|
327
333
|
}
|
328
334
|
}
|
@@ -331,23 +337,38 @@ void Profiler::Run() {
|
|
331
337
|
//
|
332
338
|
// Logger class implementation.
|
333
339
|
//
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
+
|
341
|
+
Logger::Logger()
|
342
|
+
: ticker_(NULL),
|
343
|
+
profiler_(NULL),
|
344
|
+
sliding_state_window_(NULL),
|
345
|
+
log_events_(NULL),
|
346
|
+
logging_nesting_(0),
|
347
|
+
cpu_profiler_nesting_(0),
|
348
|
+
heap_profiler_nesting_(0),
|
349
|
+
log_(new Log(this)),
|
350
|
+
is_initialized_(false),
|
351
|
+
last_address_(NULL),
|
352
|
+
prev_sp_(NULL),
|
353
|
+
prev_function_(NULL),
|
354
|
+
prev_to_(NULL),
|
355
|
+
prev_code_(NULL) {
|
356
|
+
}
|
357
|
+
|
358
|
+
Logger::~Logger() {
|
359
|
+
delete log_;
|
360
|
+
}
|
340
361
|
|
341
362
|
#define DECLARE_EVENT(ignore1, name) name,
|
342
|
-
const char* kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
|
363
|
+
static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
|
343
364
|
LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT)
|
344
365
|
};
|
345
366
|
#undef DECLARE_EVENT
|
346
367
|
|
347
368
|
|
348
369
|
void Logger::ProfilerBeginEvent() {
|
349
|
-
if (!
|
350
|
-
LogMessageBuilder msg;
|
370
|
+
if (!log_->IsEnabled()) return;
|
371
|
+
LogMessageBuilder msg(this);
|
351
372
|
msg.Append("profiler,\"begin\",%d\n", kSamplingIntervalMs);
|
352
373
|
msg.WriteToLogFile();
|
353
374
|
}
|
@@ -364,8 +385,8 @@ void Logger::StringEvent(const char* name, const char* value) {
|
|
364
385
|
|
365
386
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
366
387
|
void Logger::UncheckedStringEvent(const char* name, const char* value) {
|
367
|
-
if (!
|
368
|
-
LogMessageBuilder msg;
|
388
|
+
if (!log_->IsEnabled()) return;
|
389
|
+
LogMessageBuilder msg(this);
|
369
390
|
msg.Append("%s,\"%s\"\n", name, value);
|
370
391
|
msg.WriteToLogFile();
|
371
392
|
}
|
@@ -388,8 +409,8 @@ void Logger::IntPtrTEvent(const char* name, intptr_t value) {
|
|
388
409
|
|
389
410
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
390
411
|
void Logger::UncheckedIntEvent(const char* name, int value) {
|
391
|
-
if (!
|
392
|
-
LogMessageBuilder msg;
|
412
|
+
if (!log_->IsEnabled()) return;
|
413
|
+
LogMessageBuilder msg(this);
|
393
414
|
msg.Append("%s,%d\n", name, value);
|
394
415
|
msg.WriteToLogFile();
|
395
416
|
}
|
@@ -398,8 +419,8 @@ void Logger::UncheckedIntEvent(const char* name, int value) {
|
|
398
419
|
|
399
420
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
400
421
|
void Logger::UncheckedIntPtrTEvent(const char* name, intptr_t value) {
|
401
|
-
if (!
|
402
|
-
LogMessageBuilder msg;
|
422
|
+
if (!log_->IsEnabled()) return;
|
423
|
+
LogMessageBuilder msg(this);
|
403
424
|
msg.Append("%s,%" V8_PTR_PREFIX "d\n", name, value);
|
404
425
|
msg.WriteToLogFile();
|
405
426
|
}
|
@@ -408,8 +429,8 @@ void Logger::UncheckedIntPtrTEvent(const char* name, intptr_t value) {
|
|
408
429
|
|
409
430
|
void Logger::HandleEvent(const char* name, Object** location) {
|
410
431
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
411
|
-
if (!
|
412
|
-
LogMessageBuilder msg;
|
432
|
+
if (!log_->IsEnabled() || !FLAG_log_handles) return;
|
433
|
+
LogMessageBuilder msg(this);
|
413
434
|
msg.Append("%s,0x%" V8PRIxPTR "\n", name, location);
|
414
435
|
msg.WriteToLogFile();
|
415
436
|
#endif
|
@@ -421,8 +442,8 @@ void Logger::HandleEvent(const char* name, Object** location) {
|
|
421
442
|
// caller's responsibility to ensure that log is enabled and that
|
422
443
|
// FLAG_log_api is true.
|
423
444
|
void Logger::ApiEvent(const char* format, ...) {
|
424
|
-
ASSERT(
|
425
|
-
LogMessageBuilder msg;
|
445
|
+
ASSERT(log_->IsEnabled() && FLAG_log_api);
|
446
|
+
LogMessageBuilder msg(this);
|
426
447
|
va_list ap;
|
427
448
|
va_start(ap, format);
|
428
449
|
msg.AppendVA(format, ap);
|
@@ -434,7 +455,7 @@ void Logger::ApiEvent(const char* format, ...) {
|
|
434
455
|
|
435
456
|
void Logger::ApiNamedSecurityCheck(Object* key) {
|
436
457
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
437
|
-
if (!
|
458
|
+
if (!log_->IsEnabled() || !FLAG_log_api) return;
|
438
459
|
if (key->IsString()) {
|
439
460
|
SmartPointer<char> str =
|
440
461
|
String::cast(key)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
|
@@ -452,8 +473,8 @@ void Logger::SharedLibraryEvent(const char* library_path,
|
|
452
473
|
uintptr_t start,
|
453
474
|
uintptr_t end) {
|
454
475
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
455
|
-
if (!
|
456
|
-
LogMessageBuilder msg;
|
476
|
+
if (!log_->IsEnabled() || !FLAG_prof) return;
|
477
|
+
LogMessageBuilder msg(this);
|
457
478
|
msg.Append("shared-library,\"%s\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR "\n",
|
458
479
|
library_path,
|
459
480
|
start,
|
@@ -467,8 +488,8 @@ void Logger::SharedLibraryEvent(const wchar_t* library_path,
|
|
467
488
|
uintptr_t start,
|
468
489
|
uintptr_t end) {
|
469
490
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
470
|
-
if (!
|
471
|
-
LogMessageBuilder msg;
|
491
|
+
if (!log_->IsEnabled() || !FLAG_prof) return;
|
492
|
+
LogMessageBuilder msg(this);
|
472
493
|
msg.Append("shared-library,\"%ls\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR "\n",
|
473
494
|
library_path,
|
474
495
|
start,
|
@@ -482,7 +503,7 @@ void Logger::SharedLibraryEvent(const wchar_t* library_path,
|
|
482
503
|
void Logger::LogRegExpSource(Handle<JSRegExp> regexp) {
|
483
504
|
// Prints "/" + re.source + "/" +
|
484
505
|
// (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"")
|
485
|
-
LogMessageBuilder msg;
|
506
|
+
LogMessageBuilder msg(this);
|
486
507
|
|
487
508
|
Handle<Object> source = GetProperty(regexp, "source");
|
488
509
|
if (!source->IsString()) {
|
@@ -524,8 +545,8 @@ void Logger::LogRegExpSource(Handle<JSRegExp> regexp) {
|
|
524
545
|
|
525
546
|
void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) {
|
526
547
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
527
|
-
if (!
|
528
|
-
LogMessageBuilder msg;
|
548
|
+
if (!log_->IsEnabled() || !FLAG_log_regexp) return;
|
549
|
+
LogMessageBuilder msg(this);
|
529
550
|
msg.Append("regexp-compile,");
|
530
551
|
LogRegExpSource(regexp);
|
531
552
|
msg.Append(in_cache ? ",hit\n" : ",miss\n");
|
@@ -536,9 +557,9 @@ void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) {
|
|
536
557
|
|
537
558
|
void Logger::LogRuntime(Vector<const char> format, JSArray* args) {
|
538
559
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
539
|
-
if (!
|
560
|
+
if (!log_->IsEnabled() || !FLAG_log_runtime) return;
|
540
561
|
HandleScope scope;
|
541
|
-
LogMessageBuilder msg;
|
562
|
+
LogMessageBuilder msg(this);
|
542
563
|
for (int i = 0; i < format.length(); i++) {
|
543
564
|
char c = format[i];
|
544
565
|
if (c == '%' && i <= format.length() - 2) {
|
@@ -582,7 +603,7 @@ void Logger::LogRuntime(Vector<const char> format, JSArray* args) {
|
|
582
603
|
|
583
604
|
void Logger::ApiIndexedSecurityCheck(uint32_t index) {
|
584
605
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
585
|
-
if (!
|
606
|
+
if (!log_->IsEnabled() || !FLAG_log_api) return;
|
586
607
|
ApiEvent("api,check-security,%u\n", index);
|
587
608
|
#endif
|
588
609
|
}
|
@@ -593,13 +614,13 @@ void Logger::ApiNamedPropertyAccess(const char* tag,
|
|
593
614
|
Object* name) {
|
594
615
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
595
616
|
ASSERT(name->IsString());
|
596
|
-
if (!
|
617
|
+
if (!log_->IsEnabled() || !FLAG_log_api) return;
|
597
618
|
String* class_name_obj = holder->class_name();
|
598
619
|
SmartPointer<char> class_name =
|
599
620
|
class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
|
600
621
|
SmartPointer<char> property_name =
|
601
622
|
String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
|
602
|
-
|
623
|
+
ApiEvent("api,%s,\"%s\",\"%s\"\n", tag, *class_name, *property_name);
|
603
624
|
#endif
|
604
625
|
}
|
605
626
|
|
@@ -607,37 +628,37 @@ void Logger::ApiIndexedPropertyAccess(const char* tag,
|
|
607
628
|
JSObject* holder,
|
608
629
|
uint32_t index) {
|
609
630
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
610
|
-
if (!
|
631
|
+
if (!log_->IsEnabled() || !FLAG_log_api) return;
|
611
632
|
String* class_name_obj = holder->class_name();
|
612
633
|
SmartPointer<char> class_name =
|
613
634
|
class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
|
614
|
-
|
635
|
+
ApiEvent("api,%s,\"%s\",%u\n", tag, *class_name, index);
|
615
636
|
#endif
|
616
637
|
}
|
617
638
|
|
618
639
|
void Logger::ApiObjectAccess(const char* tag, JSObject* object) {
|
619
640
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
620
|
-
if (!
|
641
|
+
if (!log_->IsEnabled() || !FLAG_log_api) return;
|
621
642
|
String* class_name_obj = object->class_name();
|
622
643
|
SmartPointer<char> class_name =
|
623
644
|
class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
|
624
|
-
|
645
|
+
ApiEvent("api,%s,\"%s\"\n", tag, *class_name);
|
625
646
|
#endif
|
626
647
|
}
|
627
648
|
|
628
649
|
|
629
650
|
void Logger::ApiEntryCall(const char* name) {
|
630
651
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
631
|
-
if (!
|
632
|
-
|
652
|
+
if (!log_->IsEnabled() || !FLAG_log_api) return;
|
653
|
+
ApiEvent("api,%s\n", name);
|
633
654
|
#endif
|
634
655
|
}
|
635
656
|
|
636
657
|
|
637
658
|
void Logger::NewEvent(const char* name, void* object, size_t size) {
|
638
659
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
639
|
-
if (!
|
640
|
-
LogMessageBuilder msg;
|
660
|
+
if (!log_->IsEnabled() || !FLAG_log) return;
|
661
|
+
LogMessageBuilder msg(this);
|
641
662
|
msg.Append("new,%s,0x%" V8PRIxPTR ",%u\n", name, object,
|
642
663
|
static_cast<unsigned int>(size));
|
643
664
|
msg.WriteToLogFile();
|
@@ -647,19 +668,28 @@ void Logger::NewEvent(const char* name, void* object, size_t size) {
|
|
647
668
|
|
648
669
|
void Logger::DeleteEvent(const char* name, void* object) {
|
649
670
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
650
|
-
if (!
|
651
|
-
LogMessageBuilder msg;
|
671
|
+
if (!log_->IsEnabled() || !FLAG_log) return;
|
672
|
+
LogMessageBuilder msg(this);
|
652
673
|
msg.Append("delete,%s,0x%" V8PRIxPTR "\n", name, object);
|
653
674
|
msg.WriteToLogFile();
|
654
675
|
#endif
|
655
676
|
}
|
656
677
|
|
657
678
|
|
679
|
+
void Logger::NewEventStatic(const char* name, void* object, size_t size) {
|
680
|
+
LOGGER->NewEvent(name, object, size);
|
681
|
+
}
|
682
|
+
|
683
|
+
|
684
|
+
void Logger::DeleteEventStatic(const char* name, void* object) {
|
685
|
+
LOGGER->DeleteEvent(name, object);
|
686
|
+
}
|
687
|
+
|
658
688
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
659
689
|
void Logger::CallbackEventInternal(const char* prefix, const char* name,
|
660
690
|
Address entry_point) {
|
661
|
-
if (!
|
662
|
-
LogMessageBuilder msg;
|
691
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
692
|
+
LogMessageBuilder msg(this);
|
663
693
|
msg.Append("%s,%s,",
|
664
694
|
kLogEventsNames[CODE_CREATION_EVENT],
|
665
695
|
kLogEventsNames[CALLBACK_TAG]);
|
@@ -673,7 +703,7 @@ void Logger::CallbackEventInternal(const char* prefix, const char* name,
|
|
673
703
|
|
674
704
|
void Logger::CallbackEvent(String* name, Address entry_point) {
|
675
705
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
676
|
-
if (!
|
706
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
677
707
|
SmartPointer<char> str =
|
678
708
|
name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
|
679
709
|
CallbackEventInternal("", *str, entry_point);
|
@@ -683,7 +713,7 @@ void Logger::CallbackEvent(String* name, Address entry_point) {
|
|
683
713
|
|
684
714
|
void Logger::GetterCallbackEvent(String* name, Address entry_point) {
|
685
715
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
686
|
-
if (!
|
716
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
687
717
|
SmartPointer<char> str =
|
688
718
|
name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
|
689
719
|
CallbackEventInternal("get ", *str, entry_point);
|
@@ -693,7 +723,7 @@ void Logger::GetterCallbackEvent(String* name, Address entry_point) {
|
|
693
723
|
|
694
724
|
void Logger::SetterCallbackEvent(String* name, Address entry_point) {
|
695
725
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
696
|
-
if (!
|
726
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
697
727
|
SmartPointer<char> str =
|
698
728
|
name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
|
699
729
|
CallbackEventInternal("set ", *str, entry_point);
|
@@ -705,8 +735,8 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
|
|
705
735
|
Code* code,
|
706
736
|
const char* comment) {
|
707
737
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
708
|
-
if (!
|
709
|
-
LogMessageBuilder msg;
|
738
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
739
|
+
LogMessageBuilder msg(this);
|
710
740
|
msg.Append("%s,%s,",
|
711
741
|
kLogEventsNames[CODE_CREATION_EVENT],
|
712
742
|
kLogEventsNames[tag]);
|
@@ -758,9 +788,12 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
|
|
758
788
|
SharedFunctionInfo* shared,
|
759
789
|
String* name) {
|
760
790
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
761
|
-
if (!
|
762
|
-
if (code ==
|
763
|
-
|
791
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
792
|
+
if (code == Isolate::Current()->builtins()->builtin(
|
793
|
+
Builtins::kLazyCompile))
|
794
|
+
return;
|
795
|
+
|
796
|
+
LogMessageBuilder msg(this);
|
764
797
|
SmartPointer<char> str =
|
765
798
|
name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
|
766
799
|
msg.Append("%s,%s,",
|
@@ -785,8 +818,8 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
|
|
785
818
|
SharedFunctionInfo* shared,
|
786
819
|
String* source, int line) {
|
787
820
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
788
|
-
if (!
|
789
|
-
LogMessageBuilder msg;
|
821
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
822
|
+
LogMessageBuilder msg(this);
|
790
823
|
SmartPointer<char> name =
|
791
824
|
shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
|
792
825
|
SmartPointer<char> sourcestr =
|
@@ -811,8 +844,8 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
|
|
811
844
|
|
812
845
|
void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) {
|
813
846
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
814
|
-
if (!
|
815
|
-
LogMessageBuilder msg;
|
847
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
848
|
+
LogMessageBuilder msg(this);
|
816
849
|
msg.Append("%s,%s,",
|
817
850
|
kLogEventsNames[CODE_CREATION_EVENT],
|
818
851
|
kLogEventsNames[tag]);
|
@@ -827,8 +860,8 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) {
|
|
827
860
|
|
828
861
|
void Logger::CodeMovingGCEvent() {
|
829
862
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
830
|
-
if (!
|
831
|
-
LogMessageBuilder msg;
|
863
|
+
if (!log_->IsEnabled() || !FLAG_log_code || !FLAG_ll_prof) return;
|
864
|
+
LogMessageBuilder msg(this);
|
832
865
|
msg.Append("%s\n", kLogEventsNames[CODE_MOVING_GC]);
|
833
866
|
msg.WriteToLogFile();
|
834
867
|
OS::SignalCodeMovingGC();
|
@@ -838,8 +871,8 @@ void Logger::CodeMovingGCEvent() {
|
|
838
871
|
|
839
872
|
void Logger::RegExpCodeCreateEvent(Code* code, String* source) {
|
840
873
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
841
|
-
if (!
|
842
|
-
LogMessageBuilder msg;
|
874
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
875
|
+
LogMessageBuilder msg(this);
|
843
876
|
msg.Append("%s,%s,",
|
844
877
|
kLogEventsNames[CODE_CREATION_EVENT],
|
845
878
|
kLogEventsNames[REG_EXP_TAG]);
|
@@ -870,8 +903,8 @@ void Logger::CodeDeleteEvent(Address from) {
|
|
870
903
|
|
871
904
|
void Logger::SnapshotPositionEvent(Address addr, int pos) {
|
872
905
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
873
|
-
if (!
|
874
|
-
LogMessageBuilder msg;
|
906
|
+
if (!log_->IsEnabled() || !FLAG_log_snapshot_positions) return;
|
907
|
+
LogMessageBuilder msg(this);
|
875
908
|
msg.Append("%s,", kLogEventsNames[SNAPSHOT_POSITION_EVENT]);
|
876
909
|
msg.AppendAddress(addr);
|
877
910
|
msg.Append(",%d", pos);
|
@@ -881,9 +914,9 @@ void Logger::SnapshotPositionEvent(Address addr, int pos) {
|
|
881
914
|
}
|
882
915
|
|
883
916
|
|
884
|
-
void Logger::
|
917
|
+
void Logger::SharedFunctionInfoMoveEvent(Address from, Address to) {
|
885
918
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
886
|
-
MoveEventInternal(
|
919
|
+
MoveEventInternal(SHARED_FUNC_MOVE_EVENT, from, to);
|
887
920
|
#endif
|
888
921
|
}
|
889
922
|
|
@@ -892,8 +925,8 @@ void Logger::SFIMoveEvent(Address from, Address to) {
|
|
892
925
|
void Logger::MoveEventInternal(LogEventsAndTags event,
|
893
926
|
Address from,
|
894
927
|
Address to) {
|
895
|
-
if (!
|
896
|
-
LogMessageBuilder msg;
|
928
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
929
|
+
LogMessageBuilder msg(this);
|
897
930
|
msg.Append("%s,", kLogEventsNames[event]);
|
898
931
|
msg.AppendAddress(from);
|
899
932
|
msg.Append(',');
|
@@ -906,8 +939,8 @@ void Logger::MoveEventInternal(LogEventsAndTags event,
|
|
906
939
|
|
907
940
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
908
941
|
void Logger::DeleteEventInternal(LogEventsAndTags event, Address from) {
|
909
|
-
if (!
|
910
|
-
LogMessageBuilder msg;
|
942
|
+
if (!log_->IsEnabled() || !FLAG_log_code) return;
|
943
|
+
LogMessageBuilder msg(this);
|
911
944
|
msg.Append("%s,", kLogEventsNames[event]);
|
912
945
|
msg.AppendAddress(from);
|
913
946
|
msg.Append('\n');
|
@@ -918,8 +951,8 @@ void Logger::DeleteEventInternal(LogEventsAndTags event, Address from) {
|
|
918
951
|
|
919
952
|
void Logger::ResourceEvent(const char* name, const char* tag) {
|
920
953
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
921
|
-
if (!
|
922
|
-
LogMessageBuilder msg;
|
954
|
+
if (!log_->IsEnabled() || !FLAG_log) return;
|
955
|
+
LogMessageBuilder msg(this);
|
923
956
|
msg.Append("%s,%s,", name, tag);
|
924
957
|
|
925
958
|
uint32_t sec, usec;
|
@@ -936,11 +969,11 @@ void Logger::ResourceEvent(const char* name, const char* tag) {
|
|
936
969
|
|
937
970
|
void Logger::SuspectReadEvent(String* name, Object* obj) {
|
938
971
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
939
|
-
if (!
|
940
|
-
LogMessageBuilder msg;
|
972
|
+
if (!log_->IsEnabled() || !FLAG_log_suspect) return;
|
973
|
+
LogMessageBuilder msg(this);
|
941
974
|
String* class_name = obj->IsJSObject()
|
942
975
|
? JSObject::cast(obj)->class_name()
|
943
|
-
:
|
976
|
+
: HEAP->empty_string();
|
944
977
|
msg.Append("suspect-read,");
|
945
978
|
msg.Append(class_name);
|
946
979
|
msg.Append(',');
|
@@ -955,8 +988,8 @@ void Logger::SuspectReadEvent(String* name, Object* obj) {
|
|
955
988
|
|
956
989
|
void Logger::HeapSampleBeginEvent(const char* space, const char* kind) {
|
957
990
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
958
|
-
if (!
|
959
|
-
LogMessageBuilder msg;
|
991
|
+
if (!log_->IsEnabled() || !FLAG_log_gc) return;
|
992
|
+
LogMessageBuilder msg(this);
|
960
993
|
// Using non-relative system time in order to be able to synchronize with
|
961
994
|
// external memory profiling events (e.g. DOM memory size).
|
962
995
|
msg.Append("heap-sample-begin,\"%s\",\"%s\",%.0f\n",
|
@@ -969,8 +1002,8 @@ void Logger::HeapSampleBeginEvent(const char* space, const char* kind) {
|
|
969
1002
|
void Logger::HeapSampleStats(const char* space, const char* kind,
|
970
1003
|
intptr_t capacity, intptr_t used) {
|
971
1004
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
972
|
-
if (!
|
973
|
-
LogMessageBuilder msg;
|
1005
|
+
if (!log_->IsEnabled() || !FLAG_log_gc) return;
|
1006
|
+
LogMessageBuilder msg(this);
|
974
1007
|
msg.Append("heap-sample-stats,\"%s\",\"%s\","
|
975
1008
|
"%" V8_PTR_PREFIX "d,%" V8_PTR_PREFIX "d\n",
|
976
1009
|
space, kind, capacity, used);
|
@@ -981,8 +1014,8 @@ void Logger::HeapSampleStats(const char* space, const char* kind,
|
|
981
1014
|
|
982
1015
|
void Logger::HeapSampleEndEvent(const char* space, const char* kind) {
|
983
1016
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
984
|
-
if (!
|
985
|
-
LogMessageBuilder msg;
|
1017
|
+
if (!log_->IsEnabled() || !FLAG_log_gc) return;
|
1018
|
+
LogMessageBuilder msg(this);
|
986
1019
|
msg.Append("heap-sample-end,\"%s\",\"%s\"\n", space, kind);
|
987
1020
|
msg.WriteToLogFile();
|
988
1021
|
#endif
|
@@ -991,8 +1024,8 @@ void Logger::HeapSampleEndEvent(const char* space, const char* kind) {
|
|
991
1024
|
|
992
1025
|
void Logger::HeapSampleItemEvent(const char* type, int number, int bytes) {
|
993
1026
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
994
|
-
if (!
|
995
|
-
LogMessageBuilder msg;
|
1027
|
+
if (!log_->IsEnabled() || !FLAG_log_gc) return;
|
1028
|
+
LogMessageBuilder msg(this);
|
996
1029
|
msg.Append("heap-sample-item,%s,%d,%d\n", type, number, bytes);
|
997
1030
|
msg.WriteToLogFile();
|
998
1031
|
#endif
|
@@ -1002,32 +1035,32 @@ void Logger::HeapSampleItemEvent(const char* type, int number, int bytes) {
|
|
1002
1035
|
void Logger::HeapSampleJSConstructorEvent(const char* constructor,
|
1003
1036
|
int number, int bytes) {
|
1004
1037
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1005
|
-
if (!
|
1006
|
-
LogMessageBuilder msg;
|
1038
|
+
if (!log_->IsEnabled() || !FLAG_log_gc) return;
|
1039
|
+
LogMessageBuilder msg(this);
|
1007
1040
|
msg.Append("heap-js-cons-item,%s,%d,%d\n", constructor, number, bytes);
|
1008
1041
|
msg.WriteToLogFile();
|
1009
1042
|
#endif
|
1010
1043
|
}
|
1011
1044
|
|
1045
|
+
// Event starts with comma, so we don't have it in the format string.
|
1046
|
+
static const char kEventText[] = "heap-js-ret-item,%s";
|
1047
|
+
// We take placeholder strings into account, but it's OK to be conservative.
|
1048
|
+
static const int kEventTextLen = sizeof(kEventText)/sizeof(kEventText[0]);
|
1012
1049
|
|
1013
1050
|
void Logger::HeapSampleJSRetainersEvent(
|
1014
1051
|
const char* constructor, const char* event) {
|
1015
1052
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1016
|
-
if (!
|
1017
|
-
// Event starts with comma, so we don't have it in the format string.
|
1018
|
-
static const char* event_text = "heap-js-ret-item,%s";
|
1019
|
-
// We take placeholder strings into account, but it's OK to be conservative.
|
1020
|
-
static const int event_text_len = StrLength(event_text);
|
1053
|
+
if (!log_->IsEnabled() || !FLAG_log_gc) return;
|
1021
1054
|
const int cons_len = StrLength(constructor);
|
1022
1055
|
const int event_len = StrLength(event);
|
1023
1056
|
int pos = 0;
|
1024
1057
|
// Retainer lists can be long. We may need to split them into multiple events.
|
1025
1058
|
do {
|
1026
|
-
LogMessageBuilder msg;
|
1027
|
-
msg.Append(
|
1059
|
+
LogMessageBuilder msg(this);
|
1060
|
+
msg.Append(kEventText, constructor);
|
1028
1061
|
int to_write = event_len - pos;
|
1029
|
-
if (to_write > Log::kMessageBufferSize - (cons_len +
|
1030
|
-
int cut_pos = pos + Log::kMessageBufferSize - (cons_len +
|
1062
|
+
if (to_write > Log::kMessageBufferSize - (cons_len + kEventTextLen)) {
|
1063
|
+
int cut_pos = pos + Log::kMessageBufferSize - (cons_len + kEventTextLen);
|
1031
1064
|
ASSERT(cut_pos < event_len);
|
1032
1065
|
while (cut_pos > pos && event[cut_pos] != ',') --cut_pos;
|
1033
1066
|
if (event[cut_pos] != ',') {
|
@@ -1053,8 +1086,8 @@ void Logger::HeapSampleJSRetainersEvent(
|
|
1053
1086
|
void Logger::HeapSampleJSProducerEvent(const char* constructor,
|
1054
1087
|
Address* stack) {
|
1055
1088
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1056
|
-
if (!
|
1057
|
-
LogMessageBuilder msg;
|
1089
|
+
if (!log_->IsEnabled() || !FLAG_log_gc) return;
|
1090
|
+
LogMessageBuilder msg(this);
|
1058
1091
|
msg.Append("heap-js-prod-item,%s", constructor);
|
1059
1092
|
while (*stack != NULL) {
|
1060
1093
|
msg.Append(",0x%" V8PRIxPTR, *stack++);
|
@@ -1067,8 +1100,8 @@ void Logger::HeapSampleJSProducerEvent(const char* constructor,
|
|
1067
1100
|
|
1068
1101
|
void Logger::DebugTag(const char* call_site_tag) {
|
1069
1102
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1070
|
-
if (!
|
1071
|
-
LogMessageBuilder msg;
|
1103
|
+
if (!log_->IsEnabled() || !FLAG_log) return;
|
1104
|
+
LogMessageBuilder msg(this);
|
1072
1105
|
msg.Append("debug-tag,%s\n", call_site_tag);
|
1073
1106
|
msg.WriteToLogFile();
|
1074
1107
|
#endif
|
@@ -1077,13 +1110,13 @@ void Logger::DebugTag(const char* call_site_tag) {
|
|
1077
1110
|
|
1078
1111
|
void Logger::DebugEvent(const char* event_type, Vector<uint16_t> parameter) {
|
1079
1112
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1080
|
-
if (!
|
1113
|
+
if (!log_->IsEnabled() || !FLAG_log) return;
|
1081
1114
|
StringBuilder s(parameter.length() + 1);
|
1082
1115
|
for (int i = 0; i < parameter.length(); ++i) {
|
1083
1116
|
s.AddCharacter(static_cast<char>(parameter[i]));
|
1084
1117
|
}
|
1085
1118
|
char* parameter_string = s.Finalize();
|
1086
|
-
LogMessageBuilder msg;
|
1119
|
+
LogMessageBuilder msg(this);
|
1087
1120
|
msg.Append("debug-queue-event,%s,%15.3f,%s\n",
|
1088
1121
|
event_type,
|
1089
1122
|
OS::TimeCurrentMillis(),
|
@@ -1096,14 +1129,19 @@ void Logger::DebugEvent(const char* event_type, Vector<uint16_t> parameter) {
|
|
1096
1129
|
|
1097
1130
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1098
1131
|
void Logger::TickEvent(TickSample* sample, bool overflow) {
|
1099
|
-
if (!
|
1100
|
-
LogMessageBuilder msg;
|
1132
|
+
if (!log_->IsEnabled() || !FLAG_prof) return;
|
1133
|
+
LogMessageBuilder msg(this);
|
1101
1134
|
msg.Append("%s,", kLogEventsNames[TICK_EVENT]);
|
1102
1135
|
msg.AppendAddress(sample->pc);
|
1103
1136
|
msg.Append(',');
|
1104
1137
|
msg.AppendAddress(sample->sp);
|
1105
|
-
|
1106
|
-
|
1138
|
+
if (sample->has_external_callback) {
|
1139
|
+
msg.Append(",1,");
|
1140
|
+
msg.AppendAddress(sample->external_callback);
|
1141
|
+
} else {
|
1142
|
+
msg.Append(",0,");
|
1143
|
+
msg.AppendAddress(sample->tos);
|
1144
|
+
}
|
1107
1145
|
msg.Append(",%d", static_cast<int>(sample->state));
|
1108
1146
|
if (overflow) {
|
1109
1147
|
msg.Append(",overflow");
|
@@ -1130,7 +1168,7 @@ int Logger::GetActiveProfilerModules() {
|
|
1130
1168
|
|
1131
1169
|
|
1132
1170
|
void Logger::PauseProfiler(int flags, int tag) {
|
1133
|
-
if (!
|
1171
|
+
if (!log_->IsEnabled()) return;
|
1134
1172
|
if (profiler_ != NULL && (flags & PROFILER_MODULE_CPU)) {
|
1135
1173
|
// It is OK to have negative nesting.
|
1136
1174
|
if (--cpu_profiler_nesting_ == 0) {
|
@@ -1141,7 +1179,7 @@ void Logger::PauseProfiler(int flags, int tag) {
|
|
1141
1179
|
}
|
1142
1180
|
FLAG_log_code = false;
|
1143
1181
|
// Must be the same message as Log::kDynamicBufferSeal.
|
1144
|
-
LOG(UncheckedStringEvent("profiler", "pause"));
|
1182
|
+
LOG(ISOLATE, UncheckedStringEvent("profiler", "pause"));
|
1145
1183
|
}
|
1146
1184
|
--logging_nesting_;
|
1147
1185
|
}
|
@@ -1160,7 +1198,7 @@ void Logger::PauseProfiler(int flags, int tag) {
|
|
1160
1198
|
|
1161
1199
|
|
1162
1200
|
void Logger::ResumeProfiler(int flags, int tag) {
|
1163
|
-
if (!
|
1201
|
+
if (!log_->IsEnabled()) return;
|
1164
1202
|
if (tag != 0) {
|
1165
1203
|
UncheckedIntEvent("open-tag", tag);
|
1166
1204
|
}
|
@@ -1169,7 +1207,7 @@ void Logger::ResumeProfiler(int flags, int tag) {
|
|
1169
1207
|
++logging_nesting_;
|
1170
1208
|
if (FLAG_prof_lazy) {
|
1171
1209
|
profiler_->Engage();
|
1172
|
-
LOG(UncheckedStringEvent("profiler", "resume"));
|
1210
|
+
LOG(ISOLATE, UncheckedStringEvent("profiler", "resume"));
|
1173
1211
|
FLAG_log_code = true;
|
1174
1212
|
LogCompiledFunctions();
|
1175
1213
|
LogAccessorCallbacks();
|
@@ -1192,8 +1230,7 @@ void Logger::ResumeProfiler(int flags, int tag) {
|
|
1192
1230
|
|
1193
1231
|
// This function can be called when Log's mutex is acquired,
|
1194
1232
|
// either from main or Profiler's thread.
|
1195
|
-
void Logger::
|
1196
|
-
Log::stop();
|
1233
|
+
void Logger::LogFailure() {
|
1197
1234
|
PauseProfiler(PROFILER_MODULE_CPU, 0);
|
1198
1235
|
}
|
1199
1236
|
|
@@ -1204,7 +1241,7 @@ bool Logger::IsProfilerSamplerActive() {
|
|
1204
1241
|
|
1205
1242
|
|
1206
1243
|
int Logger::GetLogLines(int from_pos, char* dest_buf, int max_size) {
|
1207
|
-
return
|
1244
|
+
return log_->GetLogLines(from_pos, dest_buf, max_size);
|
1208
1245
|
}
|
1209
1246
|
|
1210
1247
|
|
@@ -1297,6 +1334,10 @@ void Logger::LogCodeObject(Object* object) {
|
|
1297
1334
|
description = "A keyed load IC from the snapshot";
|
1298
1335
|
tag = Logger::KEYED_LOAD_IC_TAG;
|
1299
1336
|
break;
|
1337
|
+
case Code::KEYED_EXTERNAL_ARRAY_LOAD_IC:
|
1338
|
+
description = "A keyed external array load IC from the snapshot";
|
1339
|
+
tag = Logger::KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG;
|
1340
|
+
break;
|
1300
1341
|
case Code::LOAD_IC:
|
1301
1342
|
description = "A load IC from the snapshot";
|
1302
1343
|
tag = Logger::LOAD_IC_TAG;
|
@@ -1309,6 +1350,10 @@ void Logger::LogCodeObject(Object* object) {
|
|
1309
1350
|
description = "A keyed store IC from the snapshot";
|
1310
1351
|
tag = Logger::KEYED_STORE_IC_TAG;
|
1311
1352
|
break;
|
1353
|
+
case Code::KEYED_EXTERNAL_ARRAY_STORE_IC:
|
1354
|
+
description = "A keyed external array store IC from the snapshot";
|
1355
|
+
tag = Logger::KEYED_EXTERNAL_ARRAY_STORE_IC_TAG;
|
1356
|
+
break;
|
1312
1357
|
case Code::CALL_IC:
|
1313
1358
|
description = "A call IC from the snapshot";
|
1314
1359
|
tag = Logger::CALL_IC_TAG;
|
@@ -1318,14 +1363,14 @@ void Logger::LogCodeObject(Object* object) {
|
|
1318
1363
|
tag = Logger::KEYED_CALL_IC_TAG;
|
1319
1364
|
break;
|
1320
1365
|
}
|
1321
|
-
PROFILE(CodeCreateEvent(tag, code_object, description));
|
1366
|
+
PROFILE(ISOLATE, CodeCreateEvent(tag, code_object, description));
|
1322
1367
|
}
|
1323
1368
|
}
|
1324
1369
|
|
1325
1370
|
|
1326
1371
|
void Logger::LogCodeInfo() {
|
1327
1372
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1328
|
-
if (!
|
1373
|
+
if (!log_->IsEnabled() || !FLAG_log_code || !FLAG_ll_prof) return;
|
1329
1374
|
#if V8_TARGET_ARCH_IA32
|
1330
1375
|
const char arch[] = "ia32";
|
1331
1376
|
#elif V8_TARGET_ARCH_X64
|
@@ -1335,7 +1380,7 @@ void Logger::LogCodeInfo() {
|
|
1335
1380
|
#else
|
1336
1381
|
const char arch[] = "unknown";
|
1337
1382
|
#endif
|
1338
|
-
LogMessageBuilder msg;
|
1383
|
+
LogMessageBuilder msg(this);
|
1339
1384
|
msg.Append("code-info,%s,%d\n", arch, Code::kHeaderSize);
|
1340
1385
|
msg.WriteToLogFile();
|
1341
1386
|
#endif // ENABLE_LOGGING_AND_PROFILING
|
@@ -1343,10 +1388,10 @@ void Logger::LogCodeInfo() {
|
|
1343
1388
|
|
1344
1389
|
|
1345
1390
|
void Logger::LowLevelCodeCreateEvent(Code* code, LogMessageBuilder* msg) {
|
1346
|
-
if (!FLAG_ll_prof ||
|
1347
|
-
int pos = static_cast<int>(ftell(
|
1391
|
+
if (!FLAG_ll_prof || log_->output_code_handle_ == NULL) return;
|
1392
|
+
int pos = static_cast<int>(ftell(log_->output_code_handle_));
|
1348
1393
|
size_t rv = fwrite(code->instruction_start(), 1, code->instruction_size(),
|
1349
|
-
|
1394
|
+
log_->output_code_handle_);
|
1350
1395
|
ASSERT(static_cast<size_t>(code->instruction_size()) == rv);
|
1351
1396
|
USE(rv);
|
1352
1397
|
msg->Append(",%d", pos);
|
@@ -1372,7 +1417,9 @@ void Logger::LogCompiledFunctions() {
|
|
1372
1417
|
// During iteration, there can be heap allocation due to
|
1373
1418
|
// GetScriptLineNumber call.
|
1374
1419
|
for (int i = 0; i < compiled_funcs_count; ++i) {
|
1375
|
-
if (*code_objects[i] ==
|
1420
|
+
if (*code_objects[i] == Isolate::Current()->builtins()->builtin(
|
1421
|
+
Builtins::kLazyCompile))
|
1422
|
+
continue;
|
1376
1423
|
Handle<SharedFunctionInfo> shared = sfis[i];
|
1377
1424
|
Handle<String> func_name(shared->DebugName());
|
1378
1425
|
if (shared->script()->IsScript()) {
|
@@ -1381,20 +1428,23 @@ void Logger::LogCompiledFunctions() {
|
|
1381
1428
|
Handle<String> script_name(String::cast(script->name()));
|
1382
1429
|
int line_num = GetScriptLineNumber(script, shared->start_position());
|
1383
1430
|
if (line_num > 0) {
|
1384
|
-
PROFILE(
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1431
|
+
PROFILE(ISOLATE,
|
1432
|
+
CodeCreateEvent(
|
1433
|
+
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
|
1434
|
+
*code_objects[i], *shared,
|
1435
|
+
*script_name, line_num + 1));
|
1388
1436
|
} else {
|
1389
1437
|
// Can't distinguish eval and script here, so always use Script.
|
1390
|
-
PROFILE(
|
1391
|
-
|
1392
|
-
|
1438
|
+
PROFILE(ISOLATE,
|
1439
|
+
CodeCreateEvent(
|
1440
|
+
Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script),
|
1441
|
+
*code_objects[i], *shared, *script_name));
|
1393
1442
|
}
|
1394
1443
|
} else {
|
1395
|
-
PROFILE(
|
1396
|
-
|
1397
|
-
|
1444
|
+
PROFILE(ISOLATE,
|
1445
|
+
CodeCreateEvent(
|
1446
|
+
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
|
1447
|
+
*code_objects[i], *shared, *func_name));
|
1398
1448
|
}
|
1399
1449
|
} else if (shared->IsApiFunction()) {
|
1400
1450
|
// API function.
|
@@ -1404,11 +1454,13 @@ void Logger::LogCompiledFunctions() {
|
|
1404
1454
|
CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data);
|
1405
1455
|
Object* callback_obj = call_data->callback();
|
1406
1456
|
Address entry_point = v8::ToCData<Address>(callback_obj);
|
1407
|
-
PROFILE(CallbackEvent(*func_name, entry_point));
|
1457
|
+
PROFILE(ISOLATE, CallbackEvent(*func_name, entry_point));
|
1408
1458
|
}
|
1409
1459
|
} else {
|
1410
|
-
PROFILE(
|
1411
|
-
|
1460
|
+
PROFILE(ISOLATE,
|
1461
|
+
CodeCreateEvent(
|
1462
|
+
Logger::LAZY_COMPILE_TAG, *code_objects[i],
|
1463
|
+
*shared, *func_name));
|
1412
1464
|
}
|
1413
1465
|
}
|
1414
1466
|
}
|
@@ -1417,6 +1469,7 @@ void Logger::LogCompiledFunctions() {
|
|
1417
1469
|
void Logger::LogAccessorCallbacks() {
|
1418
1470
|
AssertNoAllocation no_alloc;
|
1419
1471
|
HeapIterator iterator;
|
1472
|
+
i::Isolate* isolate = ISOLATE;
|
1420
1473
|
for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
|
1421
1474
|
if (!obj->IsAccessorInfo()) continue;
|
1422
1475
|
AccessorInfo* ai = AccessorInfo::cast(obj);
|
@@ -1424,11 +1477,11 @@ void Logger::LogAccessorCallbacks() {
|
|
1424
1477
|
String* name = String::cast(ai->name());
|
1425
1478
|
Address getter_entry = v8::ToCData<Address>(ai->getter());
|
1426
1479
|
if (getter_entry != 0) {
|
1427
|
-
PROFILE(GetterCallbackEvent(name, getter_entry));
|
1480
|
+
PROFILE(isolate, GetterCallbackEvent(name, getter_entry));
|
1428
1481
|
}
|
1429
1482
|
Address setter_entry = v8::ToCData<Address>(ai->setter());
|
1430
1483
|
if (setter_entry != 0) {
|
1431
|
-
PROFILE(SetterCallbackEvent(name, setter_entry));
|
1484
|
+
PROFILE(isolate, SetterCallbackEvent(name, setter_entry));
|
1432
1485
|
}
|
1433
1486
|
}
|
1434
1487
|
}
|
@@ -1438,19 +1491,9 @@ void Logger::LogAccessorCallbacks() {
|
|
1438
1491
|
|
1439
1492
|
bool Logger::Setup() {
|
1440
1493
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1441
|
-
//
|
1442
|
-
if (
|
1443
|
-
|
1444
|
-
FLAG_log_api = true;
|
1445
|
-
FLAG_log_code = true;
|
1446
|
-
FLAG_log_gc = true;
|
1447
|
-
FLAG_log_suspect = true;
|
1448
|
-
FLAG_log_handles = true;
|
1449
|
-
FLAG_log_regexp = true;
|
1450
|
-
}
|
1451
|
-
|
1452
|
-
// --prof implies --log-code.
|
1453
|
-
if (FLAG_prof) FLAG_log_code = true;
|
1494
|
+
// Tests and EnsureInitialize() can call this twice in a row. It's harmless.
|
1495
|
+
if (is_initialized_) return true;
|
1496
|
+
is_initialized_ = true;
|
1454
1497
|
|
1455
1498
|
// --ll-prof implies --log-code and --log-snapshot-positions.
|
1456
1499
|
if (FLAG_ll_prof) {
|
@@ -1464,73 +1507,31 @@ bool Logger::Setup() {
|
|
1464
1507
|
FLAG_prof_auto = false;
|
1465
1508
|
}
|
1466
1509
|
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
// If we're logging anything, we need to open the log file.
|
1474
|
-
if (open_log_file) {
|
1475
|
-
if (strcmp(FLAG_logfile, "-") == 0) {
|
1476
|
-
Log::OpenStdout();
|
1477
|
-
} else if (strcmp(FLAG_logfile, "*") == 0) {
|
1478
|
-
Log::OpenMemoryBuffer();
|
1479
|
-
} else if (strchr(FLAG_logfile, '%') != NULL) {
|
1480
|
-
// If there's a '%' in the log file name we have to expand
|
1481
|
-
// placeholders.
|
1482
|
-
HeapStringAllocator allocator;
|
1483
|
-
StringStream stream(&allocator);
|
1484
|
-
for (const char* p = FLAG_logfile; *p; p++) {
|
1485
|
-
if (*p == '%') {
|
1486
|
-
p++;
|
1487
|
-
switch (*p) {
|
1488
|
-
case '\0':
|
1489
|
-
// If there's a % at the end of the string we back up
|
1490
|
-
// one character so we can escape the loop properly.
|
1491
|
-
p--;
|
1492
|
-
break;
|
1493
|
-
case 't': {
|
1494
|
-
// %t expands to the current time in milliseconds.
|
1495
|
-
double time = OS::TimeCurrentMillis();
|
1496
|
-
stream.Add("%.0f", FmtElm(time));
|
1497
|
-
break;
|
1498
|
-
}
|
1499
|
-
case '%':
|
1500
|
-
// %% expands (contracts really) to %.
|
1501
|
-
stream.Put('%');
|
1502
|
-
break;
|
1503
|
-
default:
|
1504
|
-
// All other %'s expand to themselves.
|
1505
|
-
stream.Put('%');
|
1506
|
-
stream.Put(*p);
|
1507
|
-
break;
|
1508
|
-
}
|
1509
|
-
} else {
|
1510
|
-
stream.Put(*p);
|
1511
|
-
}
|
1512
|
-
}
|
1513
|
-
SmartPointer<const char> expanded = stream.ToCString();
|
1514
|
-
Log::OpenFile(*expanded);
|
1515
|
-
} else {
|
1516
|
-
Log::OpenFile(FLAG_logfile);
|
1517
|
-
}
|
1518
|
-
}
|
1510
|
+
// TODO(isolates): this assert introduces cyclic dependency (logger
|
1511
|
+
// -> thread local top -> heap -> logger).
|
1512
|
+
// ASSERT(VMState::is_outermost_external());
|
1513
|
+
|
1514
|
+
log_->Initialize();
|
1519
1515
|
|
1520
1516
|
if (FLAG_ll_prof) LogCodeInfo();
|
1521
1517
|
|
1522
|
-
ticker_ = new Ticker(kSamplingIntervalMs);
|
1518
|
+
ticker_ = new Ticker(Isolate::Current(), kSamplingIntervalMs);
|
1523
1519
|
|
1520
|
+
Isolate* isolate = Isolate::Current();
|
1524
1521
|
if (FLAG_sliding_state_window && sliding_state_window_ == NULL) {
|
1525
|
-
sliding_state_window_ = new SlidingStateWindow();
|
1522
|
+
sliding_state_window_ = new SlidingStateWindow(isolate);
|
1526
1523
|
}
|
1527
1524
|
|
1525
|
+
bool start_logging = FLAG_log || FLAG_log_runtime || FLAG_log_api
|
1526
|
+
|| FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect
|
1527
|
+
|| FLAG_log_regexp || FLAG_log_state_changes;
|
1528
|
+
|
1528
1529
|
if (start_logging) {
|
1529
1530
|
logging_nesting_ = 1;
|
1530
1531
|
}
|
1531
1532
|
|
1532
1533
|
if (FLAG_prof) {
|
1533
|
-
profiler_ = new Profiler();
|
1534
|
+
profiler_ = new Profiler(isolate);
|
1534
1535
|
if (!FLAG_prof_auto) {
|
1535
1536
|
profiler_->pause();
|
1536
1537
|
} else {
|
@@ -1541,7 +1542,6 @@ bool Logger::Setup() {
|
|
1541
1542
|
}
|
1542
1543
|
}
|
1543
1544
|
|
1544
|
-
LogMessageBuilder::set_write_failure_handler(StopLoggingAndProfiling);
|
1545
1545
|
return true;
|
1546
1546
|
|
1547
1547
|
#else
|
@@ -1550,6 +1550,11 @@ bool Logger::Setup() {
|
|
1550
1550
|
}
|
1551
1551
|
|
1552
1552
|
|
1553
|
+
Sampler* Logger::sampler() {
|
1554
|
+
return ticker_;
|
1555
|
+
}
|
1556
|
+
|
1557
|
+
|
1553
1558
|
void Logger::EnsureTickerStarted() {
|
1554
1559
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1555
1560
|
ASSERT(ticker_ != NULL);
|
@@ -1567,7 +1572,8 @@ void Logger::EnsureTickerStopped() {
|
|
1567
1572
|
|
1568
1573
|
void Logger::TearDown() {
|
1569
1574
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1570
|
-
|
1575
|
+
if (!is_initialized_) return;
|
1576
|
+
is_initialized_ = false;
|
1571
1577
|
|
1572
1578
|
// Stop the profiler before closing the file.
|
1573
1579
|
if (profiler_ != NULL) {
|
@@ -1582,7 +1588,7 @@ void Logger::TearDown() {
|
|
1582
1588
|
delete ticker_;
|
1583
1589
|
ticker_ = NULL;
|
1584
1590
|
|
1585
|
-
|
1591
|
+
log_->Close();
|
1586
1592
|
#endif
|
1587
1593
|
}
|
1588
1594
|
|
@@ -1600,9 +1606,61 @@ void Logger::EnableSlidingStateWindow() {
|
|
1600
1606
|
// Otherwise, if the sliding state window computation has not been
|
1601
1607
|
// started we do it now.
|
1602
1608
|
if (sliding_state_window_ == NULL) {
|
1603
|
-
sliding_state_window_ = new SlidingStateWindow();
|
1609
|
+
sliding_state_window_ = new SlidingStateWindow(Isolate::Current());
|
1604
1610
|
}
|
1605
1611
|
#endif
|
1606
1612
|
}
|
1607
1613
|
|
1614
|
+
|
1615
|
+
Mutex* SamplerRegistry::mutex_ = OS::CreateMutex();
|
1616
|
+
List<Sampler*>* SamplerRegistry::active_samplers_ = NULL;
|
1617
|
+
|
1618
|
+
|
1619
|
+
bool SamplerRegistry::IterateActiveSamplers(VisitSampler func, void* param) {
|
1620
|
+
ScopedLock lock(mutex_);
|
1621
|
+
for (int i = 0;
|
1622
|
+
ActiveSamplersExist() && i < active_samplers_->length();
|
1623
|
+
++i) {
|
1624
|
+
func(active_samplers_->at(i), param);
|
1625
|
+
}
|
1626
|
+
return ActiveSamplersExist();
|
1627
|
+
}
|
1628
|
+
|
1629
|
+
|
1630
|
+
static void ComputeCpuProfiling(Sampler* sampler, void* flag_ptr) {
|
1631
|
+
bool* flag = reinterpret_cast<bool*>(flag_ptr);
|
1632
|
+
*flag |= sampler->IsProfiling();
|
1633
|
+
}
|
1634
|
+
|
1635
|
+
|
1636
|
+
SamplerRegistry::State SamplerRegistry::GetState() {
|
1637
|
+
bool flag = false;
|
1638
|
+
if (!IterateActiveSamplers(&ComputeCpuProfiling, &flag)) {
|
1639
|
+
return HAS_NO_SAMPLERS;
|
1640
|
+
}
|
1641
|
+
return flag ? HAS_CPU_PROFILING_SAMPLERS : HAS_SAMPLERS;
|
1642
|
+
}
|
1643
|
+
|
1644
|
+
|
1645
|
+
void SamplerRegistry::AddActiveSampler(Sampler* sampler) {
|
1646
|
+
ASSERT(sampler->IsActive());
|
1647
|
+
ScopedLock lock(mutex_);
|
1648
|
+
if (active_samplers_ == NULL) {
|
1649
|
+
active_samplers_ = new List<Sampler*>;
|
1650
|
+
} else {
|
1651
|
+
ASSERT(!active_samplers_->Contains(sampler));
|
1652
|
+
}
|
1653
|
+
active_samplers_->Add(sampler);
|
1654
|
+
}
|
1655
|
+
|
1656
|
+
|
1657
|
+
void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) {
|
1658
|
+
ASSERT(sampler->IsActive());
|
1659
|
+
ScopedLock lock(mutex_);
|
1660
|
+
ASSERT(active_samplers_ != NULL);
|
1661
|
+
bool removed = active_samplers_->RemoveElement(sampler);
|
1662
|
+
ASSERT(removed);
|
1663
|
+
USE(removed);
|
1664
|
+
}
|
1665
|
+
|
1608
1666
|
} } // namespace v8::internal
|