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
@@ -53,7 +53,7 @@ class LCodeGen BASE_EMBEDDED {
|
|
53
53
|
deoptimizations_(4),
|
54
54
|
deoptimization_literals_(8),
|
55
55
|
inlined_function_count_(0),
|
56
|
-
scope_(
|
56
|
+
scope_(info->scope()),
|
57
57
|
status_(UNUSED),
|
58
58
|
deferred_(8),
|
59
59
|
osr_pc_offset_(-1),
|
@@ -64,6 +64,10 @@ class LCodeGen BASE_EMBEDDED {
|
|
64
64
|
|
65
65
|
// Simple accessors.
|
66
66
|
MacroAssembler* masm() const { return masm_; }
|
67
|
+
CompilationInfo* info() const { return info_; }
|
68
|
+
Isolate* isolate() const { return info_->isolate(); }
|
69
|
+
Factory* factory() const { return isolate()->factory(); }
|
70
|
+
Heap* heap() const { return isolate()->heap(); }
|
67
71
|
|
68
72
|
// Support for converting LOperands to assembler types.
|
69
73
|
// LOperand must be a register.
|
@@ -104,6 +108,7 @@ class LCodeGen BASE_EMBEDDED {
|
|
104
108
|
void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);
|
105
109
|
void DoDeferredStackCheck(LGoto* instr);
|
106
110
|
void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr);
|
111
|
+
void DoDeferredStringCharFromCode(LStringCharFromCode* instr);
|
107
112
|
void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
|
108
113
|
Label* map_check);
|
109
114
|
|
@@ -132,7 +137,7 @@ class LCodeGen BASE_EMBEDDED {
|
|
132
137
|
bool is_aborted() const { return status_ == ABORTED; }
|
133
138
|
|
134
139
|
int strict_mode_flag() const {
|
135
|
-
return
|
140
|
+
return info()->is_strict() ? kStrictMode : kNonStrictMode;
|
136
141
|
}
|
137
142
|
|
138
143
|
LChunk* chunk() const { return chunk_; }
|
@@ -170,13 +175,13 @@ class LCodeGen BASE_EMBEDDED {
|
|
170
175
|
void CallCode(Handle<Code> code,
|
171
176
|
RelocInfo::Mode mode,
|
172
177
|
LInstruction* instr);
|
173
|
-
void CallRuntime(Runtime::Function* function,
|
178
|
+
void CallRuntime(const Runtime::Function* function,
|
174
179
|
int num_arguments,
|
175
180
|
LInstruction* instr);
|
176
181
|
void CallRuntime(Runtime::FunctionId id,
|
177
182
|
int num_arguments,
|
178
183
|
LInstruction* instr) {
|
179
|
-
Runtime::Function* function = Runtime::FunctionForId(id);
|
184
|
+
const Runtime::Function* function = Runtime::FunctionForId(id);
|
180
185
|
CallRuntime(function, num_arguments, instr);
|
181
186
|
}
|
182
187
|
|
@@ -206,14 +211,13 @@ class LCodeGen BASE_EMBEDDED {
|
|
206
211
|
// Specific math operations - used from DoUnaryMathOperation.
|
207
212
|
void EmitIntegerMathAbs(LUnaryMathOperation* instr);
|
208
213
|
void DoMathAbs(LUnaryMathOperation* instr);
|
209
|
-
void EmitVFPTruncate(VFPRoundingMode rounding_mode,
|
210
|
-
SwVfpRegister result,
|
211
|
-
DwVfpRegister double_input,
|
212
|
-
Register scratch1,
|
213
|
-
Register scratch2);
|
214
214
|
void DoMathFloor(LUnaryMathOperation* instr);
|
215
215
|
void DoMathRound(LUnaryMathOperation* instr);
|
216
216
|
void DoMathSqrt(LUnaryMathOperation* instr);
|
217
|
+
void DoMathPowHalf(LUnaryMathOperation* instr);
|
218
|
+
void DoMathLog(LUnaryMathOperation* instr);
|
219
|
+
void DoMathCos(LUnaryMathOperation* instr);
|
220
|
+
void DoMathSin(LUnaryMathOperation* instr);
|
217
221
|
|
218
222
|
// Support for recording safepoint and position information.
|
219
223
|
void RecordSafepoint(LPointerMap* pointers,
|
@@ -229,6 +233,9 @@ class LCodeGen BASE_EMBEDDED {
|
|
229
233
|
int arguments,
|
230
234
|
int deoptimization_index);
|
231
235
|
void RecordPosition(int position);
|
236
|
+
int LastSafepointEnd() {
|
237
|
+
return static_cast<int>(safepoints_.GetPcAfterGap());
|
238
|
+
}
|
232
239
|
|
233
240
|
static Condition TokenToCondition(Token::Value op, bool is_unsigned);
|
234
241
|
void EmitGoto(int block, LDeferredCode* deferred_stack_check = NULL);
|
@@ -257,6 +264,11 @@ class LCodeGen BASE_EMBEDDED {
|
|
257
264
|
// Caller should branch on equal condition.
|
258
265
|
void EmitIsConstructCall(Register temp1, Register temp2);
|
259
266
|
|
267
|
+
void EmitLoadField(Register result,
|
268
|
+
Register object,
|
269
|
+
Handle<Map> type,
|
270
|
+
Handle<String> name);
|
271
|
+
|
260
272
|
LChunk* const chunk_;
|
261
273
|
MacroAssembler* const masm_;
|
262
274
|
CompilationInfo* const info_;
|
@@ -25,6 +25,8 @@
|
|
25
25
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
26
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
27
|
|
28
|
+
#include "v8.h"
|
29
|
+
|
28
30
|
#include "arm/lithium-gap-resolver-arm.h"
|
29
31
|
#include "arm/lithium-codegen-arm.h"
|
30
32
|
|
@@ -39,11 +39,14 @@
|
|
39
39
|
namespace v8 {
|
40
40
|
namespace internal {
|
41
41
|
|
42
|
-
MacroAssembler::MacroAssembler(void* buffer, int size)
|
43
|
-
: Assembler(buffer, size),
|
42
|
+
MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size)
|
43
|
+
: Assembler(arg_isolate, buffer, size),
|
44
44
|
generating_stub_(false),
|
45
|
-
allow_stub_calls_(true)
|
46
|
-
|
45
|
+
allow_stub_calls_(true) {
|
46
|
+
if (isolate() != NULL) {
|
47
|
+
code_object_ = Handle<Object>(isolate()->heap()->undefined_value(),
|
48
|
+
isolate());
|
49
|
+
}
|
47
50
|
}
|
48
51
|
|
49
52
|
|
@@ -103,7 +106,22 @@ void MacroAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
|
|
103
106
|
}
|
104
107
|
|
105
108
|
|
109
|
+
int MacroAssembler::CallSize(Register target, Condition cond) {
|
110
|
+
#if USE_BLX
|
111
|
+
return kInstrSize;
|
112
|
+
#else
|
113
|
+
return 2 * kInstrSize;
|
114
|
+
#endif
|
115
|
+
}
|
116
|
+
|
117
|
+
|
106
118
|
void MacroAssembler::Call(Register target, Condition cond) {
|
119
|
+
// Block constant pool for the call instruction sequence.
|
120
|
+
BlockConstPoolScope block_const_pool(this);
|
121
|
+
#ifdef DEBUG
|
122
|
+
int pre_position = pc_offset();
|
123
|
+
#endif
|
124
|
+
|
107
125
|
#if USE_BLX
|
108
126
|
blx(target, cond);
|
109
127
|
#else
|
@@ -111,29 +129,46 @@ void MacroAssembler::Call(Register target, Condition cond) {
|
|
111
129
|
mov(lr, Operand(pc), LeaveCC, cond);
|
112
130
|
mov(pc, Operand(target), LeaveCC, cond);
|
113
131
|
#endif
|
132
|
+
|
133
|
+
#ifdef DEBUG
|
134
|
+
int post_position = pc_offset();
|
135
|
+
CHECK_EQ(pre_position + CallSize(target, cond), post_position);
|
136
|
+
#endif
|
114
137
|
}
|
115
138
|
|
116
139
|
|
117
|
-
|
118
|
-
|
140
|
+
int MacroAssembler::CallSize(
|
141
|
+
intptr_t target, RelocInfo::Mode rmode, Condition cond) {
|
142
|
+
int size = 2 * kInstrSize;
|
143
|
+
Instr mov_instr = cond | MOV | LeaveCC;
|
144
|
+
if (!Operand(target, rmode).is_single_instruction(mov_instr)) {
|
145
|
+
size += kInstrSize;
|
146
|
+
}
|
147
|
+
return size;
|
148
|
+
}
|
149
|
+
|
150
|
+
|
151
|
+
void MacroAssembler::Call(
|
152
|
+
intptr_t target, RelocInfo::Mode rmode, Condition cond) {
|
153
|
+
// Block constant pool for the call instruction sequence.
|
154
|
+
BlockConstPoolScope block_const_pool(this);
|
155
|
+
#ifdef DEBUG
|
156
|
+
int pre_position = pc_offset();
|
157
|
+
#endif
|
158
|
+
|
119
159
|
#if USE_BLX
|
120
160
|
// On ARMv5 and after the recommended call sequence is:
|
121
161
|
// ldr ip, [pc, #...]
|
122
162
|
// blx ip
|
123
163
|
|
124
|
-
//
|
125
|
-
//
|
126
|
-
//
|
127
|
-
|
128
|
-
|
129
|
-
// address is loaded. The mov method will automatically record
|
130
|
-
// positions when pc is the target, since this is not the case here
|
131
|
-
// we have to do it explicitly.
|
132
|
-
positions_recorder()->WriteRecordedPositions();
|
164
|
+
// Statement positions are expected to be recorded when the target
|
165
|
+
// address is loaded. The mov method will automatically record
|
166
|
+
// positions when pc is the target, since this is not the case here
|
167
|
+
// we have to do it explicitly.
|
168
|
+
positions_recorder()->WriteRecordedPositions();
|
133
169
|
|
134
|
-
|
135
|
-
|
136
|
-
}
|
170
|
+
mov(ip, Operand(target, rmode), LeaveCC, cond);
|
171
|
+
blx(ip, cond);
|
137
172
|
|
138
173
|
ASSERT(kCallTargetAddressOffset == 2 * kInstrSize);
|
139
174
|
#else
|
@@ -141,24 +176,58 @@ void MacroAssembler::Call(intptr_t target, RelocInfo::Mode rmode,
|
|
141
176
|
mov(lr, Operand(pc), LeaveCC, cond);
|
142
177
|
// Emit a ldr<cond> pc, [pc + offset of target in constant pool].
|
143
178
|
mov(pc, Operand(target, rmode), LeaveCC, cond);
|
144
|
-
|
145
179
|
ASSERT(kCallTargetAddressOffset == kInstrSize);
|
146
180
|
#endif
|
181
|
+
|
182
|
+
#ifdef DEBUG
|
183
|
+
int post_position = pc_offset();
|
184
|
+
CHECK_EQ(pre_position + CallSize(target, rmode, cond), post_position);
|
185
|
+
#endif
|
147
186
|
}
|
148
187
|
|
149
188
|
|
150
|
-
|
151
|
-
|
189
|
+
int MacroAssembler::CallSize(
|
190
|
+
byte* target, RelocInfo::Mode rmode, Condition cond) {
|
191
|
+
return CallSize(reinterpret_cast<intptr_t>(target), rmode);
|
192
|
+
}
|
193
|
+
|
194
|
+
|
195
|
+
void MacroAssembler::Call(
|
196
|
+
byte* target, RelocInfo::Mode rmode, Condition cond) {
|
197
|
+
#ifdef DEBUG
|
198
|
+
int pre_position = pc_offset();
|
199
|
+
#endif
|
200
|
+
|
152
201
|
ASSERT(!RelocInfo::IsCodeTarget(rmode));
|
153
202
|
Call(reinterpret_cast<intptr_t>(target), rmode, cond);
|
203
|
+
|
204
|
+
#ifdef DEBUG
|
205
|
+
int post_position = pc_offset();
|
206
|
+
CHECK_EQ(pre_position + CallSize(target, rmode, cond), post_position);
|
207
|
+
#endif
|
154
208
|
}
|
155
209
|
|
156
210
|
|
157
|
-
|
158
|
-
|
211
|
+
int MacroAssembler::CallSize(
|
212
|
+
Handle<Code> code, RelocInfo::Mode rmode, Condition cond) {
|
213
|
+
return CallSize(reinterpret_cast<intptr_t>(code.location()), rmode, cond);
|
214
|
+
}
|
215
|
+
|
216
|
+
|
217
|
+
void MacroAssembler::Call(
|
218
|
+
Handle<Code> code, RelocInfo::Mode rmode, Condition cond) {
|
219
|
+
#ifdef DEBUG
|
220
|
+
int pre_position = pc_offset();
|
221
|
+
#endif
|
222
|
+
|
159
223
|
ASSERT(RelocInfo::IsCodeTarget(rmode));
|
160
224
|
// 'code' is always generated ARM code, never THUMB code
|
161
225
|
Call(reinterpret_cast<intptr_t>(code.location()), rmode, cond);
|
226
|
+
|
227
|
+
#ifdef DEBUG
|
228
|
+
int post_position = pc_offset();
|
229
|
+
CHECK_EQ(pre_position + CallSize(code, rmode, cond), post_position);
|
230
|
+
#endif
|
162
231
|
}
|
163
232
|
|
164
233
|
|
@@ -271,6 +340,29 @@ void MacroAssembler::Sbfx(Register dst, Register src1, int lsb, int width,
|
|
271
340
|
}
|
272
341
|
|
273
342
|
|
343
|
+
void MacroAssembler::Bfi(Register dst,
|
344
|
+
Register src,
|
345
|
+
Register scratch,
|
346
|
+
int lsb,
|
347
|
+
int width,
|
348
|
+
Condition cond) {
|
349
|
+
ASSERT(0 <= lsb && lsb < 32);
|
350
|
+
ASSERT(0 <= width && width < 32);
|
351
|
+
ASSERT(lsb + width < 32);
|
352
|
+
ASSERT(!scratch.is(dst));
|
353
|
+
if (width == 0) return;
|
354
|
+
if (!CpuFeatures::IsSupported(ARMv7)) {
|
355
|
+
int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1);
|
356
|
+
bic(dst, dst, Operand(mask));
|
357
|
+
and_(scratch, src, Operand((1 << width) - 1));
|
358
|
+
mov(scratch, Operand(scratch, LSL, lsb));
|
359
|
+
orr(dst, dst, scratch);
|
360
|
+
} else {
|
361
|
+
bfi(dst, src, lsb, width, cond);
|
362
|
+
}
|
363
|
+
}
|
364
|
+
|
365
|
+
|
274
366
|
void MacroAssembler::Bfc(Register dst, int lsb, int width, Condition cond) {
|
275
367
|
ASSERT(lsb < 32);
|
276
368
|
if (!CpuFeatures::IsSupported(ARMv7)) {
|
@@ -344,7 +436,7 @@ void MacroAssembler::StoreRoot(Register source,
|
|
344
436
|
void MacroAssembler::RecordWriteHelper(Register object,
|
345
437
|
Register address,
|
346
438
|
Register scratch) {
|
347
|
-
if (
|
439
|
+
if (emit_debug_code()) {
|
348
440
|
// Check that the object is not in new space.
|
349
441
|
Label not_in_new_space;
|
350
442
|
InNewSpace(object, scratch, ne, ¬_in_new_space);
|
@@ -372,8 +464,8 @@ void MacroAssembler::InNewSpace(Register object,
|
|
372
464
|
Condition cond,
|
373
465
|
Label* branch) {
|
374
466
|
ASSERT(cond == eq || cond == ne);
|
375
|
-
and_(scratch, object, Operand(ExternalReference::new_space_mask()));
|
376
|
-
cmp(scratch, Operand(ExternalReference::new_space_start()));
|
467
|
+
and_(scratch, object, Operand(ExternalReference::new_space_mask(isolate())));
|
468
|
+
cmp(scratch, Operand(ExternalReference::new_space_start(isolate())));
|
377
469
|
b(cond, branch);
|
378
470
|
}
|
379
471
|
|
@@ -406,7 +498,7 @@ void MacroAssembler::RecordWrite(Register object,
|
|
406
498
|
|
407
499
|
// Clobber all input registers when running with the debug-code flag
|
408
500
|
// turned on to provoke errors.
|
409
|
-
if (
|
501
|
+
if (emit_debug_code()) {
|
410
502
|
mov(object, Operand(BitCast<int32_t>(kZapValue)));
|
411
503
|
mov(scratch0, Operand(BitCast<int32_t>(kZapValue)));
|
412
504
|
mov(scratch1, Operand(BitCast<int32_t>(kZapValue)));
|
@@ -438,7 +530,7 @@ void MacroAssembler::RecordWrite(Register object,
|
|
438
530
|
|
439
531
|
// Clobber all input registers when running with the debug-code flag
|
440
532
|
// turned on to provoke errors.
|
441
|
-
if (
|
533
|
+
if (emit_debug_code()) {
|
442
534
|
mov(object, Operand(BitCast<int32_t>(kZapValue)));
|
443
535
|
mov(address, Operand(BitCast<int32_t>(kZapValue)));
|
444
536
|
mov(scratch, Operand(BitCast<int32_t>(kZapValue)));
|
@@ -642,7 +734,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) {
|
|
642
734
|
mov(fp, Operand(sp)); // Setup new frame pointer.
|
643
735
|
// Reserve room for saved entry sp and code object.
|
644
736
|
sub(sp, sp, Operand(2 * kPointerSize));
|
645
|
-
if (
|
737
|
+
if (emit_debug_code()) {
|
646
738
|
mov(ip, Operand(0));
|
647
739
|
str(ip, MemOperand(fp, ExitFrameConstants::kSPOffset));
|
648
740
|
}
|
@@ -650,9 +742,9 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) {
|
|
650
742
|
str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset));
|
651
743
|
|
652
744
|
// Save the frame pointer and the context in top.
|
653
|
-
mov(ip, Operand(ExternalReference(
|
745
|
+
mov(ip, Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate())));
|
654
746
|
str(fp, MemOperand(ip));
|
655
|
-
mov(ip, Operand(ExternalReference(
|
747
|
+
mov(ip, Operand(ExternalReference(Isolate::k_context_address, isolate())));
|
656
748
|
str(cp, MemOperand(ip));
|
657
749
|
|
658
750
|
// Optionally save all double registers.
|
@@ -728,11 +820,11 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles,
|
|
728
820
|
|
729
821
|
// Clear top frame.
|
730
822
|
mov(r3, Operand(0, RelocInfo::NONE));
|
731
|
-
mov(ip, Operand(ExternalReference(
|
823
|
+
mov(ip, Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate())));
|
732
824
|
str(r3, MemOperand(ip));
|
733
825
|
|
734
826
|
// Restore current context from top and clear it in debug mode.
|
735
|
-
mov(ip, Operand(ExternalReference(
|
827
|
+
mov(ip, Operand(ExternalReference(Isolate::k_context_address, isolate())));
|
736
828
|
ldr(cp, MemOperand(ip));
|
737
829
|
#ifdef DEBUG
|
738
830
|
str(r3, MemOperand(ip));
|
@@ -761,7 +853,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
|
761
853
|
Register code_reg,
|
762
854
|
Label* done,
|
763
855
|
InvokeFlag flag,
|
764
|
-
|
856
|
+
CallWrapper* call_wrapper) {
|
765
857
|
bool definitely_matches = false;
|
766
858
|
Label regular_invoke;
|
767
859
|
|
@@ -814,10 +906,13 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
|
814
906
|
}
|
815
907
|
|
816
908
|
Handle<Code> adaptor =
|
817
|
-
|
909
|
+
isolate()->builtins()->ArgumentsAdaptorTrampoline();
|
818
910
|
if (flag == CALL_FUNCTION) {
|
911
|
+
if (call_wrapper != NULL) {
|
912
|
+
call_wrapper->BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET));
|
913
|
+
}
|
819
914
|
Call(adaptor, RelocInfo::CODE_TARGET);
|
820
|
-
if (
|
915
|
+
if (call_wrapper != NULL) call_wrapper->AfterCall();
|
821
916
|
b(done);
|
822
917
|
} else {
|
823
918
|
Jump(adaptor, RelocInfo::CODE_TARGET);
|
@@ -831,14 +926,15 @@ void MacroAssembler::InvokeCode(Register code,
|
|
831
926
|
const ParameterCount& expected,
|
832
927
|
const ParameterCount& actual,
|
833
928
|
InvokeFlag flag,
|
834
|
-
|
929
|
+
CallWrapper* call_wrapper) {
|
835
930
|
Label done;
|
836
931
|
|
837
932
|
InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag,
|
838
|
-
|
933
|
+
call_wrapper);
|
839
934
|
if (flag == CALL_FUNCTION) {
|
935
|
+
if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(code));
|
840
936
|
Call(code);
|
841
|
-
if (
|
937
|
+
if (call_wrapper != NULL) call_wrapper->AfterCall();
|
842
938
|
} else {
|
843
939
|
ASSERT(flag == JUMP_FUNCTION);
|
844
940
|
Jump(code);
|
@@ -873,7 +969,7 @@ void MacroAssembler::InvokeCode(Handle<Code> code,
|
|
873
969
|
void MacroAssembler::InvokeFunction(Register fun,
|
874
970
|
const ParameterCount& actual,
|
875
971
|
InvokeFlag flag,
|
876
|
-
|
972
|
+
CallWrapper* call_wrapper) {
|
877
973
|
// Contract with called JS functions requires that function is passed in r1.
|
878
974
|
ASSERT(fun.is(r1));
|
879
975
|
|
@@ -890,7 +986,7 @@ void MacroAssembler::InvokeFunction(Register fun,
|
|
890
986
|
FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
|
891
987
|
|
892
988
|
ParameterCount expected(expected_reg);
|
893
|
-
InvokeCode(code_reg, expected, actual, flag,
|
989
|
+
InvokeCode(code_reg, expected, actual, flag, call_wrapper);
|
894
990
|
}
|
895
991
|
|
896
992
|
|
@@ -954,7 +1050,7 @@ void MacroAssembler::IsObjectJSStringType(Register object,
|
|
954
1050
|
void MacroAssembler::DebugBreak() {
|
955
1051
|
ASSERT(allow_stub_calls());
|
956
1052
|
mov(r0, Operand(0, RelocInfo::NONE));
|
957
|
-
mov(r1, Operand(ExternalReference(Runtime::kDebugBreak)));
|
1053
|
+
mov(r1, Operand(ExternalReference(Runtime::kDebugBreak, isolate())));
|
958
1054
|
CEntryStub ces(1);
|
959
1055
|
Call(ces.GetCode(), RelocInfo::DEBUG_BREAK);
|
960
1056
|
}
|
@@ -977,7 +1073,7 @@ void MacroAssembler::PushTryHandler(CodeLocation try_location,
|
|
977
1073
|
&& StackHandlerConstants::kPCOffset == 3 * kPointerSize);
|
978
1074
|
stm(db_w, sp, r3.bit() | fp.bit() | lr.bit());
|
979
1075
|
// Save the current handler as the next handler.
|
980
|
-
mov(r3, Operand(ExternalReference(
|
1076
|
+
mov(r3, Operand(ExternalReference(Isolate::k_handler_address, isolate())));
|
981
1077
|
ldr(r1, MemOperand(r3));
|
982
1078
|
ASSERT(StackHandlerConstants::kNextOffset == 0);
|
983
1079
|
push(r1);
|
@@ -996,7 +1092,7 @@ void MacroAssembler::PushTryHandler(CodeLocation try_location,
|
|
996
1092
|
&& StackHandlerConstants::kPCOffset == 3 * kPointerSize);
|
997
1093
|
stm(db_w, sp, r6.bit() | ip.bit() | lr.bit());
|
998
1094
|
// Save the current handler as the next handler.
|
999
|
-
mov(r7, Operand(ExternalReference(
|
1095
|
+
mov(r7, Operand(ExternalReference(Isolate::k_handler_address, isolate())));
|
1000
1096
|
ldr(r6, MemOperand(r7));
|
1001
1097
|
ASSERT(StackHandlerConstants::kNextOffset == 0);
|
1002
1098
|
push(r6);
|
@@ -1009,7 +1105,7 @@ void MacroAssembler::PushTryHandler(CodeLocation try_location,
|
|
1009
1105
|
void MacroAssembler::PopTryHandler() {
|
1010
1106
|
ASSERT_EQ(0, StackHandlerConstants::kNextOffset);
|
1011
1107
|
pop(r1);
|
1012
|
-
mov(ip, Operand(ExternalReference(
|
1108
|
+
mov(ip, Operand(ExternalReference(Isolate::k_handler_address, isolate())));
|
1013
1109
|
add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize));
|
1014
1110
|
str(r1, MemOperand(ip));
|
1015
1111
|
}
|
@@ -1025,7 +1121,7 @@ void MacroAssembler::Throw(Register value) {
|
|
1025
1121
|
STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
|
1026
1122
|
|
1027
1123
|
// Drop the sp to the top of the handler.
|
1028
|
-
mov(r3, Operand(ExternalReference(
|
1124
|
+
mov(r3, Operand(ExternalReference(Isolate::k_handler_address, isolate())));
|
1029
1125
|
ldr(sp, MemOperand(r3));
|
1030
1126
|
|
1031
1127
|
// Restore the next handler and frame pointer, discard handler state.
|
@@ -1044,7 +1140,7 @@ void MacroAssembler::Throw(Register value) {
|
|
1044
1140
|
// Restore cp otherwise.
|
1045
1141
|
ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne);
|
1046
1142
|
#ifdef DEBUG
|
1047
|
-
if (
|
1143
|
+
if (emit_debug_code()) {
|
1048
1144
|
mov(lr, Operand(pc));
|
1049
1145
|
}
|
1050
1146
|
#endif
|
@@ -1064,7 +1160,7 @@ void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type,
|
|
1064
1160
|
}
|
1065
1161
|
|
1066
1162
|
// Drop sp to the top stack handler.
|
1067
|
-
mov(r3, Operand(ExternalReference(
|
1163
|
+
mov(r3, Operand(ExternalReference(Isolate::k_handler_address, isolate())));
|
1068
1164
|
ldr(sp, MemOperand(r3));
|
1069
1165
|
|
1070
1166
|
// Unwind the handlers until the ENTRY handler is found.
|
@@ -1088,7 +1184,8 @@ void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type,
|
|
1088
1184
|
|
1089
1185
|
if (type == OUT_OF_MEMORY) {
|
1090
1186
|
// Set external caught exception to false.
|
1091
|
-
ExternalReference external_caught(
|
1187
|
+
ExternalReference external_caught(
|
1188
|
+
Isolate::k_external_caught_exception_address, isolate());
|
1092
1189
|
mov(r0, Operand(false, RelocInfo::NONE));
|
1093
1190
|
mov(r2, Operand(external_caught));
|
1094
1191
|
str(r0, MemOperand(r2));
|
@@ -1096,7 +1193,8 @@ void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type,
|
|
1096
1193
|
// Set pending exception and r0 to out of memory exception.
|
1097
1194
|
Failure* out_of_memory = Failure::OutOfMemoryException();
|
1098
1195
|
mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory)));
|
1099
|
-
mov(r2, Operand(ExternalReference(
|
1196
|
+
mov(r2, Operand(ExternalReference(Isolate::k_pending_exception_address,
|
1197
|
+
isolate())));
|
1100
1198
|
str(r0, MemOperand(r2));
|
1101
1199
|
}
|
1102
1200
|
|
@@ -1117,7 +1215,7 @@ void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type,
|
|
1117
1215
|
// Restore cp otherwise.
|
1118
1216
|
ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne);
|
1119
1217
|
#ifdef DEBUG
|
1120
|
-
if (
|
1218
|
+
if (emit_debug_code()) {
|
1121
1219
|
mov(lr, Operand(pc));
|
1122
1220
|
}
|
1123
1221
|
#endif
|
@@ -1149,7 +1247,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
|
|
1149
1247
|
ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset));
|
1150
1248
|
|
1151
1249
|
// Check the context is a global context.
|
1152
|
-
if (
|
1250
|
+
if (emit_debug_code()) {
|
1153
1251
|
// TODO(119): avoid push(holder_reg)/pop(holder_reg)
|
1154
1252
|
// Cannot use ip as a temporary in this verification code. Due to the fact
|
1155
1253
|
// that ip is clobbered as part of cmp with an object Operand.
|
@@ -1168,7 +1266,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
|
|
1168
1266
|
b(eq, &same_contexts);
|
1169
1267
|
|
1170
1268
|
// Check the context is a global context.
|
1171
|
-
if (
|
1269
|
+
if (emit_debug_code()) {
|
1172
1270
|
// TODO(119): avoid push(holder_reg)/pop(holder_reg)
|
1173
1271
|
// Cannot use ip as a temporary in this verification code. Due to the fact
|
1174
1272
|
// that ip is clobbered as part of cmp with an object Operand.
|
@@ -1210,7 +1308,7 @@ void MacroAssembler::AllocateInNewSpace(int object_size,
|
|
1210
1308
|
Label* gc_required,
|
1211
1309
|
AllocationFlags flags) {
|
1212
1310
|
if (!FLAG_inline_new) {
|
1213
|
-
if (
|
1311
|
+
if (emit_debug_code()) {
|
1214
1312
|
// Trash the registers to simulate an allocation failure.
|
1215
1313
|
mov(result, Operand(0x7091));
|
1216
1314
|
mov(scratch1, Operand(0x7191));
|
@@ -1223,6 +1321,8 @@ void MacroAssembler::AllocateInNewSpace(int object_size,
|
|
1223
1321
|
ASSERT(!result.is(scratch1));
|
1224
1322
|
ASSERT(!result.is(scratch2));
|
1225
1323
|
ASSERT(!scratch1.is(scratch2));
|
1324
|
+
ASSERT(!scratch1.is(ip));
|
1325
|
+
ASSERT(!scratch2.is(ip));
|
1226
1326
|
|
1227
1327
|
// Make object size into bytes.
|
1228
1328
|
if ((flags & SIZE_IN_WORDS) != 0) {
|
@@ -1235,9 +1335,9 @@ void MacroAssembler::AllocateInNewSpace(int object_size,
|
|
1235
1335
|
// Also, assert that the registers are numbered such that the values
|
1236
1336
|
// are loaded in the correct order.
|
1237
1337
|
ExternalReference new_space_allocation_top =
|
1238
|
-
ExternalReference::new_space_allocation_top_address();
|
1338
|
+
ExternalReference::new_space_allocation_top_address(isolate());
|
1239
1339
|
ExternalReference new_space_allocation_limit =
|
1240
|
-
ExternalReference::new_space_allocation_limit_address();
|
1340
|
+
ExternalReference::new_space_allocation_limit_address(isolate());
|
1241
1341
|
intptr_t top =
|
1242
1342
|
reinterpret_cast<intptr_t>(new_space_allocation_top.address());
|
1243
1343
|
intptr_t limit =
|
@@ -1257,7 +1357,7 @@ void MacroAssembler::AllocateInNewSpace(int object_size,
|
|
1257
1357
|
// Load allocation top into result and allocation limit into ip.
|
1258
1358
|
ldm(ia, topaddr, result.bit() | ip.bit());
|
1259
1359
|
} else {
|
1260
|
-
if (
|
1360
|
+
if (emit_debug_code()) {
|
1261
1361
|
// Assert that result actually contains top on entry. ip is used
|
1262
1362
|
// immediately below so this use of ip does not cause difference with
|
1263
1363
|
// respect to register content between debug and release mode.
|
@@ -1291,7 +1391,7 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
|
|
1291
1391
|
Label* gc_required,
|
1292
1392
|
AllocationFlags flags) {
|
1293
1393
|
if (!FLAG_inline_new) {
|
1294
|
-
if (
|
1394
|
+
if (emit_debug_code()) {
|
1295
1395
|
// Trash the registers to simulate an allocation failure.
|
1296
1396
|
mov(result, Operand(0x7091));
|
1297
1397
|
mov(scratch1, Operand(0x7191));
|
@@ -1315,9 +1415,9 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
|
|
1315
1415
|
// Also, assert that the registers are numbered such that the values
|
1316
1416
|
// are loaded in the correct order.
|
1317
1417
|
ExternalReference new_space_allocation_top =
|
1318
|
-
ExternalReference::new_space_allocation_top_address();
|
1418
|
+
ExternalReference::new_space_allocation_top_address(isolate());
|
1319
1419
|
ExternalReference new_space_allocation_limit =
|
1320
|
-
ExternalReference::new_space_allocation_limit_address();
|
1420
|
+
ExternalReference::new_space_allocation_limit_address(isolate());
|
1321
1421
|
intptr_t top =
|
1322
1422
|
reinterpret_cast<intptr_t>(new_space_allocation_top.address());
|
1323
1423
|
intptr_t limit =
|
@@ -1335,7 +1435,7 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
|
|
1335
1435
|
// Load allocation top into result and allocation limit into ip.
|
1336
1436
|
ldm(ia, topaddr, result.bit() | ip.bit());
|
1337
1437
|
} else {
|
1338
|
-
if (
|
1438
|
+
if (emit_debug_code()) {
|
1339
1439
|
// Assert that result actually contains top on entry. ip is used
|
1340
1440
|
// immediately below so this use of ip does not cause difference with
|
1341
1441
|
// respect to register content between debug and release mode.
|
@@ -1360,7 +1460,7 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
|
|
1360
1460
|
b(hi, gc_required);
|
1361
1461
|
|
1362
1462
|
// Update allocation top. result temporarily holds the new top.
|
1363
|
-
if (
|
1463
|
+
if (emit_debug_code()) {
|
1364
1464
|
tst(scratch2, Operand(kObjectAlignmentMask));
|
1365
1465
|
Check(eq, "Unaligned allocation in new space");
|
1366
1466
|
}
|
@@ -1376,7 +1476,7 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
|
|
1376
1476
|
void MacroAssembler::UndoAllocationInNewSpace(Register object,
|
1377
1477
|
Register scratch) {
|
1378
1478
|
ExternalReference new_space_allocation_top =
|
1379
|
-
ExternalReference::new_space_allocation_top_address();
|
1479
|
+
ExternalReference::new_space_allocation_top_address(isolate());
|
1380
1480
|
|
1381
1481
|
// Make sure the object has no tag before resetting top.
|
1382
1482
|
and_(object, object, Operand(~kHeapObjectTagMask));
|
@@ -1512,6 +1612,14 @@ void MacroAssembler::CompareInstanceType(Register map,
|
|
1512
1612
|
}
|
1513
1613
|
|
1514
1614
|
|
1615
|
+
void MacroAssembler::CompareRoot(Register obj,
|
1616
|
+
Heap::RootListIndex index) {
|
1617
|
+
ASSERT(!obj.is(ip));
|
1618
|
+
LoadRoot(ip, index);
|
1619
|
+
cmp(obj, ip);
|
1620
|
+
}
|
1621
|
+
|
1622
|
+
|
1515
1623
|
void MacroAssembler::CheckMap(Register obj,
|
1516
1624
|
Register scratch,
|
1517
1625
|
Handle<Map> map,
|
@@ -1618,7 +1726,7 @@ static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
|
|
1618
1726
|
|
1619
1727
|
|
1620
1728
|
MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(
|
1621
|
-
|
1729
|
+
ExternalReference function, int stack_space) {
|
1622
1730
|
ExternalReference next_address =
|
1623
1731
|
ExternalReference::handle_scope_next_address();
|
1624
1732
|
const int kNextOffset = 0;
|
@@ -1656,7 +1764,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(
|
|
1656
1764
|
// No more valid handles (the result handle was the last one). Restore
|
1657
1765
|
// previous handle scope.
|
1658
1766
|
str(r4, MemOperand(r7, kNextOffset));
|
1659
|
-
if (
|
1767
|
+
if (emit_debug_code()) {
|
1660
1768
|
ldr(r1, MemOperand(r7, kLevelOffset));
|
1661
1769
|
cmp(r1, r6);
|
1662
1770
|
Check(eq, "Unexpected level after return from api call");
|
@@ -1670,7 +1778,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(
|
|
1670
1778
|
// Check if the function scheduled an exception.
|
1671
1779
|
bind(&leave_exit_frame);
|
1672
1780
|
LoadRoot(r4, Heap::kTheHoleValueRootIndex);
|
1673
|
-
mov(ip, Operand(ExternalReference::scheduled_exception_address()));
|
1781
|
+
mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate())));
|
1674
1782
|
ldr(r5, MemOperand(ip));
|
1675
1783
|
cmp(r4, r5);
|
1676
1784
|
b(ne, &promote_scheduled_exception);
|
@@ -1681,8 +1789,11 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(
|
|
1681
1789
|
mov(pc, lr);
|
1682
1790
|
|
1683
1791
|
bind(&promote_scheduled_exception);
|
1684
|
-
MaybeObject* result
|
1685
|
-
|
1792
|
+
MaybeObject* result
|
1793
|
+
= TryTailCallExternalReference(
|
1794
|
+
ExternalReference(Runtime::kPromoteScheduledException, isolate()),
|
1795
|
+
0,
|
1796
|
+
1);
|
1686
1797
|
if (result->IsFailure()) {
|
1687
1798
|
return result;
|
1688
1799
|
}
|
@@ -1691,8 +1802,10 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(
|
|
1691
1802
|
bind(&delete_allocated_handles);
|
1692
1803
|
str(r5, MemOperand(r7, kLimitOffset));
|
1693
1804
|
mov(r4, r0);
|
1694
|
-
PrepareCallCFunction(
|
1695
|
-
|
1805
|
+
PrepareCallCFunction(1, r5);
|
1806
|
+
mov(r0, Operand(ExternalReference::isolate_address()));
|
1807
|
+
CallCFunction(
|
1808
|
+
ExternalReference::delete_handle_scope_extensions(isolate()), 1);
|
1696
1809
|
mov(r0, r4);
|
1697
1810
|
jmp(&leave_exit_frame);
|
1698
1811
|
|
@@ -1818,9 +1931,9 @@ void MacroAssembler::ConvertToInt32(Register source,
|
|
1818
1931
|
ldr(scratch, FieldMemOperand(source, HeapNumber::kExponentOffset));
|
1819
1932
|
// Get exponent alone in scratch2.
|
1820
1933
|
Ubfx(scratch2,
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1934
|
+
scratch,
|
1935
|
+
HeapNumber::kExponentShift,
|
1936
|
+
HeapNumber::kExponentBits);
|
1824
1937
|
// Load dest with zero. We use this either for the final shift or
|
1825
1938
|
// for the answer.
|
1826
1939
|
mov(dest, Operand(0, RelocInfo::NONE));
|
@@ -1883,6 +1996,167 @@ void MacroAssembler::ConvertToInt32(Register source,
|
|
1883
1996
|
}
|
1884
1997
|
|
1885
1998
|
|
1999
|
+
void MacroAssembler::EmitVFPTruncate(VFPRoundingMode rounding_mode,
|
2000
|
+
SwVfpRegister result,
|
2001
|
+
DwVfpRegister double_input,
|
2002
|
+
Register scratch1,
|
2003
|
+
Register scratch2,
|
2004
|
+
CheckForInexactConversion check_inexact) {
|
2005
|
+
ASSERT(CpuFeatures::IsSupported(VFP3));
|
2006
|
+
CpuFeatures::Scope scope(VFP3);
|
2007
|
+
Register prev_fpscr = scratch1;
|
2008
|
+
Register scratch = scratch2;
|
2009
|
+
|
2010
|
+
int32_t check_inexact_conversion =
|
2011
|
+
(check_inexact == kCheckForInexactConversion) ? kVFPInexactExceptionBit : 0;
|
2012
|
+
|
2013
|
+
// Set custom FPCSR:
|
2014
|
+
// - Set rounding mode.
|
2015
|
+
// - Clear vfp cumulative exception flags.
|
2016
|
+
// - Make sure Flush-to-zero mode control bit is unset.
|
2017
|
+
vmrs(prev_fpscr);
|
2018
|
+
bic(scratch,
|
2019
|
+
prev_fpscr,
|
2020
|
+
Operand(kVFPExceptionMask |
|
2021
|
+
check_inexact_conversion |
|
2022
|
+
kVFPRoundingModeMask |
|
2023
|
+
kVFPFlushToZeroMask));
|
2024
|
+
// 'Round To Nearest' is encoded by 0b00 so no bits need to be set.
|
2025
|
+
if (rounding_mode != kRoundToNearest) {
|
2026
|
+
orr(scratch, scratch, Operand(rounding_mode));
|
2027
|
+
}
|
2028
|
+
vmsr(scratch);
|
2029
|
+
|
2030
|
+
// Convert the argument to an integer.
|
2031
|
+
vcvt_s32_f64(result,
|
2032
|
+
double_input,
|
2033
|
+
(rounding_mode == kRoundToZero) ? kDefaultRoundToZero
|
2034
|
+
: kFPSCRRounding);
|
2035
|
+
|
2036
|
+
// Retrieve FPSCR.
|
2037
|
+
vmrs(scratch);
|
2038
|
+
// Restore FPSCR.
|
2039
|
+
vmsr(prev_fpscr);
|
2040
|
+
// Check for vfp exceptions.
|
2041
|
+
tst(scratch, Operand(kVFPExceptionMask | check_inexact_conversion));
|
2042
|
+
}
|
2043
|
+
|
2044
|
+
|
2045
|
+
void MacroAssembler::EmitOutOfInt32RangeTruncate(Register result,
|
2046
|
+
Register input_high,
|
2047
|
+
Register input_low,
|
2048
|
+
Register scratch) {
|
2049
|
+
Label done, normal_exponent, restore_sign;
|
2050
|
+
|
2051
|
+
// Extract the biased exponent in result.
|
2052
|
+
Ubfx(result,
|
2053
|
+
input_high,
|
2054
|
+
HeapNumber::kExponentShift,
|
2055
|
+
HeapNumber::kExponentBits);
|
2056
|
+
|
2057
|
+
// Check for Infinity and NaNs, which should return 0.
|
2058
|
+
cmp(result, Operand(HeapNumber::kExponentMask));
|
2059
|
+
mov(result, Operand(0), LeaveCC, eq);
|
2060
|
+
b(eq, &done);
|
2061
|
+
|
2062
|
+
// Express exponent as delta to (number of mantissa bits + 31).
|
2063
|
+
sub(result,
|
2064
|
+
result,
|
2065
|
+
Operand(HeapNumber::kExponentBias + HeapNumber::kMantissaBits + 31),
|
2066
|
+
SetCC);
|
2067
|
+
|
2068
|
+
// If the delta is strictly positive, all bits would be shifted away,
|
2069
|
+
// which means that we can return 0.
|
2070
|
+
b(le, &normal_exponent);
|
2071
|
+
mov(result, Operand(0));
|
2072
|
+
b(&done);
|
2073
|
+
|
2074
|
+
bind(&normal_exponent);
|
2075
|
+
const int kShiftBase = HeapNumber::kNonMantissaBitsInTopWord - 1;
|
2076
|
+
// Calculate shift.
|
2077
|
+
add(scratch, result, Operand(kShiftBase + HeapNumber::kMantissaBits), SetCC);
|
2078
|
+
|
2079
|
+
// Save the sign.
|
2080
|
+
Register sign = result;
|
2081
|
+
result = no_reg;
|
2082
|
+
and_(sign, input_high, Operand(HeapNumber::kSignMask));
|
2083
|
+
|
2084
|
+
// Set the implicit 1 before the mantissa part in input_high.
|
2085
|
+
orr(input_high,
|
2086
|
+
input_high,
|
2087
|
+
Operand(1 << HeapNumber::kMantissaBitsInTopWord));
|
2088
|
+
// Shift the mantissa bits to the correct position.
|
2089
|
+
// We don't need to clear non-mantissa bits as they will be shifted away.
|
2090
|
+
// If they weren't, it would mean that the answer is in the 32bit range.
|
2091
|
+
mov(input_high, Operand(input_high, LSL, scratch));
|
2092
|
+
|
2093
|
+
// Replace the shifted bits with bits from the lower mantissa word.
|
2094
|
+
Label pos_shift, shift_done;
|
2095
|
+
rsb(scratch, scratch, Operand(32), SetCC);
|
2096
|
+
b(&pos_shift, ge);
|
2097
|
+
|
2098
|
+
// Negate scratch.
|
2099
|
+
rsb(scratch, scratch, Operand(0));
|
2100
|
+
mov(input_low, Operand(input_low, LSL, scratch));
|
2101
|
+
b(&shift_done);
|
2102
|
+
|
2103
|
+
bind(&pos_shift);
|
2104
|
+
mov(input_low, Operand(input_low, LSR, scratch));
|
2105
|
+
|
2106
|
+
bind(&shift_done);
|
2107
|
+
orr(input_high, input_high, Operand(input_low));
|
2108
|
+
// Restore sign if necessary.
|
2109
|
+
cmp(sign, Operand(0));
|
2110
|
+
result = sign;
|
2111
|
+
sign = no_reg;
|
2112
|
+
rsb(result, input_high, Operand(0), LeaveCC, ne);
|
2113
|
+
mov(result, input_high, LeaveCC, eq);
|
2114
|
+
bind(&done);
|
2115
|
+
}
|
2116
|
+
|
2117
|
+
|
2118
|
+
void MacroAssembler::EmitECMATruncate(Register result,
|
2119
|
+
DwVfpRegister double_input,
|
2120
|
+
SwVfpRegister single_scratch,
|
2121
|
+
Register scratch,
|
2122
|
+
Register input_high,
|
2123
|
+
Register input_low) {
|
2124
|
+
CpuFeatures::Scope scope(VFP3);
|
2125
|
+
ASSERT(!input_high.is(result));
|
2126
|
+
ASSERT(!input_low.is(result));
|
2127
|
+
ASSERT(!input_low.is(input_high));
|
2128
|
+
ASSERT(!scratch.is(result) &&
|
2129
|
+
!scratch.is(input_high) &&
|
2130
|
+
!scratch.is(input_low));
|
2131
|
+
ASSERT(!single_scratch.is(double_input.low()) &&
|
2132
|
+
!single_scratch.is(double_input.high()));
|
2133
|
+
|
2134
|
+
Label done;
|
2135
|
+
|
2136
|
+
// Clear cumulative exception flags.
|
2137
|
+
ClearFPSCRBits(kVFPExceptionMask, scratch);
|
2138
|
+
// Try a conversion to a signed integer.
|
2139
|
+
vcvt_s32_f64(single_scratch, double_input);
|
2140
|
+
vmov(result, single_scratch);
|
2141
|
+
// Retrieve he FPSCR.
|
2142
|
+
vmrs(scratch);
|
2143
|
+
// Check for overflow and NaNs.
|
2144
|
+
tst(scratch, Operand(kVFPOverflowExceptionBit |
|
2145
|
+
kVFPUnderflowExceptionBit |
|
2146
|
+
kVFPInvalidOpExceptionBit));
|
2147
|
+
// If we had no exceptions we are done.
|
2148
|
+
b(eq, &done);
|
2149
|
+
|
2150
|
+
// Load the double value and perform a manual truncation.
|
2151
|
+
vmov(input_low, input_high, double_input);
|
2152
|
+
EmitOutOfInt32RangeTruncate(result,
|
2153
|
+
input_high,
|
2154
|
+
input_low,
|
2155
|
+
scratch);
|
2156
|
+
bind(&done);
|
2157
|
+
}
|
2158
|
+
|
2159
|
+
|
1886
2160
|
void MacroAssembler::GetLeastBitsFromSmi(Register dst,
|
1887
2161
|
Register src,
|
1888
2162
|
int num_least_bits) {
|
@@ -1902,7 +2176,8 @@ void MacroAssembler::GetLeastBitsFromInt32(Register dst,
|
|
1902
2176
|
}
|
1903
2177
|
|
1904
2178
|
|
1905
|
-
void MacroAssembler::CallRuntime(Runtime::Function* f,
|
2179
|
+
void MacroAssembler::CallRuntime(const Runtime::Function* f,
|
2180
|
+
int num_arguments) {
|
1906
2181
|
// All parameters are on the stack. r0 has the return value after call.
|
1907
2182
|
|
1908
2183
|
// If the expected number of arguments of the runtime function is
|
@@ -1918,7 +2193,7 @@ void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) {
|
|
1918
2193
|
// should remove this need and make the runtime routine entry code
|
1919
2194
|
// smarter.
|
1920
2195
|
mov(r0, Operand(num_arguments));
|
1921
|
-
mov(r1, Operand(ExternalReference(f)));
|
2196
|
+
mov(r1, Operand(ExternalReference(f, isolate())));
|
1922
2197
|
CEntryStub stub(1);
|
1923
2198
|
CallStub(&stub);
|
1924
2199
|
}
|
@@ -1930,9 +2205,9 @@ void MacroAssembler::CallRuntime(Runtime::FunctionId fid, int num_arguments) {
|
|
1930
2205
|
|
1931
2206
|
|
1932
2207
|
void MacroAssembler::CallRuntimeSaveDoubles(Runtime::FunctionId id) {
|
1933
|
-
Runtime::Function* function = Runtime::FunctionForId(id);
|
2208
|
+
const Runtime::Function* function = Runtime::FunctionForId(id);
|
1934
2209
|
mov(r0, Operand(function->nargs));
|
1935
|
-
mov(r1, Operand(ExternalReference(function)));
|
2210
|
+
mov(r1, Operand(ExternalReference(function, isolate())));
|
1936
2211
|
CEntryStub stub(1);
|
1937
2212
|
stub.SaveDoubles();
|
1938
2213
|
CallStub(&stub);
|
@@ -1975,7 +2250,9 @@ MaybeObject* MacroAssembler::TryTailCallExternalReference(
|
|
1975
2250
|
void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid,
|
1976
2251
|
int num_arguments,
|
1977
2252
|
int result_size) {
|
1978
|
-
TailCallExternalReference(ExternalReference(fid
|
2253
|
+
TailCallExternalReference(ExternalReference(fid, isolate()),
|
2254
|
+
num_arguments,
|
2255
|
+
result_size);
|
1979
2256
|
}
|
1980
2257
|
|
1981
2258
|
|
@@ -2004,11 +2281,12 @@ MaybeObject* MacroAssembler::TryJumpToExternalReference(
|
|
2004
2281
|
|
2005
2282
|
void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id,
|
2006
2283
|
InvokeJSFlags flags,
|
2007
|
-
|
2284
|
+
CallWrapper* call_wrapper) {
|
2008
2285
|
GetBuiltinEntry(r2, id);
|
2009
2286
|
if (flags == CALL_JS) {
|
2287
|
+
if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(r2));
|
2010
2288
|
Call(r2);
|
2011
|
-
if (
|
2289
|
+
if (call_wrapper != NULL) call_wrapper->AfterCall();
|
2012
2290
|
} else {
|
2013
2291
|
ASSERT(flags == JUMP_JS);
|
2014
2292
|
Jump(r2);
|
@@ -2070,14 +2348,14 @@ void MacroAssembler::DecrementCounter(StatsCounter* counter, int value,
|
|
2070
2348
|
|
2071
2349
|
|
2072
2350
|
void MacroAssembler::Assert(Condition cond, const char* msg) {
|
2073
|
-
if (
|
2351
|
+
if (emit_debug_code())
|
2074
2352
|
Check(cond, msg);
|
2075
2353
|
}
|
2076
2354
|
|
2077
2355
|
|
2078
2356
|
void MacroAssembler::AssertRegisterIsRoot(Register reg,
|
2079
2357
|
Heap::RootListIndex index) {
|
2080
|
-
if (
|
2358
|
+
if (emit_debug_code()) {
|
2081
2359
|
LoadRoot(ip, index);
|
2082
2360
|
cmp(reg, ip);
|
2083
2361
|
Check(eq, "Register did not match expected root");
|
@@ -2086,7 +2364,7 @@ void MacroAssembler::AssertRegisterIsRoot(Register reg,
|
|
2086
2364
|
|
2087
2365
|
|
2088
2366
|
void MacroAssembler::AssertFastElements(Register elements) {
|
2089
|
-
if (
|
2367
|
+
if (emit_debug_code()) {
|
2090
2368
|
ASSERT(!elements.is(ip));
|
2091
2369
|
Label ok;
|
2092
2370
|
push(elements);
|
@@ -2174,7 +2452,7 @@ void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
|
|
2174
2452
|
// (i.e., the static scope chain and runtime context chain do not agree).
|
2175
2453
|
// A variable occurring in such a scope should have slot type LOOKUP and
|
2176
2454
|
// not CONTEXT.
|
2177
|
-
if (
|
2455
|
+
if (emit_debug_code()) {
|
2178
2456
|
ldr(ip, MemOperand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX)));
|
2179
2457
|
cmp(dst, ip);
|
2180
2458
|
Check(eq, "Yo dawg, I heard you liked function contexts "
|
@@ -2199,7 +2477,7 @@ void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
|
|
2199
2477
|
Register scratch) {
|
2200
2478
|
// Load the initial map. The global functions all have initial maps.
|
2201
2479
|
ldr(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
|
2202
|
-
if (
|
2480
|
+
if (emit_debug_code()) {
|
2203
2481
|
Label ok, fail;
|
2204
2482
|
CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, false);
|
2205
2483
|
b(&ok);
|
@@ -2221,6 +2499,18 @@ void MacroAssembler::JumpIfNotPowerOfTwoOrZero(
|
|
2221
2499
|
}
|
2222
2500
|
|
2223
2501
|
|
2502
|
+
void MacroAssembler::JumpIfNotPowerOfTwoOrZeroAndNeg(
|
2503
|
+
Register reg,
|
2504
|
+
Register scratch,
|
2505
|
+
Label* zero_and_neg,
|
2506
|
+
Label* not_power_of_two) {
|
2507
|
+
sub(scratch, reg, Operand(1), SetCC);
|
2508
|
+
b(mi, zero_and_neg);
|
2509
|
+
tst(scratch, reg);
|
2510
|
+
b(ne, not_power_of_two);
|
2511
|
+
}
|
2512
|
+
|
2513
|
+
|
2224
2514
|
void MacroAssembler::JumpIfNotBothSmi(Register reg1,
|
2225
2515
|
Register reg2,
|
2226
2516
|
Label* on_not_both_smi) {
|
@@ -2271,9 +2561,7 @@ void MacroAssembler::AbortIfNotString(Register object) {
|
|
2271
2561
|
void MacroAssembler::AbortIfNotRootValue(Register src,
|
2272
2562
|
Heap::RootListIndex root_value_index,
|
2273
2563
|
const char* message) {
|
2274
|
-
|
2275
|
-
LoadRoot(ip, root_value_index);
|
2276
|
-
cmp(src, ip);
|
2564
|
+
CompareRoot(src, root_value_index);
|
2277
2565
|
Assert(eq, message);
|
2278
2566
|
}
|
2279
2567
|
|
@@ -2389,6 +2677,60 @@ void MacroAssembler::CopyFields(Register dst,
|
|
2389
2677
|
}
|
2390
2678
|
|
2391
2679
|
|
2680
|
+
void MacroAssembler::CopyBytes(Register src,
|
2681
|
+
Register dst,
|
2682
|
+
Register length,
|
2683
|
+
Register scratch) {
|
2684
|
+
Label align_loop, align_loop_1, word_loop, byte_loop, byte_loop_1, done;
|
2685
|
+
|
2686
|
+
// Align src before copying in word size chunks.
|
2687
|
+
bind(&align_loop);
|
2688
|
+
cmp(length, Operand(0));
|
2689
|
+
b(eq, &done);
|
2690
|
+
bind(&align_loop_1);
|
2691
|
+
tst(src, Operand(kPointerSize - 1));
|
2692
|
+
b(eq, &word_loop);
|
2693
|
+
ldrb(scratch, MemOperand(src, 1, PostIndex));
|
2694
|
+
strb(scratch, MemOperand(dst, 1, PostIndex));
|
2695
|
+
sub(length, length, Operand(1), SetCC);
|
2696
|
+
b(ne, &byte_loop_1);
|
2697
|
+
|
2698
|
+
// Copy bytes in word size chunks.
|
2699
|
+
bind(&word_loop);
|
2700
|
+
if (emit_debug_code()) {
|
2701
|
+
tst(src, Operand(kPointerSize - 1));
|
2702
|
+
Assert(eq, "Expecting alignment for CopyBytes");
|
2703
|
+
}
|
2704
|
+
cmp(length, Operand(kPointerSize));
|
2705
|
+
b(lt, &byte_loop);
|
2706
|
+
ldr(scratch, MemOperand(src, kPointerSize, PostIndex));
|
2707
|
+
#if CAN_USE_UNALIGNED_ACCESSES
|
2708
|
+
str(scratch, MemOperand(dst, kPointerSize, PostIndex));
|
2709
|
+
#else
|
2710
|
+
strb(scratch, MemOperand(dst, 1, PostIndex));
|
2711
|
+
mov(scratch, Operand(scratch, LSR, 8));
|
2712
|
+
strb(scratch, MemOperand(dst, 1, PostIndex));
|
2713
|
+
mov(scratch, Operand(scratch, LSR, 8));
|
2714
|
+
strb(scratch, MemOperand(dst, 1, PostIndex));
|
2715
|
+
mov(scratch, Operand(scratch, LSR, 8));
|
2716
|
+
strb(scratch, MemOperand(dst, 1, PostIndex));
|
2717
|
+
#endif
|
2718
|
+
sub(length, length, Operand(kPointerSize));
|
2719
|
+
b(&word_loop);
|
2720
|
+
|
2721
|
+
// Copy the last bytes if any left.
|
2722
|
+
bind(&byte_loop);
|
2723
|
+
cmp(length, Operand(0));
|
2724
|
+
b(eq, &done);
|
2725
|
+
bind(&byte_loop_1);
|
2726
|
+
ldrb(scratch, MemOperand(src, 1, PostIndex));
|
2727
|
+
strb(scratch, MemOperand(dst, 1, PostIndex));
|
2728
|
+
sub(length, length, Operand(1), SetCC);
|
2729
|
+
b(ne, &byte_loop_1);
|
2730
|
+
bind(&done);
|
2731
|
+
}
|
2732
|
+
|
2733
|
+
|
2392
2734
|
void MacroAssembler::CountLeadingZeros(Register zeros, // Answer.
|
2393
2735
|
Register source, // Input.
|
2394
2736
|
Register scratch) {
|
@@ -2454,11 +2796,14 @@ void MacroAssembler::JumpIfInstanceTypeIsNotSequentialAscii(Register type,
|
|
2454
2796
|
b(ne, failure);
|
2455
2797
|
}
|
2456
2798
|
|
2799
|
+
static const int kRegisterPassedArguments = 4;
|
2457
2800
|
|
2458
2801
|
void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
|
2459
2802
|
int frame_alignment = ActivationFrameAlignment();
|
2803
|
+
|
2460
2804
|
// Up to four simple arguments are passed in registers r0..r3.
|
2461
|
-
int stack_passed_arguments = (num_arguments <=
|
2805
|
+
int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ?
|
2806
|
+
0 : num_arguments - kRegisterPassedArguments;
|
2462
2807
|
if (frame_alignment > kPointerSize) {
|
2463
2808
|
// Make stack end at alignment and make room for num_arguments - 4 words
|
2464
2809
|
// and the original value of sp.
|
@@ -2475,17 +2820,28 @@ void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
|
|
2475
2820
|
|
2476
2821
|
void MacroAssembler::CallCFunction(ExternalReference function,
|
2477
2822
|
int num_arguments) {
|
2478
|
-
|
2479
|
-
|
2823
|
+
CallCFunctionHelper(no_reg, function, ip, num_arguments);
|
2824
|
+
}
|
2825
|
+
|
2826
|
+
void MacroAssembler::CallCFunction(Register function,
|
2827
|
+
Register scratch,
|
2828
|
+
int num_arguments) {
|
2829
|
+
CallCFunctionHelper(function,
|
2830
|
+
ExternalReference::the_hole_value_location(isolate()),
|
2831
|
+
scratch,
|
2832
|
+
num_arguments);
|
2480
2833
|
}
|
2481
2834
|
|
2482
2835
|
|
2483
|
-
void MacroAssembler::
|
2836
|
+
void MacroAssembler::CallCFunctionHelper(Register function,
|
2837
|
+
ExternalReference function_reference,
|
2838
|
+
Register scratch,
|
2839
|
+
int num_arguments) {
|
2484
2840
|
// Make sure that the stack is aligned before calling a C function unless
|
2485
2841
|
// running in the simulator. The simulator has its own alignment check which
|
2486
2842
|
// provides more information.
|
2487
2843
|
#if defined(V8_HOST_ARCH_ARM)
|
2488
|
-
if (
|
2844
|
+
if (emit_debug_code()) {
|
2489
2845
|
int frame_alignment = OS::ActivationFrameAlignment();
|
2490
2846
|
int frame_alignment_mask = frame_alignment - 1;
|
2491
2847
|
if (frame_alignment > kPointerSize) {
|
@@ -2504,8 +2860,13 @@ void MacroAssembler::CallCFunction(Register function, int num_arguments) {
|
|
2504
2860
|
// Just call directly. The function called cannot cause a GC, or
|
2505
2861
|
// allow preemption, so the return address in the link register
|
2506
2862
|
// stays correct.
|
2863
|
+
if (function.is(no_reg)) {
|
2864
|
+
mov(scratch, Operand(function_reference));
|
2865
|
+
function = scratch;
|
2866
|
+
}
|
2507
2867
|
Call(function);
|
2508
|
-
int stack_passed_arguments = (num_arguments <=
|
2868
|
+
int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ?
|
2869
|
+
0 : num_arguments - kRegisterPassedArguments;
|
2509
2870
|
if (OS::ActivationFrameAlignment() > kPointerSize) {
|
2510
2871
|
ldr(sp, MemOperand(sp, stack_passed_arguments * kPointerSize));
|
2511
2872
|
} else {
|
@@ -2519,7 +2880,7 @@ void MacroAssembler::GetRelocatedValueLocation(Register ldr_location,
|
|
2519
2880
|
const uint32_t kLdrOffsetMask = (1 << 12) - 1;
|
2520
2881
|
const int32_t kPCRegOffset = 2 * kPointerSize;
|
2521
2882
|
ldr(result, MemOperand(ldr_location));
|
2522
|
-
if (
|
2883
|
+
if (emit_debug_code()) {
|
2523
2884
|
// Check that the instruction is a ldr reg, [pc + offset] .
|
2524
2885
|
and_(result, result, Operand(kLdrPCPattern));
|
2525
2886
|
cmp(result, Operand(kLdrPCPattern));
|
@@ -2538,7 +2899,7 @@ CodePatcher::CodePatcher(byte* address, int instructions)
|
|
2538
2899
|
: address_(address),
|
2539
2900
|
instructions_(instructions),
|
2540
2901
|
size_(instructions * Assembler::kInstrSize),
|
2541
|
-
masm_(address, size_ + Assembler::kGap) {
|
2902
|
+
masm_(Isolate::Current(), address, size_ + Assembler::kGap) {
|
2542
2903
|
// Create a new macro assembler pointing to the address of the code to patch.
|
2543
2904
|
// The size is adjusted with kGap on order for the assembler to generate size
|
2544
2905
|
// bytes of instructions without failing with buffer size constraints.
|