summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest
diff options
context:
space:
mode:
authorUjjwal Sharma <usharma1998@gmail.com>2019-03-15 18:35:06 +0530
committerRefael Ackermann <refack@gmail.com>2019-03-28 16:36:18 -0400
commitf579e1194046c50f2e6bb54348d48c8e7d1a53cf (patch)
tree9125787c758358365f74f9fd9673c14f57e67870 /deps/v8/test/cctest
parent2c73868b0471fbd4038f500d076df056cbf697fe (diff)
downloadnode-new-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.tar.gz
deps: update V8 to 7.4.288.13
PR-URL: https://github.com/nodejs/node/pull/26685 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest')
-rw-r--r--deps/v8/test/cctest/BUILD.gn24
-rw-r--r--deps/v8/test/cctest/OWNERS1
-rw-r--r--deps/v8/test/cctest/assembler-helper-arm.cc6
-rw-r--r--deps/v8/test/cctest/assembler-helper-arm.h4
-rw-r--r--deps/v8/test/cctest/cctest.cc45
-rw-r--r--deps/v8/test/cctest/cctest.h14
-rw-r--r--deps/v8/test/cctest/cctest.status116
-rw-r--r--deps/v8/test/cctest/compiler/codegen-tester.cc136
-rw-r--r--deps/v8/test/cctest/compiler/codegen-tester.h3
-rw-r--r--deps/v8/test/cctest/compiler/function-tester.cc22
-rw-r--r--deps/v8/test/cctest/compiler/serializer-tester.cc219
-rw-r--r--deps/v8/test/cctest/compiler/serializer-tester.h42
-rw-r--r--deps/v8/test/cctest/compiler/test-branch-combine.cc141
-rw-r--r--deps/v8/test/cctest/compiler/test-code-generator.cc33
-rw-r--r--deps/v8/test/cctest/compiler/test-js-constant-cache.cc7
-rw-r--r--deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc139
-rw-r--r--deps/v8/test/cctest/compiler/test-multiple-return.cc2
-rw-r--r--deps/v8/test/cctest/compiler/test-representation-change.cc14
-rw-r--r--deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc4
-rw-r--r--deps/v8/test/cctest/compiler/test-run-load-store.cc126
-rw-r--r--deps/v8/test/cctest/compiler/test-run-machops.cc1446
-rw-r--r--deps/v8/test/cctest/compiler/test-run-native-calls.cc11
-rw-r--r--deps/v8/test/cctest/compiler/value-helper.h11
-rw-r--r--deps/v8/test/cctest/heap/heap-utils.cc17
-rw-r--r--deps/v8/test/cctest/heap/heap-utils.h12
-rw-r--r--deps/v8/test/cctest/heap/test-alloc.cc18
-rw-r--r--deps/v8/test/cctest/heap/test-array-buffer-tracker.cc3
-rw-r--r--deps/v8/test/cctest/heap/test-compaction.cc20
-rw-r--r--deps/v8/test/cctest/heap/test-embedder-tracing.cc348
-rw-r--r--deps/v8/test/cctest/heap/test-external-string-tracker.cc5
-rw-r--r--deps/v8/test/cctest/heap/test-heap.cc405
-rw-r--r--deps/v8/test/cctest/heap/test-incremental-marking.cc6
-rw-r--r--deps/v8/test/cctest/heap/test-invalidated-slots.cc21
-rw-r--r--deps/v8/test/cctest/heap/test-mark-compact.cc15
-rw-r--r--deps/v8/test/cctest/heap/test-page-promotion.cc5
-rw-r--r--deps/v8/test/cctest/heap/test-spaces.cc172
-rw-r--r--deps/v8/test/cctest/heap/test-weak-references.cc35
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc5
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden110
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden8
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden10
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden2
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden24
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden4
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden40
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden14
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden13
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden126
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden8
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden126
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden24
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden30
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden42
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden66
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden20
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden8
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden42
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden42
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden136
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden54
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden4
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden7
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden4506
-rw-r--r--deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc46
-rw-r--r--deps/v8/test/cctest/interpreter/interpreter-tester.cc1
-rw-r--r--deps/v8/test/cctest/interpreter/test-bytecode-generator.cc3
-rw-r--r--deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc1
-rw-r--r--deps/v8/test/cctest/interpreter/test-interpreter.cc157
-rw-r--r--deps/v8/test/cctest/interpreter/test-source-positions.cc1
-rw-r--r--deps/v8/test/cctest/libplatform/test-tracing.cc54
-rw-r--r--deps/v8/test/cctest/libsampler/test-sampler.cc4
-rw-r--r--deps/v8/test/cctest/parsing/test-preparser.cc28
-rw-r--r--deps/v8/test/cctest/parsing/test-scanner-streams.cc18
-rw-r--r--deps/v8/test/cctest/scope-test-helper.h14
-rw-r--r--deps/v8/test/cctest/test-allocation.cc3
-rw-r--r--deps/v8/test/cctest/test-api-interceptors.cc198
-rw-r--r--deps/v8/test/cctest/test-api.cc1252
-rw-r--r--deps/v8/test/cctest/test-assembler-arm.cc88
-rw-r--r--deps/v8/test/cctest/test-assembler-arm64.cc82
-rw-r--r--deps/v8/test/cctest/test-assembler-ia32.cc28
-rw-r--r--deps/v8/test/cctest/test-assembler-mips.cc11
-rw-r--r--deps/v8/test/cctest/test-assembler-mips64.cc12
-rw-r--r--deps/v8/test/cctest/test-assembler-ppc.cc1
-rw-r--r--deps/v8/test/cctest/test-code-layout.cc26
-rw-r--r--deps/v8/test/cctest/test-code-stub-assembler.cc20
-rw-r--r--deps/v8/test/cctest/test-compiler.cc28
-rw-r--r--deps/v8/test/cctest/test-cpu-profiler.cc233
-rw-r--r--deps/v8/test/cctest/test-debug.cc111
-rw-r--r--deps/v8/test/cctest/test-decls.cc55
-rw-r--r--deps/v8/test/cctest/test-dictionary.cc5
-rw-r--r--deps/v8/test/cctest/test-disasm-arm64.cc10
-rw-r--r--deps/v8/test/cctest/test-disasm-x64.cc6
-rw-r--r--deps/v8/test/cctest/test-elements-kind.cc3
-rw-r--r--deps/v8/test/cctest/test-factory.cc1
-rw-r--r--deps/v8/test/cctest/test-feedback-vector.cc64
-rw-r--r--deps/v8/test/cctest/test-field-type-tracking.cc112
-rw-r--r--deps/v8/test/cctest/test-func-name-inference.cc6
-rw-r--r--deps/v8/test/cctest/test-global-handles.cc80
-rw-r--r--deps/v8/test/cctest/test-heap-profiler.cc4
-rw-r--r--deps/v8/test/cctest/test-icache.cc16
-rw-r--r--deps/v8/test/cctest/test-inobject-slack-tracking.cc150
-rw-r--r--deps/v8/test/cctest/test-intl.cc9
-rw-r--r--deps/v8/test/cctest/test-js-weak-refs.cc609
-rw-r--r--deps/v8/test/cctest/test-lockers.cc27
-rw-r--r--deps/v8/test/cctest/test-macro-assembler-arm.cc87
-rw-r--r--deps/v8/test/cctest/test-macro-assembler-x64.cc168
-rw-r--r--deps/v8/test/cctest/test-mementos.cc2
-rw-r--r--deps/v8/test/cctest/test-object.cc159
-rw-r--r--deps/v8/test/cctest/test-parsing.cc133
-rw-r--r--deps/v8/test/cctest/test-profile-generator.cc2
-rw-r--r--deps/v8/test/cctest/test-regexp.cc52
-rw-r--r--deps/v8/test/cctest/test-representation.cc69
-rw-r--r--deps/v8/test/cctest/test-roots.cc7
-rw-r--r--deps/v8/test/cctest/test-serialize.cc127
-rw-r--r--deps/v8/test/cctest/test-strings.cc7
-rw-r--r--deps/v8/test/cctest/test-thread-termination.cc108
-rw-r--r--deps/v8/test/cctest/test-trace-event.cc20
-rw-r--r--deps/v8/test/cctest/test-transitions.cc2
-rw-r--r--deps/v8/test/cctest/test-types.cc2
-rw-r--r--deps/v8/test/cctest/test-unboxed-doubles.cc13
-rw-r--r--deps/v8/test/cctest/test-unscopables-hidden-prototype.cc2
-rw-r--r--deps/v8/test/cctest/test-unwinder.cc1
-rw-r--r--deps/v8/test/cctest/test-weakmaps.cc38
-rw-r--r--deps/v8/test/cctest/test-weaksets.cc5
-rw-r--r--deps/v8/test/cctest/testcfg.py15
-rw-r--r--deps/v8/test/cctest/torque/test-torque.cc32
-rw-r--r--deps/v8/test/cctest/types-fuzz.h224
-rw-r--r--deps/v8/test/cctest/unicode-helpers.cc8
-rw-r--r--deps/v8/test/cctest/wasm/test-c-wasm-entry.cc10
-rw-r--r--deps/v8/test/cctest/wasm/test-jump-table-assembler.cc31
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-64.cc328
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc16
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc78
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc74
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc220
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc126
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-js.cc105
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-module.cc3
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-simd.cc118
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm.cc310
-rw-r--r--deps/v8/test/cctest/wasm/test-streaming-compilation.cc6
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc3
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc16
-rw-r--r--deps/v8/test/cctest/wasm/wasm-run-utils.cc57
-rw-r--r--deps/v8/test/cctest/wasm/wasm-run-utils.h58
145 files changed, 9570 insertions, 5968 deletions
diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn
index 9c18ce5806..b61d9edf53 100644
--- a/deps/v8/test/cctest/BUILD.gn
+++ b/deps/v8/test/cctest/BUILD.gn
@@ -43,6 +43,19 @@ v8_executable("cctest") {
}
}
+v8_header_set("cctest_headers") {
+ testonly = true
+
+ configs = [
+ "../..:external_config",
+ "../..:internal_config_base",
+ ]
+
+ sources = [
+ "cctest.h",
+ ]
+}
+
v8_source_set("cctest_sources") {
testonly = true
@@ -55,7 +68,6 @@ v8_source_set("cctest_sources") {
"../common/wasm/test-signatures.h",
"../common/wasm/wasm-macro-gen.h",
"cctest.cc",
- "cctest.h",
"compiler/c-signature.h",
"compiler/call-tester.h",
"compiler/code-assembler-tester.h",
@@ -64,6 +76,8 @@ v8_source_set("cctest_sources") {
"compiler/function-tester.cc",
"compiler/function-tester.h",
"compiler/graph-builder-tester.h",
+ "compiler/serializer-tester.cc",
+ "compiler/serializer-tester.h",
"compiler/test-basic-block-profiler.cc",
"compiler/test-branch-combine.cc",
"compiler/test-code-assembler.cc",
@@ -236,10 +250,8 @@ v8_source_set("cctest_sources") {
"test-version.cc",
"test-weakmaps.cc",
"test-weaksets.cc",
- "torque/test-torque.cc",
"trace-extension.cc",
"trace-extension.h",
- "types-fuzz.h",
"unicode-helpers.cc",
"unicode-helpers.h",
"wasm/test-c-wasm-entry.cc",
@@ -248,6 +260,7 @@ v8_source_set("cctest_sources") {
"wasm/test-run-wasm-asmjs.cc",
"wasm/test-run-wasm-atomics.cc",
"wasm/test-run-wasm-atomics64.cc",
+ "wasm/test-run-wasm-exceptions.cc",
"wasm/test-run-wasm-interpreter.cc",
"wasm/test-run-wasm-js.cc",
"wasm/test-run-wasm-module.cc",
@@ -354,7 +367,9 @@ v8_source_set("cctest_sources") {
]
public_deps = [
+ ":cctest_headers",
":resources",
+ "..:common_test_headers",
"../..:v8_initializers",
"../..:v8_libbase",
"../..:v8_libplatform",
@@ -437,6 +452,8 @@ action("resources") {
}
v8_executable("generate-bytecode-expectations") {
+ testonly = true
+
sources = [
"interpreter/bytecode-expectations-printer.cc",
"interpreter/bytecode-expectations-printer.h",
@@ -449,6 +466,7 @@ v8_executable("generate-bytecode-expectations") {
]
deps = [
+ ":cctest_headers",
"../..:v8",
"../..:v8_libbase",
"../..:v8_libplatform",
diff --git a/deps/v8/test/cctest/OWNERS b/deps/v8/test/cctest/OWNERS
index 30fc172657..43a617e87a 100644
--- a/deps/v8/test/cctest/OWNERS
+++ b/deps/v8/test/cctest/OWNERS
@@ -11,3 +11,4 @@ per-file *-s390*=joransiu@ca.ibm.com
per-file *-s390*=jyan@ca.ibm.com
per-file *-s390*=mbrandy@us.ibm.com
per-file *-s390*=michael_dawson@ca.ibm.com
+per-file *profile*=alph@chromium.org
diff --git a/deps/v8/test/cctest/assembler-helper-arm.cc b/deps/v8/test/cctest/assembler-helper-arm.cc
index bb3ed9eb4c..b3a27f8cd8 100644
--- a/deps/v8/test/cctest/assembler-helper-arm.cc
+++ b/deps/v8/test/cctest/assembler-helper-arm.cc
@@ -4,7 +4,7 @@
#include "test/cctest/assembler-helper-arm.h"
-#include "src/assembler-inl.h"
+#include "src/macro-assembler.h"
#include "src/isolate-inl.h"
#include "src/v8.h"
#include "test/cctest/cctest.h"
@@ -12,9 +12,9 @@
namespace v8 {
namespace internal {
-Handle<Code> AssembleCodeImpl(std::function<void(Assembler&)> assemble) {
+Handle<Code> AssembleCodeImpl(std::function<void(MacroAssembler&)> assemble) {
Isolate* isolate = CcTest::i_isolate();
- Assembler assm(AssemblerOptions{});
+ MacroAssembler assm(AssemblerOptions{});
assemble(assm);
assm.bx(lr);
diff --git a/deps/v8/test/cctest/assembler-helper-arm.h b/deps/v8/test/cctest/assembler-helper-arm.h
index 1f7c0ff9ad..15b821a30d 100644
--- a/deps/v8/test/cctest/assembler-helper-arm.h
+++ b/deps/v8/test/cctest/assembler-helper-arm.h
@@ -21,11 +21,11 @@ using F_ppiii = void*(void* p0, void* p1, int p2, int p3, int p4);
using F_pppii = void*(void* p0, void* p1, void* p2, int p3, int p4);
using F_ippii = void*(int p0, void* p1, void* p2, int p3, int p4);
-Handle<Code> AssembleCodeImpl(std::function<void(Assembler&)> assemble);
+Handle<Code> AssembleCodeImpl(std::function<void(MacroAssembler&)> assemble);
template <typename Signature>
GeneratedCode<Signature> AssembleCode(
- std::function<void(Assembler&)> assemble) {
+ std::function<void(MacroAssembler&)> assemble) {
return GeneratedCode<Signature>::FromCode(*AssembleCodeImpl(assemble));
}
diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc
index ee03a66ea3..e4a0bd8a50 100644
--- a/deps/v8/test/cctest/cctest.cc
+++ b/deps/v8/test/cctest/cctest.cc
@@ -29,8 +29,11 @@
#include "test/cctest/cctest.h"
#include "include/libplatform/libplatform.h"
+#include "src/compiler.h"
+#include "src/compiler/pipeline.h"
#include "src/debug/debug.h"
#include "src/objects-inl.h"
+#include "src/optimized-compilation-info.h"
#include "src/trap-handler/trap-handler.h"
#include "test/cctest/print-extension.h"
#include "test/cctest/profiler-extension.h"
@@ -222,6 +225,36 @@ HandleAndZoneScope::HandleAndZoneScope()
HandleAndZoneScope::~HandleAndZoneScope() = default;
+i::Handle<i::JSFunction> Optimize(i::Handle<i::JSFunction> function,
+ i::Zone* zone, i::Isolate* isolate,
+ uint32_t flags,
+ i::compiler::JSHeapBroker** out_broker) {
+ i::Handle<i::SharedFunctionInfo> shared(function->shared(), isolate);
+ i::IsCompiledScope is_compiled_scope(shared->is_compiled_scope());
+ CHECK(is_compiled_scope.is_compiled() ||
+ i::Compiler::Compile(function, i::Compiler::CLEAR_EXCEPTION,
+ &is_compiled_scope));
+
+ CHECK_NOT_NULL(zone);
+
+ i::OptimizedCompilationInfo info(zone, isolate, shared, function);
+
+ if (flags & i::OptimizedCompilationInfo::kInliningEnabled) {
+ info.MarkAsInliningEnabled();
+ }
+
+ CHECK(info.shared_info()->HasBytecodeArray());
+ i::JSFunction::EnsureFeedbackVector(function);
+
+ i::Handle<i::Code> code =
+ i::compiler::Pipeline::GenerateCodeForTesting(&info, isolate, out_broker)
+ .ToHandleChecked();
+ info.native_context()->AddOptimizedCode(*code);
+ function->set_code(*code);
+
+ return function;
+}
+
static void PrintTestList(CcTest* current) {
if (current == nullptr) return;
PrintTestList(current->prev());
@@ -282,12 +315,9 @@ int main(int argc, char* argv[]) {
CcTest::set_array_buffer_allocator(
v8::ArrayBuffer::Allocator::NewDefaultAllocator());
- i::PrintExtension print_extension;
- v8::RegisterExtension(&print_extension);
- i::ProfilerExtension profiler_extension;
- v8::RegisterExtension(&profiler_extension);
- i::TraceExtension trace_extension;
- v8::RegisterExtension(&trace_extension);
+ v8::RegisterExtension(v8::base::make_unique<i::PrintExtension>());
+ v8::RegisterExtension(v8::base::make_unique<i::ProfilerExtension>());
+ v8::RegisterExtension(v8::base::make_unique<i::TraceExtension>());
int tests_run = 0;
bool print_run_count = true;
@@ -337,8 +367,7 @@ int main(int argc, char* argv[]) {
if (print_run_count && tests_run != 1)
printf("Ran %i tests.\n", tests_run);
CcTest::TearDown();
- // TODO(svenpanne) See comment above.
- // if (!disable_automatic_dispose_) v8::V8::Dispose();
+ if (!disable_automatic_dispose_) v8::V8::Dispose();
v8::V8::ShutdownPlatform();
return 0;
}
diff --git a/deps/v8/test/cctest/cctest.h b/deps/v8/test/cctest/cctest.h
index 3c99721760..6e6b920dbd 100644
--- a/deps/v8/test/cctest/cctest.h
+++ b/deps/v8/test/cctest/cctest.h
@@ -56,6 +56,12 @@ const auto GetRegConfig = RegisterConfiguration::Default;
class HandleScope;
class Zone;
+namespace compiler {
+
+class JSHeapBroker;
+
+} // namespace compiler
+
} // namespace internal
} // namespace v8
@@ -487,7 +493,13 @@ static inline v8::Local<v8::Value> CompileRunWithOrigin(
return CompileRunWithOrigin(v8_str(source), origin_url);
}
-
+// Takes a JSFunction and runs it through the test version of the optimizing
+// pipeline, allocating the temporary compilation artifacts in a given Zone.
+// For possible {flags} values, look at OptimizedCompilationInfo::Flag.
+// If passed a non-null pointer for {broker}, outputs the JSHeapBroker to it.
+i::Handle<i::JSFunction> Optimize(
+ i::Handle<i::JSFunction> function, i::Zone* zone, i::Isolate* isolate,
+ uint32_t flags, i::compiler::JSHeapBroker** out_broker = nullptr);
static inline void ExpectString(const char* code, const char* expected) {
v8::Local<v8::Value> result = CompileRun(code);
diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status
index b05848d07e..71dd21db35 100644
--- a/deps/v8/test/cctest/cctest.status
+++ b/deps/v8/test/cctest/cctest.status
@@ -74,23 +74,14 @@
# BUG(5193). The cpu profiler tests are notoriously flaky.
'test-profile-generator/RecordStackTraceAtStartProfiling': [SKIP],
- 'test-cpu-profiler/CollectCpuProfile': [SKIP],
- 'test-cpu-profiler/CollectCpuProfileCallerLineNumbers': [SKIP],
- 'test-cpu-profiler/CollectCpuProfileSamples': [SKIP],
'test-cpu-profiler/CollectDeoptEvents': [SKIP],
- 'test-cpu-profiler/CpuProfileDeepStack': [SKIP],
- 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [SKIP],
- 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [SKIP],
- 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP],
- 'test-cpu-profiler/FunctionApplySample': [SKIP],
- 'test-cpu-profiler/HotDeoptNoFrameEntry': [SKIP],
+ 'test-cpu-profiler/CollectCpuProfile': [SKIP],
'test-cpu-profiler/JsNative1JsNative2JsSample': [SKIP],
'test-cpu-profiler/JsNativeJsRuntimeJsSample': [SKIP],
'test-cpu-profiler/JsNativeJsRuntimeJsSampleMultiple': [SKIP],
'test-cpu-profiler/JsNativeJsSample': [SKIP],
- 'test-cpu-profiler/NativeAccessorUninitializedIC': [SKIP],
+ 'test-cpu-profiler/HotDeoptNoFrameEntry': [SKIP],
'test-cpu-profiler/SampleWhenFrameIsNotSetup': [SKIP],
- 'test-cpu-profiler/TracingCpuProfiler': [SKIP],
'test-sampler/LibSamplerCollectSample': [SKIP],
# BUG(7202). The test is flaky.
@@ -118,6 +109,12 @@
# BUG(v8:8296). Flaky OOM test.
'test-heap/OutOfMemorySmallObjects': [SKIP],
+ # BUG(v8:8739). Wasm interpreter does not create proper stack traces.
+ 'test-wasm-stack/RunWasmInterpreter_CollectDetailedWasmStack_WasmError': [SKIP],
+
+ # https://crbug.com/v8/8919
+ 'test-platform/StackAlignment': [PASS, ['not is_clang', SKIP]],
+
############################################################################
# Slow tests.
'test-debug/CallFunctionInDebugger': [PASS, ['mode == debug', SLOW]],
@@ -184,11 +181,6 @@
}], # variant == nooptimization and (arch == arm or arch == arm64) and simulator_run
##############################################################################
-# TODO(ahaas): Port multiple return values to ARM, MIPS, S390 and PPC
-['arch == s390 or arch == s390x or arch == ppc or arch == ppc64', {
- 'test-multiple-return/*': [SKIP],
-}],
-##############################################################################
['asan == True', {
# Skip tests not suitable for ASAN.
'test-assembler-x64/AssemblerX64XchglOperations': [SKIP],
@@ -219,6 +211,8 @@
# support.
'test-serialize/CustomSnapshotDataBlobWithWarmup': [SKIP],
'test-serialize/SnapshotDataBlobWithWarmup': [SKIP],
+ # Fails the embedded blob <-> Isolate verification step.
+ 'test-serialize/CustomSnapshotDataBlobWithLocker': [SKIP],
# https://crbug.com/v8/7763
'test-lockers/ExtensionsRegistration': [SKIP],
@@ -420,8 +414,16 @@
# TODO(ppc/s390): implement atomic operations
'test-run-wasm-atomics/*': [SKIP],
+ # TODO(ppc/s390): support concurrent patching of jump table
+ 'test-jump-table-assembler/*': [SKIP],
+
}], # 'arch == ppc or arch == ppc64 or arch == s390 or arch == s390x'
+['arch == ppc64', {
+ # https://crbug.com/v8/8766
+ 'test-bytecode-generator/WideRegisters': [SKIP],
+}],
+
##############################################################################
['variant == stress_incremental_marking', {
'test-heap-profiler/SamplingHeapProfiler': [SKIP],
@@ -434,6 +436,12 @@
}], # variant == stress_background_compile
##############################################################################
+['variant == interpreted_regexp', {
+ # Times out: https://crbug.com/v8/8678
+ 'test-api/RegExpInterruption': [SKIP],
+}], # variant == interpreted_regexp
+
+##############################################################################
['variant == no_wasm_traps', {
'test-accessors/*': [SKIP],
'test-api-interceptors/*': [SKIP],
@@ -465,7 +473,7 @@
}],
##############################################################################
-['lite_mode', {
+['lite_mode or variant == jitless', {
# TODO(8394): First execution events don't work in lite_mode. Enable this after
# we fix the lite mode to track the first execution.
@@ -512,6 +520,9 @@
'test-heap/IncrementalMarkingStepMakesBigProgressWithLargeObjects': [SKIP],
# TODO(v8:7777): Re-enable once wasm is supported in jitless mode.
+ 'test-api/WasmI32AtomicWaitCallback': [SKIP],
+ 'test-api/WasmI64AtomicWaitCallback': [SKIP],
+ 'test-api/WasmStreaming*': [SKIP],
'test-c-wasm-entry/*': [SKIP],
'test-jump-table-assembler/*': [SKIP],
'test-run-wasm-64/*': [SKIP],
@@ -519,6 +530,7 @@
'test-run-wasm-atomics64/*': [SKIP],
'test-run-wasm-atomics/*': [SKIP],
'test-run-wasm/*': [SKIP],
+ 'test-run-wasm-exceptions/*': [SKIP],
'test-run-wasm-interpreter/*': [SKIP],
'test-run-wasm-js/*': [SKIP],
'test-run-wasm-module/*': [SKIP],
@@ -537,11 +549,81 @@
# Tests that generate code at runtime.
'codegen-tester/*': [SKIP],
+ 'test-api/RegExpInterruption': [SKIP],
'test-assembler-*': [SKIP],
'test-basic-block-profiler/*': [SKIP],
'test-branch-combine/*': [SKIP],
'test-multiple-return/*': [SKIP],
+ 'test-regexp/MacroAssemblernativeAtStart': [SKIP],
+ 'test-regexp/MacroAssemblerNativeBackReferenceLATIN1': [SKIP],
+ 'test-regexp/MacroAssemblerNativeBackReferenceUC16': [SKIP],
+ 'test-regexp/MacroAssemblerNativeBackRefNoCase': [SKIP],
+ 'test-regexp/MacroAssemblerNativeBacktrack': [SKIP],
+ 'test-regexp/MacroAssemblerNativeLotsOfRegisters': [SKIP],
+ 'test-regexp/MacroAssemblerNativeRegisters': [SKIP],
+ 'test-regexp/MacroAssemblerNativeSimple': [SKIP],
+ 'test-regexp/MacroAssemblerNativeSimpleUC16': [SKIP],
+ 'test-regexp/MacroAssemblerNativeSuccess': [SKIP],
+ 'test-regexp/MacroAssemblerStackOverflow': [SKIP],
'test-run-calls-to-external-references/*': [SKIP],
+
+ # Field representation tracking is disabled in jitless mode.
+ 'test-field-type-tracking/*': [SKIP],
+
+ # Instruction cache flushing is disabled in jitless mode.
+ 'test-icache/*': [SKIP],
+}], # lite_mode or variant == jitless
+
+##############################################################################
+['lite_mode', {
+ # TODO(v8:8510): Tests that currently fail with lazy source positions.
+ 'test-cpu-profiler/TickLinesBaseline': [SKIP],
+ 'test-cpu-profiler/TickLinesOptimized': [SKIP],
+ 'test-cpu-profiler/Inlining2': [SKIP],
}], # lite_mode
+##############################################################################
+['variant == jitless', {
+ # https://crbug.com/v8/7777
+ 'serializer-tester/SerializeCallAnyReceiver': [SKIP],
+ 'serializer-tester/SerializeCallArguments': [SKIP],
+ 'serializer-tester/SerializeCallProperty': [SKIP],
+ 'serializer-tester/SerializeCallProperty2': [SKIP],
+ 'serializer-tester/SerializeCallUndefinedReceiver': [SKIP],
+ 'serializer-tester/SerializeCallUndefinedReceiver2': [SKIP],
+ 'serializer-tester/SerializeCallWithSpread': [SKIP],
+ 'serializer-tester/SerializeConstruct': [SKIP],
+ 'serializer-tester/SerializeConstructWithSpread': [SKIP],
+ 'serializer-tester/SerializeInlinedClosure': [SKIP],
+ 'serializer-tester/SerializeInlinedFunction': [SKIP],
+ 'test-api/TurboAsmDisablesDetach': [SKIP],
+ 'test-cpu-profiler/TickLinesOptimized': [SKIP],
+ 'test-heap/TestOptimizeAfterBytecodeFlushingCandidate': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmInterpreter_TryCatchCallDirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmInterpreter_TryCatchCallExternal': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmInterpreter_TryCatchCallIndirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmInterpreter_TryCatchThrow': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmInterpreter_TryCatchTrapTypeError': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmLiftoff_TryCatchCallDirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmLiftoff_TryCatchCallExternal': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmLiftoff_TryCatchCallIndirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmLiftoff_TryCatchThrow': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmLiftoff_TryCatchTrapTypeError': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchCallDirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchCallExternal': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchCallIndirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchThrow': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchTrapTypeError': [SKIP],
+
+ # Crashes on native arm.
+ 'test-macro-assembler-arm/ExtractLane': [PASS, ['arch == arm and not simulator_run', SKIP]],
+ 'test-macro-assembler-arm/LoadAndStoreWithRepresentation': [PASS, ['arch == arm and not simulator_run', SKIP]],
+ 'test-macro-assembler-arm/ReplaceLane': [PASS, ['arch == arm and not simulator_run', SKIP]],
+}], # variant == jitless
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
+
]
diff --git a/deps/v8/test/cctest/compiler/codegen-tester.cc b/deps/v8/test/cctest/compiler/codegen-tester.cc
index 0aff318211..a06585cbca 100644
--- a/deps/v8/test/cctest/compiler/codegen-tester.cc
+++ b/deps/v8/test/cctest/compiler/codegen-tester.cc
@@ -22,27 +22,19 @@ TEST(CompareWrapper) {
CompareWrapper wUint32LessThan(IrOpcode::kUint32LessThan);
CompareWrapper wUint32LessThanOrEqual(IrOpcode::kUint32LessThanOrEqual);
- {
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t a = *pl;
- int32_t b = *pr;
- CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
- CHECK_EQ(a < b, wInt32LessThan.Int32Compare(a, b));
- CHECK_EQ(a <= b, wInt32LessThanOrEqual.Int32Compare(a, b));
- }
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
+ CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
+ CHECK_EQ(a < b, wInt32LessThan.Int32Compare(a, b));
+ CHECK_EQ(a <= b, wInt32LessThanOrEqual.Int32Compare(a, b));
}
}
- {
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t a = *pl;
- uint32_t b = *pr;
- CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
- CHECK_EQ(a < b, wUint32LessThan.Int32Compare(a, b));
- CHECK_EQ(a <= b, wUint32LessThanOrEqual.Int32Compare(a, b));
- }
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
+ CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
+ CHECK_EQ(a < b, wUint32LessThan.Int32Compare(a, b));
+ CHECK_EQ(a <= b, wUint32LessThanOrEqual.Int32Compare(a, b));
}
}
@@ -338,8 +330,8 @@ void Int32BinopInputShapeTester::TestAllInputShapes() {
void Int32BinopInputShapeTester::Run(RawMachineAssemblerTester<int32_t>* m) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
- input_a = *pl;
- input_b = *pr;
+ input_a = pl;
+ input_b = pr;
int32_t expect = gen->expected(input_a, input_b);
CHECK_EQ(expect, m->Call(input_a, input_b));
}
@@ -350,7 +342,7 @@ void Int32BinopInputShapeTester::Run(RawMachineAssemblerTester<int32_t>* m) {
void Int32BinopInputShapeTester::RunLeft(
RawMachineAssemblerTester<int32_t>* m) {
FOR_UINT32_INPUTS(i) {
- input_a = *i;
+ input_a = i;
int32_t expect = gen->expected(input_a, input_b);
CHECK_EQ(expect, m->Call(input_a, input_b));
}
@@ -360,7 +352,7 @@ void Int32BinopInputShapeTester::RunLeft(
void Int32BinopInputShapeTester::RunRight(
RawMachineAssemblerTester<int32_t>* m) {
FOR_UINT32_INPUTS(i) {
- input_b = *i;
+ input_b = i;
int32_t expect = gen->expected(input_a, input_b);
CHECK_EQ(expect, m->Call(input_a, input_b));
}
@@ -414,8 +406,8 @@ TEST(RunEmpty) {
TEST(RunInt32Constants) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m;
- m.Return(m.Int32Constant(*i));
- CHECK_EQ(*i, m.Call());
+ m.Return(m.Int32Constant(i));
+ CHECK_EQ(i, m.Call());
}
}
@@ -435,17 +427,12 @@ TEST(RunSmiConstants) {
RunSmiConstant(Smi::kMinValue);
RunSmiConstant(Smi::kMinValue + 1);
- FOR_INT32_INPUTS(i) { RunSmiConstant(*i); }
+ FOR_INT32_INPUTS(i) { RunSmiConstant(i); }
}
-
TEST(RunNumberConstants) {
- {
- FOR_FLOAT64_INPUTS(i) { RunNumberConstant(*i); }
- }
- {
- FOR_INT32_INPUTS(i) { RunNumberConstant(*i); }
- }
+ FOR_FLOAT64_INPUTS(i) { RunNumberConstant(i); }
+ FOR_INT32_INPUTS(i) { RunNumberConstant(i); }
for (int32_t i = 1; i < Smi::kMaxValue && i != 0;
i = base::ShlWithWraparound(i, 1)) {
@@ -460,7 +447,6 @@ TEST(RunNumberConstants) {
RunNumberConstant(Smi::kMinValue + 1);
}
-
TEST(RunEmptyString) {
RawMachineAssemblerTester<Object> m;
m.Return(m.StringConstant("empty"));
@@ -490,8 +476,8 @@ TEST(RunParam1) {
m.Return(m.Parameter(0));
FOR_INT32_INPUTS(i) {
- int32_t result = m.Call(*i);
- CHECK_EQ(*i, result);
+ int32_t result = m.Call(i);
+ CHECK_EQ(i, result);
}
}
@@ -505,8 +491,8 @@ TEST(RunParam2_1) {
USE(p1);
FOR_INT32_INPUTS(i) {
- int32_t result = m.Call(*i, -9999);
- CHECK_EQ(*i, result);
+ int32_t result = m.Call(i, -9999);
+ CHECK_EQ(i, result);
}
}
@@ -520,8 +506,8 @@ TEST(RunParam2_2) {
USE(p0);
FOR_INT32_INPUTS(i) {
- int32_t result = m.Call(-7777, *i);
- CHECK_EQ(*i, result);
+ int32_t result = m.Call(-7777, i);
+ CHECK_EQ(i, result);
}
}
@@ -535,9 +521,9 @@ TEST(RunParam3) {
int p[] = {-99, -77, -88};
FOR_INT32_INPUTS(j) {
- p[i] = *j;
+ p[i] = j;
int32_t result = m.Call(p[0], p[1], p[2]);
- CHECK_EQ(*j, result);
+ CHECK_EQ(j, result);
}
}
}
@@ -549,7 +535,7 @@ TEST(RunBinopTester) {
Int32BinopTester bt(&m);
bt.AddReturn(bt.param0);
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, bt.call(*i, 777)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, bt.call(i, 777)); }
}
{
@@ -557,7 +543,7 @@ TEST(RunBinopTester) {
Int32BinopTester bt(&m);
bt.AddReturn(bt.param1);
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, bt.call(666, *i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, bt.call(666, i)); }
}
{
@@ -565,7 +551,7 @@ TEST(RunBinopTester) {
Float64BinopTester bt(&m);
bt.AddReturn(bt.param0);
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, bt.call(*i, 9.0)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, bt.call(i, 9.0)); }
}
{
@@ -573,7 +559,7 @@ TEST(RunBinopTester) {
Float64BinopTester bt(&m);
bt.AddReturn(bt.param1);
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, bt.call(-11.25, *i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, bt.call(-11.25, i)); }
}
}
@@ -603,7 +589,7 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
{
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Parameter(0));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, m.Call(i)); }
}
{
BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64(),
@@ -611,8 +597,8 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int64Add(m.Parameter(0), m.Parameter(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(base::AddWithWraparound(*i, *j), m.Call(*i, *j));
- CHECK_EQ(base::AddWithWraparound(*j, *i), m.Call(*j, *i));
+ CHECK_EQ(base::AddWithWraparound(i, j), m.Call(i, j));
+ CHECK_EQ(base::AddWithWraparound(j, i), m.Call(j, i));
}
}
}
@@ -623,9 +609,9 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(Add3(*i, *i, *j), m.Call(*i, *i, *j));
- CHECK_EQ(Add3(*i, *j, *i), m.Call(*i, *j, *i));
- CHECK_EQ(Add3(*j, *i, *i), m.Call(*j, *i, *i));
+ CHECK_EQ(Add3(i, i, j), m.Call(i, i, j));
+ CHECK_EQ(Add3(i, j, i), m.Call(i, j, i));
+ CHECK_EQ(Add3(j, i, i), m.Call(j, i, i));
}
}
}
@@ -638,10 +624,10 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Parameter(3)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(Add4(*i, *i, *i, *j), m.Call(*i, *i, *i, *j));
- CHECK_EQ(Add4(*i, *i, *j, *i), m.Call(*i, *i, *j, *i));
- CHECK_EQ(Add4(*i, *j, *i, *i), m.Call(*i, *j, *i, *i));
- CHECK_EQ(Add4(*j, *i, *i, *i), m.Call(*j, *i, *i, *i));
+ CHECK_EQ(Add4(i, i, i, j), m.Call(i, i, i, j));
+ CHECK_EQ(Add4(i, i, j, i), m.Call(i, i, j, i));
+ CHECK_EQ(Add4(i, j, i, i), m.Call(i, j, i, i));
+ CHECK_EQ(Add4(j, i, i, i), m.Call(j, i, i, i));
}
}
}
@@ -662,8 +648,8 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.PointerConstant(&result), m.Parameter(0), kNoWriteBarrier);
m.Return(m.Int32Constant(0));
FOR_FLOAT64_INPUTS(i) {
- m.Call(*i);
- CHECK_DOUBLE_EQ(*i, result);
+ m.Call(i);
+ CHECK_DOUBLE_EQ(i, result);
}
}
{
@@ -676,11 +662,11 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int32Constant(0));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- m.Call(*i, *j);
- CHECK_EQ(base::AddWithWraparound(*i, *j), result);
+ m.Call(i, j);
+ CHECK_EQ(base::AddWithWraparound(i, j), result);
- m.Call(*j, *i);
- CHECK_EQ(base::AddWithWraparound(*j, *i), result);
+ m.Call(j, i);
+ CHECK_EQ(base::AddWithWraparound(j, i), result);
}
}
}
@@ -695,14 +681,14 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int32Constant(0));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- m.Call(*i, *i, *j);
- CHECK_EQ(Add3(*i, *i, *j), result);
+ m.Call(i, i, j);
+ CHECK_EQ(Add3(i, i, j), result);
- m.Call(*i, *j, *i);
- CHECK_EQ(Add3(*i, *j, *i), result);
+ m.Call(i, j, i);
+ CHECK_EQ(Add3(i, j, i), result);
- m.Call(*j, *i, *i);
- CHECK_EQ(Add3(*j, *i, *i), result);
+ m.Call(j, i, i);
+ CHECK_EQ(Add3(j, i, i), result);
}
}
}
@@ -720,17 +706,17 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int32Constant(0));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- m.Call(*i, *i, *i, *j);
- CHECK_EQ(Add4(*i, *i, *i, *j), result);
+ m.Call(i, i, i, j);
+ CHECK_EQ(Add4(i, i, i, j), result);
- m.Call(*i, *i, *j, *i);
- CHECK_EQ(Add4(*i, *i, *j, *i), result);
+ m.Call(i, i, j, i);
+ CHECK_EQ(Add4(i, i, j, i), result);
- m.Call(*i, *j, *i, *i);
- CHECK_EQ(Add4(*i, *j, *i, *i), result);
+ m.Call(i, j, i, i);
+ CHECK_EQ(Add4(i, j, i, i), result);
- m.Call(*j, *i, *i, *i);
- CHECK_EQ(Add4(*j, *i, *i, *i), result);
+ m.Call(j, i, i, i);
+ CHECK_EQ(Add4(j, i, i, i), result);
}
}
}
diff --git a/deps/v8/test/cctest/compiler/codegen-tester.h b/deps/v8/test/cctest/compiler/codegen-tester.h
index dc35a6b928..93d93e1671 100644
--- a/deps/v8/test/cctest/compiler/codegen-tester.h
+++ b/deps/v8/test/cctest/compiler/codegen-tester.h
@@ -139,7 +139,10 @@ class BufferedRawMachineAssemblerTester
template <typename... Params>
ReturnType Call(Params... p) {
+ uintptr_t zap_data[] = {kZapValue, kZapValue};
ReturnType return_value;
+ STATIC_ASSERT(sizeof(return_value) <= sizeof(zap_data));
+ MemCopy(&return_value, &zap_data, sizeof(return_value));
CSignature::VerifyParams<Params...>(test_graph_signature_);
CallHelper<int32_t>::Call(reinterpret_cast<void*>(&p)...,
reinterpret_cast<void*>(&return_value));
diff --git a/deps/v8/test/cctest/compiler/function-tester.cc b/deps/v8/test/cctest/compiler/function-tester.cc
index bb23d0644a..347f414b56 100644
--- a/deps/v8/test/cctest/compiler/function-tester.cc
+++ b/deps/v8/test/cctest/compiler/function-tester.cc
@@ -6,7 +6,6 @@
#include "src/api-inl.h"
#include "src/assembler.h"
-#include "src/compiler.h"
#include "src/compiler/linkage.h"
#include "src/compiler/pipeline.h"
#include "src/execution.h"
@@ -142,27 +141,8 @@ Handle<JSFunction> FunctionTester::ForMachineGraph(Graph* graph,
}
Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
- Handle<SharedFunctionInfo> shared(function->shared(), isolate);
- IsCompiledScope is_compiled_scope(shared->is_compiled_scope());
- CHECK(is_compiled_scope.is_compiled() ||
- Compiler::Compile(function, Compiler::CLEAR_EXCEPTION,
- &is_compiled_scope));
-
Zone zone(isolate->allocator(), ZONE_NAME);
- OptimizedCompilationInfo info(&zone, isolate, shared, function);
-
- if (flags_ & OptimizedCompilationInfo::kInliningEnabled) {
- info.MarkAsInliningEnabled();
- }
-
- CHECK(info.shared_info()->HasBytecodeArray());
- JSFunction::EnsureFeedbackVector(function);
-
- Handle<Code> code =
- Pipeline::GenerateCodeForTesting(&info, isolate).ToHandleChecked();
- info.native_context()->AddOptimizedCode(*code);
- function->set_code(*code);
- return function;
+ return Optimize(function, &zone, isolate, flags_);
}
// Compile the given machine graph instead of the source of the function
diff --git a/deps/v8/test/cctest/compiler/serializer-tester.cc b/deps/v8/test/cctest/compiler/serializer-tester.cc
new file mode 100644
index 0000000000..9b6d328159
--- /dev/null
+++ b/deps/v8/test/cctest/compiler/serializer-tester.cc
@@ -0,0 +1,219 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Serializer tests don't make sense in lite mode, as it doesn't gather
+// IC feedback.
+#ifndef V8_LITE_MODE
+
+#include "test/cctest/compiler/serializer-tester.h"
+
+#include "src/api-inl.h"
+#include "src/compiler/serializer-for-background-compilation.h"
+#include "src/compiler/zone-stats.h"
+#include "src/optimized-compilation-info.h"
+#include "src/zone/zone.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+SerializerTester::SerializerTester(const char* source)
+ : canonical_(main_isolate()) {
+ // The tests only make sense in the context of concurrent compilation.
+ FLAG_concurrent_inlining = true;
+ // The tests don't make sense when optimizations are turned off.
+ FLAG_opt = true;
+ // We need the IC to feed it to the serializer.
+ FLAG_use_ic = true;
+ // We need manual control over when a given function is optimized.
+ FLAG_always_opt = false;
+ // We need allocation of executable memory for the compilation.
+ FLAG_jitless = false;
+
+ std::string function_string = "(function() { ";
+ function_string += source;
+ function_string += " })();";
+ Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(function_string.c_str()))));
+ uint32_t flags = i::OptimizedCompilationInfo::kInliningEnabled |
+ i::OptimizedCompilationInfo::kFunctionContextSpecializing |
+ i::OptimizedCompilationInfo::kAccessorInliningEnabled |
+ i::OptimizedCompilationInfo::kLoopPeelingEnabled |
+ i::OptimizedCompilationInfo::kBailoutOnUninitialized |
+ i::OptimizedCompilationInfo::kAllocationFoldingEnabled |
+ i::OptimizedCompilationInfo::kSplittingEnabled |
+ i::OptimizedCompilationInfo::kAnalyzeEnvironmentLiveness;
+ Optimize(function, main_zone(), main_isolate(), flags, &broker_);
+ function_ = JSFunctionRef(broker_, function);
+}
+
+TEST(SerializeEmptyFunction) {
+ SerializerTester tester("function f() {}; return f;");
+ CHECK(tester.function().IsSerializedForCompilation());
+}
+
+// This helper function allows for testing weather an inlinee candidate
+// was properly serialized. It expects that the top-level function (that is
+// run through the SerializerTester) will return its inlinee candidate.
+void CheckForSerializedInlinee(const char* source, int argc = 0,
+ Handle<Object> argv[] = {}) {
+ SerializerTester tester(source);
+ JSFunctionRef f = tester.function();
+ CHECK(f.IsSerializedForCompilation());
+
+ MaybeHandle<Object> g_obj = Execution::Call(
+ tester.isolate(), tester.function().object(),
+ tester.isolate()->factory()->undefined_value(), argc, argv);
+ Handle<Object> g;
+ CHECK(g_obj.ToHandle(&g));
+
+ Handle<JSFunction> g_func = Handle<JSFunction>::cast(g);
+ SharedFunctionInfoRef g_sfi(tester.broker(),
+ handle(g_func->shared(), tester.isolate()));
+ FeedbackVectorRef g_fv(tester.broker(),
+ handle(g_func->feedback_vector(), tester.isolate()));
+ CHECK(g_sfi.IsSerializedForCompilation(g_fv));
+}
+
+TEST(SerializeInlinedClosure) {
+ CheckForSerializedInlinee(
+ "function f() {"
+ " return (function g(){ return g; })();"
+ "}; f(); return f;");
+}
+
+TEST(SerializeInlinedFunction) {
+ CheckForSerializedInlinee(
+ "function g() {};"
+ "function f() {"
+ " g(); return g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeCallUndefinedReceiver) {
+ CheckForSerializedInlinee(
+ "function g(a,b,c) {};"
+ "function f() {"
+ " g(1,2,3); return g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeCallUndefinedReceiver2) {
+ CheckForSerializedInlinee(
+ "function g(a,b) {};"
+ "function f() {"
+ " g(1,2); return g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeCallProperty) {
+ CheckForSerializedInlinee(
+ "let obj = {"
+ " g: function g(a,b,c) {}"
+ "};"
+ "function f() {"
+ " obj.g(1,2,3); return obj.g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeCallProperty2) {
+ CheckForSerializedInlinee(
+ "let obj = {"
+ " g: function g(a,b) {}"
+ "};"
+ "function f() {"
+ " obj.g(1,2); return obj.g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeCallAnyReceiver) {
+ CheckForSerializedInlinee(
+ "let obj = {"
+ " g: function g() {}"
+ "};"
+ "function f() {"
+ " with(obj) {"
+ " g(); return g;"
+ " };"
+ "};"
+ "f(); return f;");
+}
+
+TEST(SerializeCallWithSpread) {
+ CheckForSerializedInlinee(
+ "function g(args) {};"
+ "const arr = [1,2,3];"
+ "function f() {"
+ " g(...arr); return g;"
+ "}; f(); return f;");
+}
+
+// The following test causes the CallIC of `g` to turn megamorphic,
+// thus allowing us to test if we forward arguments hints (`callee` in this
+// example) and correctly serialize the inlining candidate `j`.
+TEST(SerializeCallArguments) {
+ CheckForSerializedInlinee(
+ "function g(callee) { callee(); };"
+ "function h() {};"
+ "function i() {};"
+ "g(h); g(i);"
+ "function f() {"
+ " function j() {};"
+ " g(j);"
+ " return j;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeConstruct) {
+ CheckForSerializedInlinee(
+ "function g() {};"
+ "function f() {"
+ " new g(); return g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeConstructWithSpread) {
+ CheckForSerializedInlinee(
+ "function g(a, b, c) {};"
+ "const arr = [1, 2];"
+ "function f() {"
+ " new g(0, ...arr); return g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeConditionalJump) {
+ CheckForSerializedInlinee(
+ "function g(callee) { callee(); };"
+ "function h() {};"
+ "function i() {};"
+ "let a = true;"
+ "g(h); g(i);"
+ "function f() {"
+ " function q() {};"
+ " if (a) g(q);"
+ " return q;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeUnconditionalJump) {
+ CheckForSerializedInlinee(
+ "function g(callee) { callee(); };"
+ "function h() {};"
+ "function i() {};"
+ "let a = false;"
+ "g(h); g(i);"
+ "function f() {"
+ " function p() {};"
+ " function q() {};"
+ " if (a) g(q);"
+ " else g(p);"
+ " return p;"
+ "}; f(); return f;");
+}
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_LITE_MODE
diff --git a/deps/v8/test/cctest/compiler/serializer-tester.h b/deps/v8/test/cctest/compiler/serializer-tester.h
new file mode 100644
index 0000000000..f5a5107841
--- /dev/null
+++ b/deps/v8/test/cctest/compiler/serializer-tester.h
@@ -0,0 +1,42 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_
+#define V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_
+
+#include "src/compiler/js-heap-broker.h"
+#include "test/cctest/cctest.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+class ZoneStats;
+
+// The purpose of this class is to provide testing facility for the
+// SerializerForBackgroundCompilation class. On a high-level, it executes the
+// following steps:
+// 1. Wraps the provided source in an IIFE
+// 2. Generates bytecode for the given source
+// 3. Runs the bytecode which *must* return a function
+// 4. Takes the returned function and optimizes it
+// 5. The optimized function is accessible through `function()`
+class SerializerTester : public HandleAndZoneScope {
+ public:
+ explicit SerializerTester(const char* source);
+
+ JSFunctionRef function() const { return function_.value(); }
+ JSHeapBroker* broker() const { return broker_; }
+ Isolate* isolate() { return main_isolate(); }
+
+ private:
+ CanonicalHandleScope canonical_;
+ base::Optional<JSFunctionRef> function_;
+ JSHeapBroker* broker_ = nullptr;
+};
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_
diff --git a/deps/v8/test/cctest/compiler/test-branch-combine.cc b/deps/v8/test/cctest/compiler/test-branch-combine.cc
index 46240aa9b1..b36d61fbc6 100644
--- a/deps/v8/test/cctest/compiler/test-branch-combine.cc
+++ b/deps/v8/test/cctest/compiler/test-branch-combine.cc
@@ -32,8 +32,7 @@ TEST(BranchCombineWord32EqualZero_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- int32_t a = *i;
+ FOR_INT32_INPUTS(a) {
int32_t expect = a == 0 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -59,8 +58,7 @@ TEST(BranchCombineWord32EqualZero_chain) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- int32_t a = *i;
+ FOR_INT32_INPUTS(a) {
int32_t expect = (k & 1) == 1 ? (a == 0 ? eq_constant : ne_constant)
: (a == 0 ? ne_constant : eq_constant);
CHECK_EQ(expect, m.Call(a));
@@ -83,8 +81,7 @@ TEST(BranchCombineInt32LessThanZero_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- int32_t a = *i;
+ FOR_INT32_INPUTS(a) {
int32_t expect = a < 0 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -105,8 +102,7 @@ TEST(BranchCombineUint32LessThan100_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_UINT32_INPUTS(i) {
- uint32_t a = *i;
+ FOR_UINT32_INPUTS(a) {
int32_t expect = a < 100 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -127,8 +123,7 @@ TEST(BranchCombineUint32LessThanOrEqual100_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_UINT32_INPUTS(i) {
- uint32_t a = *i;
+ FOR_UINT32_INPUTS(a) {
int32_t expect = a <= 100 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -149,8 +144,7 @@ TEST(BranchCombineZeroLessThanInt32_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- int32_t a = *i;
+ FOR_INT32_INPUTS(a) {
int32_t expect = 0 < a ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -171,8 +165,7 @@ TEST(BranchCombineInt32GreaterThanZero_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- int32_t a = *i;
+ FOR_INT32_INPUTS(a) {
int32_t expect = a > 0 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -195,10 +188,8 @@ TEST(BranchCombineWord32EqualP) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = a == b ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -211,9 +202,8 @@ TEST(BranchCombineWord32EqualI) {
int32_t ne_constant = 925718;
for (int left = 0; left < 2; left++) {
- FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(a) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- int32_t a = *i;
Node* p0 = m.Int32Constant(a);
Node* p1 = m.Parameter(0);
@@ -226,8 +216,7 @@ TEST(BranchCombineWord32EqualI) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(j) {
- int32_t b = *j;
+ FOR_INT32_INPUTS(b) {
int32_t expect = a == b ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(b));
}
@@ -254,10 +243,8 @@ TEST(BranchCombineInt32CmpP) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = 0;
if (op == 0) expect = a < b ? eq_constant : ne_constant;
if (op == 1) expect = a <= b ? eq_constant : ne_constant;
@@ -273,9 +260,8 @@ TEST(BranchCombineInt32CmpI) {
int32_t ne_constant = 927711;
for (int op = 0; op < 2; op++) {
- FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(a) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- int32_t a = *i;
Node* p0 = m.Int32Constant(a);
Node* p1 = m.Parameter(0);
@@ -287,8 +273,7 @@ TEST(BranchCombineInt32CmpI) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(j) {
- int32_t b = *j;
+ FOR_INT32_INPUTS(b) {
int32_t expect = 0;
if (op == 0) expect = a < b ? eq_constant : ne_constant;
if (op == 1) expect = a <= b ? eq_constant : ne_constant;
@@ -498,10 +483,8 @@ TEST(BranchCombineInt32AddLessThanZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect =
(base::AddWithWraparound(a, b) < 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
@@ -527,10 +510,8 @@ TEST(BranchCombineInt32AddGreaterThanOrEqualZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect =
(base::AddWithWraparound(a, b) >= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
@@ -556,10 +537,8 @@ TEST(BranchCombineInt32ZeroGreaterThanAdd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect =
(0 > base::AddWithWraparound(a, b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
@@ -585,10 +564,8 @@ TEST(BranchCombineInt32ZeroLessThanOrEqualAdd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect =
(0 <= base::AddWithWraparound(a, b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
@@ -614,10 +591,8 @@ TEST(BranchCombineUint32AddLessThanOrEqualZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (a + b <= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -642,10 +617,8 @@ TEST(BranchCombineUint32AddGreaterThanZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (a + b > 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -670,10 +643,8 @@ TEST(BranchCombineUint32ZeroGreaterThanOrEqualAdd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (0 >= a + b) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -698,10 +669,8 @@ TEST(BranchCombineUint32ZeroLessThanAdd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (0 < a + b) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -726,10 +695,8 @@ TEST(BranchCombineWord32AndLessThanZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = ((a & b) < 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -754,10 +721,8 @@ TEST(BranchCombineWord32AndGreaterThanOrEqualZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = ((a & b) >= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -782,10 +747,8 @@ TEST(BranchCombineInt32ZeroGreaterThanAnd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = (0 > (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -810,10 +773,8 @@ TEST(BranchCombineInt32ZeroLessThanOrEqualAnd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = (0 <= (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -838,10 +799,8 @@ TEST(BranchCombineUint32AndLessThanOrEqualZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = ((a & b) <= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -866,10 +825,8 @@ TEST(BranchCombineUint32AndGreaterThanZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = ((a & b) > 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -894,10 +851,8 @@ TEST(BranchCombineUint32ZeroGreaterThanOrEqualAnd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (0 >= (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -922,10 +877,8 @@ TEST(BranchCombineUint32ZeroLessThanAnd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (0 < (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
diff --git a/deps/v8/test/cctest/compiler/test-code-generator.cc b/deps/v8/test/cctest/compiler/test-code-generator.cc
index 6125ef4bdb..ed39225747 100644
--- a/deps/v8/test/cctest/compiler/test-code-generator.cc
+++ b/deps/v8/test/cctest/compiler/test-code-generator.cc
@@ -29,8 +29,10 @@ namespace {
int GetSlotSizeInBytes(MachineRepresentation rep) {
switch (rep) {
case MachineRepresentation::kTagged:
+ // Spill slots for tagged values are always uncompressed.
+ return kSystemPointerSize;
case MachineRepresentation::kFloat32:
- return kPointerSize;
+ return kSystemPointerSize;
case MachineRepresentation::kFloat64:
return kDoubleSize;
case MachineRepresentation::kSimd128:
@@ -382,7 +384,7 @@ class TestEnvironment : public HandleAndZoneScope {
TestEnvironment()
: blocks_(1, NewBlock(main_zone(), RpoNumber::FromInt(0)), main_zone()),
- code_(main_isolate(), main_zone(), &blocks_),
+ instructions_(main_isolate(), main_zone(), &blocks_),
rng_(CcTest::random_number_generator()),
supported_reps_({MachineRepresentation::kTagged,
MachineRepresentation::kFloat32,
@@ -521,7 +523,7 @@ class TestEnvironment : public HandleAndZoneScope {
// Keep a map of (MachineRepresentation . std::vector<int>) with
// allocated slots to pick from for each representation.
int slot = slot_parameter_n;
- slot_parameter_n -= (GetSlotSizeInBytes(rep) / kPointerSize);
+ slot_parameter_n -= (GetSlotSizeInBytes(rep) / kSystemPointerSize);
AddStackSlot(&test_signature, rep, slot);
entry->second--;
}
@@ -535,7 +537,7 @@ class TestEnvironment : public HandleAndZoneScope {
for (int i = 0; i < kSmiConstantCount; i++) {
intptr_t smi_value = static_cast<intptr_t>(
Smi::FromInt(rng_->NextInt(Smi::kMaxValue)).ptr());
- Constant constant = kPointerSize == 8
+ Constant constant = kSystemPointerSize == 8
? Constant(static_cast<int64_t>(smi_value))
: Constant(static_cast<int32_t>(smi_value));
AddConstant(MachineRepresentation::kTagged, AllocateConstant(constant));
@@ -573,8 +575,8 @@ class TestEnvironment : public HandleAndZoneScope {
}
int AllocateConstant(Constant constant) {
- int virtual_register = code_.NextVirtualRegister();
- code_.AddConstant(virtual_register, constant);
+ int virtual_register = instructions_.NextVirtualRegister();
+ instructions_.AddConstant(virtual_register, constant);
return virtual_register;
}
@@ -721,8 +723,8 @@ class TestEnvironment : public HandleAndZoneScope {
OperandToStatePosition(AllocatedOperand::cast(move->destination()));
InstructionOperand from = move->source();
if (from.IsConstant()) {
- Constant constant =
- code_.GetConstant(ConstantOperand::cast(from).virtual_register());
+ Constant constant = instructions_.GetConstant(
+ ConstantOperand::cast(from).virtual_register());
Handle<Object> constant_value;
switch (constant.type()) {
case Constant::kInt32:
@@ -924,13 +926,13 @@ class TestEnvironment : public HandleAndZoneScope {
}
v8::base::RandomNumberGenerator* rng() const { return rng_; }
- InstructionSequence* code() { return &code_; }
+ InstructionSequence* instructions() { return &instructions_; }
CallDescriptor* test_descriptor() { return test_descriptor_; }
int stack_slot_count() const { return stack_slot_count_; }
private:
ZoneVector<InstructionBlock*> blocks_;
- InstructionSequence code_;
+ InstructionSequence instructions_;
v8::base::RandomNumberGenerator* rng_;
// The layout describes the type of each element in the environment, in order.
std::vector<AllocatedOperand> layout_;
@@ -995,9 +997,10 @@ class CodeGeneratorTester {
}
generator_ = new CodeGenerator(
- environment->main_zone(), &frame_, &linkage_, environment->code(),
- &info_, environment->main_isolate(), base::Optional<OsrHelper>(),
- kNoSourcePosition, nullptr, PoisoningMitigationLevel::kDontPoison,
+ environment->main_zone(), &frame_, &linkage_,
+ environment->instructions(), &info_, environment->main_isolate(),
+ base::Optional<OsrHelper>(), kNoSourcePosition, nullptr,
+ PoisoningMitigationLevel::kDontPoison,
AssemblerOptions::Default(environment->main_isolate()),
Builtins::kNoBuiltinId);
@@ -1109,6 +1112,8 @@ class CodeGeneratorTester {
generator_->FinishCode();
generator_->safepoints()->Emit(generator_->tasm(),
frame_.GetTotalFrameSlotCount());
+ generator_->MaybeEmitOutOfLineConstantPool();
+
return generator_->FinalizeCode().ToHandleChecked();
}
@@ -1121,7 +1126,7 @@ class CodeGeneratorTester {
generator_->AssembleMove(&move.second, &move.first);
}
- InstructionSequence* sequence = generator_->code();
+ InstructionSequence* sequence = generator_->instructions();
sequence->StartBlock(RpoNumber::FromInt(0));
// The environment expects this code to tail-call to it's first parameter
diff --git a/deps/v8/test/cctest/compiler/test-js-constant-cache.cc b/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
index a31700ede2..23711bb3e7 100644
--- a/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
+++ b/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
@@ -167,9 +167,9 @@ TEST(CanonicalizingNumbers) {
JSConstantCacheTester T;
FOR_FLOAT64_INPUTS(i) {
- Node* node = T.Constant(*i);
+ Node* node = T.Constant(i);
for (int j = 0; j < 5; j++) {
- CHECK_EQ(node, T.Constant(*i));
+ CHECK_EQ(node, T.Constant(i));
}
}
}
@@ -178,8 +178,7 @@ TEST(CanonicalizingNumbers) {
TEST(HeapNumbers) {
JSConstantCacheTester T;
- FOR_FLOAT64_INPUTS(i) {
- double value = *i;
+ FOR_FLOAT64_INPUTS(value) {
Handle<Object> num = T.factory()->NewNumber(value);
Handle<HeapNumber> heap = T.factory()->NewHeapNumber(value);
Node* node1 = T.Constant(value);
diff --git a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
index 073891a52b..61736ae2dc 100644
--- a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
+++ b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
@@ -256,11 +256,8 @@ TEST(ReduceWord32And) {
ReducerTester R;
R.binop = R.machine.Word32And();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x & y, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x & y, x, y); }
}
R.CheckPutConstantOnRight(33);
@@ -282,11 +279,8 @@ TEST(ReduceWord32Or) {
ReducerTester R;
R.binop = R.machine.Word32Or();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x | y, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x | y, x, y); }
}
R.CheckPutConstantOnRight(36);
@@ -308,11 +302,8 @@ TEST(ReduceWord32Xor) {
ReducerTester R;
R.binop = R.machine.Word32Xor();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x ^ y, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x ^ y, x, y); }
}
R.CheckPutConstantOnRight(39);
@@ -332,10 +323,9 @@ TEST(ReduceWord32Shl) {
R.binop = R.machine.Word32Shl();
// TODO(titzer): out of range shifts
- FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(x) {
for (int y = 0; y < 32; y++) {
- int32_t x = *i;
- R.CheckFoldBinop<int32_t>(x << y, x, y);
+ R.CheckFoldBinop<int32_t>(base::ShlWithWraparound(x, y), x, y);
}
}
@@ -351,10 +341,9 @@ TEST(ReduceWord64Shl) {
ReducerTester R;
R.binop = R.machine.Word64Shl();
- FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(x) {
for (int64_t y = 0; y < 64; y++) {
- int64_t x = *i;
- R.CheckFoldBinop<int64_t>(x << y, x, y);
+ R.CheckFoldBinop<int64_t>(base::ShlWithWraparound(x, y), x, y);
}
}
@@ -371,9 +360,8 @@ TEST(ReduceWord32Shr) {
R.binop = R.machine.Word32Shr();
// TODO(titzer): test out of range shifts
- FOR_UINT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(x) {
for (uint32_t y = 0; y < 32; y++) {
- uint32_t x = *i;
R.CheckFoldBinop<int32_t>(x >> y, x, y);
}
}
@@ -390,9 +378,8 @@ TEST(ReduceWord64Shr) {
ReducerTester R;
R.binop = R.machine.Word64Shr();
- FOR_UINT64_INPUTS(i) {
+ FOR_UINT64_INPUTS(x) {
for (uint64_t y = 0; y < 64; y++) {
- uint64_t x = *i;
R.CheckFoldBinop<int64_t>(x >> y, x, y);
}
}
@@ -410,9 +397,8 @@ TEST(ReduceWord32Sar) {
R.binop = R.machine.Word32Sar();
// TODO(titzer): test out of range shifts
- FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(x) {
for (int32_t y = 0; y < 32; y++) {
- int32_t x = *i;
R.CheckFoldBinop<int32_t>(x >> y, x, y);
}
}
@@ -429,9 +415,8 @@ TEST(ReduceWord64Sar) {
ReducerTester R;
R.binop = R.machine.Word64Sar();
- FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(x) {
for (int64_t y = 0; y < 64; y++) {
- int64_t x = *i;
R.CheckFoldBinop<int64_t>(x >> y, x, y);
}
}
@@ -477,11 +462,8 @@ TEST(Word32Equal) {
ReducerTester R;
R.binop = R.machine.Word32Equal();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x == y ? 1 : 0, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x == y ? 1 : 0, x, y); }
}
R.CheckPutConstantOnRight(48);
@@ -502,9 +484,8 @@ TEST(ReduceInt32Add) {
ReducerTester R;
R.binop = R.machine.Int32Add();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
R.CheckFoldBinop<int32_t>(base::AddWithWraparound(x, y), x, y);
}
}
@@ -523,9 +504,8 @@ TEST(ReduceInt64Add) {
ReducerTester R;
R.binop = R.machine.Int64Add();
- FOR_INT64_INPUTS(pl) {
- FOR_INT64_INPUTS(pr) {
- int64_t x = *pl, y = *pr;
+ FOR_INT64_INPUTS(x) {
+ FOR_INT64_INPUTS(y) {
R.CheckFoldBinop<int64_t>(base::AddWithWraparound(x, y), x, y);
}
}
@@ -542,9 +522,8 @@ TEST(ReduceInt32Sub) {
ReducerTester R;
R.binop = R.machine.Int32Sub();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
R.CheckFoldBinop<int32_t>(base::SubWithWraparound(x, y), x, y);
}
}
@@ -561,9 +540,8 @@ TEST(ReduceInt64Sub) {
ReducerTester R;
R.binop = R.machine.Int64Sub();
- FOR_INT64_INPUTS(pl) {
- FOR_INT64_INPUTS(pr) {
- int64_t x = *pl, y = *pr;
+ FOR_INT64_INPUTS(x) {
+ FOR_INT64_INPUTS(y) {
R.CheckFoldBinop<int64_t>(base::SubWithWraparound(x, y), x, y);
}
}
@@ -586,9 +564,8 @@ TEST(ReduceInt32Mul) {
ReducerTester R;
R.binop = R.machine.Int32Mul();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
R.CheckFoldBinop<int32_t>(base::MulWithWraparound(x, y), x, y);
}
}
@@ -624,9 +601,8 @@ TEST(ReduceInt32Div) {
ReducerTester R;
R.binop = R.machine.Int32Div();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
if (y == 0) continue; // TODO(titzer): test / 0
int32_t r = y == -1 ? base::NegateWithWraparound(x)
: x / y; // INT_MIN / -1 may explode in C
@@ -653,9 +629,8 @@ TEST(ReduceUint32Div) {
ReducerTester R;
R.binop = R.machine.Uint32Div();
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) {
if (y == 0) continue; // TODO(titzer): test / 0
R.CheckFoldBinop<int32_t>(x / y, x, y);
}
@@ -682,9 +657,8 @@ TEST(ReduceInt32Mod) {
ReducerTester R;
R.binop = R.machine.Int32Mod();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
if (y == 0) continue; // TODO(titzer): test % 0
int32_t r = y == -1 ? 0 : x % y; // INT_MIN % -1 may explode in C
R.CheckFoldBinop<int32_t>(r, x, y);
@@ -706,9 +680,8 @@ TEST(ReduceUint32Mod) {
ReducerTester R;
R.binop = R.machine.Uint32Mod();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) {
if (y == 0) continue; // TODO(titzer): test x % 0
R.CheckFoldBinop<int32_t>(x % y, x, y);
}
@@ -734,11 +707,8 @@ TEST(ReduceInt32LessThan) {
ReducerTester R;
R.binop = R.machine.Int32LessThan();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y); }
}
R.CheckDontPutConstantOnRight(41399);
@@ -754,14 +724,11 @@ TEST(ReduceInt32LessThanOrEqual) {
ReducerTester R;
R.binop = R.machine.Int32LessThanOrEqual();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y); }
}
- FOR_INT32_INPUTS(i) { R.CheckDontPutConstantOnRight<int32_t>(*i); }
+ FOR_INT32_INPUTS(i) { R.CheckDontPutConstantOnRight<int32_t>(i); }
Node* x = R.Parameter(0);
@@ -773,11 +740,8 @@ TEST(ReduceUint32LessThan) {
ReducerTester R;
R.binop = R.machine.Uint32LessThan();
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y);
- }
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y); }
}
R.CheckDontPutConstantOnRight(41399);
@@ -797,11 +761,8 @@ TEST(ReduceUint32LessThanOrEqual) {
ReducerTester R;
R.binop = R.machine.Uint32LessThanOrEqual();
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y);
- }
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y); }
}
R.CheckDontPutConstantOnRight(41399);
@@ -846,11 +807,8 @@ TEST(ReduceFloat32Sub) {
ReducerTester R;
R.binop = R.machine.Float32Sub();
- FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) {
- float x = *pl, y = *pr;
- R.CheckFoldBinop<float>(x - y, x, y);
- }
+ FOR_FLOAT32_INPUTS(x) {
+ FOR_FLOAT32_INPUTS(y) { R.CheckFoldBinop<float>(x - y, x, y); }
}
Node* x = R.Parameter();
@@ -866,11 +824,8 @@ TEST(ReduceFloat64Sub) {
ReducerTester R;
R.binop = R.machine.Float64Sub();
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(x - y, x, y);
- }
+ FOR_FLOAT64_INPUTS(x) {
+ FOR_FLOAT64_INPUTS(y) { R.CheckFoldBinop<double>(x - y, x, y); }
}
Node* x = R.Parameter();
diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc
index bf5e829509..7f35b1b0ee 100644
--- a/deps/v8/test/cctest/compiler/test-multiple-return.cc
+++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc
@@ -125,7 +125,7 @@ std::unique_ptr<wasm::NativeModule> AllocateNativeModule(Isolate* isolate,
// We have to add the code object to a NativeModule, because the
// WasmCallDescriptor assumes that code is on the native heap and not
// within a code object.
- return isolate->wasm_engine()->code_manager()->NewNativeModule(
+ return isolate->wasm_engine()->NewNativeModule(
isolate, wasm::kAllWasmFeatures, code_size, false, std::move(module));
}
diff --git a/deps/v8/test/cctest/compiler/test-representation-change.cc b/deps/v8/test/cctest/compiler/test-representation-change.cc
index f4218467f7..3f1cbaad24 100644
--- a/deps/v8/test/cctest/compiler/test-representation-change.cc
+++ b/deps/v8/test/cctest/compiler/test-representation-change.cc
@@ -261,12 +261,12 @@ TEST(ToInt32_constant) {
RepresentationChangerTester r;
{
FOR_INT32_INPUTS(i) {
- Node* n = r.jsgraph()->Constant(*i);
+ Node* n = r.jsgraph()->Constant(i);
Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
n, MachineRepresentation::kTagged, Type::Signed32(), use,
UseInfo(MachineRepresentation::kWord32, Truncation::None()));
- r.CheckInt32Constant(c, *i);
+ r.CheckInt32Constant(c, i);
}
}
}
@@ -274,24 +274,24 @@ TEST(ToInt32_constant) {
TEST(ToUint32_constant) {
RepresentationChangerTester r;
FOR_UINT32_INPUTS(i) {
- Node* n = r.jsgraph()->Constant(static_cast<double>(*i));
+ Node* n = r.jsgraph()->Constant(static_cast<double>(i));
Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
n, MachineRepresentation::kTagged, Type::Unsigned32(), use,
UseInfo(MachineRepresentation::kWord32, Truncation::None()));
- r.CheckUint32Constant(c, *i);
+ r.CheckUint32Constant(c, i);
}
}
TEST(ToInt64_constant) {
RepresentationChangerTester r;
FOR_INT32_INPUTS(i) {
- Node* n = r.jsgraph()->Constant(*i);
+ Node* n = r.jsgraph()->Constant(i);
Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
n, MachineRepresentation::kTagged, TypeCache::Get()->kSafeInteger, use,
UseInfo(MachineRepresentation::kWord64, Truncation::None()));
- r.CheckInt64Constant(c, *i);
+ r.CheckInt64Constant(c, i);
}
}
@@ -692,8 +692,6 @@ TEST(Nops) {
MachineRepresentation::kWord16);
r.CheckNop(MachineRepresentation::kBit, Type::Boolean(),
MachineRepresentation::kWord32);
- r.CheckNop(MachineRepresentation::kBit, Type::Boolean(),
- MachineRepresentation::kWord64);
}
diff --git a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc
index 775ffadfd4..b6043f2a9d 100644
--- a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc
+++ b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc
@@ -2891,7 +2891,7 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) {
ExpectedSnippet<0, const char*> illegal_const_decl[] = {
{"const x = x = 10 + 3; return x;",
- {"Uncaught ReferenceError: x is not defined"}},
+ {"Uncaught ReferenceError: Cannot access 'x' before initialization"}},
{"const x = 10; x = 20; return x;",
{"Uncaught TypeError: Assignment to constant variable."}},
{"const x = 10; { x = 20; } return x;",
@@ -2899,7 +2899,7 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) {
{"const x = 10; eval('x = 20;'); return x;",
{"Uncaught TypeError: Assignment to constant variable."}},
{"let x = x + 10; return x;",
- {"Uncaught ReferenceError: x is not defined"}},
+ {"Uncaught ReferenceError: Cannot access 'x' before initialization"}},
{"'use strict'; (function f1() { f1 = 123; })() ",
{"Uncaught TypeError: Assignment to constant variable."}},
};
diff --git a/deps/v8/test/cctest/compiler/test-run-load-store.cc b/deps/v8/test/cctest/compiler/test-run-load-store.cc
index ffee5310d2..26d681299d 100644
--- a/deps/v8/test/cctest/compiler/test-run-load-store.cc
+++ b/deps/v8/test/cctest/compiler/test-run-load-store.cc
@@ -52,7 +52,7 @@ void RunLoadInt32(const TestAlignment t) {
}
FOR_INT32_INPUTS(i) {
- p1 = *i;
+ p1 = i;
CHECK_EQ(p1, m.Call());
}
}
@@ -79,7 +79,7 @@ void RunLoadInt32Offset(TestAlignment t) {
}
FOR_INT32_INPUTS(j) {
- p1 = *j;
+ p1 = j;
CHECK_EQ(p1, m.Call());
}
}
@@ -91,9 +91,9 @@ void RunLoadStoreFloat32Offset(TestAlignment t) {
FOR_INT32_INPUTS(i) {
int32_t magic =
- base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(*i, 3));
+ base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(i, 3));
RawMachineAssemblerTester<int32_t> m;
- int32_t offset = *i;
+ int32_t offset = i;
byte* from = reinterpret_cast<byte*>(&p1) - offset;
byte* to = reinterpret_cast<byte*>(&p2) - offset;
// generate load [#base + #index]
@@ -115,8 +115,8 @@ void RunLoadStoreFloat32Offset(TestAlignment t) {
m.Return(m.Int32Constant(magic));
FOR_FLOAT32_INPUTS(j) {
- p1 = *j;
- p2 = *j - 5;
+ p1 = j;
+ p2 = j - 5;
CHECK_EQ(magic, m.Call());
CHECK_DOUBLE_EQ(p1, p2);
}
@@ -129,9 +129,9 @@ void RunLoadStoreFloat64Offset(TestAlignment t) {
FOR_INT32_INPUTS(i) {
int32_t magic =
- base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(*i, 3));
+ base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(i, 3));
RawMachineAssemblerTester<int32_t> m;
- int32_t offset = *i;
+ int32_t offset = i;
byte* from = reinterpret_cast<byte*>(&p1) - offset;
byte* to = reinterpret_cast<byte*>(&p2) - offset;
// generate load [#base + #index]
@@ -152,8 +152,8 @@ void RunLoadStoreFloat64Offset(TestAlignment t) {
m.Return(m.Int32Constant(magic));
FOR_FLOAT64_INPUTS(j) {
- p1 = *j;
- p2 = *j - 5;
+ p1 = j;
+ p2 = j - 5;
CHECK_EQ(magic, m.Call());
CHECK_DOUBLE_EQ(p1, p2);
}
@@ -189,6 +189,36 @@ TEST(RunUnalignedLoadStoreFloat64Offset) {
namespace {
+// Mostly same as CHECK_EQ() but customized for compressed tagged values.
+template <typename CType>
+void CheckEq(CType in_value, CType out_value) {
+ CHECK_EQ(in_value, out_value);
+}
+
+#ifdef V8_COMPRESS_POINTERS
+// Specializations for checking the result of compressing store.
+template <>
+void CheckEq<Object>(Object in_value, Object out_value) {
+ Isolate* isolate = CcTest::InitIsolateOnce();
+ // |out_value| is compressed. Check that it's valid.
+ CHECK_EQ(CompressTagged(in_value->ptr()), out_value->ptr());
+ STATIC_ASSERT(kTaggedSize == kSystemPointerSize);
+ CHECK_EQ(in_value->ptr(),
+ DecompressTaggedAny(isolate->isolate_root(),
+ static_cast<int32_t>(out_value->ptr())));
+}
+
+template <>
+void CheckEq<HeapObject>(HeapObject in_value, HeapObject out_value) {
+ return CheckEq<Object>(in_value, out_value);
+}
+
+template <>
+void CheckEq<Smi>(Smi in_value, Smi out_value) {
+ return CheckEq<Object>(in_value, out_value);
+}
+#endif
+
// Initializes the buffer with some raw data respecting requested representation
// of the values.
template <typename CType>
@@ -239,7 +269,7 @@ void RunLoadImmIndex(MachineType rep, TestAlignment t) {
// When pointer compression is enabled then we need to access only
// the lower 32-bit of the tagged value while the buffer contains
// full 64-bit values.
- base_pointer = LSB(base_pointer, kPointerSize / 2);
+ base_pointer = LSB(base_pointer, kSystemPointerSize / 2);
}
#endif
Node* base = m.PointerConstant(base_pointer);
@@ -252,27 +282,21 @@ void RunLoadImmIndex(MachineType rep, TestAlignment t) {
UNREACHABLE();
}
- CHECK_EQ(buffer[i], m.Call());
+ CheckEq<CType>(buffer[i], m.Call());
}
}
}
template <typename CType>
-CType NullValue() {
- return CType{0};
-}
-
-template <>
-HeapObject NullValue<HeapObject>() {
- return HeapObject();
-}
-
-template <typename CType>
void RunLoadStore(MachineType rep, TestAlignment t) {
const int kNumElems = 16;
CType in_buffer[kNumElems];
CType out_buffer[kNumElems];
+ uintptr_t zap_data[] = {kZapValue, kZapValue};
+ CType zap_value;
+ STATIC_ASSERT(sizeof(CType) <= sizeof(zap_data));
+ MemCopy(&zap_value, &zap_data, sizeof(CType));
InitBuffer(in_buffer, kNumElems, rep);
for (int32_t x = 0; x < kNumElems; x++) {
@@ -294,12 +318,15 @@ void RunLoadStore(MachineType rep, TestAlignment t) {
m.Return(m.Int32Constant(OK));
- memset(out_buffer, 0, sizeof(out_buffer));
+ for (int32_t z = 0; z < kNumElems; z++) {
+ out_buffer[z] = zap_value;
+ }
CHECK_NE(in_buffer[x], out_buffer[y]);
CHECK_EQ(OK, m.Call());
- CHECK_EQ(in_buffer[x], out_buffer[y]);
+ // Mostly same as CHECK_EQ() but customized for compressed tagged values.
+ CheckEq<CType>(in_buffer[x], out_buffer[y]);
for (int32_t z = 0; z < kNumElems; z++) {
- if (z != y) CHECK_EQ(NullValue<CType>(), out_buffer[z]);
+ if (z != y) CHECK_EQ(zap_value, out_buffer[z]);
}
}
}
@@ -335,7 +362,8 @@ void RunUnalignedLoadStoreUnalignedAccess(MachineType rep) {
// Direct read of &out_buffer[y] may cause unaligned access in C++ code
// so we use MemCopy() to handle that.
MemCopy(&out, &out_buffer[y], sizeof(CType));
- CHECK_EQ(in, out);
+ // Mostly same as CHECK_EQ() but customized for compressed tagged values.
+ CheckEq<CType>(in, out);
}
}
}
@@ -458,12 +486,12 @@ void RunLoadStoreSignExtend32(TestAlignment t) {
m.Return(load8);
FOR_INT32_INPUTS(i) {
- buffer[0] = *i;
+ buffer[0] = i;
- CHECK_EQ(static_cast<int8_t>(*i & 0xFF), m.Call());
- CHECK_EQ(static_cast<int8_t>(*i & 0xFF), buffer[1]);
- CHECK_EQ(static_cast<int16_t>(*i & 0xFFFF), buffer[2]);
- CHECK_EQ(*i, buffer[3]);
+ CHECK_EQ(static_cast<int8_t>(i & 0xFF), m.Call());
+ CHECK_EQ(static_cast<int8_t>(i & 0xFF), buffer[1]);
+ CHECK_EQ(static_cast<int16_t>(i & 0xFFFF), buffer[2]);
+ CHECK_EQ(i, buffer[3]);
}
}
@@ -491,12 +519,12 @@ void RunLoadStoreZeroExtend32(TestAlignment t) {
m.Return(load8);
FOR_UINT32_INPUTS(i) {
- buffer[0] = *i;
+ buffer[0] = i;
- CHECK_EQ((*i & 0xFF), m.Call());
- CHECK_EQ((*i & 0xFF), buffer[1]);
- CHECK_EQ((*i & 0xFFFF), buffer[2]);
- CHECK_EQ(*i, buffer[3]);
+ CHECK_EQ((i & 0xFF), m.Call());
+ CHECK_EQ((i & 0xFF), buffer[1]);
+ CHECK_EQ((i & 0xFFFF), buffer[2]);
+ CHECK_EQ(i, buffer[3]);
}
}
} // namespace
@@ -552,18 +580,18 @@ void RunLoadStoreSignExtend64(TestAlignment t) {
m.Return(load8);
FOR_INT64_INPUTS(i) {
- buffer[0] = *i;
+ buffer[0] = i;
- CHECK_EQ(static_cast<int8_t>(*i & 0xFF), m.Call());
- CHECK_EQ(static_cast<int8_t>(*i & 0xFF), buffer[1]);
- CHECK_EQ(static_cast<int16_t>(*i & 0xFFFF), buffer[2]);
- CHECK_EQ(static_cast<int32_t>(*i & 0xFFFFFFFF), buffer[3]);
- CHECK_EQ(*i, buffer[4]);
+ CHECK_EQ(static_cast<int8_t>(i & 0xFF), m.Call());
+ CHECK_EQ(static_cast<int8_t>(i & 0xFF), buffer[1]);
+ CHECK_EQ(static_cast<int16_t>(i & 0xFFFF), buffer[2]);
+ CHECK_EQ(static_cast<int32_t>(i & 0xFFFFFFFF), buffer[3]);
+ CHECK_EQ(i, buffer[4]);
}
}
void RunLoadStoreZeroExtend64(TestAlignment t) {
- if (kPointerSize < 8) return;
+ if (kSystemPointerSize < 8) return;
uint64_t buffer[5];
RawMachineAssemblerTester<uint64_t> m;
Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Uint8());
@@ -595,13 +623,13 @@ void RunLoadStoreZeroExtend64(TestAlignment t) {
m.Return(load8);
FOR_UINT64_INPUTS(i) {
- buffer[0] = *i;
+ buffer[0] = i;
- CHECK_EQ((*i & 0xFF), m.Call());
- CHECK_EQ((*i & 0xFF), buffer[1]);
- CHECK_EQ((*i & 0xFFFF), buffer[2]);
- CHECK_EQ((*i & 0xFFFFFFFF), buffer[3]);
- CHECK_EQ(*i, buffer[4]);
+ CHECK_EQ((i & 0xFF), m.Call());
+ CHECK_EQ((i & 0xFF), buffer[1]);
+ CHECK_EQ((i & 0xFFFF), buffer[2]);
+ CHECK_EQ((i & 0xFFFFFFFF), buffer[3]);
+ CHECK_EQ(i, buffer[4]);
}
}
diff --git a/deps/v8/test/cctest/compiler/test-run-machops.cc b/deps/v8/test/cctest/compiler/test-run-machops.cc
index 782e9b51b8..92e473c840 100644
--- a/deps/v8/test/cctest/compiler/test-run-machops.cc
+++ b/deps/v8/test/cctest/compiler/test-run-machops.cc
@@ -527,8 +527,8 @@ TEST(RunInt64AddWithOverflowP) {
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
int64_t expected_val;
- int expected_ovf = base::bits::SignedAddOverflow64(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, bt.call(*i, *j));
+ int expected_ovf = base::bits::SignedAddOverflow64(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, bt.call(i, j));
CHECK_EQ(expected_val, actual_val);
}
}
@@ -540,41 +540,39 @@ TEST(RunInt64AddWithOverflowImm) {
FOR_INT64_INPUTS(i) {
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
- Node* add = m.Int64AddWithOverflow(m.Int64Constant(*i), m.Parameter(0));
+ Node* add = m.Int64AddWithOverflow(m.Int64Constant(i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
FOR_INT64_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedAddOverflow64(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedAddOverflow64(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
- Node* add = m.Int64AddWithOverflow(m.Parameter(0), m.Int64Constant(*i));
+ Node* add = m.Int64AddWithOverflow(m.Parameter(0), m.Int64Constant(i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
FOR_INT64_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedAddOverflow64(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedAddOverflow64(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
FOR_INT64_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m;
Node* add =
- m.Int64AddWithOverflow(m.Int64Constant(*i), m.Int64Constant(*j));
+ m.Int64AddWithOverflow(m.Int64Constant(i), m.Int64Constant(j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
- int expected_ovf = base::bits::SignedAddOverflow64(*i, *j, &expected_val);
+ int expected_ovf = base::bits::SignedAddOverflow64(i, j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
CHECK_EQ(expected_val, actual_val);
}
@@ -600,10 +598,10 @@ TEST(RunInt64AddWithOverflowInBranchP) {
FOR_INT64_INPUTS(j) {
int32_t expected = constant;
int64_t result;
- if (!base::bits::SignedAddOverflow64(*i, *j, &result)) {
+ if (!base::bits::SignedAddOverflow64(i, j, &result)) {
expected = static_cast<int32_t>(result);
}
- CHECK_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -621,8 +619,8 @@ TEST(RunInt64SubWithOverflowP) {
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
int64_t expected_val;
- int expected_ovf = base::bits::SignedSubOverflow64(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, bt.call(*i, *j));
+ int expected_ovf = base::bits::SignedSubOverflow64(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, bt.call(i, j));
CHECK_EQ(expected_val, actual_val);
}
}
@@ -634,41 +632,39 @@ TEST(RunInt64SubWithOverflowImm) {
FOR_INT64_INPUTS(i) {
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
- Node* add = m.Int64SubWithOverflow(m.Int64Constant(*i), m.Parameter(0));
+ Node* add = m.Int64SubWithOverflow(m.Int64Constant(i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
FOR_INT64_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedSubOverflow64(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedSubOverflow64(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
- Node* add = m.Int64SubWithOverflow(m.Parameter(0), m.Int64Constant(*i));
+ Node* add = m.Int64SubWithOverflow(m.Parameter(0), m.Int64Constant(i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
FOR_INT64_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedSubOverflow64(*j, *i, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedSubOverflow64(j, i, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
FOR_INT64_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m;
Node* add =
- m.Int64SubWithOverflow(m.Int64Constant(*i), m.Int64Constant(*j));
+ m.Int64SubWithOverflow(m.Int64Constant(i), m.Int64Constant(j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
- int expected_ovf = base::bits::SignedSubOverflow64(*i, *j, &expected_val);
+ int expected_ovf = base::bits::SignedSubOverflow64(i, j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
CHECK_EQ(expected_val, actual_val);
}
@@ -694,10 +690,10 @@ TEST(RunInt64SubWithOverflowInBranchP) {
FOR_INT64_INPUTS(j) {
int32_t expected = constant;
int64_t result;
- if (!base::bits::SignedSubOverflow64(*i, *j, &result)) {
+ if (!base::bits::SignedSubOverflow64(i, j, &result)) {
expected = static_cast<int32_t>(result);
}
- CHECK_EQ(expected, static_cast<int32_t>(bt.call(*i, *j)));
+ CHECK_EQ(expected, static_cast<int32_t>(bt.call(i, j)));
}
}
}
@@ -1249,9 +1245,9 @@ TEST(RunInt32AddP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
// Use uint32_t because signed overflow is UB in C.
- int expected = static_cast<int32_t>(static_cast<uint32_t>(*i) +
- static_cast<uint32_t>(*j));
- CHECK_EQ(expected, bt.call(*i, *j));
+ int expected = static_cast<int32_t>(static_cast<uint32_t>(i) +
+ static_cast<uint32_t>(j));
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1268,8 +1264,8 @@ TEST(RunInt32AddAndWord32EqualP) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>(bit_cast<uint32_t>(*i) + (*j == *k));
- CHECK_EQ(expected, m.Call(*i, *j, *k));
+ bit_cast<int32_t>(bit_cast<uint32_t>(i) + (j == k));
+ CHECK_EQ(expected, m.Call(i, j, k));
}
}
}
@@ -1284,8 +1280,8 @@ TEST(RunInt32AddAndWord32EqualP) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>((*i == *j) + bit_cast<uint32_t>(*k));
- CHECK_EQ(expected, m.Call(*i, *j, *k));
+ bit_cast<int32_t>((i == j) + bit_cast<uint32_t>(k));
+ CHECK_EQ(expected, m.Call(i, j, k));
}
}
}
@@ -1298,30 +1294,30 @@ TEST(RunInt32AddAndWord32EqualImm) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Int32Add(m.Int32Constant(*i),
- m.Word32Equal(m.Parameter(0), m.Parameter(1))));
- FOR_INT32_INPUTS(j) {
- FOR_INT32_INPUTS(k) {
- // Use uint32_t because signed overflow is UB in C.
- int32_t const expected =
- bit_cast<int32_t>(bit_cast<uint32_t>(*i) + (*j == *k));
- CHECK_EQ(expected, m.Call(*j, *k));
- }
- }
+ m.Return(m.Int32Add(m.Int32Constant(i),
+ m.Word32Equal(m.Parameter(0), m.Parameter(1))));
+ FOR_INT32_INPUTS(j) {
+ FOR_INT32_INPUTS(k) {
+ // Use uint32_t because signed overflow is UB in C.
+ int32_t const expected =
+ bit_cast<int32_t>(bit_cast<uint32_t>(i) + (j == k));
+ CHECK_EQ(expected, m.Call(j, k));
+ }
+ }
}
}
{
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Int32Add(m.Word32Equal(m.Int32Constant(*i), m.Parameter(0)),
+ m.Return(m.Int32Add(m.Word32Equal(m.Int32Constant(i), m.Parameter(0)),
m.Parameter(1)));
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>((*i == *j) + bit_cast<uint32_t>(*k));
- CHECK_EQ(expected, m.Call(*j, *k));
+ bit_cast<int32_t>((i == j) + bit_cast<uint32_t>(k));
+ CHECK_EQ(expected, m.Call(j, k));
}
}
}
@@ -1340,8 +1336,8 @@ TEST(RunInt32AddAndWord32NotEqualP) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>(bit_cast<uint32_t>(*i) + (*j != *k));
- CHECK_EQ(expected, m.Call(*i, *j, *k));
+ bit_cast<int32_t>(bit_cast<uint32_t>(i) + (j != k));
+ CHECK_EQ(expected, m.Call(i, j, k));
}
}
}
@@ -1356,8 +1352,8 @@ TEST(RunInt32AddAndWord32NotEqualP) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>((*i != *j) + bit_cast<uint32_t>(*k));
- CHECK_EQ(expected, m.Call(*i, *j, *k));
+ bit_cast<int32_t>((i != j) + bit_cast<uint32_t>(k));
+ CHECK_EQ(expected, m.Call(i, j, k));
}
}
}
@@ -1370,30 +1366,30 @@ TEST(RunInt32AddAndWord32NotEqualImm) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Int32Add(m.Int32Constant(*i),
- m.Word32NotEqual(m.Parameter(0), m.Parameter(1))));
- FOR_INT32_INPUTS(j) {
- FOR_INT32_INPUTS(k) {
- // Use uint32_t because signed overflow is UB in C.
- int32_t const expected =
- bit_cast<int32_t>(bit_cast<uint32_t>(*i) + (*j != *k));
- CHECK_EQ(expected, m.Call(*j, *k));
- }
- }
+ m.Return(m.Int32Add(m.Int32Constant(i),
+ m.Word32NotEqual(m.Parameter(0), m.Parameter(1))));
+ FOR_INT32_INPUTS(j) {
+ FOR_INT32_INPUTS(k) {
+ // Use uint32_t because signed overflow is UB in C.
+ int32_t const expected =
+ bit_cast<int32_t>(bit_cast<uint32_t>(i) + (j != k));
+ CHECK_EQ(expected, m.Call(j, k));
+ }
+ }
}
}
{
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Int32Add(m.Word32NotEqual(m.Int32Constant(*i), m.Parameter(0)),
+ m.Return(m.Int32Add(m.Word32NotEqual(m.Int32Constant(i), m.Parameter(0)),
m.Parameter(1)));
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>((*i != *j) + bit_cast<uint32_t>(*k));
- CHECK_EQ(expected, m.Call(*j, *k));
+ bit_cast<int32_t>((i != j) + bit_cast<uint32_t>(k));
+ CHECK_EQ(expected, m.Call(j, k));
}
}
}
@@ -1411,8 +1407,8 @@ TEST(RunInt32AddAndWord32SarP) {
FOR_INT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = *i + (*j >> shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = i + (j >> shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1426,8 +1422,8 @@ TEST(RunInt32AddAndWord32SarP) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = (*i >> shift) + *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = (i >> shift) + k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1438,30 +1434,30 @@ TEST(RunInt32AddAndWord32SarP) {
TEST(RunInt32AddAndWord32ShlP) {
{
RawMachineAssemblerTester<int32_t> m(
- MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
+ MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
m.Return(m.Int32Add(m.Parameter(0),
m.Word32Shl(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
+ FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = *i + (*j << shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = i + (j << shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
}
{
RawMachineAssemblerTester<int32_t> m(
- MachineType::Int32(), MachineType::Uint32(), MachineType::Uint32());
+ MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
m.Return(m.Int32Add(m.Word32Shl(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
- FOR_INT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = (*i << shift) + *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = (i << shift) + k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1479,8 +1475,8 @@ TEST(RunInt32AddAndWord32ShrP) {
FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = *i + (*j >> shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = i + (j >> shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1494,8 +1490,8 @@ TEST(RunInt32AddAndWord32ShrP) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = (*i >> shift) + *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = (i >> shift) + k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1518,8 +1514,8 @@ TEST(RunInt32AddInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i + *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i + j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1536,8 +1532,8 @@ TEST(RunInt32AddInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i + *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i + j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1545,7 +1541,7 @@ TEST(RunInt32AddInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32Equal(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32Equal(m.Int32Add(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -1553,8 +1549,8 @@ TEST(RunInt32AddInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i + *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (i + j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -1562,7 +1558,7 @@ TEST(RunInt32AddInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32NotEqual(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32NotEqual(m.Int32Add(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -1570,8 +1566,8 @@ TEST(RunInt32AddInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i + *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (i + j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -1601,17 +1597,17 @@ TEST(RunInt32AddInBranch) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = ((*i + right) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = ((i + right) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1628,8 +1624,8 @@ TEST(RunInt32AddInComparison) {
m.Word32Equal(m.Int32Add(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i + *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i + j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1640,31 +1636,31 @@ TEST(RunInt32AddInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Int32Add(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i + *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i + j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i + *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Int32Add(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (i + j) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Int32Add(m.Parameter(0), m.Int32Constant(*i)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*j + *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Int32Add(m.Parameter(0), m.Int32Constant(i)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (j + i) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
@@ -1687,17 +1683,17 @@ TEST(RunInt32AddInComparison) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = (*i + right) == 0;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = (i + right) == 0;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1714,8 +1710,8 @@ TEST(RunInt32SubP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i - *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i - j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1724,20 +1720,20 @@ TEST(RunInt32SubImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i - *j;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Int32Sub(m.Int32Constant(i), m.Parameter(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = i - j;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Int32Sub(m.Parameter(0), m.Int32Constant(*i)));
+ m.Return(m.Int32Sub(m.Parameter(0), m.Int32Constant(i)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *j - *i;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = j - i;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -1758,8 +1754,8 @@ TEST(RunInt32SubAndWord32SarP) {
FOR_UINT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- int32_t expected = *i - (*j >> shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = i - (j >> shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1772,8 +1768,8 @@ TEST(RunInt32SubAndWord32SarP) {
FOR_INT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
- int32_t expected = (*i >> shift) - *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = (i >> shift) - k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1784,29 +1780,29 @@ TEST(RunInt32SubAndWord32SarP) {
TEST(RunInt32SubAndWord32ShlP) {
{
RawMachineAssemblerTester<int32_t> m(
- MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
+ MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
m.Return(m.Int32Sub(m.Parameter(0),
m.Word32Shl(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
+ FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- int32_t expected = *i - (*j << shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = i - (j << shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
}
{
RawMachineAssemblerTester<int32_t> m(
- MachineType::Int32(), MachineType::Uint32(), MachineType::Uint32());
+ MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
m.Return(m.Int32Sub(m.Word32Shl(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
- FOR_INT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = (*i << shift) - *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = (i << shift) - k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1824,8 +1820,8 @@ TEST(RunInt32SubAndWord32ShrP) {
FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
// Use uint32_t because signed overflow is UB in C.
- uint32_t expected = *i - (*j >> shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ uint32_t expected = i - (j >> shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1839,8 +1835,8 @@ TEST(RunInt32SubAndWord32ShrP) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- uint32_t expected = (*i >> shift) - *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ uint32_t expected = (i >> shift) - k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1863,8 +1859,8 @@ TEST(RunInt32SubInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i - *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i - j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1881,8 +1877,8 @@ TEST(RunInt32SubInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i - *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i - j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1890,7 +1886,7 @@ TEST(RunInt32SubInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32Equal(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32Equal(m.Int32Sub(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -1898,8 +1894,8 @@ TEST(RunInt32SubInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i - *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (i - j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -1907,7 +1903,7 @@ TEST(RunInt32SubInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32NotEqual(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32NotEqual(m.Int32Sub(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -1915,8 +1911,8 @@ TEST(RunInt32SubInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i - *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = (i - j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -1946,17 +1942,17 @@ TEST(RunInt32SubInBranch) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = ((*i - right) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = ((i - right) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1973,8 +1969,8 @@ TEST(RunInt32SubInComparison) {
m.Word32Equal(m.Int32Sub(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i - *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i - j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1985,31 +1981,31 @@ TEST(RunInt32SubInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Int32Sub(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i - *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i - j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i - *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Int32Sub(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (i - j) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Int32Sub(m.Parameter(0), m.Int32Constant(*i)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*j - *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Int32Sub(m.Parameter(0), m.Int32Constant(i)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (j - i) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
@@ -2032,17 +2028,17 @@ TEST(RunInt32SubInComparison) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = (*i - right) == 0;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = (i - right) == 0;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -2058,8 +2054,8 @@ TEST(RunInt32MulP) {
bt.AddReturn(m.Int32Mul(bt.param0, bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int expected = base::MulWithWraparound(*i, *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ int expected = base::MulWithWraparound(i, j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2069,8 +2065,8 @@ TEST(RunInt32MulP) {
bt.AddReturn(m.Int32Mul(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i * *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i * j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2084,8 +2080,8 @@ TEST(RunInt32MulHighP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected = static_cast<int32_t>(
- (static_cast<int64_t>(*i) * static_cast<int64_t>(*j)) >> 32);
- CHECK_EQ(expected, bt.call(*i, *j));
+ (static_cast<int64_t>(i) * static_cast<int64_t>(j)) >> 32);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2095,20 +2091,20 @@ TEST(RunInt32MulImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Int32Mul(m.Int32Constant(*i), m.Parameter(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i * *j;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Int32Mul(m.Int32Constant(i), m.Parameter(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = i * j;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Int32Mul(m.Parameter(0), m.Int32Constant(*i)));
+ m.Return(m.Int32Mul(m.Parameter(0), m.Int32Constant(i)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *j * *i;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = j * i;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2119,16 +2115,15 @@ TEST(RunInt32MulAndInt32AddP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- int32_t p0 = *i;
- int32_t p1 = *j;
- m.Return(m.Int32Add(m.Int32Constant(p0),
- m.Int32Mul(m.Parameter(0), m.Int32Constant(p1))));
- FOR_INT32_INPUTS(k) {
- int32_t p2 = *k;
- int expected =
- base::AddWithWraparound(p0, base::MulWithWraparound(p1, p2));
- CHECK_EQ(expected, m.Call(p2));
- }
+ int32_t p0 = i;
+ int32_t p1 = j;
+ m.Return(m.Int32Add(m.Int32Constant(p0),
+ m.Int32Mul(m.Parameter(0), m.Int32Constant(p1))));
+ FOR_INT32_INPUTS(k) {
+ int32_t p2 = k;
+ int expected = base::AddWithWraparound(p0, base::MulWithWraparound(p1, p2));
+ CHECK_EQ(expected, m.Call(p2));
+ }
}
}
}
@@ -2140,9 +2135,9 @@ TEST(RunInt32MulAndInt32AddP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
- int32_t p0 = *i;
- int32_t p1 = *j;
- int32_t p2 = *k;
+ int32_t p0 = i;
+ int32_t p1 = j;
+ int32_t p2 = k;
int expected =
base::AddWithWraparound(p0, base::MulWithWraparound(p1, p2));
CHECK_EQ(expected, m.Call(p0, p1, p2));
@@ -2158,9 +2153,9 @@ TEST(RunInt32MulAndInt32AddP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
- int32_t p0 = *i;
- int32_t p1 = *j;
- int32_t p2 = *k;
+ int32_t p0 = i;
+ int32_t p1 = j;
+ int32_t p2 = k;
int expected =
base::AddWithWraparound(base::MulWithWraparound(p0, p1), p2);
CHECK_EQ(expected, m.Call(p0, p1, p2));
@@ -2173,13 +2168,13 @@ TEST(RunInt32MulAndInt32AddP) {
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
bt.AddReturn(
- m.Int32Add(m.Int32Constant(*i), m.Int32Mul(bt.param0, bt.param1)));
+ m.Int32Add(m.Int32Constant(i), m.Int32Mul(bt.param0, bt.param1)));
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
- int32_t p0 = *j;
- int32_t p1 = *k;
+ int32_t p0 = j;
+ int32_t p1 = k;
int expected =
- base::AddWithWraparound(*i, base::MulWithWraparound(p0, p1));
+ base::AddWithWraparound(i, base::MulWithWraparound(p0, p1));
CHECK_EQ(expected, bt.call(p0, p1));
}
}
@@ -2197,9 +2192,9 @@ TEST(RunInt32MulAndInt32SubP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
- int32_t p0 = *i;
- int32_t p1 = *j;
- int32_t p2 = *k;
+ int32_t p0 = i;
+ int32_t p1 = j;
+ int32_t p2 = k;
int expected =
base::SubWithWraparound(p0, base::MulWithWraparound(p1, p2));
CHECK_EQ(expected, m.Call(p0, p1, p2));
@@ -2212,13 +2207,13 @@ TEST(RunInt32MulAndInt32SubP) {
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
bt.AddReturn(
- m.Int32Sub(m.Int32Constant(*i), m.Int32Mul(bt.param0, bt.param1)));
+ m.Int32Sub(m.Int32Constant(i), m.Int32Mul(bt.param0, bt.param1)));
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
- int32_t p0 = *j;
- int32_t p1 = *k;
+ int32_t p0 = j;
+ int32_t p1 = k;
int expected =
- base::SubWithWraparound(*i, base::MulWithWraparound(p0, p1));
+ base::SubWithWraparound(i, base::MulWithWraparound(p0, p1));
CHECK_EQ(expected, bt.call(p0, p1));
}
}
@@ -2234,8 +2229,8 @@ TEST(RunUint32MulHighP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
int32_t expected = bit_cast<int32_t>(static_cast<uint32_t>(
- (static_cast<uint64_t>(*i) * static_cast<uint64_t>(*j)) >> 32));
- CHECK_EQ(expected, bt.call(bit_cast<int32_t>(*i), bit_cast<int32_t>(*j)));
+ (static_cast<uint64_t>(i) * static_cast<uint64_t>(j)) >> 32));
+ CHECK_EQ(expected, bt.call(bit_cast<int32_t>(i), bit_cast<int32_t>(j)));
}
}
}
@@ -2248,8 +2243,8 @@ TEST(RunInt32DivP) {
bt.AddReturn(m.Int32Div(bt.param0, bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int p0 = *i;
- int p1 = *j;
+ int p0 = i;
+ int p1 = j;
if (p1 != 0 && (static_cast<uint32_t>(p0) != 0x80000000 || p1 != -1)) {
int expected = static_cast<int32_t>(p0 / p1);
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2263,8 +2258,8 @@ TEST(RunInt32DivP) {
bt.AddReturn(m.Int32Add(bt.param0, m.Int32Div(bt.param0, bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int p0 = *i;
- int p1 = *j;
+ int p0 = i;
+ int p1 = j;
if (p1 != 0 && (static_cast<uint32_t>(p0) != 0x80000000 || p1 != -1)) {
int expected =
static_cast<int32_t>(base::AddWithWraparound(p0, (p0 / p1)));
@@ -2283,8 +2278,8 @@ TEST(RunUint32DivP) {
bt.AddReturn(m.Uint32Div(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t p0 = *i;
- uint32_t p1 = *j;
+ uint32_t p0 = i;
+ uint32_t p1 = j;
if (p1 != 0) {
int32_t expected = bit_cast<int32_t>(p0 / p1);
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2298,8 +2293,8 @@ TEST(RunUint32DivP) {
bt.AddReturn(m.Int32Add(bt.param0, m.Uint32Div(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t p0 = *i;
- uint32_t p1 = *j;
+ uint32_t p0 = i;
+ uint32_t p1 = j;
if (p1 != 0) {
int32_t expected = bit_cast<int32_t>(p0 + (p0 / p1));
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2317,8 +2312,8 @@ TEST(RunInt32ModP) {
bt.AddReturn(m.Int32Mod(bt.param0, bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int p0 = *i;
- int p1 = *j;
+ int p0 = i;
+ int p1 = j;
if (p1 != 0 && (static_cast<uint32_t>(p0) != 0x80000000 || p1 != -1)) {
int expected = static_cast<int32_t>(p0 % p1);
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2332,8 +2327,8 @@ TEST(RunInt32ModP) {
bt.AddReturn(m.Int32Add(bt.param0, m.Int32Mod(bt.param0, bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int p0 = *i;
- int p1 = *j;
+ int p0 = i;
+ int p1 = j;
if (p1 != 0 && (static_cast<uint32_t>(p0) != 0x80000000 || p1 != -1)) {
int expected =
static_cast<int32_t>(base::AddWithWraparound(p0, (p0 % p1)));
@@ -2352,8 +2347,8 @@ TEST(RunUint32ModP) {
bt.AddReturn(m.Uint32Mod(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t p0 = *i;
- uint32_t p1 = *j;
+ uint32_t p0 = i;
+ uint32_t p1 = j;
if (p1 != 0) {
uint32_t expected = static_cast<uint32_t>(p0 % p1);
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2367,8 +2362,8 @@ TEST(RunUint32ModP) {
bt.AddReturn(m.Int32Add(bt.param0, m.Uint32Mod(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t p0 = *i;
- uint32_t p1 = *j;
+ uint32_t p0 = i;
+ uint32_t p1 = j;
if (p1 != 0) {
uint32_t expected = static_cast<uint32_t>(p0 + (p0 % p1));
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2386,8 +2381,8 @@ TEST(RunWord32AndP) {
bt.AddReturn(m.Word32And(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = *i & *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = i & j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2397,8 +2392,8 @@ TEST(RunWord32AndP) {
bt.AddReturn(m.Word32And(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = *i & ~(*j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = i & ~(j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2408,8 +2403,8 @@ TEST(RunWord32AndP) {
bt.AddReturn(m.Word32And(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = ~(*i) & *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = ~(i)&j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2424,8 +2419,8 @@ TEST(RunWord32AndAndWord32ShlP) {
m.Word32Shl(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1F))));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i << (*j & 0x1F);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i << (j & 0x1F);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2436,8 +2431,8 @@ TEST(RunWord32AndAndWord32ShlP) {
m.Word32Shl(bt.param0, m.Word32And(m.Int32Constant(0x1F), bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i << (0x1F & *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i << (0x1F & j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2452,8 +2447,8 @@ TEST(RunWord32AndAndWord32ShrP) {
m.Word32Shr(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1F))));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i >> (*j & 0x1F);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i >> (j & 0x1F);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2464,8 +2459,8 @@ TEST(RunWord32AndAndWord32ShrP) {
m.Word32Shr(bt.param0, m.Word32And(m.Int32Constant(0x1F), bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i >> (0x1F & *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i >> (0x1F & j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2480,8 +2475,8 @@ TEST(RunWord32AndAndWord32SarP) {
m.Word32Sar(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1F))));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = *i >> (*j & 0x1F);
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = i >> (j & 0x1F);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2492,8 +2487,8 @@ TEST(RunWord32AndAndWord32SarP) {
m.Word32Sar(bt.param0, m.Word32And(m.Int32Constant(0x1F), bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = *i >> (0x1F & *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = i >> (0x1F & j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2504,21 +2499,21 @@ TEST(RunWord32AndImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32And(m.Int32Constant(*i), m.Parameter(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i & *j;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32And(m.Int32Constant(i), m.Parameter(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = i & j;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
m.Return(
- m.Word32And(m.Int32Constant(*i), m.Word32BitwiseNot(m.Parameter(0))));
+ m.Word32And(m.Int32Constant(i), m.Word32BitwiseNot(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i & ~(*j);
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = i & ~(j);
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2540,8 +2535,8 @@ TEST(RunWord32AndInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i & j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2558,8 +2553,8 @@ TEST(RunWord32AndInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i & j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2567,7 +2562,7 @@ TEST(RunWord32AndInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32Equal(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32Equal(m.Word32And(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -2575,8 +2570,8 @@ TEST(RunWord32AndInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = (i & j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2584,17 +2579,16 @@ TEST(RunWord32AndInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(
- m.Word32NotEqual(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)),
- &blocka, &blockb);
+ m.Branch(m.Word32NotEqual(m.Word32And(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)),
+ &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(constant));
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = (i & j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2624,17 +2618,17 @@ TEST(RunWord32AndInBranch) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = ((*i & right) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = ((i & right) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -2651,8 +2645,8 @@ TEST(RunWord32AndInComparison) {
m.Word32Equal(m.Word32And(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i & *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i & j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2663,30 +2657,30 @@ TEST(RunWord32AndInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32And(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i & *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i & j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i & *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Word32And(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (i & j) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Word32And(m.Parameter(0), m.Int32Constant(*i)),
+ m.Return(m.Word32Equal(m.Word32And(m.Parameter(0), m.Int32Constant(i)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*j & *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (j & i) == 0;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2700,8 +2694,8 @@ TEST(RunWord32OrP) {
bt.AddReturn(m.Word32Or(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i | *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i | j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2711,8 +2705,8 @@ TEST(RunWord32OrP) {
bt.AddReturn(m.Word32Or(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i | ~(*j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i | ~(j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2722,8 +2716,8 @@ TEST(RunWord32OrP) {
bt.AddReturn(m.Word32Or(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = ~(*i) | *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = ~(i) | j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2734,21 +2728,21 @@ TEST(RunWord32OrImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i | *j;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Or(m.Int32Constant(i), m.Parameter(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = i | j;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
m.Return(
- m.Word32Or(m.Int32Constant(*i), m.Word32BitwiseNot(m.Parameter(0))));
+ m.Word32Or(m.Int32Constant(i), m.Word32BitwiseNot(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i | ~(*j);
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = i | ~(j);
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2770,8 +2764,8 @@ TEST(RunWord32OrInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = (*i | *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i | j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2788,8 +2782,8 @@ TEST(RunWord32OrInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = (*i | *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i | j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2797,7 +2791,7 @@ TEST(RunWord32OrInBranch) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32Equal(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32Equal(m.Word32Or(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -2805,8 +2799,8 @@ TEST(RunWord32OrInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_INT32_INPUTS(j) {
- int32_t expected = (*i | *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = (i | j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2814,7 +2808,7 @@ TEST(RunWord32OrInBranch) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32NotEqual(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32NotEqual(m.Word32Or(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -2822,8 +2816,8 @@ TEST(RunWord32OrInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_INT32_INPUTS(j) {
- int32_t expected = (*i | *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = (i | j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2853,17 +2847,17 @@ TEST(RunWord32OrInBranch) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = ((*i | right) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = ((i | right) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -2880,8 +2874,8 @@ TEST(RunWord32OrInComparison) {
m.Word32Equal(m.Word32Or(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i | *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i | j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2892,30 +2886,30 @@ TEST(RunWord32OrInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32Or(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i | *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i | j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i | *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Word32Or(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (i | j) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Word32Or(m.Parameter(0), m.Int32Constant(*i)),
+ m.Return(m.Word32Equal(m.Word32Or(m.Parameter(0), m.Int32Constant(i)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*j | *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (j | i) == 0;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2926,11 +2920,11 @@ TEST(RunWord32XorP) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i ^ *j;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Xor(m.Int32Constant(i), m.Parameter(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = i ^ j;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
@@ -2939,8 +2933,8 @@ TEST(RunWord32XorP) {
bt.AddReturn(m.Word32Xor(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i ^ *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i ^ j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2950,8 +2944,8 @@ TEST(RunWord32XorP) {
bt.AddReturn(m.Word32Xor(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = *i ^ ~(*j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = i ^ ~(j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2961,8 +2955,8 @@ TEST(RunWord32XorP) {
bt.AddReturn(m.Word32Xor(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = ~(*i) ^ *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = ~(i) ^ j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2970,10 +2964,10 @@ TEST(RunWord32XorP) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
m.Return(
- m.Word32Xor(m.Int32Constant(*i), m.Word32BitwiseNot(m.Parameter(0))));
+ m.Word32Xor(m.Int32Constant(i), m.Word32BitwiseNot(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i ^ ~(*j);
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = i ^ ~(j);
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2995,8 +2989,8 @@ TEST(RunWord32XorInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i ^ j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -3013,8 +3007,8 @@ TEST(RunWord32XorInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i ^ j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -3022,7 +3016,7 @@ TEST(RunWord32XorInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32Equal(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32Equal(m.Word32Xor(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -3030,8 +3024,8 @@ TEST(RunWord32XorInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (i ^ j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3039,17 +3033,16 @@ TEST(RunWord32XorInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(
- m.Word32NotEqual(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)),
- &blocka, &blockb);
+ m.Branch(m.Word32NotEqual(m.Word32Xor(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)),
+ &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(constant));
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (i ^ j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3079,17 +3072,17 @@ TEST(RunWord32XorInBranch) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = ((*i ^ right) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = ((i ^ right) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -3104,8 +3097,8 @@ TEST(RunWord32ShlP) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
m.Return(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *j << shift;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = j << shift;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3115,8 +3108,8 @@ TEST(RunWord32ShlP) {
bt.AddReturn(m.Word32Shl(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = *i << shift;
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = i << shift;
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3131,8 +3124,8 @@ TEST(RunWord32ShlInComparison) {
m.Word32Equal(m.Word32Shl(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == (*i << shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == (i << shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3143,8 +3136,8 @@ TEST(RunWord32ShlInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32Shl(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == (*i << shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == (i << shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3155,8 +3148,8 @@ TEST(RunWord32ShlInComparison) {
m.Word32Equal(m.Int32Constant(0),
m.Word32Shl(m.Parameter(0), m.Int32Constant(shift))));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == (*i << shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == (i << shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3167,8 +3160,8 @@ TEST(RunWord32ShlInComparison) {
m.Word32Equal(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == (*i << shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == (i << shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3181,8 +3174,8 @@ TEST(RunWord32ShrP) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
m.Return(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *j >> shift;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = j >> shift;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3192,8 +3185,8 @@ TEST(RunWord32ShrP) {
bt.AddReturn(m.Word32Shr(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = *i >> shift;
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = i >> shift;
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
CHECK_EQ(0x00010000u, bt.call(0x80000000, 15));
@@ -3213,8 +3206,8 @@ TEST(RunWordShiftInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = ((*i << shift) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = ((i << shift) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i));
}
}
FOR_UINT32_SHIFTS(shift) {
@@ -3228,8 +3221,8 @@ TEST(RunWordShiftInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = ((*i >> shift) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = ((i >> shift) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i));
}
}
FOR_UINT32_SHIFTS(shift) {
@@ -3243,8 +3236,8 @@ TEST(RunWordShiftInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_INT32_INPUTS(i) {
- int32_t expected = ((*i >> shift) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i));
+ int32_t expected = ((i >> shift) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3257,8 +3250,8 @@ TEST(RunWord32ShrInComparison) {
m.Word32Equal(m.Word32Shr(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3269,8 +3262,8 @@ TEST(RunWord32ShrInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32Shr(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3281,8 +3274,8 @@ TEST(RunWord32ShrInComparison) {
m.Word32Equal(m.Int32Constant(0),
m.Word32Shr(m.Parameter(0), m.Int32Constant(shift))));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3293,8 +3286,8 @@ TEST(RunWord32ShrInComparison) {
m.Word32Equal(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3307,8 +3300,8 @@ TEST(RunWord32SarP) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
m.Return(m.Word32Sar(m.Parameter(0), m.Int32Constant(shift)));
FOR_INT32_INPUTS(j) {
- int32_t expected = *j >> shift;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = j >> shift;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3318,8 +3311,8 @@ TEST(RunWord32SarP) {
bt.AddReturn(m.Word32Sar(bt.param0, bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_SHIFTS(shift) {
- int32_t expected = *i >> shift;
- CHECK_EQ(expected, bt.call(*i, shift));
+ int32_t expected = i >> shift;
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
CHECK_EQ(bit_cast<int32_t>(0xFFFF0000), bt.call(0x80000000, 15));
@@ -3335,8 +3328,8 @@ TEST(RunWord32SarInComparison) {
m.Word32Equal(m.Word32Sar(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_INT32_INPUTS(i) {
FOR_INT32_SHIFTS(shift) {
- int32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ int32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3347,8 +3340,8 @@ TEST(RunWord32SarInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32Sar(bt.param0, bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_SHIFTS(shift) {
- int32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ int32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3359,8 +3352,8 @@ TEST(RunWord32SarInComparison) {
m.Word32Equal(m.Int32Constant(0),
m.Word32Sar(m.Parameter(0), m.Int32Constant(shift))));
FOR_INT32_INPUTS(i) {
- int32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, m.Call(*i));
+ int32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3371,8 +3364,8 @@ TEST(RunWord32SarInComparison) {
m.Word32Equal(m.Word32Sar(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_INT32_INPUTS(i) {
- int32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, m.Call(*i));
+ int32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3385,8 +3378,8 @@ TEST(RunWord32RorP) {
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
m.Return(m.Word32Ror(m.Parameter(0), m.Int32Constant(shift)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = base::bits::RotateRight32(*j, shift);
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = base::bits::RotateRight32(j, shift);
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3396,8 +3389,8 @@ TEST(RunWord32RorP) {
bt.AddReturn(m.Word32Ror(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = base::bits::RotateRight32(*i, shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = base::bits::RotateRight32(i, shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3412,8 +3405,8 @@ TEST(RunWord32RorInComparison) {
m.Word32Equal(m.Word32Ror(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == base::bits::RotateRight32(*i, shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == base::bits::RotateRight32(i, shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3424,8 +3417,8 @@ TEST(RunWord32RorInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32Ror(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == base::bits::RotateRight32(*i, shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == base::bits::RotateRight32(i, shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3436,8 +3429,8 @@ TEST(RunWord32RorInComparison) {
m.Word32Equal(m.Int32Constant(0),
m.Word32Ror(m.Parameter(0), m.Int32Constant(shift))));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == base::bits::RotateRight32(*i, shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == base::bits::RotateRight32(i, shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3448,8 +3441,8 @@ TEST(RunWord32RorInComparison) {
m.Word32Equal(m.Word32Ror(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == base::bits::RotateRight32(*i, shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == base::bits::RotateRight32(i, shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3459,8 +3452,8 @@ TEST(RunWord32BitwiseNotP) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
m.Return(m.Word32BitwiseNot(m.Parameter(0)));
FOR_INT32_INPUTS(i) {
- int expected = ~(*i);
- CHECK_EQ(expected, m.Call(*i));
+ int expected = ~(i);
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -3469,8 +3462,8 @@ TEST(RunInt32NegP) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
m.Return(m.Int32Neg(m.Parameter(0)));
FOR_INT32_INPUTS(i) {
- int expected = base::NegateWithWraparound(*i);
- CHECK_EQ(expected, m.Call(*i));
+ int expected = base::NegateWithWraparound(i);
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -3484,8 +3477,8 @@ TEST(RunWord32EqualAndWord32SarP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- int32_t expected = (*i == (*j >> shift));
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = (i == (j >> shift));
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -3498,8 +3491,8 @@ TEST(RunWord32EqualAndWord32SarP) {
FOR_INT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_INT32_INPUTS(k) {
- int32_t expected = ((*i >> shift) == *k);
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = ((i >> shift) == k);
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -3516,8 +3509,8 @@ TEST(RunWord32EqualAndWord32ShlP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- int32_t expected = (*i == (*j << shift));
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = (i == (j << shift));
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -3530,8 +3523,8 @@ TEST(RunWord32EqualAndWord32ShlP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
- int32_t expected = ((*i << shift) == *k);
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = ((i << shift) == k);
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -3548,8 +3541,8 @@ TEST(RunWord32EqualAndWord32ShrP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- int32_t expected = (*i == (*j >> shift));
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = (i == (j >> shift));
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -3562,8 +3555,8 @@ TEST(RunWord32EqualAndWord32ShrP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
- int32_t expected = ((*i >> shift) == *k);
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = ((i >> shift) == k);
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -3644,7 +3637,7 @@ TEST(RunFloat32Add) {
m.Return(m.Float32Add(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i + *j, m.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(i + j, m.Call(i, j)); }
}
}
@@ -3655,14 +3648,14 @@ TEST(RunFloat32Sub) {
m.Return(m.Float32Sub(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, m.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(i - j, m.Call(i, j)); }
}
}
TEST(RunFloat32Neg) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
m.Return(m.AddNode(m.machine()->Float32Neg(), m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(-0.0f - *i, m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(-0.0f - i, m.Call(i)); }
}
TEST(RunFloat32Mul) {
@@ -3671,7 +3664,7 @@ TEST(RunFloat32Mul) {
m.Return(m.Float32Mul(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i * *j, m.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(i * j, m.Call(i, j)); }
}
}
@@ -3682,9 +3675,7 @@ TEST(RunFloat32Div) {
m.Return(m.Float32Div(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) {
- CHECK_FLOAT_EQ(base::Divide(*i, *j), m.Call(*i, *j));
- }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(base::Divide(i, j), m.Call(i, j)); }
}
}
@@ -3695,7 +3686,7 @@ TEST(RunFloat64Add) {
m.Return(m.Float64Add(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(*i + *j, m.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(i + j, m.Call(i, j)); }
}
}
@@ -3706,14 +3697,14 @@ TEST(RunFloat64Sub) {
m.Return(m.Float64Sub(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(*i - *j, m.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(i - j, m.Call(i, j)); }
}
}
TEST(RunFloat64Neg) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.AddNode(m.machine()->Float64Neg(), m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(-0.0 - *i, m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(-0.0 - i, m.Call(i)); }
}
TEST(RunFloat64Mul) {
@@ -3722,7 +3713,7 @@ TEST(RunFloat64Mul) {
m.Return(m.Float64Mul(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(*i * *j, m.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(i * j, m.Call(i, j)); }
}
}
@@ -3733,9 +3724,7 @@ TEST(RunFloat64Div) {
m.Return(m.Float64Div(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) {
- CHECK_DOUBLE_EQ(base::Divide(*i, *j), m.Call(*i, *j));
- }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(base::Divide(i, j), m.Call(i, j)); }
}
}
@@ -3746,7 +3735,7 @@ TEST(RunFloat64Mod) {
m.Return(m.Float64Mod(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(Modulo(*i, *j), m.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(Modulo(i, j), m.Call(i, j)); }
}
}
@@ -3792,7 +3781,7 @@ TEST(RunFloat32AddP) {
bt.AddReturn(m.Float32Add(bt.param0, bt.param1));
FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(*pl + *pr, bt.call(*pl, *pr)); }
+ FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(pl + pr, bt.call(pl, pr)); }
}
}
@@ -3804,7 +3793,7 @@ TEST(RunFloat64AddP) {
bt.AddReturn(m.Float64Add(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(*pl + *pr, bt.call(*pl, *pr)); }
+ FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(pl + pr, bt.call(pl, pr)); }
}
}
@@ -3814,9 +3803,7 @@ TEST(RunFloat64MaxP) {
bt.AddReturn(m.Float64Max(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(JSMax(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(JSMax(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3827,9 +3814,7 @@ TEST(RunFloat64MinP) {
bt.AddReturn(m.Float64Min(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(JSMin(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(JSMin(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3839,9 +3824,7 @@ TEST(RunFloat32Max) {
bt.AddReturn(m.Float32Max(bt.param0, bt.param1));
FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) {
- CHECK_FLOAT_EQ(JSMax(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(JSMax(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3851,9 +3834,7 @@ TEST(RunFloat32Min) {
bt.AddReturn(m.Float32Min(bt.param0, bt.param1));
FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) {
- CHECK_FLOAT_EQ(JSMin(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(JSMin(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3863,9 +3844,7 @@ TEST(RunFloat64Max) {
bt.AddReturn(m.Float64Max(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(JSMax(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(JSMax(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3875,9 +3854,7 @@ TEST(RunFloat64Min) {
bt.AddReturn(m.Float64Min(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(JSMin(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(JSMin(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3888,7 +3865,7 @@ TEST(RunFloat32SubP) {
bt.AddReturn(m.Float32Sub(bt.param0, bt.param1));
FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(*pl - *pr, bt.call(*pl, *pr)); }
+ FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(pl - pr, bt.call(pl, pr)); }
}
}
@@ -3896,9 +3873,9 @@ TEST(RunFloat32SubP) {
TEST(RunFloat32SubImm1) {
FOR_FLOAT32_INPUTS(i) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
- m.Return(m.Float32Sub(m.Float32Constant(*i), m.Parameter(0)));
+ m.Return(m.Float32Sub(m.Float32Constant(i), m.Parameter(0)));
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, m.Call(*j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(i - j, m.Call(j)); }
}
}
@@ -3906,9 +3883,9 @@ TEST(RunFloat32SubImm1) {
TEST(RunFloat32SubImm2) {
FOR_FLOAT32_INPUTS(i) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
- m.Return(m.Float32Sub(m.Parameter(0), m.Float32Constant(*i)));
+ m.Return(m.Float32Sub(m.Parameter(0), m.Float32Constant(i)));
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*j - *i, m.Call(*j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(j - i, m.Call(j)); }
}
}
@@ -3916,9 +3893,9 @@ TEST(RunFloat32SubImm2) {
TEST(RunFloat64SubImm1) {
FOR_FLOAT64_INPUTS(i) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
- m.Return(m.Float64Sub(m.Float64Constant(*i), m.Parameter(0)));
+ m.Return(m.Float64Sub(m.Float64Constant(i), m.Parameter(0)));
- FOR_FLOAT64_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, m.Call(*j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(i - j, m.Call(j)); }
}
}
@@ -3926,9 +3903,9 @@ TEST(RunFloat64SubImm1) {
TEST(RunFloat64SubImm2) {
FOR_FLOAT64_INPUTS(i) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
- m.Return(m.Float64Sub(m.Parameter(0), m.Float64Constant(*i)));
+ m.Return(m.Float64Sub(m.Parameter(0), m.Float64Constant(i)));
- FOR_FLOAT64_INPUTS(j) { CHECK_FLOAT_EQ(*j - *i, m.Call(*j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(j - i, m.Call(j)); }
}
}
@@ -3941,8 +3918,8 @@ TEST(RunFloat64SubP) {
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- double expected = *pl - *pr;
- CHECK_DOUBLE_EQ(expected, bt.call(*pl, *pr));
+ double expected = pl - pr;
+ CHECK_DOUBLE_EQ(expected, bt.call(pl, pr));
}
}
}
@@ -3955,7 +3932,7 @@ TEST(RunFloat32MulP) {
bt.AddReturn(m.Float32Mul(bt.param0, bt.param1));
FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(*pl * *pr, bt.call(*pl, *pr)); }
+ FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(pl * pr, bt.call(pl, pr)); }
}
}
@@ -3968,8 +3945,8 @@ TEST(RunFloat64MulP) {
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- double expected = *pl * *pr;
- CHECK_DOUBLE_EQ(expected, bt.call(*pl, *pr));
+ double expected = pl * pr;
+ CHECK_DOUBLE_EQ(expected, bt.call(pl, pr));
}
}
}
@@ -3983,9 +3960,7 @@ TEST(RunFloat64MulAndFloat64Add1) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- FOR_FLOAT64_INPUTS(k) {
- CHECK_DOUBLE_EQ((*i * *j) + *k, m.Call(*i, *j, *k));
- }
+ FOR_FLOAT64_INPUTS(k) { CHECK_DOUBLE_EQ((i * j) + k, m.Call(i, j, k)); }
}
}
}
@@ -3999,9 +3974,7 @@ TEST(RunFloat64MulAndFloat64Add2) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- FOR_FLOAT64_INPUTS(k) {
- CHECK_DOUBLE_EQ(*i + (*j * *k), m.Call(*i, *j, *k));
- }
+ FOR_FLOAT64_INPUTS(k) { CHECK_DOUBLE_EQ(i + (j * k), m.Call(i, j, k)); }
}
}
}
@@ -4015,9 +3988,7 @@ TEST(RunFloat64MulAndFloat64Sub1) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- FOR_FLOAT64_INPUTS(k) {
- CHECK_DOUBLE_EQ((*i * *j) - *k, m.Call(*i, *j, *k));
- }
+ FOR_FLOAT64_INPUTS(k) { CHECK_DOUBLE_EQ((i * j) - k, m.Call(i, j, k)); }
}
}
}
@@ -4031,9 +4002,7 @@ TEST(RunFloat64MulAndFloat64Sub2) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- FOR_FLOAT64_INPUTS(k) {
- CHECK_DOUBLE_EQ(*i - (*j * *k), m.Call(*i, *j, *k));
- }
+ FOR_FLOAT64_INPUTS(k) { CHECK_DOUBLE_EQ(i - (j * k), m.Call(i, j, k)); }
}
}
}
@@ -4042,9 +4011,9 @@ TEST(RunFloat64MulAndFloat64Sub2) {
TEST(RunFloat64MulImm1) {
FOR_FLOAT64_INPUTS(i) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
- m.Return(m.Float64Mul(m.Float64Constant(*i), m.Parameter(0)));
+ m.Return(m.Float64Mul(m.Float64Constant(i), m.Parameter(0)));
- FOR_FLOAT64_INPUTS(j) { CHECK_FLOAT_EQ(*i * *j, m.Call(*j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(i * j, m.Call(j)); }
}
}
@@ -4052,9 +4021,9 @@ TEST(RunFloat64MulImm1) {
TEST(RunFloat64MulImm2) {
FOR_FLOAT64_INPUTS(i) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
- m.Return(m.Float64Mul(m.Parameter(0), m.Float64Constant(*i)));
+ m.Return(m.Float64Mul(m.Parameter(0), m.Float64Constant(i)));
- FOR_FLOAT64_INPUTS(j) { CHECK_FLOAT_EQ(*j * *i, m.Call(*j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(j * i, m.Call(j)); }
}
}
@@ -4067,7 +4036,7 @@ TEST(RunFloat32DivP) {
FOR_FLOAT32_INPUTS(pl) {
FOR_FLOAT32_INPUTS(pr) {
- CHECK_FLOAT_EQ(base::Divide(*pl, *pr), bt.call(*pl, *pr));
+ CHECK_FLOAT_EQ(base::Divide(pl, pr), bt.call(pl, pr));
}
}
}
@@ -4081,7 +4050,7 @@ TEST(RunFloat64DivP) {
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(base::Divide(*pl, *pr), bt.call(*pl, *pr));
+ CHECK_DOUBLE_EQ(base::Divide(pl, pr), bt.call(pl, pr));
}
}
}
@@ -4094,7 +4063,7 @@ TEST(RunFloat64ModP) {
bt.AddReturn(m.Float64Mod(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(Modulo(*i, *j), bt.call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(Modulo(i, j), bt.call(i, j)); }
}
}
@@ -4111,7 +4080,7 @@ TEST(RunChangeInt32ToFloat64_B) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Int32());
m.Return(m.ChangeInt32ToFloat64(m.Parameter(0)));
- FOR_INT32_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), m.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(i), m.Call(i)); }
}
@@ -4119,7 +4088,7 @@ TEST(RunChangeUint32ToFloat64) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Uint32());
m.Return(m.ChangeUint32ToFloat64(m.Parameter(0)));
- FOR_UINT32_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), m.Call(*i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(i), m.Call(i)); }
}
@@ -4134,8 +4103,8 @@ TEST(RunTruncateFloat32ToInt32) {
// is.
float lower_bound = static_cast<float>(INT32_MIN);
FOR_FLOAT32_INPUTS(i) {
- if (*i < upper_bound && *i >= lower_bound) {
- CHECK_FLOAT_EQ(static_cast<int32_t>(*i), m.Call(*i));
+ if (i < upper_bound && i >= lower_bound) {
+ CHECK_FLOAT_EQ(static_cast<int32_t>(i), m.Call(i));
}
}
}
@@ -4150,14 +4119,14 @@ TEST(RunTruncateFloat32ToUint32) {
double upper_bound = 4294967296.0f;
double lower_bound = -1.0f;
FOR_UINT32_INPUTS(i) {
- volatile float input = static_cast<float>(*i);
+ volatile float input = static_cast<float>(i);
if (input < upper_bound) {
CHECK_EQ(static_cast<uint32_t>(input), m.Call(input));
}
}
FOR_FLOAT32_INPUTS(j) {
- if ((*j < upper_bound) && (*j > lower_bound)) {
- CHECK_FLOAT_EQ(static_cast<uint32_t>(*j), m.Call(*j));
+ if ((j < upper_bound) && (j > lower_bound)) {
+ CHECK_FLOAT_EQ(static_cast<uint32_t>(j), m.Call(j));
}
}
}
@@ -4177,7 +4146,7 @@ TEST(RunChangeFloat64ToInt32_B) {
// Note we don't check fractional inputs, or inputs outside the range of
// int32, because these Convert operators really should be Change operators.
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, m.Call(static_cast<double>(*i))); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, m.Call(static_cast<double>(i))); }
for (int32_t n = 1; n < 31; ++n) {
CHECK_EQ(1 << n, m.Call(static_cast<double>(1 << n)));
@@ -4193,7 +4162,7 @@ TEST(RunChangeFloat64ToUint32) {
m.Return(m.ChangeFloat64ToUint32(m.Parameter(0)));
{
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, m.Call(static_cast<double>(*i))); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, m.Call(static_cast<double>(i))); }
}
// Check various powers of 2.
@@ -4212,7 +4181,7 @@ TEST(RunTruncateFloat64ToFloat32) {
m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(DoubleToFloat32(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(DoubleToFloat32(i), m.Call(i)); }
}
uint64_t ToInt64(uint32_t low, uint32_t high) {
@@ -4239,11 +4208,11 @@ TEST(RunInt32PairAdd) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32));
- CHECK_EQ(*i + *j, ToInt64(low, high));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32));
+ CHECK_EQ(i + j, ToInt64(low, high));
}
}
}
@@ -4259,11 +4228,11 @@ TEST(RunInt32PairAddUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
CHECK_EQ(
- static_cast<uint32_t>((*i + *j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32))));
+ static_cast<uint32_t>((i + j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32))));
}
}
}
@@ -4286,8 +4255,8 @@ void TestInt32PairAddWithSharedInput(int a, int b, int c, int d) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- m.Call(*i, *j);
- uint32_t inputs[] = {*i, *j};
+ m.Call(i, j);
+ uint32_t inputs[] = {i, j};
CHECK_EQ(ToInt64(inputs[a], inputs[b]) + ToInt64(inputs[c], inputs[d]),
ToInt64(low, high));
}
@@ -4322,11 +4291,11 @@ TEST(RunInt32PairSub) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32));
- CHECK_EQ(*i - *j, ToInt64(low, high));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32));
+ CHECK_EQ(i - j, ToInt64(low, high));
}
}
}
@@ -4342,11 +4311,11 @@ TEST(RunInt32PairSubUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
CHECK_EQ(
- static_cast<uint32_t>((*i - *j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32))));
+ static_cast<uint32_t>((i - j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32))));
}
}
}
@@ -4369,8 +4338,8 @@ void TestInt32PairSubWithSharedInput(int a, int b, int c, int d) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- m.Call(*i, *j);
- uint32_t inputs[] = {*i, *j};
+ m.Call(i, j);
+ uint32_t inputs[] = {i, j};
CHECK_EQ(ToInt64(inputs[a], inputs[b]) - ToInt64(inputs[c], inputs[d]),
ToInt64(low, high));
}
@@ -4405,11 +4374,11 @@ TEST(RunInt32PairMul) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32));
- CHECK_EQ(*i * *j, ToInt64(low, high));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32));
+ CHECK_EQ(i * j, ToInt64(low, high));
}
}
}
@@ -4425,11 +4394,11 @@ TEST(RunInt32PairMulUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
CHECK_EQ(
- static_cast<uint32_t>((*i * *j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32))));
+ static_cast<uint32_t>((i * j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32))));
}
}
}
@@ -4452,8 +4421,8 @@ void TestInt32PairMulWithSharedInput(int a, int b, int c, int d) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- m.Call(*i, *j);
- uint32_t inputs[] = {*i, *j};
+ m.Call(i, j);
+ uint32_t inputs[] = {i, j};
CHECK_EQ(ToInt64(inputs[a], inputs[b]) * ToInt64(inputs[c], inputs[d]),
ToInt64(low, high));
}
@@ -4488,9 +4457,9 @@ TEST(RunWord32PairShl) {
FOR_UINT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j);
- CHECK_EQ(*i << j, ToInt64(low, high));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j);
+ CHECK_EQ(i << j, ToInt64(low, high));
}
}
}
@@ -4505,9 +4474,9 @@ TEST(RunWord32PairShlUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
CHECK_EQ(
- static_cast<uint32_t>((*i << j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j)));
+ static_cast<uint32_t>((i << j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j)));
}
}
}
@@ -4530,8 +4499,8 @@ void TestWord32PairShlWithSharedInput(int a, int b) {
FOR_UINT32_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
- m.Call(*i, j);
- uint32_t inputs[] = {*i, j};
+ m.Call(i, j);
+ uint32_t inputs[] = {i, j};
CHECK_EQ(ToInt64(inputs[a], inputs[b]) << j, ToInt64(low, high));
}
}
@@ -4562,9 +4531,9 @@ TEST(RunWord32PairShr) {
FOR_UINT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j);
- CHECK_EQ(*i >> j, ToInt64(low, high));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j);
+ CHECK_EQ(i >> j, ToInt64(low, high));
}
}
}
@@ -4579,9 +4548,9 @@ TEST(RunWord32PairShrUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
CHECK_EQ(
- static_cast<uint32_t>((*i >> j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j)));
+ static_cast<uint32_t>((i >> j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j)));
}
}
}
@@ -4604,9 +4573,9 @@ TEST(RunWord32PairSar) {
FOR_INT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j);
- CHECK_EQ(*i >> j, static_cast<int64_t>(ToInt64(low, high)));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j);
+ CHECK_EQ(i >> j, static_cast<int64_t>(ToInt64(low, high)));
}
}
}
@@ -4621,9 +4590,9 @@ TEST(RunWord32PairSarUseOnlyHighWord) {
FOR_INT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
CHECK_EQ(
- static_cast<uint32_t>((*i >> j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j)));
+ static_cast<uint32_t>((i >> j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j)));
}
}
}
@@ -4740,8 +4709,14 @@ TEST(RunRefDiamond) {
m.Goto(&end);
m.Bind(&end);
Node* phi = m.Phi(MachineRepresentation::kTagged, k2, k1);
- m.Store(MachineRepresentation::kTagged, m.PointerConstant(&buffer),
- m.Int32Constant(0), phi, kNoWriteBarrier);
+ if (COMPRESS_POINTERS_BOOL) {
+ // Since |buffer| is located off-heap, use full pointer store.
+ m.Store(MachineType::PointerRepresentation(), m.PointerConstant(&buffer),
+ m.Int32Constant(0), m.BitcastTaggedToWord(phi), kNoWriteBarrier);
+ } else {
+ m.Store(MachineRepresentation::kTagged, m.PointerConstant(&buffer),
+ m.Int32Constant(0), phi, kNoWriteBarrier);
+ }
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -4774,8 +4749,14 @@ TEST(RunDoubleRefDiamond) {
Node* rphi = m.Phi(MachineRepresentation::kTagged, r2, r1);
m.Store(MachineRepresentation::kFloat64, m.PointerConstant(&dbuffer),
m.Int32Constant(0), dphi, kNoWriteBarrier);
- m.Store(MachineRepresentation::kTagged, m.PointerConstant(&rbuffer),
- m.Int32Constant(0), rphi, kNoWriteBarrier);
+ if (COMPRESS_POINTERS_BOOL) {
+ // Since |buffer| is located off-heap, use full pointer store.
+ m.Store(MachineType::PointerRepresentation(), m.PointerConstant(&rbuffer),
+ m.Int32Constant(0), m.BitcastTaggedToWord(rphi), kNoWriteBarrier);
+ } else {
+ m.Store(MachineRepresentation::kTagged, m.PointerConstant(&rbuffer),
+ m.Int32Constant(0), rphi, kNoWriteBarrier);
+ }
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -4819,8 +4800,14 @@ TEST(RunDoubleRefDoubleDiamond) {
m.Store(MachineRepresentation::kFloat64, m.PointerConstant(&dbuffer),
m.Int32Constant(0), dphi2, kNoWriteBarrier);
- m.Store(MachineRepresentation::kTagged, m.PointerConstant(&rbuffer),
- m.Int32Constant(0), rphi2, kNoWriteBarrier);
+ if (COMPRESS_POINTERS_BOOL) {
+ // Since |buffer| is located off-heap, use full pointer store.
+ m.Store(MachineType::PointerRepresentation(), m.PointerConstant(&rbuffer),
+ m.Int32Constant(0), m.BitcastTaggedToWord(rphi2), kNoWriteBarrier);
+ } else {
+ m.Store(MachineRepresentation::kTagged, m.PointerConstant(&rbuffer),
+ m.Int32Constant(0), rphi2, kNoWriteBarrier);
+ }
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -5093,7 +5080,7 @@ TEST(RunFloat64UnorderedCompare) {
for (size_t o = 0; o < arraysize(operators); ++o) {
for (int j = 0; j < 2; j++) {
RawMachineAssemblerTester<int32_t> m;
- Node* a = m.Float64Constant(*i);
+ Node* a = m.Float64Constant(i);
Node* b = m.Float64Constant(nan);
if (j == 1) std::swap(a, b);
m.Return(m.AddNode(operators[o], a, b));
@@ -5116,8 +5103,8 @@ TEST(RunFloat64Equal) {
CompareWrapper cmp(IrOpcode::kFloat64Equal);
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- input_a = *pl;
- input_b = *pr;
+ input_a = pl;
+ input_b = pr;
int32_t expected = cmp.Float64Compare(input_a, input_b) ? 1 : 0;
CHECK_EQ(expected, m.Call());
}
@@ -5137,8 +5124,8 @@ TEST(RunFloat64LessThan) {
CompareWrapper cmp(IrOpcode::kFloat64LessThan);
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- input_a = *pl;
- input_b = *pr;
+ input_a = pl;
+ input_b = pr;
int32_t expected = cmp.Float64Compare(input_a, input_b) ? 1 : 0;
CHECK_EQ(expected, m.Call());
}
@@ -5276,11 +5263,11 @@ TEST(RunSpillConstantsAndParameters) {
m.Return(m.Int32Add(acc, m.Int32Add(m.Parameter(0), m.Parameter(1))));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = base::AddWithWraparound(*i, *j);
+ int32_t expected = base::AddWithWraparound(i, j);
for (int k = 0; k < kInputSize; k++) {
expected = base::AddWithWraparound(expected, kBase + k);
}
- CHECK_EQ(expected, m.Call(*i, *j));
+ CHECK_EQ(expected, m.Call(i, j));
expected = 0;
for (int k = 0; k < kInputSize; k++) {
expected += kBase + k;
@@ -5328,8 +5315,8 @@ TEST(RunInt32AddWithOverflowP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected_val;
- int expected_ovf = base::bits::SignedAddOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, bt.call(*i, *j));
+ int expected_ovf = base::bits::SignedAddOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, bt.call(i, j));
CHECK_EQ(expected_val, actual_val);
}
}
@@ -5341,41 +5328,39 @@ TEST(RunInt32AddWithOverflowImm) {
FOR_INT32_INPUTS(i) {
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32AddWithOverflow(m.Int32Constant(*i), m.Parameter(0));
+ Node* add = m.Int32AddWithOverflow(m.Int32Constant(i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedAddOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedAddOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32AddWithOverflow(m.Parameter(0), m.Int32Constant(*i));
+ Node* add = m.Int32AddWithOverflow(m.Parameter(0), m.Int32Constant(i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedAddOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedAddOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
FOR_INT32_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m;
Node* add =
- m.Int32AddWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j));
+ m.Int32AddWithOverflow(m.Int32Constant(i), m.Int32Constant(j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
- int expected_ovf = base::bits::SignedAddOverflow32(*i, *j, &expected_val);
+ int expected_ovf = base::bits::SignedAddOverflow32(i, j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
CHECK_EQ(expected_val, actual_val);
}
@@ -5399,9 +5384,8 @@ TEST(RunInt32AddWithOverflowInBranchP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected;
- if (base::bits::SignedAddOverflow32(*i, *j, &expected))
- expected = constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ if (base::bits::SignedAddOverflow32(i, j, &expected)) expected = constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -5419,8 +5403,8 @@ TEST(RunInt32SubWithOverflowP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected_val;
- int expected_ovf = base::bits::SignedSubOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, bt.call(*i, *j));
+ int expected_ovf = base::bits::SignedSubOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, bt.call(i, j));
CHECK_EQ(expected_val, actual_val);
}
}
@@ -5432,41 +5416,39 @@ TEST(RunInt32SubWithOverflowImm) {
FOR_INT32_INPUTS(i) {
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32SubWithOverflow(m.Int32Constant(*i), m.Parameter(0));
+ Node* add = m.Int32SubWithOverflow(m.Int32Constant(i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedSubOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedSubOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32SubWithOverflow(m.Parameter(0), m.Int32Constant(*i));
+ Node* add = m.Int32SubWithOverflow(m.Parameter(0), m.Int32Constant(i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedSubOverflow32(*j, *i, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedSubOverflow32(j, i, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
FOR_INT32_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m;
Node* add =
- m.Int32SubWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j));
+ m.Int32SubWithOverflow(m.Int32Constant(i), m.Int32Constant(j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
- int expected_ovf = base::bits::SignedSubOverflow32(*i, *j, &expected_val);
+ int expected_ovf = base::bits::SignedSubOverflow32(i, j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
CHECK_EQ(expected_val, actual_val);
}
@@ -5490,9 +5472,8 @@ TEST(RunInt32SubWithOverflowInBranchP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected;
- if (base::bits::SignedSubOverflow32(*i, *j, &expected))
- expected = constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ if (base::bits::SignedSubOverflow32(i, j, &expected)) expected = constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -5509,8 +5490,8 @@ TEST(RunInt32MulWithOverflowP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected_val;
- int expected_ovf = base::bits::SignedMulOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, bt.call(*i, *j));
+ int expected_ovf = base::bits::SignedMulOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, bt.call(i, j));
if (!expected_ovf) {
CHECK_EQ(expected_val, actual_val);
}
@@ -5523,15 +5504,14 @@ TEST(RunInt32MulWithOverflowImm) {
FOR_INT32_INPUTS(i) {
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32MulWithOverflow(m.Int32Constant(*i), m.Parameter(0));
+ Node* add = m.Int32MulWithOverflow(m.Int32Constant(i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedMulOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedMulOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
if (!expected_ovf) {
CHECK_EQ(expected_val, actual_val);
}
@@ -5539,15 +5519,14 @@ TEST(RunInt32MulWithOverflowImm) {
}
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32MulWithOverflow(m.Parameter(0), m.Int32Constant(*i));
+ Node* add = m.Int32MulWithOverflow(m.Parameter(0), m.Int32Constant(i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedMulOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedMulOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
if (!expected_ovf) {
CHECK_EQ(expected_val, actual_val);
}
@@ -5556,12 +5535,12 @@ TEST(RunInt32MulWithOverflowImm) {
FOR_INT32_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m;
Node* add =
- m.Int32MulWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j));
+ m.Int32MulWithOverflow(m.Int32Constant(i), m.Int32Constant(j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
- int expected_ovf = base::bits::SignedMulOverflow32(*i, *j, &expected_val);
+ int expected_ovf = base::bits::SignedMulOverflow32(i, j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
if (!expected_ovf) {
CHECK_EQ(expected_val, actual_val);
@@ -5586,9 +5565,8 @@ TEST(RunInt32MulWithOverflowInBranchP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected;
- if (base::bits::SignedMulOverflow32(*i, *j, &expected))
- expected = constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ if (base::bits::SignedMulOverflow32(i, j, &expected)) expected = constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -5614,44 +5592,44 @@ TEST(RunWord64EqualInBranchP) {
TEST(RunChangeInt32ToInt64P) {
- if (kPointerSize < 8) return;
+ if (kSystemPointerSize < 8) return;
int64_t actual = -1;
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
m.StoreToPointer(&actual, MachineRepresentation::kWord64,
m.ChangeInt32ToInt64(m.Parameter(0)));
m.Return(m.Int32Constant(0));
FOR_INT32_INPUTS(i) {
- int64_t expected = *i;
- CHECK_EQ(0, m.Call(*i));
+ int64_t expected = i;
+ CHECK_EQ(0, m.Call(i));
CHECK_EQ(expected, actual);
}
}
TEST(RunChangeUint32ToUint64P) {
- if (kPointerSize < 8) return;
+ if (kSystemPointerSize < 8) return;
int64_t actual = -1;
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
m.StoreToPointer(&actual, MachineRepresentation::kWord64,
m.ChangeUint32ToUint64(m.Parameter(0)));
m.Return(m.Int32Constant(0));
FOR_UINT32_INPUTS(i) {
- int64_t expected = static_cast<uint64_t>(*i);
- CHECK_EQ(0, m.Call(*i));
+ int64_t expected = static_cast<uint64_t>(i);
+ CHECK_EQ(0, m.Call(i));
CHECK_EQ(expected, actual);
}
}
TEST(RunTruncateInt64ToInt32P) {
- if (kPointerSize < 8) return;
+ if (kSystemPointerSize < 8) return;
int64_t expected = -1;
RawMachineAssemblerTester<int32_t> m;
m.Return(m.TruncateInt64ToInt32(
m.LoadFromPointer(&expected, MachineType::Int64())));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- expected = (static_cast<uint64_t>(*j) << 32) | *i;
+ expected = (static_cast<uint64_t>(j) << 32) | i;
CHECK_EQ(static_cast<int32_t>(expected), m.Call());
}
}
@@ -5739,17 +5717,15 @@ TEST(RunChangeFloat32ToFloat64) {
m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) {
- CHECK_DOUBLE_EQ(static_cast<double>(*i), m.Call(*i));
- }
+ FOR_FLOAT32_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(i), m.Call(i)); }
}
TEST(RunFloat32Constant) {
FOR_FLOAT32_INPUTS(i) {
BufferedRawMachineAssemblerTester<float> m;
- m.Return(m.Float32Constant(*i));
- CHECK_FLOAT_EQ(*i, m.Call());
+ m.Return(m.Float32Constant(i));
+ CHECK_FLOAT_EQ(i, m.Call());
}
}
@@ -5758,8 +5734,8 @@ TEST(RunFloat64ExtractLowWord32) {
BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Float64());
m.Return(m.Float64ExtractLowWord32(m.Parameter(0)));
FOR_FLOAT64_INPUTS(i) {
- uint32_t expected = static_cast<uint32_t>(bit_cast<uint64_t>(*i));
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = static_cast<uint32_t>(bit_cast<uint64_t>(i));
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -5768,8 +5744,8 @@ TEST(RunFloat64ExtractHighWord32) {
BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Float64());
m.Return(m.Float64ExtractHighWord32(m.Parameter(0)));
FOR_FLOAT64_INPUTS(i) {
- uint32_t expected = static_cast<uint32_t>(bit_cast<uint64_t>(*i) >> 32);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = static_cast<uint32_t>(bit_cast<uint64_t>(i) >> 32);
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -5781,9 +5757,9 @@ TEST(RunFloat64InsertLowWord32) {
FOR_FLOAT64_INPUTS(i) {
FOR_INT32_INPUTS(j) {
double expected =
- bit_cast<double>((bit_cast<uint64_t>(*i) & ~(uint64_t{0xFFFFFFFF})) |
- (static_cast<uint64_t>(bit_cast<uint32_t>(*j))));
- CHECK_DOUBLE_EQ(expected, m.Call(*i, *j));
+ bit_cast<double>((bit_cast<uint64_t>(i) & ~(uint64_t{0xFFFFFFFF})) |
+ (static_cast<uint64_t>(bit_cast<uint32_t>(j))));
+ CHECK_DOUBLE_EQ(expected, m.Call(i, j));
}
}
}
@@ -5795,10 +5771,10 @@ TEST(RunFloat64InsertHighWord32) {
m.Return(m.Float64InsertHighWord32(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint64_t expected = (bit_cast<uint64_t>(*i) & 0xFFFFFFFF) |
- (static_cast<uint64_t>(*j) << 32);
+ uint64_t expected = (bit_cast<uint64_t>(i) & 0xFFFFFFFF) |
+ (static_cast<uint64_t>(j) << 32);
- CHECK_DOUBLE_EQ(bit_cast<double>(expected), m.Call(*i, *j));
+ CHECK_DOUBLE_EQ(bit_cast<double>(expected), m.Call(i, j));
}
}
}
@@ -5807,46 +5783,38 @@ TEST(RunFloat64InsertHighWord32) {
TEST(RunFloat32Abs) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
m.Return(m.Float32Abs(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(std::abs(*i), m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(std::abs(i), m.Call(i)); }
}
TEST(RunFloat64Abs) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Float64Abs(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::abs(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::abs(i), m.Call(i)); }
}
TEST(RunFloat64Acos) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Float64Acos(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::acos(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::acos(i), m.Call(i)); }
}
TEST(RunFloat64Acosh) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Float64Acosh(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::acosh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::acosh(i), m.Call(i)); }
}
TEST(RunFloat64Asin) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Float64Asin(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::asin(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::asin(i), m.Call(i)); }
}
TEST(RunFloat64Asinh) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Float64Asinh(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::asinh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::asinh(i), m.Call(i)); }
}
TEST(RunFloat64Atan) {
@@ -5856,9 +5824,7 @@ TEST(RunFloat64Atan) {
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0));
CHECK_DOUBLE_EQ(0.0, m.Call(0.0));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::atan(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::atan(i), m.Call(i)); }
}
TEST(RunFloat64Atanh) {
@@ -5870,9 +5836,7 @@ TEST(RunFloat64Atanh) {
CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-1.0));
CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0));
CHECK_DOUBLE_EQ(0.0, m.Call(0.0));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::atanh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::atanh(i), m.Call(i)); }
}
TEST(RunFloat64Atan2) {
@@ -5881,7 +5845,7 @@ TEST(RunFloat64Atan2) {
m.Return(m.Float64Atan2(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- CHECK_DOUBLE_EQ(base::ieee754::atan2(*i, *j), m.Call(*i, *j));
+ CHECK_DOUBLE_EQ(base::ieee754::atan2(i, j), m.Call(i, j));
}
}
}
@@ -5891,7 +5855,7 @@ TEST(RunFloat64Cos) {
m.Return(m.Float64Cos(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::cos(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::cos(i), m.Call(i)); }
}
TEST(RunFloat64Cosh) {
@@ -5899,9 +5863,7 @@ TEST(RunFloat64Cosh) {
m.Return(m.Float64Cosh(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::cosh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::cosh(i), m.Call(i)); }
}
TEST(RunFloat64Exp) {
@@ -5914,7 +5876,7 @@ TEST(RunFloat64Exp) {
CHECK_DOUBLE_EQ(1.0, m.Call(0.0));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::exp(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::exp(i), m.Call(i)); }
}
TEST(RunFloat64Expm1) {
@@ -5925,9 +5887,7 @@ TEST(RunFloat64Expm1) {
CHECK_EQ(-1.0, m.Call(-std::numeric_limits<double>::infinity()));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::expm1(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::expm1(i), m.Call(i)); }
}
TEST(RunFloat64Log) {
@@ -5942,7 +5902,7 @@ TEST(RunFloat64Log) {
CHECK_DOUBLE_EQ(0.0, m.Call(1.0));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::log(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::log(i), m.Call(i)); }
}
TEST(RunFloat64Log1p) {
@@ -5956,9 +5916,7 @@ TEST(RunFloat64Log1p) {
CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::log1p(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::log1p(i), m.Call(i)); }
}
TEST(RunFloat64Log2) {
@@ -5973,9 +5931,7 @@ TEST(RunFloat64Log2) {
CHECK_DOUBLE_EQ(0.0, m.Call(1.0));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::log2(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::log2(i), m.Call(i)); }
}
TEST(RunFloat64Log10) {
@@ -5989,9 +5945,7 @@ TEST(RunFloat64Log10) {
CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::log10(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::log10(i), m.Call(i)); }
}
TEST(RunFloat64Cbrt) {
@@ -6003,9 +5957,7 @@ TEST(RunFloat64Cbrt) {
m.Call(std::numeric_limits<double>::infinity()));
CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(),
m.Call(-std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::cbrt(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::cbrt(i), m.Call(i)); }
}
TEST(RunFloat64Sin) {
@@ -6013,7 +5965,7 @@ TEST(RunFloat64Sin) {
m.Return(m.Float64Sin(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::sin(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::sin(i), m.Call(i)); }
}
TEST(RunFloat64Sinh) {
@@ -6021,9 +5973,7 @@ TEST(RunFloat64Sinh) {
m.Return(m.Float64Sinh(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::sinh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::sinh(i), m.Call(i)); }
}
TEST(RunFloat64Tan) {
@@ -6031,7 +5981,7 @@ TEST(RunFloat64Tan) {
m.Return(m.Float64Tan(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::tan(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::tan(i), m.Call(i)); }
}
TEST(RunFloat64Tanh) {
@@ -6039,9 +5989,7 @@ TEST(RunFloat64Tanh) {
m.Return(m.Float64Tanh(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::tanh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::tanh(i), m.Call(i)); }
}
static double two_30 = 1 << 30; // 2^30 is a smi boundary.
@@ -6148,7 +6096,7 @@ TEST(RunFloat32RoundDown) {
m.Return(m.Float32RoundDown(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(*i), m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(i), m.Call(i)); }
}
@@ -6158,7 +6106,7 @@ TEST(RunFloat64RoundDown1) {
m.Return(m.Float64RoundDown(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(i), m.Call(i)); }
}
@@ -6180,7 +6128,7 @@ TEST(RunFloat32RoundUp) {
if (!m.machine()->Float32RoundUp().IsSupported()) return;
m.Return(m.Float32RoundUp(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(*i), m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(i), m.Call(i)); }
}
@@ -6189,7 +6137,7 @@ TEST(RunFloat64RoundUp) {
if (!m.machine()->Float64RoundUp().IsSupported()) return;
m.Return(m.Float64RoundUp(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(i), m.Call(i)); }
}
@@ -6198,7 +6146,7 @@ TEST(RunFloat32RoundTiesEven) {
if (!m.machine()->Float32RoundTiesEven().IsSupported()) return;
m.Return(m.Float32RoundTiesEven(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyint(*i), m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyint(i), m.Call(i)); }
}
@@ -6207,7 +6155,7 @@ TEST(RunFloat64RoundTiesEven) {
if (!m.machine()->Float64RoundTiesEven().IsSupported()) return;
m.Return(m.Float64RoundTiesEven(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(i), m.Call(i)); }
}
@@ -6217,7 +6165,7 @@ TEST(RunFloat32RoundTruncate) {
m.Return(m.Float32RoundTruncate(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(*i), m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(i), m.Call(i)); }
}
@@ -6283,7 +6231,7 @@ TEST(RunCallCFunction1) {
m.Return(m.CallCFunction1(MachineType::Int32(), MachineType::Int32(),
function, m.Parameter(0)));
FOR_INT32_INPUTS(i) {
- int32_t const expected = *i;
+ int32_t const expected = i;
CHECK_EQ(expected, m.Call(expected));
}
}
@@ -6298,9 +6246,9 @@ TEST(RunCallCFunction2) {
MachineType::Int32(), function, m.Parameter(0),
m.Parameter(1)));
FOR_INT32_INPUTS(i) {
- int32_t const x = *i;
+ int32_t const x = i;
FOR_INT32_INPUTS(j) {
- int32_t const y = *j;
+ int32_t const y = j;
CHECK_EQ(base::SubWithWraparound(x, y), m.Call(x, y));
}
}
@@ -6318,7 +6266,7 @@ TEST(RunCallCFunction8) {
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
function, param, param, param, param, param, param, param, param));
FOR_INT32_INPUTS(i) {
- int32_t const x = *i;
+ int32_t const x = i;
CHECK_EQ(base::MulWithWraparound(x, 8), m.Call(x));
}
}
@@ -6342,7 +6290,7 @@ TEST(RunCallCFunction9) {
m.Int32Add(param, m.Int32Constant(7)),
m.Int32Add(param, m.Int32Constant(8))));
FOR_INT32_INPUTS(i) {
- int32_t const x = *i;
+ int32_t const x = i;
CHECK_EQ(base::AddWithWraparound(base::MulWithWraparound(x, 9), 36),
m.Call(x));
}
@@ -6357,8 +6305,8 @@ TEST(RunChangeFloat64ToInt64) {
m.Return(m.ChangeFloat64ToInt64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
- double input = static_cast<double>(*i);
- if (static_cast<int64_t>(input) == *i) {
+ double input = static_cast<double>(i);
+ if (static_cast<int64_t>(input) == i) {
CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
}
}
@@ -6368,9 +6316,9 @@ TEST(RunChangeInt64ToFloat64) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Int64());
m.Return(m.ChangeInt64ToFloat64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
- double output = static_cast<double>(*i);
- if (static_cast<int64_t>(output) == *i) {
- CHECK_EQ(output, m.Call(*i));
+ double output = static_cast<double>(i);
+ if (static_cast<int64_t>(output) == i) {
+ CHECK_EQ(output, m.Call(i));
}
}
}
@@ -6384,7 +6332,7 @@ TEST(RunBitcastInt64ToFloat64) {
m.BitcastInt64ToFloat64(m.LoadFromPointer(&input, MachineType::Int64())));
m.Return(m.Int32Constant(11));
FOR_INT64_INPUTS(i) {
- input = *i;
+ input = i;
CHECK_EQ(11, m.Call());
Float64 expected = Float64::FromBits(input);
CHECK_EQ(expected.get_bits(), output.get_bits());
@@ -6396,7 +6344,7 @@ TEST(RunBitcastFloat64ToInt64) {
BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64());
m.Return(m.BitcastFloat64ToInt64(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(i), m.Call(i)); }
}
@@ -6405,7 +6353,7 @@ TEST(RunTryTruncateFloat32ToInt64WithoutCheck) {
m.Return(m.TryTruncateFloat32ToInt64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
- float input = static_cast<float>(*i);
+ float input = static_cast<float>(i);
if (input < static_cast<float>(INT64_MAX) &&
input >= static_cast<float>(INT64_MIN)) {
CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
@@ -6424,12 +6372,12 @@ TEST(RunTryTruncateFloat32ToInt64WithCheck) {
m.Return(val);
FOR_FLOAT32_INPUTS(i) {
- if (*i < static_cast<float>(INT64_MAX) &&
- *i >= static_cast<float>(INT64_MIN)) {
- CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i));
+ if (i < static_cast<float>(INT64_MAX) &&
+ i >= static_cast<float>(INT64_MIN)) {
+ CHECK_EQ(static_cast<int64_t>(i), m.Call(i));
CHECK_NE(0, success);
} else {
- m.Call(*i);
+ m.Call(i);
CHECK_EQ(0, success);
}
}
@@ -6441,7 +6389,7 @@ TEST(RunTryTruncateFloat64ToInt64WithoutCheck) {
m.Return(m.TryTruncateFloat64ToInt64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
- double input = static_cast<double>(*i);
+ double input = static_cast<double>(i);
CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
}
}
@@ -6457,13 +6405,13 @@ TEST(RunTryTruncateFloat64ToInt64WithCheck) {
m.Return(val);
FOR_FLOAT64_INPUTS(i) {
- if (*i < static_cast<double>(INT64_MAX) &&
- *i >= static_cast<double>(INT64_MIN)) {
+ if (i < static_cast<double>(INT64_MAX) &&
+ i >= static_cast<double>(INT64_MIN)) {
// Conversions within this range should succeed.
- CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i));
+ CHECK_EQ(static_cast<int64_t>(i), m.Call(i));
CHECK_NE(0, success);
} else {
- m.Call(*i);
+ m.Call(i);
CHECK_EQ(0, success);
}
}
@@ -6475,7 +6423,7 @@ TEST(RunTryTruncateFloat32ToUint64WithoutCheck) {
m.Return(m.TryTruncateFloat32ToUint64(m.Parameter(0)));
FOR_UINT64_INPUTS(i) {
- float input = static_cast<float>(*i);
+ float input = static_cast<float>(i);
// This condition on 'input' is required because
// static_cast<float>(UINT64_MAX) results in a value outside uint64 range.
if (input < static_cast<float>(UINT64_MAX)) {
@@ -6495,12 +6443,12 @@ TEST(RunTryTruncateFloat32ToUint64WithCheck) {
m.Return(val);
FOR_FLOAT32_INPUTS(i) {
- if (*i < static_cast<float>(UINT64_MAX) && *i > -1.0) {
+ if (i < static_cast<float>(UINT64_MAX) && i > -1.0) {
// Conversions within this range should succeed.
- CHECK_EQ(static_cast<uint64_t>(*i), m.Call(*i));
+ CHECK_EQ(static_cast<uint64_t>(i), m.Call(i));
CHECK_NE(0, success);
} else {
- m.Call(*i);
+ m.Call(i);
CHECK_EQ(0, success);
}
}
@@ -6512,7 +6460,7 @@ TEST(RunTryTruncateFloat64ToUint64WithoutCheck) {
m.Return(m.TryTruncateFloat64ToUint64(m.Parameter(0)));
FOR_UINT64_INPUTS(j) {
- double input = static_cast<double>(*j);
+ double input = static_cast<double>(j);
if (input < static_cast<float>(UINT64_MAX)) {
CHECK_EQ(static_cast<uint64_t>(input), m.Call(input));
@@ -6531,12 +6479,12 @@ TEST(RunTryTruncateFloat64ToUint64WithCheck) {
m.Return(val);
FOR_FLOAT64_INPUTS(i) {
- if (*i < 18446744073709551616.0 && *i > -1) {
+ if (i < 18446744073709551616.0 && i > -1) {
// Conversions within this range should succeed.
- CHECK_EQ(static_cast<uint64_t>(*i), static_cast<uint64_t>(m.Call(*i)));
+ CHECK_EQ(static_cast<uint64_t>(i), static_cast<uint64_t>(m.Call(i)));
CHECK_NE(0, success);
} else {
- m.Call(*i);
+ m.Call(i);
CHECK_EQ(0, success);
}
}
@@ -6546,14 +6494,14 @@ TEST(RunTryTruncateFloat64ToUint64WithCheck) {
TEST(RunRoundInt64ToFloat32) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Int64());
m.Return(m.RoundInt64ToFloat32(m.Parameter(0)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(i), m.Call(i)); }
}
TEST(RunRoundInt64ToFloat64) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Int64());
m.Return(m.RoundInt64ToFloat64(m.Parameter(0)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), m.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(i), m.Call(i)); }
}
@@ -6745,7 +6693,7 @@ TEST(RunBitcastFloat32ToInt32) {
m.Return(m.BitcastFloat32ToInt32(
m.LoadFromPointer(&input, MachineType::Float32())));
FOR_FLOAT32_INPUTS(i) {
- input = *i;
+ input = i;
int32_t expected = bit_cast<int32_t>(input);
CHECK_EQ(expected, m.Call());
}
@@ -6756,8 +6704,8 @@ TEST(RunRoundInt32ToFloat32) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Int32());
m.Return(m.RoundInt32ToFloat32(m.Parameter(0)));
FOR_INT32_INPUTS(i) {
- volatile float expected = static_cast<float>(*i);
- CHECK_EQ(expected, m.Call(*i));
+ volatile float expected = static_cast<float>(i);
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -6766,8 +6714,8 @@ TEST(RunRoundUint32ToFloat32) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Uint32());
m.Return(m.RoundUint32ToFloat32(m.Parameter(0)));
FOR_UINT32_INPUTS(i) {
- volatile float expected = static_cast<float>(*i);
- CHECK_EQ(expected, m.Call(*i));
+ volatile float expected = static_cast<float>(i);
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -6781,7 +6729,7 @@ TEST(RunBitcastInt32ToFloat32) {
m.BitcastInt32ToFloat32(m.LoadFromPointer(&input, MachineType::Int32())));
m.Return(m.Int32Constant(11));
FOR_INT32_INPUTS(i) {
- input = *i;
+ input = i;
CHECK_EQ(11, m.Call());
Float32 expected = Float32::FromBits(input);
CHECK_EQ(expected.get_bits(), output.get_bits());
diff --git a/deps/v8/test/cctest/compiler/test-run-native-calls.cc b/deps/v8/test/cctest/compiler/test-run-native-calls.cc
index 19c6abb8fc..7037bd5f2b 100644
--- a/deps/v8/test/cctest/compiler/test-run-native-calls.cc
+++ b/deps/v8/test/cctest/compiler/test-run-native-calls.cc
@@ -143,7 +143,7 @@ class Allocator {
}
int StackWords(MachineType type) {
int size = 1 << ElementSizeLog2Of(type.representation());
- return size <= kPointerSize ? 1 : size / kPointerSize;
+ return size <= kSystemPointerSize ? 1 : size / kSystemPointerSize;
}
void Reset() {
stack_offset_ = 0;
@@ -542,9 +542,9 @@ static void TestInt32Sub(CallDescriptor* desc) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*i) -
- static_cast<uint32_t>(*j));
- int32_t result = runnable.Call(*i, *j);
+ int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(i) -
+ static_cast<uint32_t>(j));
+ int32_t result = runnable.Call(i, j);
CHECK_EQ(expected, result);
}
}
@@ -831,7 +831,8 @@ TEST_INT32_SELECT(63)
TEST(Int64Select_registers) {
if (GetRegConfig()->num_allocatable_general_registers() < 2) return;
- if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms
+ // TODO(titzer): int64 on 32-bit platforms
+ if (kSystemPointerSize < 8) return;
int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
ArgsBuffer<int64_t>::Sig sig(2);
diff --git a/deps/v8/test/cctest/compiler/value-helper.h b/deps/v8/test/cctest/compiler/value-helper.h
index 45750e7e28..34079f1032 100644
--- a/deps/v8/test/cctest/compiler/value-helper.h
+++ b/deps/v8/test/cctest/compiler/value-helper.h
@@ -317,14 +317,9 @@ class ValueHelper {
}
};
-// Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... }
-// Watch out, these macros aren't hygenic; they pollute your scope. Thanks STL.
-#define FOR_INPUTS(ctype, itype, var) \
- Vector<const ctype> var##_vec = \
- ::v8::internal::compiler::ValueHelper::itype##_vector(); \
- for (Vector<const ctype>::iterator var = var##_vec.begin(), \
- var##_end = var##_vec.end(); \
- var != var##_end; ++var)
+// Helper macros that can be used in FOR_INT32_INPUTS(i) { ... i ... }
+#define FOR_INPUTS(ctype, itype, var) \
+ for (ctype var : ::v8::internal::compiler::ValueHelper::itype##_vector())
#define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var)
#define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var)
diff --git a/deps/v8/test/cctest/heap/heap-utils.cc b/deps/v8/test/cctest/heap/heap-utils.cc
index 084bf6ef1b..0e437ed9d8 100644
--- a/deps/v8/test/cctest/heap/heap-utils.cc
+++ b/deps/v8/test/cctest/heap/heap-utils.cc
@@ -15,6 +15,10 @@ namespace v8 {
namespace internal {
namespace heap {
+void InvokeScavenge() { CcTest::CollectGarbage(i::NEW_SPACE); }
+
+void InvokeMarkSweep() { CcTest::CollectAllGarbage(); }
+
void SealCurrentObjects(Heap* heap) {
CcTest::CollectAllGarbage();
CcTest::CollectAllGarbage();
@@ -26,7 +30,8 @@ void SealCurrentObjects(Heap* heap) {
}
int FixedArrayLenFromSize(int size) {
- return (size - FixedArray::kHeaderSize) / kTaggedSize;
+ return Min((size - FixedArray::kHeaderSize) / kTaggedSize,
+ FixedArray::kMaxRegularLength);
}
std::vector<Handle<FixedArray>> FillOldSpacePageWithFixedArrays(Heap* heap,
@@ -101,9 +106,10 @@ std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size,
}
}
handles.push_back(isolate->factory()->NewFixedArray(length, tenure));
- CHECK((tenure == NOT_TENURED && Heap::InNewSpace(*handles.back())) ||
+ CHECK((tenure == NOT_TENURED &&
+ heap->new_space()->Contains(*handles.back())) ||
(tenure == TENURED && heap->InOldSpace(*handles.back())));
- free_memory -= allocate_memory;
+ free_memory -= handles.back()->Size();
}
return handles;
}
@@ -148,6 +154,7 @@ void SimulateFullSpace(v8::internal::NewSpace* space,
}
void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) {
+ const double kStepSizeInMs = 100;
CHECK(FLAG_incremental_marking);
i::IncrementalMarking* marking = heap->incremental_marking();
i::MarkCompactCollector* collector = heap->mark_compact_collector();
@@ -166,8 +173,8 @@ void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) {
if (!force_completion) return;
while (!marking->IsComplete()) {
- marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- i::StepOrigin::kV8);
+ marking->V8Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ i::StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
diff --git a/deps/v8/test/cctest/heap/heap-utils.h b/deps/v8/test/cctest/heap/heap-utils.h
index a494f54210..30a18b5895 100644
--- a/deps/v8/test/cctest/heap/heap-utils.h
+++ b/deps/v8/test/cctest/heap/heap-utils.h
@@ -5,6 +5,7 @@
#ifndef HEAP_HEAP_UTILS_H_
#define HEAP_HEAP_UTILS_H_
+#include "src/api-inl.h"
#include "src/heap/heap.h"
namespace v8 {
@@ -52,6 +53,17 @@ void GcAndSweep(Heap* heap, AllocationSpace space);
void ForceEvacuationCandidate(Page* page);
+void InvokeScavenge();
+
+void InvokeMarkSweep();
+
+template <typename GlobalOrPersistent>
+bool InYoungGeneration(v8::Isolate* isolate, const GlobalOrPersistent& global) {
+ v8::HandleScope scope(isolate);
+ auto tmp = global.Get(isolate);
+ return i::Heap::InYoungGeneration(*v8::Utils::OpenHandle(*tmp));
+}
+
} // namespace heap
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/heap/test-alloc.cc b/deps/v8/test/cctest/heap/test-alloc.cc
index 89bb25b56c..cf01d9fe9b 100644
--- a/deps/v8/test/cctest/heap/test-alloc.cc
+++ b/deps/v8/test/cctest/heap/test-alloc.cc
@@ -30,6 +30,7 @@
#include "src/accessors.h"
#include "src/api-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/objects-inl.h"
#include "src/objects/api-callbacks.h"
#include "src/property.h"
@@ -48,15 +49,16 @@ Handle<Object> HeapTester::TestAllocateAfterFailures() {
AlwaysAllocateScope scope(CcTest::i_isolate());
Heap* heap = CcTest::heap();
int size = FixedArray::SizeFor(100);
- // New space.
- HeapObject obj = heap->AllocateRaw(size, NEW_SPACE).ToObjectChecked();
+ // Young generation.
+ HeapObject obj =
+ heap->AllocateRaw(size, AllocationType::kYoung).ToObjectChecked();
// In order to pass heap verification on Isolate teardown, mark the
// allocated area as a filler.
heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo);
- // Old space.
+ // Old generation.
heap::SimulateFullSpace(heap->old_space());
- obj = heap->AllocateRaw(size, OLD_SPACE).ToObjectChecked();
+ obj = heap->AllocateRaw(size, AllocationType::kOld).ToObjectChecked();
heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo);
// Large object space.
@@ -67,24 +69,24 @@ Handle<Object> HeapTester::TestAllocateAfterFailures() {
CHECK_GT(kLargeObjectSpaceFillerSize,
static_cast<size_t>(heap->old_space()->AreaSize()));
while (heap->OldGenerationSpaceAvailable() > kLargeObjectSpaceFillerSize) {
- obj = heap->AllocateRaw(kLargeObjectSpaceFillerSize, OLD_SPACE)
+ obj = heap->AllocateRaw(kLargeObjectSpaceFillerSize, AllocationType::kOld)
.ToObjectChecked();
heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo);
}
- obj = heap->AllocateRaw(kLargeObjectSpaceFillerSize, OLD_SPACE)
+ obj = heap->AllocateRaw(kLargeObjectSpaceFillerSize, AllocationType::kOld)
.ToObjectChecked();
heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo);
// Map space.
heap::SimulateFullSpace(heap->map_space());
- obj = heap->AllocateRaw(Map::kSize, MAP_SPACE).ToObjectChecked();
+ obj = heap->AllocateRaw(Map::kSize, AllocationType::kMap).ToObjectChecked();
heap->CreateFillerObjectAt(obj->address(), Map::kSize,
ClearRecordedSlots::kNo);
// Code space.
heap::SimulateFullSpace(heap->code_space());
size = CcTest::i_isolate()->builtins()->builtin(Builtins::kIllegal)->Size();
- obj = heap->AllocateRaw(size, CODE_SPACE).ToObjectChecked();
+ obj = heap->AllocateRaw(size, AllocationType::kCode).ToObjectChecked();
heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo);
return CcTest::i_isolate()->factory()->true_value();
}
diff --git a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc
index daeccca777..9cc2d84ec9 100644
--- a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc
+++ b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc
@@ -308,10 +308,11 @@ TEST(ArrayBuffer_SemiSpaceCopyThenPagePromotion) {
UNINITIALIZED_TEST(ArrayBuffer_SemiSpaceCopyMultipleTasks) {
if (FLAG_optimize_for_size) return;
+ ManualGCScope manual_gc_scope;
// Test allocates JSArrayBuffer on different pages before triggering a
// full GC that performs the semispace copy. If parallelized, this test
// ensures proper synchronization in TSAN configurations.
- FLAG_min_semi_space_size = 2 * Page::kPageSize / MB;
+ FLAG_min_semi_space_size = Max(2 * Page::kPageSize / MB, 1);
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
diff --git a/deps/v8/test/cctest/heap/test-compaction.cc b/deps/v8/test/cctest/heap/test-compaction.cc
index 9fb989482c..eea4a6eb43 100644
--- a/deps/v8/test/cctest/heap/test-compaction.cc
+++ b/deps/v8/test/cctest/heap/test-compaction.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/mark-compact.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
@@ -96,8 +97,9 @@ HEAP_TEST(CompactionPartiallyAbortedPage) {
const int objects_per_page = 10;
const int object_size =
- static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
- objects_per_page;
+ Min(kMaxRegularHeapObjectSize,
+ static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
+ objects_per_page);
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
@@ -175,8 +177,9 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) {
const int objects_per_page = 10;
const int object_size =
- static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
- objects_per_page;
+ Min(kMaxRegularHeapObjectSize,
+ static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
+ objects_per_page);
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
@@ -267,8 +270,9 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) {
const int objects_per_page = 10;
const int object_size =
- static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
- objects_per_page;
+ Min(kMaxRegularHeapObjectSize,
+ static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
+ objects_per_page);
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
@@ -302,7 +306,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) {
root_array->set(0, *compaction_page_handles.back());
Handle<FixedArray> new_space_array =
isolate->factory()->NewFixedArray(1, NOT_TENURED);
- CHECK(Heap::InNewSpace(*new_space_array));
+ CHECK(Heap::InYoungGeneration(*new_space_array));
compaction_page_handles.front()->set(1, *new_space_array);
CheckAllObjectsOnPage(compaction_page_handles, to_be_aborted_page);
}
@@ -329,7 +333,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) {
while (current->get(0) != ReadOnlyRoots(heap).undefined_value()) {
current =
Handle<FixedArray>(FixedArray::cast(current->get(0)), isolate);
- CHECK(!Heap::InNewSpace(*current));
+ CHECK(!Heap::InYoungGeneration(*current));
CHECK(current->IsFixedArray());
if (Page::FromHeapObject(*current) != to_be_aborted_page) {
in_place = false;
diff --git a/deps/v8/test/cctest/heap/test-embedder-tracing.cc b/deps/v8/test/cctest/heap/test-embedder-tracing.cc
index 5134392886..ace016dbd0 100644
--- a/deps/v8/test/cctest/heap/test-embedder-tracing.cc
+++ b/deps/v8/test/cctest/heap/test-embedder-tracing.cc
@@ -2,13 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <unordered_map>
+#include <vector>
+
#include "include/v8.h"
#include "src/api-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/objects-inl.h"
#include "src/objects/module.h"
#include "src/objects/script.h"
#include "src/objects/shared-function-info.h"
#include "test/cctest/cctest.h"
+#include "test/cctest/heap/heap-utils.h"
namespace v8 {
namespace internal {
@@ -35,9 +40,14 @@ v8::Local<v8::Object> ConstructTraceableJSApiObject(
return scope.Escape(instance);
}
+enum class TracePrologueBehavior { kNoop, kCallV8WriteBarrier };
+
class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
public:
- explicit TestEmbedderHeapTracer(v8::Isolate* isolate) : isolate_(isolate) {}
+ TestEmbedderHeapTracer() = default;
+ TestEmbedderHeapTracer(TracePrologueBehavior prologue_behavior,
+ v8::Global<v8::Array> array)
+ : prologue_behavior_(prologue_behavior), array_(std::move(array)) {}
void RegisterV8References(
const std::vector<std::pair<void*, void*>>& embedder_fields) final {
@@ -45,13 +55,13 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
embedder_fields.begin(), embedder_fields.end());
}
- void AddReferenceForTracing(v8::Persistent<v8::Object>* persistent) {
- to_register_with_v8_.push_back(persistent);
+ void AddReferenceForTracing(v8::TracedGlobal<v8::Object>* global) {
+ to_register_with_v8_.push_back(global);
}
bool AdvanceTracing(double deadline_in_ms) final {
- for (auto persistent : to_register_with_v8_) {
- persistent->RegisterExternalReference(isolate_);
+ for (auto global : to_register_with_v8_) {
+ RegisterEmbedderReference(global->As<v8::Value>());
}
to_register_with_v8_.clear();
return true;
@@ -59,9 +69,15 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
bool IsTracingDone() final { return to_register_with_v8_.empty(); }
- void TracePrologue() final {}
+ void TracePrologue() final {
+ if (prologue_behavior_ == TracePrologueBehavior::kCallV8WriteBarrier) {
+ auto local = array_.Get(isolate());
+ local->Set(local->CreationContext(), 0, v8::Object::New(isolate()))
+ .Check();
+ }
+ }
+
void TraceEpilogue() final {}
- void AbortTracing() final {}
void EnterFinalPause(EmbedderStackState) final {}
bool IsRegisteredFromV8(void* first_field) const {
@@ -71,10 +87,20 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
return false;
}
+ void ConsiderTracedGlobalAsRoot(bool value) {
+ consider_traced_global_as_root_ = value;
+ }
+
+ bool IsRootForNonTracingGC(const v8::TracedGlobal<v8::Value>& handle) final {
+ return consider_traced_global_as_root_;
+ }
+
private:
- v8::Isolate* const isolate_;
std::vector<std::pair<void*, void*>> registered_from_v8_;
- std::vector<v8::Persistent<v8::Object>*> to_register_with_v8_;
+ std::vector<v8::TracedGlobal<v8::Object>*> to_register_with_v8_;
+ bool consider_traced_global_as_root_ = true;
+ TracePrologueBehavior prologue_behavior_ = TracePrologueBehavior::kNoop;
+ v8::Global<v8::Array> array_;
};
class TemporaryEmbedderHeapTracerScope {
@@ -101,7 +127,7 @@ TEST(V8RegisteringEmbedderReference) {
ManualGCScope manual_gc;
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
@@ -121,19 +147,18 @@ TEST(EmbedderRegisteringV8Reference) {
ManualGCScope manual_gc;
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context);
- v8::Persistent<v8::Object> g;
+ v8::TracedGlobal<v8::Object> g;
{
v8::HandleScope inner_scope(isolate);
v8::Local<v8::Object> o =
v8::Local<v8::Object>::New(isolate, v8::Object::New(isolate));
g.Reset(isolate, o);
- g.SetWeak();
}
tracer.AddReferenceForTracing(&g);
CcTest::CollectGarbage(i::OLD_SPACE);
@@ -155,7 +180,7 @@ TEST(TracingInRevivedSubgraph) {
ManualGCScope manual_gc;
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
@@ -183,7 +208,7 @@ TEST(TracingInEphemerons) {
ManualGCScope manual_gc;
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
@@ -214,7 +239,7 @@ TEST(FinalizeTracingIsNoopWhenNotMarking) {
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
Isolate* i_isolate = CcTest::i_isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
// Finalize a potentially running garbage collection.
@@ -233,7 +258,7 @@ TEST(FinalizeTracingWhenMarking) {
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
Isolate* i_isolate = CcTest::i_isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
// Finalize a potentially running garbage collection.
@@ -258,7 +283,7 @@ TEST(GarbageCollectionForTesting) {
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
Isolate* i_isolate = CcTest::i_isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
int saved_gc_counter = i_isolate->heap()->gc_count();
@@ -266,6 +291,293 @@ TEST(GarbageCollectionForTesting) {
CHECK_GT(i_isolate->heap()->gc_count(), saved_gc_counter);
}
+namespace {
+
+void ConstructJSObject(v8::Isolate* isolate, v8::Local<v8::Context> context,
+ v8::TracedGlobal<v8::Object>* global) {
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Object> object(v8::Object::New(isolate));
+ CHECK(!object.IsEmpty());
+ *global = v8::TracedGlobal<v8::Object>(isolate, object);
+ CHECK(!global->IsEmpty());
+}
+
+void ConstructJSApiObject(v8::Isolate* isolate, v8::Local<v8::Context> context,
+ v8::TracedGlobal<v8::Object>* global) {
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Object> object(
+ ConstructTraceableJSApiObject(context, nullptr, nullptr));
+ CHECK(!object.IsEmpty());
+ *global = v8::TracedGlobal<v8::Object>(isolate, object);
+ CHECK(!global->IsEmpty());
+}
+
+enum class SurvivalMode { kSurvives, kDies };
+
+template <typename ModifierFunction, typename ConstructTracedGlobalFunction>
+void TracedGlobalTest(v8::Isolate* isolate,
+ ConstructTracedGlobalFunction construct_function,
+ ModifierFunction modifier_function, void (*gc_function)(),
+ SurvivalMode survives) {
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ v8::Context::Scope context_scope(context);
+
+ v8::TracedGlobal<v8::Object> global;
+ construct_function(isolate, context, &global);
+ CHECK(InYoungGeneration(isolate, global));
+ modifier_function(global);
+ gc_function();
+ CHECK_IMPLIES(survives == SurvivalMode::kSurvives, !global.IsEmpty());
+ CHECK_IMPLIES(survives == SurvivalMode::kDies, global.IsEmpty());
+}
+
+} // namespace
+
+TEST(TracedGlobalReset) {
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ v8::TracedGlobal<v8::Object> traced;
+ ConstructJSObject(isolate, isolate->GetCurrentContext(), &traced);
+ CHECK(!traced.IsEmpty());
+ traced.Reset();
+ CHECK(traced.IsEmpty());
+}
+
+TEST(TracedGlobalInStdVector) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ std::vector<v8::TracedGlobal<v8::Object>> vec;
+ {
+ v8::HandleScope scope(isolate);
+ vec.emplace_back(isolate, v8::Object::New(isolate));
+ }
+ CHECK(!vec[0].IsEmpty());
+ InvokeMarkSweep();
+ CHECK(vec[0].IsEmpty());
+}
+
+TEST(TracedGlobalInStdUnorderedMap) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ std::unordered_map<int, v8::TracedGlobal<v8::Object>> map;
+ {
+ v8::HandleScope scope(isolate);
+ map.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+ std::forward_as_tuple(isolate, v8::Object::New(isolate)));
+ }
+ CHECK(!map[1].IsEmpty());
+ InvokeMarkSweep();
+ CHECK(map[1].IsEmpty());
+}
+
+TEST(TracedGlobalToUnmodifiedJSObjectDiesOnMarkSweep) {
+ CcTest::InitializeVM();
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSObject,
+ [](const TracedGlobal<v8::Object>& global) {}, InvokeMarkSweep,
+ SurvivalMode::kDies);
+}
+
+TEST(TracedGlobalToUnmodifiedJSObjectSurvivesMarkSweepWhenHeldAliveOtherwise) {
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::Global<v8::Object> strong_global;
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSObject,
+ [isolate, &strong_global](const TracedGlobal<v8::Object>& global) {
+ v8::HandleScope scope(isolate);
+ strong_global = v8::Global<v8::Object>(isolate, global.Get(isolate));
+ },
+ InvokeMarkSweep, SurvivalMode::kSurvives);
+}
+
+TEST(TracedGlobalToUnmodifiedJSObjectSurvivesScavenge) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSObject,
+ [](const TracedGlobal<v8::Object>& global) {}, InvokeScavenge,
+ SurvivalMode::kSurvives);
+}
+
+TEST(TracedGlobalToUnmodifiedJSObjectSurvivesScavengeWhenExcludedFromRoots) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+ tracer.ConsiderTracedGlobalAsRoot(false);
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSObject,
+ [](const TracedGlobal<v8::Object>& global) {}, InvokeScavenge,
+ SurvivalMode::kSurvives);
+}
+
+TEST(TracedGlobalToUnmodifiedJSApiObjectSurvivesScavengePerDefault) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+ tracer.ConsiderTracedGlobalAsRoot(true);
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSApiObject,
+ [](const TracedGlobal<v8::Object>& global) {}, InvokeScavenge,
+ SurvivalMode::kSurvives);
+}
+
+TEST(TracedGlobalToUnmodifiedJSApiObjectDiesOnScavengeWhenExcludedFromRoots) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+ tracer.ConsiderTracedGlobalAsRoot(false);
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSApiObject,
+ [](const TracedGlobal<v8::Object>& global) {}, InvokeScavenge,
+ SurvivalMode::kDies);
+}
+
+TEST(TracedGlobalWrapperClassId) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+
+ v8::TracedGlobal<v8::Object> traced;
+ ConstructJSObject(isolate, isolate->GetCurrentContext(), &traced);
+ CHECK_EQ(0, traced.WrapperClassId());
+ traced.SetWrapperClassId(17);
+ CHECK_EQ(17, traced.WrapperClassId());
+}
+
+namespace {
+
+class TracedGlobalVisitor final
+ : public v8::EmbedderHeapTracer::TracedGlobalHandleVisitor {
+ public:
+ ~TracedGlobalVisitor() override = default;
+ void VisitTracedGlobalHandle(const TracedGlobal<Value>& value) final {
+ if (value.WrapperClassId() == 57) {
+ count_++;
+ }
+ }
+
+ size_t count() const { return count_; }
+
+ private:
+ size_t count_ = 0;
+};
+
+} // namespace
+
+TEST(TracedGlobalIteration) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+
+ v8::TracedGlobal<v8::Object> traced;
+ ConstructJSObject(isolate, isolate->GetCurrentContext(), &traced);
+ CHECK(!traced.IsEmpty());
+ traced.SetWrapperClassId(57);
+ TracedGlobalVisitor visitor;
+ {
+ v8::HandleScope scope(isolate);
+ tracer.IterateTracedGlobalHandles(&visitor);
+ }
+ CHECK_EQ(1, visitor.count());
+}
+
+namespace {
+
+void FinalizationCallback(const WeakCallbackInfo<void>& data) {
+ v8::TracedGlobal<v8::Object>* traced =
+ reinterpret_cast<v8::TracedGlobal<v8::Object>*>(data.GetParameter());
+ CHECK_EQ(reinterpret_cast<void*>(0x4), data.GetInternalField(0));
+ CHECK_EQ(reinterpret_cast<void*>(0x8), data.GetInternalField(1));
+ traced->Reset();
+}
+
+} // namespace
+
+TEST(TracedGlobalSetFinalizationCallbackScavenge) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ TestEmbedderHeapTracer tracer;
+ tracer.ConsiderTracedGlobalAsRoot(false);
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+
+ v8::TracedGlobal<v8::Object> traced;
+ ConstructJSApiObject(isolate, isolate->GetCurrentContext(), &traced);
+ CHECK(!traced.IsEmpty());
+ {
+ v8::HandleScope scope(isolate);
+ auto local = traced.Get(isolate);
+ local->SetAlignedPointerInInternalField(0, reinterpret_cast<void*>(0x4));
+ local->SetAlignedPointerInInternalField(1, reinterpret_cast<void*>(0x8));
+ }
+ traced.SetFinalizationCallback(&traced, FinalizationCallback);
+ heap::InvokeScavenge();
+ CHECK(traced.IsEmpty());
+}
+
+TEST(TracedGlobalSetFinalizationCallbackMarkSweep) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+
+ v8::TracedGlobal<v8::Object> traced;
+ ConstructJSApiObject(isolate, isolate->GetCurrentContext(), &traced);
+ CHECK(!traced.IsEmpty());
+ {
+ v8::HandleScope scope(isolate);
+ auto local = traced.Get(isolate);
+ local->SetAlignedPointerInInternalField(0, reinterpret_cast<void*>(0x4));
+ local->SetAlignedPointerInInternalField(1, reinterpret_cast<void*>(0x8));
+ }
+ traced.SetFinalizationCallback(&traced, FinalizationCallback);
+ heap::InvokeMarkSweep();
+ CHECK(traced.IsEmpty());
+}
+
+TEST(TracePrologueCallingIntoV8WriteBarrier) {
+ // Regression test: https://crbug.com/940003
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ v8::Global<v8::Array> global;
+ {
+ v8::HandleScope scope(isolate);
+ auto local = v8::Array::New(isolate, 10);
+ global.Reset(isolate, local);
+ }
+ TestEmbedderHeapTracer tracer(TracePrologueBehavior::kCallV8WriteBarrier,
+ std::move(global));
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+ SimulateIncrementalMarking(CcTest::i_isolate()->heap());
+}
+
} // namespace heap
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/heap/test-external-string-tracker.cc b/deps/v8/test/cctest/heap/test-external-string-tracker.cc
index 36a9391307..bcc00764de 100644
--- a/deps/v8/test/cctest/heap/test-external-string-tracker.cc
+++ b/deps/v8/test/cctest/heap/test-external-string-tracker.cc
@@ -4,6 +4,7 @@
#include "src/api-inl.h"
#include "src/api.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/spaces.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
@@ -193,7 +194,7 @@ TEST(ExternalString_PromotedThinString) {
i::Handle<i::String> isymbol1 = factory->InternalizeString(string1);
CHECK(isymbol1->IsInternalizedString());
CHECK(string1->IsExternalString());
- CHECK(!heap->InNewSpace(*isymbol1));
+ CHECK(!heap->InYoungGeneration(*isymbol1));
// New external string in the young space. This string has the same content
// as the previous one (that was already internalized).
@@ -209,7 +210,7 @@ TEST(ExternalString_PromotedThinString) {
i::Handle<i::String> isymbol2 = factory->InternalizeString(istring);
CHECK(isymbol2->IsInternalizedString());
CHECK(istring->IsThinString());
- CHECK(heap->InNewSpace(*istring));
+ CHECK(heap->InYoungGeneration(*istring));
// Collect thin string. References to the thin string will be updated to
// point to the actual external string in the old space.
diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc
index c7c1d93f87..f12ba10979 100644
--- a/deps/v8/test/cctest/heap/test-heap.cc
+++ b/deps/v8/test/cctest/heap/test-heap.cc
@@ -37,8 +37,10 @@
#include "src/execution.h"
#include "src/field-type.h"
#include "src/global-handles.h"
+#include "src/hash-seed-inl.h"
#include "src/heap/factory.h"
#include "src/heap/gc-tracer.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/mark-compact.h"
#include "src/heap/memory-reducer.h"
@@ -46,6 +48,7 @@
#include "src/ic/ic.h"
#include "src/macro-assembler-inl.h"
#include "src/objects-inl.h"
+#include "src/objects/frame-array-inl.h"
#include "src/objects/heap-number-inl.h"
#include "src/objects/js-array-inl.h"
#include "src/objects/js-collection-inl.h"
@@ -188,7 +191,7 @@ HEAP_TEST(TestNewSpaceRefsInCopiedCode) {
HandleScope sc(isolate);
Handle<HeapNumber> value = factory->NewHeapNumber(1.000123);
- CHECK(Heap::InNewSpace(*value));
+ CHECK(Heap::InYoungGeneration(*value));
i::byte buffer[i::Assembler::kMinimalBufferSize];
MacroAssembler masm(isolate, v8::internal::CodeObjectRequired::kYes,
@@ -368,16 +371,11 @@ TEST(GarbageCollection) {
HandleScope inner_scope(isolate);
// Allocate a function and keep it in global object's property.
Handle<JSFunction> function = factory->NewFunctionForTest(name);
- Object::SetProperty(isolate, global, name, function, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, global, name, function).Check();
// Allocate an object. Unrooted after leaving the scope.
Handle<JSObject> obj = factory->NewJSObject(function);
- Object::SetProperty(isolate, obj, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_namex, twenty_four,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
+ Object::SetProperty(isolate, obj, prop_namex, twenty_four).Check();
CHECK_EQ(Smi::FromInt(23),
*Object::GetProperty(isolate, obj, prop_name).ToHandleChecked());
@@ -399,11 +397,8 @@ TEST(GarbageCollection) {
HandleScope inner_scope(isolate);
// Allocate another object, make it reachable from global.
Handle<JSObject> obj = factory->NewJSObject(function);
- Object::SetProperty(isolate, global, obj_name, obj, LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, global, obj_name, obj).Check();
+ Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
}
// After gc, it should survive.
@@ -698,7 +693,7 @@ TEST(WeakGlobalHandlesMark) {
// Make sure the objects are promoted.
CcTest::CollectGarbage(OLD_SPACE);
CcTest::CollectGarbage(NEW_SPACE);
- CHECK(!Heap::InNewSpace(*h1) && !Heap::InNewSpace(*h2));
+ CHECK(!Heap::InYoungGeneration(*h1) && !Heap::InYoungGeneration(*h2));
std::pair<Handle<Object>*, int> handle_and_id(&h2, 1234);
GlobalHandles::MakeWeak(
@@ -944,15 +939,11 @@ TEST(FunctionAllocation) {
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
Handle<JSObject> obj = factory->NewJSObject(function);
- Object::SetProperty(isolate, obj, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
CHECK_EQ(Smi::FromInt(23),
*Object::GetProperty(isolate, obj, prop_name).ToHandleChecked());
// Check that we can add properties to function objects.
- Object::SetProperty(isolate, function, prop_name, twenty_four,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, function, prop_name, twenty_four).Check();
CHECK_EQ(
Smi::FromInt(24),
*Object::GetProperty(isolate, function, prop_name).ToHandleChecked());
@@ -983,7 +974,7 @@ TEST(ObjectProperties) {
CHECK(Just(false) == JSReceiver::HasOwnProperty(obj, first));
// add first
- Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
+ Object::SetProperty(isolate, obj, first, one).Check();
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, first));
// delete first
@@ -992,8 +983,8 @@ TEST(ObjectProperties) {
CHECK(Just(false) == JSReceiver::HasOwnProperty(obj, first));
// add first and then second
- Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
- Object::SetProperty(isolate, obj, second, two, LanguageMode::kSloppy).Check();
+ Object::SetProperty(isolate, obj, first, one).Check();
+ Object::SetProperty(isolate, obj, second, two).Check();
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, first));
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, second));
@@ -1007,8 +998,8 @@ TEST(ObjectProperties) {
CHECK(Just(false) == JSReceiver::HasOwnProperty(obj, second));
// add first and then second
- Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
- Object::SetProperty(isolate, obj, second, two, LanguageMode::kSloppy).Check();
+ Object::SetProperty(isolate, obj, first, one).Check();
+ Object::SetProperty(isolate, obj, second, two).Check();
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, first));
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, second));
@@ -1024,15 +1015,14 @@ TEST(ObjectProperties) {
// check string and internalized string match
const char* string1 = "fisk";
Handle<String> s1 = factory->NewStringFromAsciiChecked(string1);
- Object::SetProperty(isolate, obj, s1, one, LanguageMode::kSloppy).Check();
+ Object::SetProperty(isolate, obj, s1, one).Check();
Handle<String> s1_string = factory->InternalizeUtf8String(string1);
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, s1_string));
// check internalized string and string match
const char* string2 = "fugl";
Handle<String> s2_string = factory->InternalizeUtf8String(string2);
- Object::SetProperty(isolate, obj, s2_string, one, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, s2_string, one).Check();
Handle<String> s2 = factory->NewStringFromAsciiChecked(string2);
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, s2));
}
@@ -1053,9 +1043,7 @@ TEST(JSObjectMaps) {
// Set a propery
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
- Object::SetProperty(isolate, obj, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
CHECK_EQ(Smi::FromInt(23),
*Object::GetProperty(isolate, obj, prop_name).ToHandleChecked());
@@ -1090,7 +1078,7 @@ TEST(JSArray) {
CHECK(array->HasSmiOrObjectElements());
// array[length] = name.
- Object::SetElement(isolate, array, 0, name, LanguageMode::kSloppy).Check();
+ Object::SetElement(isolate, array, 0, name, ShouldThrow::kDontThrow).Check();
CHECK_EQ(Smi::FromInt(1), array->length());
element = i::Object::GetElement(isolate, array, 0).ToHandleChecked();
CHECK_EQ(*element, *name);
@@ -1104,7 +1092,7 @@ TEST(JSArray) {
CHECK(array->HasDictionaryElements()); // Must be in slow mode.
// array[length] = name.
- Object::SetElement(isolate, array, int_length, name, LanguageMode::kSloppy)
+ Object::SetElement(isolate, array, int_length, name, ShouldThrow::kDontThrow)
.Check();
uint32_t new_int_length = 0;
CHECK(array->length()->ToArrayIndex(&new_int_length));
@@ -1136,11 +1124,11 @@ TEST(JSObjectCopy) {
Handle<Smi> one(Smi::FromInt(1), isolate);
Handle<Smi> two(Smi::FromInt(2), isolate);
- Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
- Object::SetProperty(isolate, obj, second, two, LanguageMode::kSloppy).Check();
+ Object::SetProperty(isolate, obj, first, one).Check();
+ Object::SetProperty(isolate, obj, second, two).Check();
- Object::SetElement(isolate, obj, 0, first, LanguageMode::kSloppy).Check();
- Object::SetElement(isolate, obj, 1, second, LanguageMode::kSloppy).Check();
+ Object::SetElement(isolate, obj, 0, first, ShouldThrow::kDontThrow).Check();
+ Object::SetElement(isolate, obj, 1, second, ShouldThrow::kDontThrow).Check();
// Make the clone.
Handle<Object> value1, value2;
@@ -1162,13 +1150,12 @@ TEST(JSObjectCopy) {
CHECK_EQ(*value1, *value2);
// Flip the values.
- Object::SetProperty(isolate, clone, first, two, LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, clone, second, one, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, clone, first, two).Check();
+ Object::SetProperty(isolate, clone, second, one).Check();
- Object::SetElement(isolate, clone, 0, second, LanguageMode::kSloppy).Check();
- Object::SetElement(isolate, clone, 1, first, LanguageMode::kSloppy).Check();
+ Object::SetElement(isolate, clone, 0, second, ShouldThrow::kDontThrow)
+ .Check();
+ Object::SetElement(isolate, clone, 1, first, ShouldThrow::kDontThrow).Check();
value1 = Object::GetElement(isolate, obj, 1).ToHandleChecked();
value2 = Object::GetElement(isolate, clone, 0).ToHandleChecked();
@@ -1800,8 +1787,9 @@ static HeapObject NewSpaceAllocateAligned(int size,
static Address AlignNewSpace(AllocationAlignment alignment, int offset) {
Address* top_addr = CcTest::heap()->new_space()->allocation_top_address();
int fill = Heap::GetFillToAlign(*top_addr, alignment);
- if (fill) {
- NewSpaceAllocateAligned(fill + offset, kWordAligned);
+ int allocation = fill + offset;
+ if (allocation) {
+ NewSpaceAllocateAligned(allocation, kWordAligned);
}
return *top_addr;
}
@@ -1923,6 +1911,64 @@ TEST(TestAlignedOverAllocation) {
}
}
+TEST(HeapNumberAlignment) {
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
+ Heap* heap = isolate->heap();
+ HandleScope sc(isolate);
+
+ const auto required_alignment =
+ HeapObject::RequiredAlignment(*factory->heap_number_map());
+ const int maximum_misalignment =
+ Heap::GetMaximumFillToAlign(required_alignment);
+
+ for (int offset = 0; offset <= maximum_misalignment; offset += kTaggedSize) {
+ AlignNewSpace(required_alignment, offset);
+ Handle<Object> number_new = factory->NewNumber(1.000123);
+ CHECK(number_new->IsHeapNumber());
+ CHECK(Heap::InYoungGeneration(*number_new));
+ CHECK_EQ(0, Heap::GetFillToAlign(HeapObject::cast(*number_new)->address(),
+ required_alignment));
+
+ AlignOldSpace(required_alignment, offset);
+ Handle<Object> number_old = factory->NewNumber(1.000321, TENURED);
+ CHECK(number_old->IsHeapNumber());
+ CHECK(heap->InOldSpace(*number_old));
+ CHECK_EQ(0, Heap::GetFillToAlign(HeapObject::cast(*number_old)->address(),
+ required_alignment));
+ }
+}
+
+TEST(MutableHeapNumberAlignment) {
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
+ Heap* heap = isolate->heap();
+ HandleScope sc(isolate);
+
+ const auto required_alignment =
+ HeapObject::RequiredAlignment(*factory->mutable_heap_number_map());
+ const int maximum_misalignment =
+ Heap::GetMaximumFillToAlign(required_alignment);
+
+ for (int offset = 0; offset <= maximum_misalignment; offset += kTaggedSize) {
+ AlignNewSpace(required_alignment, offset);
+ Handle<Object> number_new = factory->NewMutableHeapNumber(1.000123);
+ CHECK(number_new->IsMutableHeapNumber());
+ CHECK(Heap::InYoungGeneration(*number_new));
+ CHECK_EQ(0, Heap::GetFillToAlign(HeapObject::cast(*number_new)->address(),
+ required_alignment));
+
+ AlignOldSpace(required_alignment, offset);
+ Handle<Object> number_old =
+ factory->NewMutableHeapNumber(1.000321, TENURED);
+ CHECK(number_old->IsMutableHeapNumber());
+ CHECK(heap->InOldSpace(*number_old));
+ CHECK_EQ(0, Heap::GetFillToAlign(HeapObject::cast(*number_old)->address(),
+ required_alignment));
+ }
+}
TEST(TestSizeOfObjectsVsHeapIteratorPrecision) {
CcTest::InitializeVM();
@@ -1975,6 +2021,8 @@ TEST(GrowAndShrinkNewSpace) {
// Make sure we're in a consistent state to start out.
CcTest::CollectAllGarbage();
+ CcTest::CollectAllGarbage();
+ new_space->Shrink();
// Explicitly growing should double the space capacity.
size_t old_capacity, new_capacity;
@@ -2285,11 +2333,12 @@ TEST(InstanceOfStubWriteBarrier) {
IncrementalMarking::MarkingState* marking_state = marking->marking_state();
+ const double kStepSizeInMs = 100;
while (!marking_state->IsBlack(f->code()) && !marking->IsStopped()) {
// Discard any pending GC requests otherwise we will get GC when we enter
// code below.
- marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ marking->V8Step(kStepSizeInMs, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
}
CHECK(marking->IsMarking());
@@ -2352,7 +2401,7 @@ HEAP_TEST(Regress845060) {
// Preparation: create a string in new space.
Local<Value> str = CompileRun("var str = (new Array(10000)).join('x'); str");
- CHECK(Heap::InNewSpace(*v8::Utils::OpenHandle(*str)));
+ CHECK(Heap::InYoungGeneration(*v8::Utils::OpenHandle(*str)));
// Idle incremental marking sets the "kReduceMemoryFootprint" flag, which
// causes from_space to be unmapped after scavenging.
@@ -2363,7 +2412,7 @@ HEAP_TEST(Regress845060) {
// promoted to old space. Unmapping of from_space causes accesses to any
// stale raw pointers to crash.
CompileRun("while (%InNewSpace(str)) { str.split(''); }");
- CHECK(!Heap::InNewSpace(*v8::Utils::OpenHandle(*str)));
+ CHECK(!Heap::InYoungGeneration(*v8::Utils::OpenHandle(*str)));
}
TEST(IdleNotificationFinishMarking) {
@@ -2380,9 +2429,10 @@ TEST(IdleNotificationFinishMarking) {
CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count);
+ const double kStepSizeInMs = 100;
do {
- marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ marking->V8Step(kStepSizeInMs, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
} while (
!CcTest::heap()->mark_compact_collector()->marking_worklist()->IsEmpty());
@@ -2431,7 +2481,7 @@ TEST(OptimizedAllocationAlwaysInNewSpace) {
i::Handle<JSReceiver> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
- CHECK(Heap::InNewSpace(*o));
+ CHECK(Heap::InYoungGeneration(*o));
}
@@ -2569,7 +2619,7 @@ TEST(OptimizedPretenuringNestedInObjectProperties) {
// Nested literal sites are only pretenured if the top level
// literal is pretenured
- CHECK(Heap::InNewSpace(*o));
+ CHECK(Heap::InYoungGeneration(*o));
}
TEST(OptimizedPretenuringMixedInObjectProperties) {
@@ -2897,7 +2947,7 @@ TEST(OptimizedAllocationArrayLiterals) {
i::Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
- CHECK(Heap::InNewSpace(o->elements()));
+ CHECK(Heap::InYoungGeneration(o->elements()));
}
static int CountMapTransitions(i::Isolate* isolate, Map map) {
@@ -2952,6 +3002,13 @@ TEST(Regress1465) {
CHECK_EQ(1, transitions_after);
}
+static i::Handle<JSObject> GetByName(const char* name) {
+ return i::Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
+ CcTest::global()
+ ->Get(CcTest::isolate()->GetCurrentContext(), v8_str(name))
+ .ToLocalChecked())));
+}
#ifdef DEBUG
static void AddTransitions(int transitions_count) {
@@ -2964,15 +3021,6 @@ static void AddTransitions(int transitions_count) {
}
-static i::Handle<JSObject> GetByName(const char* name) {
- return i::Handle<JSObject>::cast(
- v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
- CcTest::global()
- ->Get(CcTest::isolate()->GetCurrentContext(), v8_str(name))
- .ToLocalChecked())));
-}
-
-
static void AddPropertyTo(
int gc_count, Handle<JSObject> object, const char* property_name) {
Isolate* isolate = CcTest::i_isolate();
@@ -2983,9 +3031,7 @@ static void AddPropertyTo(
FLAG_gc_global = true;
FLAG_retain_maps_for_n_gc = 0;
CcTest::heap()->set_allocation_timeout(gc_count);
- Object::SetProperty(isolate, object, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, object, prop_name, twenty_three).Check();
}
@@ -3106,6 +3152,9 @@ TEST(ReleaseOverReservedPages) {
Factory* factory = isolate->factory();
Heap* heap = isolate->heap();
v8::HandleScope scope(CcTest::isolate());
+ // Ensure that the young generation is empty.
+ CcTest::CollectGarbage(NEW_SPACE);
+ CcTest::CollectGarbage(NEW_SPACE);
static const int number_of_test_pages = 20;
// Prepare many pages with low live-bytes count.
@@ -3139,7 +3188,7 @@ TEST(ReleaseOverReservedPages) {
// boots, but if the 20 small arrays don't fit on the first page then that's
// an indication that it is too small.
CcTest::CollectAllAvailableGarbage();
- CHECK_EQ(initial_page_count, old_space->CountTotalPages());
+ CHECK_GE(initial_page_count, old_space->CountTotalPages());
}
static int forced_gc_counter = 0;
@@ -3239,7 +3288,7 @@ static void CheckVectorIC(Handle<JSFunction> f, int slot_index,
FeedbackVectorHelper helper(vector);
FeedbackSlot slot = helper.slot(slot_index);
FeedbackNexus nexus(vector, slot);
- CHECK(nexus.StateFromFeedback() == desired_state);
+ CHECK(nexus.ic_state() == desired_state);
}
TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
@@ -3488,6 +3537,119 @@ UNINITIALIZED_TEST(ReleaseStackTraceData) {
isolate->Dispose();
}
+// TODO(mmarchini) also write tests for async/await and Promise.all
+void DetailedErrorStackTraceTest(const char* src,
+ std::function<void(Handle<FrameArray>)> test) {
+ FLAG_detailed_error_stack_trace = true;
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ v8::TryCatch try_catch(CcTest::isolate());
+ CompileRun(src);
+
+ CHECK(try_catch.HasCaught());
+ Handle<Object> exception = v8::Utils::OpenHandle(*try_catch.Exception());
+
+ Isolate* isolate = CcTest::i_isolate();
+ Handle<Name> key = isolate->factory()->stack_trace_symbol();
+
+ Handle<FrameArray> stack_trace(
+ FrameArray::cast(
+ Handle<JSArray>::cast(
+ Object::GetProperty(isolate, exception, key).ToHandleChecked())
+ ->elements()),
+ isolate);
+
+ test(stack_trace);
+}
+
+// * Test interpreted function error
+TEST(DetailedErrorStackTrace) {
+ static const char* source =
+ "function func1(arg1) { "
+ " let err = new Error(); "
+ " throw err; "
+ "} "
+ "function func2(arg1, arg2) { "
+ " func1(42); "
+ "} "
+ "class Foo {}; "
+ "function main(arg1, arg2) { "
+ " func2(arg1, false); "
+ "} "
+ "var foo = new Foo(); "
+ "main(foo); ";
+
+ DetailedErrorStackTraceTest(source, [](Handle<FrameArray> stack_trace) {
+ FixedArray foo_parameters = stack_trace->Parameters(0);
+ CHECK_EQ(foo_parameters->length(), 1);
+ CHECK(foo_parameters->get(0)->IsSmi());
+ CHECK_EQ(Smi::ToInt(foo_parameters->get(0)), 42);
+
+ FixedArray bar_parameters = stack_trace->Parameters(1);
+ CHECK_EQ(bar_parameters->length(), 2);
+ CHECK(bar_parameters->get(0)->IsJSObject());
+ CHECK(bar_parameters->get(1)->IsBoolean());
+ Handle<Object> foo = Handle<Object>::cast(GetByName("foo"));
+ CHECK_EQ(bar_parameters->get(0), *foo);
+ CHECK(!bar_parameters->get(1)->BooleanValue(CcTest::i_isolate()));
+
+ FixedArray main_parameters = stack_trace->Parameters(2);
+ CHECK_EQ(main_parameters->length(), 2);
+ CHECK(main_parameters->get(0)->IsJSObject());
+ CHECK(main_parameters->get(1)->IsUndefined());
+ CHECK_EQ(main_parameters->get(0), *foo);
+ });
+}
+
+// * Test optimized function with inline frame error
+TEST(DetailedErrorStackTraceInline) {
+ FLAG_allow_natives_syntax = true;
+ static const char* source =
+ "function add(x) { "
+ " if (x == 42) "
+ " throw new Error(); "
+ " return x + x; "
+ "} "
+ "add(0); "
+ "add(1); "
+ "function foo(x) { "
+ " return add(x + 1) "
+ "} "
+ "foo(40); "
+ "%OptimizeFunctionOnNextCall(foo); "
+ "foo(41); ";
+
+ DetailedErrorStackTraceTest(source, [](Handle<FrameArray> stack_trace) {
+ FixedArray parameters_add = stack_trace->Parameters(0);
+ CHECK_EQ(parameters_add->length(), 1);
+ CHECK(parameters_add->get(0)->IsSmi());
+ CHECK_EQ(Smi::ToInt(parameters_add->get(0)), 42);
+
+ FixedArray parameters_foo = stack_trace->Parameters(1);
+ CHECK_EQ(parameters_foo->length(), 1);
+ CHECK(parameters_foo->get(0)->IsSmi());
+ CHECK_EQ(Smi::ToInt(parameters_foo->get(0)), 41);
+ });
+}
+
+// * Test builtin exit error
+TEST(DetailedErrorStackTraceBuiltinExit) {
+ static const char* source =
+ "function test(arg1) { "
+ " (new Number()).toFixed(arg1); "
+ "} "
+ "test(9999); ";
+
+ DetailedErrorStackTraceTest(source, [](Handle<FrameArray> stack_trace) {
+ FixedArray parameters = stack_trace->Parameters(0);
+
+ CHECK_EQ(parameters->length(), 2);
+ CHECK(parameters->get(0)->IsSmi());
+ CHECK_EQ(Smi::ToInt(parameters->get(0)), 9999);
+ });
+}
+
TEST(Regress169928) {
FLAG_allow_natives_syntax = true;
#ifndef V8_LITE_MODE
@@ -3595,8 +3757,6 @@ TEST(LargeObjectSlotRecording) {
// Start incremental marking to active write barrier.
heap::SimulateIncrementalMarking(heap, false);
- heap->incremental_marking()->AdvanceIncrementalMarking(
- 10000000, IncrementalMarking::NO_GC_VIA_STACK_GUARD, StepOrigin::kV8);
// Create references from the large object to the object on the evacuation
// candidate.
@@ -3606,6 +3766,8 @@ TEST(LargeObjectSlotRecording) {
CHECK(lo->get(i) == old_location);
}
+ heap::SimulateIncrementalMarking(heap, true);
+
// Move the evaucation candidate object.
CcTest::CollectAllGarbage();
@@ -3659,9 +3821,7 @@ TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) {
CcTest::heap()->StartIncrementalMarking(
i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting);
}
- // This big step should be sufficient to mark the whole array.
- marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ heap::SimulateIncrementalMarking(CcTest::heap());
CHECK(marking->IsComplete() ||
marking->IsReadyToOverApproximateWeakClosure());
}
@@ -4069,10 +4229,10 @@ TEST(NewSpaceObjectsInOptimizedCode) {
->Get(context.local(), v8_str("foo"))
.ToLocalChecked())));
- CHECK(Heap::InNewSpace(*foo));
+ CHECK(Heap::InYoungGeneration(*foo));
CcTest::CollectGarbage(NEW_SPACE);
CcTest::CollectGarbage(NEW_SPACE);
- CHECK(!Heap::InNewSpace(*foo));
+ CHECK(!Heap::InYoungGeneration(*foo));
#ifdef VERIFY_HEAP
CcTest::heap()->Verify();
#endif
@@ -4519,7 +4679,7 @@ void CheckIC(Handle<JSFunction> function, int slot_index,
FeedbackVector vector = function->feedback_vector();
FeedbackSlot slot(slot_index);
FeedbackNexus nexus(vector, slot);
- CHECK_EQ(nexus.StateFromFeedback(), state);
+ CHECK_EQ(nexus.ic_state(), state);
}
TEST(MonomorphicStaysMonomorphicAfterGC) {
@@ -4735,8 +4895,8 @@ TEST(Regress507979) {
Handle<FixedArray> o1 = isolate->factory()->NewFixedArray(kFixedArrayLen);
Handle<FixedArray> o2 = isolate->factory()->NewFixedArray(kFixedArrayLen);
- CHECK(Heap::InNewSpace(*o1));
- CHECK(Heap::InNewSpace(*o2));
+ CHECK(Heap::InYoungGeneration(*o1));
+ CHECK(Heap::InYoungGeneration(*o2));
HeapIterator it(isolate->heap(), i::HeapIterator::kFilterUnreachable);
@@ -4826,12 +4986,7 @@ TEST(Regress3631) {
Handle<JSReceiver> obj =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result));
Handle<JSWeakCollection> weak_map(JSWeakCollection::cast(*obj), isolate);
- HeapObject weak_map_table = HeapObject::cast(weak_map->table());
- IncrementalMarking::MarkingState* marking_state = marking->marking_state();
- while (!marking_state->IsBlack(weak_map_table) && !marking->IsStopped()) {
- marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
- }
+ SimulateIncrementalMarking(heap);
// Stash the backing store in a handle.
Handle<Object> save(weak_map->table(), isolate);
// The following line will update the backing store.
@@ -4855,8 +5010,7 @@ TEST(Regress442710) {
Handle<JSArray> array = factory->NewJSArray(2);
Handle<String> name = factory->InternalizeUtf8String("testArray");
- Object::SetProperty(isolate, global, name, array, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, global, name, array).Check();
CompileRun("testArray[0] = 1; testArray[1] = 2; testArray.shift();");
CcTest::CollectGarbage(OLD_SPACE);
}
@@ -4991,7 +5145,7 @@ void AllocateInSpace(Isolate* isolate, size_t bytes, AllocationSpace space) {
static_cast<int>((bytes - FixedArray::kHeaderSize) / kTaggedSize);
Handle<FixedArray> array = factory->NewFixedArray(
elements, space == NEW_SPACE ? NOT_TENURED : TENURED);
- CHECK((space == NEW_SPACE) == Heap::InNewSpace(*array));
+ CHECK((space == NEW_SPACE) == Heap::InYoungGeneration(*array));
CHECK_EQ(bytes, static_cast<size_t>(array->Size()));
}
@@ -5213,7 +5367,8 @@ AllocationResult HeapTester::AllocateByteArrayForTest(Heap* heap, int length,
AllocationSpace space = heap->SelectSpace(pretenure);
HeapObject result;
{
- AllocationResult allocation = heap->AllocateRaw(size, space);
+ AllocationResult allocation =
+ heap->AllocateRaw(size, Heap::SelectType(space));
if (!allocation.To(&result)) return allocation;
}
@@ -5239,7 +5394,7 @@ HEAP_TEST(Regress587004) {
Handle<FixedArray> array = factory->NewFixedArray(N, TENURED);
CHECK(heap->old_space()->Contains(*array));
Handle<Object> number = factory->NewHeapNumber(1.0);
- CHECK(Heap::InNewSpace(*number));
+ CHECK(Heap::InYoungGeneration(*number));
for (int i = 0; i < N; i++) {
array->set(i, *number);
}
@@ -5349,7 +5504,8 @@ TEST(Regress598319) {
Heap* heap = CcTest::heap();
Isolate* isolate = heap->isolate();
- const int kNumberOfObjects = kMaxRegularHeapObjectSize / kTaggedSize;
+ // The size of the array should be larger than kProgressBarScanningChunk.
+ const int kNumberOfObjects = Max(FixedArray::kMaxRegularLength + 1, 128 * KB);
struct Arr {
Arr(Isolate* isolate, int number_of_objects) {
@@ -5374,7 +5530,7 @@ TEST(Regress598319) {
CHECK_EQ(arr.get()->length(), kNumberOfObjects);
CHECK(heap->lo_space()->Contains(arr.get()));
- LargePage* page = heap->lo_space()->FindPage(arr.get()->address());
+ LargePage* page = LargePage::FromHeapObject(arr.get());
CHECK_NOT_NULL(page);
// GC to cleanup state
@@ -5409,11 +5565,13 @@ TEST(Regress598319) {
// Now we search for a state where we are in incremental marking and have
// only partially marked the large object.
+ const double kSmallStepSizeInMs = 0.1;
while (!marking->IsComplete()) {
- marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
- if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) {
- CHECK_NE(page->progress_bar(), arr.get()->Size());
+ marking->V8Step(kSmallStepSizeInMs,
+ i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
+ if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->ProgressBar() > 0) {
+ CHECK_NE(page->ProgressBar(), arr.get()->Size());
{
// Shift by 1, effectively moving one white object across the progress
// bar, meaning that we will miss marking it.
@@ -5427,9 +5585,11 @@ TEST(Regress598319) {
}
// Finish marking with bigger steps to speed up test.
+ const double kLargeStepSizeInMs = 1000;
while (!marking->IsComplete()) {
- marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ marking->V8Step(kLargeStepSizeInMs,
+ i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
@@ -5509,9 +5669,10 @@ TEST(Regress615489) {
v8::HandleScope inner(CcTest::isolate());
isolate->factory()->NewFixedArray(500, TENURED)->Size();
}
+ const double kStepSizeInMs = 100;
while (!marking->IsComplete()) {
- marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ marking->V8Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
@@ -5568,10 +5729,11 @@ TEST(Regress631969) {
CcTest::CollectGarbage(NEW_SPACE);
// Finish incremental marking.
+ const double kStepSizeInMs = 100;
IncrementalMarking* marking = heap->incremental_marking();
while (!marking->IsComplete()) {
- marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ marking->V8Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
@@ -5657,7 +5819,8 @@ TEST(ContinuousLeftTrimFixedArrayInBlackArea) {
Address start_address = array->address();
Address end_address = start_address + array->Size();
Page* page = Page::FromAddress(start_address);
- IncrementalMarking::MarkingState* marking_state = marking->marking_state();
+ IncrementalMarking::NonAtomicMarkingState* marking_state =
+ marking->non_atomic_marking_state();
CHECK(marking_state->IsBlack(*array));
CHECK(marking_state->bitmap(page)->AllBitsSetInRange(
page->AddressToMarkbitIndex(start_address),
@@ -5724,7 +5887,8 @@ TEST(ContinuousRightTrimFixedArrayInBlackArea) {
Address start_address = array->address();
Address end_address = start_address + array->Size();
Page* page = Page::FromAddress(start_address);
- IncrementalMarking::MarkingState* marking_state = marking->marking_state();
+ IncrementalMarking::NonAtomicMarkingState* marking_state =
+ marking->non_atomic_marking_state();
CHECK(marking_state->IsBlack(*array));
CHECK(marking_state->bitmap(page)->AllBitsSetInRange(
@@ -5786,7 +5950,8 @@ TEST(YoungGenerationLargeObjectAllocationScavenge) {
Handle<FixedArray> array_small = isolate->factory()->NewFixedArray(200000);
MemoryChunk* chunk = MemoryChunk::FromHeapObject(*array_small);
CHECK_EQ(NEW_LO_SPACE, chunk->owner()->identity());
- CHECK(chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE));
+ CHECK(chunk->IsFlagSet(MemoryChunk::LARGE_PAGE));
+ CHECK(chunk->IsFlagSet(MemoryChunk::TO_PAGE));
Handle<Object> number = isolate->factory()->NewHeapNumber(123.456);
array_small->set(0, *number);
@@ -5797,7 +5962,7 @@ TEST(YoungGenerationLargeObjectAllocationScavenge) {
// generation large object space.
chunk = MemoryChunk::FromHeapObject(*array_small);
CHECK_EQ(LO_SPACE, chunk->owner()->identity());
- CHECK(!chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE));
+ CHECK(!chunk->InYoungGeneration());
CcTest::CollectAllAvailableGarbage();
}
@@ -5815,7 +5980,8 @@ TEST(YoungGenerationLargeObjectAllocationMarkCompact) {
Handle<FixedArray> array_small = isolate->factory()->NewFixedArray(200000);
MemoryChunk* chunk = MemoryChunk::FromHeapObject(*array_small);
CHECK_EQ(NEW_LO_SPACE, chunk->owner()->identity());
- CHECK(chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE));
+ CHECK(chunk->IsFlagSet(MemoryChunk::LARGE_PAGE));
+ CHECK(chunk->IsFlagSet(MemoryChunk::TO_PAGE));
Handle<Object> number = isolate->factory()->NewHeapNumber(123.456);
array_small->set(0, *number);
@@ -5826,7 +5992,7 @@ TEST(YoungGenerationLargeObjectAllocationMarkCompact) {
// large object space.
chunk = MemoryChunk::FromHeapObject(*array_small);
CHECK_EQ(LO_SPACE, chunk->owner()->identity());
- CHECK(!chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE));
+ CHECK(!chunk->InYoungGeneration());
CcTest::CollectAllAvailableGarbage();
}
@@ -5846,7 +6012,7 @@ TEST(YoungGenerationLargeObjectAllocationReleaseScavenger) {
Handle<FixedArray> array_small = isolate->factory()->NewFixedArray(20000);
MemoryChunk* chunk = MemoryChunk::FromHeapObject(*array_small);
CHECK_EQ(NEW_LO_SPACE, chunk->owner()->identity());
- CHECK(chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE));
+ CHECK(chunk->IsFlagSet(MemoryChunk::TO_PAGE));
}
}
@@ -5975,7 +6141,7 @@ HEAP_TEST(Regress670675) {
if (marking->IsStopped()) {
marking->Start(i::GarbageCollectionReason::kTesting);
}
- size_t array_length = Page::kPageSize / kTaggedSize + 100;
+ size_t array_length = 128 * KB;
size_t n = heap->OldGenerationSpaceAvailable() / array_length;
for (size_t i = 0; i < n + 40; i++) {
{
@@ -5985,7 +6151,7 @@ HEAP_TEST(Regress670675) {
}
if (marking->IsStopped()) break;
double deadline = heap->MonotonicallyIncreasingTimeInMs() + 1;
- marking->AdvanceIncrementalMarking(
+ marking->AdvanceWithDeadline(
deadline, IncrementalMarking::GC_VIA_STACK_GUARD, StepOrigin::kV8);
}
DCHECK(marking->IsStopped());
@@ -6159,7 +6325,7 @@ UNINITIALIZED_TEST(ReinitializeStringHashSeed) {
{
v8::Isolate::Scope isolate_scope(isolate);
CHECK_EQ(static_cast<uint64_t>(1337 * i),
- reinterpret_cast<i::Isolate*>(isolate)->heap()->HashSeed());
+ HashSeed(reinterpret_cast<i::Isolate*>(isolate)));
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
CHECK(!context.IsEmpty());
@@ -6258,7 +6424,7 @@ HEAP_TEST(Regress779503) {
// The byte array filled with kHeapObjectTag ensures that we cannot read
// from the slot again and interpret it as heap value. Doing so will crash.
Handle<ByteArray> byte_array = isolate->factory()->NewByteArray(kArraySize);
- CHECK(Heap::InNewSpace(*byte_array));
+ CHECK(Heap::InYoungGeneration(*byte_array));
for (int i = 0; i < kArraySize; i++) {
byte_array->set(i, kHeapObjectTag);
}
@@ -6268,7 +6434,7 @@ HEAP_TEST(Regress779503) {
// The FixedArray in old space serves as space for slots.
Handle<FixedArray> fixed_array =
isolate->factory()->NewFixedArray(kArraySize, TENURED);
- CHECK(!Heap::InNewSpace(*fixed_array));
+ CHECK(!Heap::InYoungGeneration(*fixed_array));
for (int i = 0; i < kArraySize; i++) {
fixed_array->set(i, *byte_array);
}
@@ -6277,7 +6443,7 @@ HEAP_TEST(Regress779503) {
// currently scavenging.
heap->delay_sweeper_tasks_for_testing_ = true;
CcTest::CollectGarbage(OLD_SPACE);
- CHECK(Heap::InNewSpace(*byte_array));
+ CHECK(Heap::InYoungGeneration(*byte_array));
}
// Scavenging and sweeping the same page will crash as slots will be
// overridden.
@@ -6291,6 +6457,7 @@ struct OutOfMemoryState {
size_t old_generation_capacity_at_oom;
size_t memory_allocator_size_at_oom;
size_t new_space_capacity_at_oom;
+ size_t new_lo_space_size_at_oom;
size_t current_heap_limit;
size_t initial_heap_limit;
};
@@ -6303,6 +6470,7 @@ size_t NearHeapLimitCallback(void* raw_state, size_t current_heap_limit,
state->old_generation_capacity_at_oom = heap->OldGenerationCapacity();
state->memory_allocator_size_at_oom = heap->memory_allocator()->Size();
state->new_space_capacity_at_oom = heap->new_space()->Capacity();
+ state->new_lo_space_size_at_oom = heap->new_lo_space()->Size();
state->current_heap_limit = current_heap_limit;
state->initial_heap_limit = initial_heap_limit;
return initial_heap_limit + 100 * MB;
@@ -6378,11 +6546,14 @@ UNINITIALIZED_TEST(OutOfMemoryLargeObjects) {
}
CHECK_LE(state.old_generation_capacity_at_oom, kOldGenerationLimit);
CHECK_LE(kOldGenerationLimit, state.old_generation_capacity_at_oom +
+ state.new_space_capacity_at_oom +
+ state.new_lo_space_size_at_oom +
FixedArray::SizeFor(kFixedArrayLength));
CHECK_LE(
state.memory_allocator_size_at_oom,
MemoryAllocatorSizeFromHeapCapacity(state.old_generation_capacity_at_oom +
- 2 * state.new_space_capacity_at_oom));
+ 2 * state.new_space_capacity_at_oom +
+ state.new_lo_space_size_at_oom));
reinterpret_cast<v8::Isolate*>(isolate)->Dispose();
}
@@ -6466,7 +6637,7 @@ TEST(Regress8617) {
Handle<Object> foo =
v8::Utils::OpenHandle(*CompileRun("function foo() { return 42; };"
"foo;"));
- if (heap->InNewSpace(*foo)) {
+ if (heap->InYoungGeneration(*foo)) {
CcTest::CollectGarbage(NEW_SPACE);
CcTest::CollectGarbage(NEW_SPACE);
}
diff --git a/deps/v8/test/cctest/heap/test-incremental-marking.cc b/deps/v8/test/cctest/heap/test-incremental-marking.cc
index 8213ea6080..d90c2c2139 100644
--- a/deps/v8/test/cctest/heap/test-incremental-marking.cc
+++ b/deps/v8/test/cctest/heap/test-incremental-marking.cc
@@ -71,14 +71,14 @@ class MockPlatform : public TestPlatform {
void PostDelayedTask(std::unique_ptr<Task> task,
double delay_in_seconds) override {
- UNREACHABLE();
- };
+ task_ = std::move(task);
+ }
void PostIdleTask(std::unique_ptr<IdleTask> task) override {
UNREACHABLE();
}
- bool IdleTasksEnabled() override { return false; };
+ bool IdleTasksEnabled() override { return false; }
bool PendingTask() { return task_ != nullptr; }
diff --git a/deps/v8/test/cctest/heap/test-invalidated-slots.cc b/deps/v8/test/cctest/heap/test-invalidated-slots.cc
index 897f4d0242..9eeda75cc5 100644
--- a/deps/v8/test/cctest/heap/test-invalidated-slots.cc
+++ b/deps/v8/test/cctest/heap/test-invalidated-slots.cc
@@ -330,25 +330,16 @@ HEAP_TEST(InvalidatedSlotsFastToSlow) {
// Start incremental marking.
heap::SimulateIncrementalMarking(heap);
// Set properties to point to the evacuation candidate.
- Object::SetProperty(isolate, obj, prop_name1, evacuated,
- LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_name2, evacuated,
- LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_name3, evacuated,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name1, evacuated).Check();
+ Object::SetProperty(isolate, obj, prop_name2, evacuated).Check();
+ Object::SetProperty(isolate, obj, prop_name3, evacuated).Check();
{
HandleScope scope(isolate);
Handle<HeapObject> dead = factory->NewFixedArray(1);
- Object::SetProperty(isolate, obj, prop_name1, dead, LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_name2, dead, LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_name3, dead, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name1, dead).Check();
+ Object::SetProperty(isolate, obj, prop_name2, dead).Check();
+ Object::SetProperty(isolate, obj, prop_name3, dead).Check();
Handle<Map> map(obj->map(), isolate);
Handle<Map> normalized_map =
Map::Normalize(isolate, map, CLEAR_INOBJECT_PROPERTIES, "testing");
diff --git a/deps/v8/test/cctest/heap/test-mark-compact.cc b/deps/v8/test/cctest/heap/test-mark-compact.cc
index 4f141af7a5..e85c73405f 100644
--- a/deps/v8/test/cctest/heap/test-mark-compact.cc
+++ b/deps/v8/test/cctest/heap/test-mark-compact.cc
@@ -101,7 +101,7 @@ HEAP_TEST(NoPromotion) {
AllocationResult HeapTester::AllocateMapForTest(Isolate* isolate) {
Heap* heap = isolate->heap();
HeapObject obj;
- AllocationResult alloc = heap->AllocateRaw(Map::kSize, MAP_SPACE);
+ AllocationResult alloc = heap->AllocateRaw(Map::kSize, AllocationType::kMap);
if (!alloc.To(&obj)) return alloc;
obj->set_map_after_allocation(ReadOnlyRoots(heap).meta_map(),
SKIP_WRITE_BARRIER);
@@ -119,7 +119,7 @@ AllocationResult HeapTester::AllocateFixedArrayForTest(
AllocationSpace space = heap->SelectSpace(pretenure);
HeapObject obj;
{
- AllocationResult result = heap->AllocateRaw(size, space);
+ AllocationResult result = heap->AllocateRaw(size, Heap::SelectType(space));
if (!result.To(&obj)) return result;
}
obj->set_map_after_allocation(ReadOnlyRoots(heap).fixed_array_map(),
@@ -165,9 +165,7 @@ HEAP_TEST(MarkCompactCollector) {
// allocate a garbage
Handle<String> func_name = factory->InternalizeUtf8String("theFunction");
Handle<JSFunction> function = factory->NewFunctionForTest(func_name);
- Object::SetProperty(isolate, global, func_name, function,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, global, func_name, function).Check();
factory->NewJSObject(function);
}
@@ -184,13 +182,10 @@ HEAP_TEST(MarkCompactCollector) {
Handle<JSObject> obj = factory->NewJSObject(function);
Handle<String> obj_name = factory->InternalizeUtf8String("theObject");
- Object::SetProperty(isolate, global, obj_name, obj, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, global, obj_name, obj).Check();
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
- Object::SetProperty(isolate, obj, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
}
CcTest::CollectGarbage(OLD_SPACE);
diff --git a/deps/v8/test/cctest/heap/test-page-promotion.cc b/deps/v8/test/cctest/heap/test-page-promotion.cc
index 2db538d484..b68484e3c0 100644
--- a/deps/v8/test/cctest/heap/test-page-promotion.cc
+++ b/deps/v8/test/cctest/heap/test-page-promotion.cc
@@ -67,6 +67,11 @@ UNINITIALIZED_TEST(PagePromotion_NewToOld) {
v8::Context::New(isolate)->Enter();
Heap* heap = i_isolate->heap();
+ // Ensure that the new space is empty so that the page to be promoted
+ // does not contain the age mark.
+ heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
+ heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
+
std::vector<Handle<FixedArray>> handles;
heap::SimulateFullSpace(heap->new_space(), &handles);
heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
diff --git a/deps/v8/test/cctest/heap/test-spaces.cc b/deps/v8/test/cctest/heap/test-spaces.cc
index 8219c1487d..337447dcea 100644
--- a/deps/v8/test/cctest/heap/test-spaces.cc
+++ b/deps/v8/test/cctest/heap/test-spaces.cc
@@ -45,18 +45,24 @@ namespace heap {
// Temporarily sets a given allocator in an isolate.
class TestMemoryAllocatorScope {
public:
- TestMemoryAllocatorScope(Isolate* isolate, MemoryAllocator* allocator)
- : isolate_(isolate), old_allocator_(isolate->heap()->memory_allocator()) {
- isolate->heap()->memory_allocator_ = allocator;
+ TestMemoryAllocatorScope(Isolate* isolate, size_t max_capacity,
+ size_t code_range_size)
+ : isolate_(isolate),
+ old_allocator_(std::move(isolate->heap()->memory_allocator_)) {
+ isolate->heap()->memory_allocator_.reset(
+ new MemoryAllocator(isolate, max_capacity, code_range_size));
}
+ MemoryAllocator* allocator() { return isolate_->heap()->memory_allocator(); }
+
~TestMemoryAllocatorScope() {
- isolate_->heap()->memory_allocator_ = old_allocator_;
+ isolate_->heap()->memory_allocator()->TearDown();
+ isolate_->heap()->memory_allocator_.swap(old_allocator_);
}
private:
Isolate* isolate_;
- MemoryAllocator* old_allocator_;
+ std::unique_ptr<MemoryAllocator> old_allocator_;
DISALLOW_COPY_AND_ASSIGN(TestMemoryAllocatorScope);
};
@@ -89,41 +95,37 @@ static void VerifyMemoryChunk(Isolate* isolate, Heap* heap,
v8::PageAllocator* code_page_allocator,
size_t reserve_area_size, size_t commit_area_size,
Executability executable, Space* space) {
- MemoryAllocator* memory_allocator =
- new MemoryAllocator(isolate, heap->MaxReserved(), 0);
- {
- TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator);
- TestCodePageAllocatorScope test_code_page_allocator_scope(
- isolate, code_page_allocator);
-
- v8::PageAllocator* page_allocator =
- memory_allocator->page_allocator(executable);
-
- size_t allocatable_memory_area_offset =
- MemoryChunkLayout::ObjectStartOffsetInMemoryChunk(space->identity());
- size_t guard_size =
- (executable == EXECUTABLE) ? MemoryChunkLayout::CodePageGuardSize() : 0;
-
- MemoryChunk* memory_chunk = memory_allocator->AllocateChunk(
- reserve_area_size, commit_area_size, executable, space);
- size_t reserved_size =
- ((executable == EXECUTABLE))
- ? allocatable_memory_area_offset +
- RoundUp(reserve_area_size, page_allocator->CommitPageSize()) +
- guard_size
- : RoundUp(allocatable_memory_area_offset + reserve_area_size,
- page_allocator->CommitPageSize());
- CHECK(memory_chunk->size() == reserved_size);
- CHECK(memory_chunk->area_start() <
- memory_chunk->address() + memory_chunk->size());
- CHECK(memory_chunk->area_end() <=
- memory_chunk->address() + memory_chunk->size());
- CHECK(static_cast<size_t>(memory_chunk->area_size()) == commit_area_size);
-
- memory_allocator->Free<MemoryAllocator::kFull>(memory_chunk);
- }
- memory_allocator->TearDown();
- delete memory_allocator;
+ TestMemoryAllocatorScope test_allocator_scope(isolate, heap->MaxReserved(),
+ 0);
+ MemoryAllocator* memory_allocator = test_allocator_scope.allocator();
+ TestCodePageAllocatorScope test_code_page_allocator_scope(
+ isolate, code_page_allocator);
+
+ v8::PageAllocator* page_allocator =
+ memory_allocator->page_allocator(executable);
+
+ size_t allocatable_memory_area_offset =
+ MemoryChunkLayout::ObjectStartOffsetInMemoryChunk(space->identity());
+ size_t guard_size =
+ (executable == EXECUTABLE) ? MemoryChunkLayout::CodePageGuardSize() : 0;
+
+ MemoryChunk* memory_chunk = memory_allocator->AllocateChunk(
+ reserve_area_size, commit_area_size, executable, space);
+ size_t reserved_size =
+ ((executable == EXECUTABLE))
+ ? allocatable_memory_area_offset +
+ RoundUp(reserve_area_size, page_allocator->CommitPageSize()) +
+ guard_size
+ : RoundUp(allocatable_memory_area_offset + reserve_area_size,
+ page_allocator->CommitPageSize());
+ CHECK(memory_chunk->size() == reserved_size);
+ CHECK(memory_chunk->area_start() <
+ memory_chunk->address() + memory_chunk->size());
+ CHECK(memory_chunk->area_end() <=
+ memory_chunk->address() + memory_chunk->size());
+ CHECK(static_cast<size_t>(memory_chunk->area_size()) == commit_area_size);
+
+ memory_allocator->Free<MemoryAllocator::kFull>(memory_chunk);
}
static unsigned int PseudorandomAreaSize() {
@@ -170,48 +172,43 @@ TEST(MemoryAllocator) {
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
- MemoryAllocator* memory_allocator =
- new MemoryAllocator(isolate, heap->MaxReserved(), 0);
- CHECK_NOT_NULL(memory_allocator);
- TestMemoryAllocatorScope test_scope(isolate, memory_allocator);
+ TestMemoryAllocatorScope test_allocator_scope(isolate, heap->MaxReserved(),
+ 0);
+ MemoryAllocator* memory_allocator = test_allocator_scope.allocator();
- {
- int total_pages = 0;
- OldSpace faked_space(heap);
- CHECK(!faked_space.first_page());
- CHECK(!faked_space.last_page());
- Page* first_page = memory_allocator->AllocatePage(
- faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space),
- NOT_EXECUTABLE);
-
- faked_space.memory_chunk_list().PushBack(first_page);
- CHECK(first_page->next_page() == nullptr);
- total_pages++;
-
- for (Page* p = first_page; p != nullptr; p = p->next_page()) {
- CHECK(p->owner() == &faked_space);
- }
+ int total_pages = 0;
+ OldSpace faked_space(heap);
+ CHECK(!faked_space.first_page());
+ CHECK(!faked_space.last_page());
+ Page* first_page = memory_allocator->AllocatePage(
+ faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space),
+ NOT_EXECUTABLE);
- // Again, we should get n or n - 1 pages.
- Page* other = memory_allocator->AllocatePage(
- faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space),
- NOT_EXECUTABLE);
- total_pages++;
- faked_space.memory_chunk_list().PushBack(other);
- int page_count = 0;
- for (Page* p = first_page; p != nullptr; p = p->next_page()) {
- CHECK(p->owner() == &faked_space);
- page_count++;
- }
- CHECK(total_pages == page_count);
+ faked_space.memory_chunk_list().PushBack(first_page);
+ CHECK(first_page->next_page() == nullptr);
+ total_pages++;
- Page* second_page = first_page->next_page();
- CHECK_NOT_NULL(second_page);
+ for (Page* p = first_page; p != nullptr; p = p->next_page()) {
+ CHECK(p->owner() == &faked_space);
+ }
- // OldSpace's destructor will tear down the space and free up all pages.
+ // Again, we should get n or n - 1 pages.
+ Page* other = memory_allocator->AllocatePage(
+ faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space),
+ NOT_EXECUTABLE);
+ total_pages++;
+ faked_space.memory_chunk_list().PushBack(other);
+ int page_count = 0;
+ for (Page* p = first_page; p != nullptr; p = p->next_page()) {
+ CHECK(p->owner() == &faked_space);
+ page_count++;
}
- memory_allocator->TearDown();
- delete memory_allocator;
+ CHECK(total_pages == page_count);
+
+ Page* second_page = first_page->next_page();
+ CHECK_NOT_NULL(second_page);
+
+ // OldSpace's destructor will tear down the space and free up all pages.
}
TEST(ComputeDiscardMemoryAreas) {
@@ -256,9 +253,9 @@ TEST(ComputeDiscardMemoryAreas) {
TEST(NewSpace) {
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
- MemoryAllocator* memory_allocator =
- new MemoryAllocator(isolate, heap->MaxReserved(), 0);
- TestMemoryAllocatorScope test_scope(isolate, memory_allocator);
+ TestMemoryAllocatorScope test_allocator_scope(isolate, heap->MaxReserved(),
+ 0);
+ MemoryAllocator* memory_allocator = test_allocator_scope.allocator();
NewSpace new_space(heap, memory_allocator->data_page_allocator(),
CcTest::heap()->InitialSemiSpaceSize(),
@@ -273,17 +270,14 @@ TEST(NewSpace) {
new_space.TearDown();
memory_allocator->unmapper()->EnsureUnmappingCompleted();
- memory_allocator->TearDown();
- delete memory_allocator;
}
TEST(OldSpace) {
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
- MemoryAllocator* memory_allocator =
- new MemoryAllocator(isolate, heap->MaxReserved(), 0);
- TestMemoryAllocatorScope test_scope(isolate, memory_allocator);
+ TestMemoryAllocatorScope test_allocator_scope(isolate, heap->MaxReserved(),
+ 0);
OldSpace* s = new OldSpace(heap);
CHECK_NOT_NULL(s);
@@ -293,8 +287,6 @@ TEST(OldSpace) {
}
delete s;
- memory_allocator->TearDown();
- delete memory_allocator;
}
TEST(LargeObjectSpace) {
@@ -315,8 +307,6 @@ TEST(LargeObjectSpace) {
CHECK(lo->Contains(HeapObject::cast(obj)));
- CHECK(lo->FindObject(ho->address()) == obj);
-
CHECK(lo->Contains(ho));
while (true) {
@@ -396,7 +386,7 @@ TEST(SizeOfInitialHeap) {
#endif // DEBUG
static HeapObject AllocateUnaligned(NewSpace* space, int size) {
- AllocationResult allocation = space->AllocateRawUnaligned(size);
+ AllocationResult allocation = space->AllocateRaw(size, kWordAligned);
CHECK(!allocation.IsRetry());
HeapObject filler;
CHECK(allocation.To(&filler));
@@ -406,7 +396,7 @@ static HeapObject AllocateUnaligned(NewSpace* space, int size) {
}
static HeapObject AllocateUnaligned(PagedSpace* space, int size) {
- AllocationResult allocation = space->AllocateRaw(size, kDoubleUnaligned);
+ AllocationResult allocation = space->AllocateRaw(size, kWordAligned);
CHECK(!allocation.IsRetry());
HeapObject filler;
CHECK(allocation.To(&filler));
diff --git a/deps/v8/test/cctest/heap/test-weak-references.cc b/deps/v8/test/cctest/heap/test-weak-references.cc
index 8a2ad3c184..bcf8622d31 100644
--- a/deps/v8/test/cctest/heap/test-weak-references.cc
+++ b/deps/v8/test/cctest/heap/test-weak-references.cc
@@ -5,6 +5,7 @@
#include "src/api-inl.h"
#include "src/assembler-inl.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects/smi.h"
#include "test/cctest/cctest.h"
@@ -41,12 +42,12 @@ TEST(WeakReferencesBasic) {
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
MaybeObject code_object = fv->optimized_code_weak_or_smi();
CHECK(code_object->IsSmi());
CcTest::CollectAllGarbage();
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
CHECK_EQ(code_object, fv->optimized_code_weak_or_smi());
{
@@ -123,7 +124,7 @@ TEST(WeakReferencesOldToNew) {
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array));
+ CHECK(Heap::InYoungGeneration(*fixed_array));
fv->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*fixed_array));
CcTest::CollectAllGarbage();
@@ -148,7 +149,7 @@ TEST(WeakReferencesOldToNewScavenged) {
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array));
+ CHECK(Heap::InYoungGeneration(*fixed_array));
fv->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*fixed_array));
CcTest::CollectGarbage(NEW_SPACE);
@@ -192,13 +193,13 @@ TEST(ObjectMovesBeforeClearingWeakField) {
HandleScope outer_scope(isolate);
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
FeedbackVector fv_location = *fv;
{
HandleScope inner_scope(isolate);
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array));
+ CHECK(Heap::InYoungGeneration(*fixed_array));
fv->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*fixed_array));
// inner_scope will go out of scope, so when marking the next time,
// *fixed_array will stay white.
@@ -233,12 +234,12 @@ TEST(ObjectWithWeakFieldDies) {
HandleScope outer_scope(isolate);
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
{
HandleScope inner_scope(isolate);
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array));
+ CHECK(Heap::InYoungGeneration(*fixed_array));
fv->set_optimized_code_weak_or_smi(
HeapObjectReference::Weak(*fixed_array));
// inner_scope will go out of scope, so when marking the next time,
@@ -266,11 +267,11 @@ TEST(ObjectWithWeakReferencePromoted) {
HandleScope outer_scope(isolate);
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array));
+ CHECK(Heap::InYoungGeneration(*fixed_array));
fv->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*fixed_array));
CcTest::CollectGarbage(NEW_SPACE);
@@ -292,13 +293,13 @@ TEST(ObjectWithClearedWeakReferencePromoted) {
HandleScope outer_scope(isolate);
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
fv->set_optimized_code_weak_or_smi(
HeapObjectReference::ClearedValue(isolate));
CcTest::CollectGarbage(NEW_SPACE);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
CHECK(fv->optimized_code_weak_or_smi()->IsCleared());
CcTest::CollectGarbage(NEW_SPACE);
@@ -323,21 +324,21 @@ TEST(WeakReferenceWriteBarrier) {
HandleScope outer_scope(isolate);
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
{
HandleScope inner_scope(isolate);
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array1 = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array1));
+ CHECK(Heap::InYoungGeneration(*fixed_array1));
fv->set_optimized_code_weak_or_smi(
HeapObjectReference::Weak(*fixed_array1));
SimulateIncrementalMarking(heap, true);
Handle<FixedArray> fixed_array2 = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array2));
+ CHECK(Heap::InYoungGeneration(*fixed_array2));
// This write will trigger the write barrier.
fv->set_optimized_code_weak_or_smi(
HeapObjectReference::Weak(*fixed_array2));
@@ -374,7 +375,7 @@ TEST(WeakArraysBasic) {
CHECK(array->IsWeakFixedArray());
CHECK(!array->IsFixedArray());
CHECK_EQ(array->length(), length);
- CHECK(Heap::InNewSpace(*array));
+ CHECK(Heap::InYoungGeneration(*array));
for (int i = 0; i < length; ++i) {
HeapObject heap_object;
@@ -481,7 +482,7 @@ TEST(WeakArrayListBasic) {
isolate, array, MaybeObjectHandle(Smi::FromInt(7), isolate));
CHECK_EQ(array->length(), 8);
- CHECK(Heap::InNewSpace(*array));
+ CHECK(Heap::InYoungGeneration(*array));
CHECK_EQ(array->Get(0), HeapObjectReference::Weak(*index0));
CHECK_EQ(array->Get(1).ToSmi().value(), 1);
diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc
index 7e1d6329c8..0a169b766c 100644
--- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc
+++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc
@@ -307,11 +307,10 @@ void BytecodeExpectationsPrinter::PrintConstant(
void BytecodeExpectationsPrinter::PrintFrameSize(
std::ostream& stream, i::Handle<i::BytecodeArray> bytecode_array) const {
- const int kPointerSize = sizeof(void*);
int frame_size = bytecode_array->frame_size();
- DCHECK_EQ(frame_size % kPointerSize, 0);
- stream << "frame size: " << frame_size / kPointerSize
+ DCHECK(IsAligned(frame_size, kSystemPointerSize));
+ stream << "frame size: " << frame_size / kSystemPointerSize
<< "\nparameter count: " << bytecode_array->parameter_count() << '\n';
}
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
index b0d3e93003..231a9050b8 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
@@ -14,7 +14,7 @@ snippet: "
"
frame size: 8
parameter count: 1
-bytecode array length: 190
+bytecode array length: 180
bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(1),
@@ -35,7 +35,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(95),
+ B(Jump), U8(85),
B(LdaUndefined),
B(Star), R(6),
B(Mov), R(0), R(5),
@@ -53,8 +53,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(51),
- B(Jump), U8(36),
+ B(Jump), U8(41),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(4),
B(Star), R(4),
@@ -70,10 +69,6 @@ bytecodes: [
B(Star), R(2),
B(LdaSmi), I8(2),
B(Star), R(1),
- B(Jump), U8(15),
- B(LdaSmi), I8(-1),
- B(Star), R(2),
- B(Star), R(1),
B(Jump), U8(7),
B(Star), R(2),
B(LdaZero),
@@ -111,8 +106,8 @@ constant pool: [
Smi [23],
]
handlers: [
- [20, 136, 144],
- [23, 100, 102],
+ [20, 134, 134],
+ [23, 100, 100],
]
---
@@ -122,7 +117,7 @@ snippet: "
"
frame size: 8
parameter count: 1
-bytecode array length: 235
+bytecode array length: 225
bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(3),
B(Mov), R(closure), R(1),
@@ -143,7 +138,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(140),
+ B(Jump), U8(130),
/* 22 S> */ B(LdaSmi), I8(42),
B(Star), R(6),
B(LdaFalse),
@@ -160,7 +155,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(95),
+ B(Jump), U8(85),
B(LdaUndefined),
B(Star), R(6),
B(Mov), R(0), R(5),
@@ -178,8 +173,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(51),
- B(Jump), U8(36),
+ B(Jump), U8(41),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(7),
B(Star), R(4),
@@ -195,10 +189,6 @@ bytecodes: [
B(Star), R(2),
B(LdaSmi), I8(2),
B(Star), R(1),
- B(Jump), U8(15),
- B(LdaSmi), I8(-1),
- B(Star), R(2),
- B(Star), R(1),
B(Jump), U8(7),
B(Star), R(2),
B(LdaZero),
@@ -239,8 +229,8 @@ constant pool: [
Smi [23],
]
handlers: [
- [20, 181, 189],
- [23, 145, 147],
+ [20, 179, 179],
+ [23, 145, 145],
]
---
@@ -250,21 +240,21 @@ snippet: "
"
frame size: 20
parameter count: 1
-bytecode array length: 416
+bytecode array length: 406
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(3),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(3),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 17 E> */ B(StackCheck),
B(Mov), R(context), R(6),
B(Mov), R(context), R(7),
- B(Ldar), R(2),
- /* 17 E> */ B(SuspendGenerator), R(2), R(0), U8(8), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(8),
+ B(Ldar), R(0),
+ /* 17 E> */ B(SuspendGenerator), R(0), R(0), U8(8), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(8),
B(Star), R(8),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0),
B(Ldar), R(8),
/* 17 E> */ B(Throw),
@@ -297,18 +287,18 @@ bytecodes: [
B(Star), R(16),
B(LdaFalse),
B(Star), R(12),
- B(Mov), R(16), R(3),
+ B(Mov), R(16), R(1),
/* 22 E> */ B(StackCheck),
- /* 31 S> */ B(Mov), R(3), R(0),
+ /* 31 S> */ B(Mov), R(1), R(3),
/* 42 S> */ B(LdaFalse),
B(Star), R(19),
- B(Mov), R(2), R(17),
- B(Mov), R(0), R(18),
+ B(Mov), R(0), R(17),
+ B(Mov), R(3), R(18),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(17), U8(3),
- /* 42 E> */ B(SuspendGenerator), R(2), R(0), U8(17), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(17),
+ /* 42 E> */ B(SuspendGenerator), R(0), R(0), U8(17), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(17),
B(Star), R(17),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0),
B(Ldar), R(17),
/* 42 E> */ B(Throw),
@@ -336,7 +326,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(18),
B(LdaConstant), U8(13),
B(Star), R(19),
@@ -364,15 +354,15 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(4),
B(Mov), R(14), R(5),
- B(Jump), U8(95),
+ B(Jump), U8(85),
B(LdaUndefined),
B(Star), R(9),
- B(Mov), R(2), R(8),
+ B(Mov), R(0), R(8),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorAwaitUncaught), R(8), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(8), U8(2),
- B(ResumeGenerator), R(2), R(0), U8(8),
+ B(SuspendGenerator), R(0), R(0), U8(8), U8(2),
+ B(ResumeGenerator), R(0), R(0), U8(8),
B(Star), R(8),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(9),
B(LdaZero),
B(TestReferenceEqual), R(9),
@@ -382,8 +372,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(4),
B(Mov), R(8), R(5),
- B(Jump), U8(51),
- B(Jump), U8(36),
+ B(Jump), U8(41),
B(Star), R(8),
B(CreateCatchContext), R(8), U8(16),
B(Star), R(7),
@@ -393,16 +382,12 @@ bytecodes: [
B(PushContext), R(8),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(10),
- B(Mov), R(2), R(9),
+ B(Mov), R(0), R(9),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorReject), R(9), U8(2),
B(PopContext), R(8),
B(Star), R(5),
B(LdaSmi), I8(2),
B(Star), R(4),
- B(Jump), U8(15),
- B(LdaSmi), I8(-1),
- B(Star), R(5),
- B(Star), R(4),
B(Jump), U8(7),
B(Star), R(5),
B(LdaZero),
@@ -410,7 +395,7 @@ bytecodes: [
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(6),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(0), U8(1),
B(Ldar), R(6),
B(SetPendingMessage),
B(Ldar), R(4),
@@ -420,7 +405,7 @@ bytecodes: [
B(ReThrow),
B(LdaTrue),
B(Star), R(9),
- B(Mov), R(2), R(7),
+ B(Mov), R(0), R(7),
B(Mov), R(5), R(8),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorResolve), R(7), U8(3),
/* 50 S> */ B(Return),
@@ -447,14 +432,14 @@ constant pool: [
Smi [6],
Smi [9],
SCOPE_INFO_TYPE,
- Smi [321],
+ Smi [311],
Smi [6],
Smi [9],
Smi [23],
]
handlers: [
- [20, 362, 370],
- [23, 326, 328],
+ [20, 360, 360],
+ [23, 326, 326],
[93, 180, 188],
[234, 247, 249],
]
@@ -467,7 +452,7 @@ snippet: "
"
frame size: 17
parameter count: 1
-bytecode array length: 482
+bytecode array length: 472
bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(5),
B(Mov), R(closure), R(1),
@@ -595,7 +580,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(7), R(2),
- B(Jump), U8(95),
+ B(Jump), U8(85),
B(LdaUndefined),
B(Star), R(6),
B(Mov), R(0), R(5),
@@ -613,8 +598,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(51),
- B(Jump), U8(36),
+ B(Jump), U8(41),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(17),
B(Star), R(4),
@@ -630,10 +614,6 @@ bytecodes: [
B(Star), R(2),
B(LdaSmi), I8(2),
B(Star), R(1),
- B(Jump), U8(15),
- B(LdaSmi), I8(-1),
- B(Star), R(2),
- B(Star), R(1),
B(Jump), U8(7),
B(Star), R(2),
B(LdaZero),
@@ -679,14 +659,14 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
SCOPE_INFO_TYPE,
- Smi [387],
- Smi [287],
+ Smi [377],
+ Smi [277],
Smi [6],
Smi [9],
Smi [23],
]
handlers: [
- [20, 428, 436],
- [23, 392, 394],
+ [20, 426, 426],
+ [23, 392, 392],
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden
index 6bbc4d11ba..e5c7177efc 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden
@@ -696,8 +696,8 @@ bytecode array length: 50
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
- B(Star), R(1),
- /* 52 S> */ B(Ldar), R(1),
+ B(Star), R(0),
+ /* 52 S> */ B(Ldar), R(0),
B(JumpIfToBooleanFalse), U8(42),
/* 45 E> */ B(StackCheck),
B(CreateBlockContext), U8(0),
@@ -705,10 +705,10 @@ bytecodes: [
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
+ B(Star), R(2),
/* 73 S> */ B(LdaSmi), I8(1),
/* 73 E> */ B(StaCurrentContextSlot), U8(4),
- /* 102 S> */ B(Mov), R(0), R(2),
+ /* 102 S> */ B(Mov), R(2), R(1),
/* 106 S> */ B(LdaCurrentContextSlot), U8(4),
B(JumpIfToBooleanFalse), U8(6),
/* 113 S> */ B(PopContext), R(3),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden
index 179ac8071a..b6184f084f 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden
@@ -109,11 +109,11 @@ bytecodes: [
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
+ B(Star), R(1),
/* 53 S> */ B(LdaSmi), I8(10),
/* 53 E> */ B(StaCurrentContextSlot), U8(4),
- /* 85 S> */ B(Mov), R(0), R(1),
- B(Ldar), R(0),
+ /* 85 S> */ B(Mov), R(1), R(0),
+ B(Ldar), R(1),
/* 88 S> */ B(Jump), U8(2),
B(PopContext), R(2),
B(LdaUndefined),
@@ -155,10 +155,10 @@ bytecodes: [
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
B(CreateClosure), U8(2), U8(0), U8(2),
- B(Star), R(0),
+ B(Star), R(1),
/* 76 S> */ B(LdaSmi), I8(2),
/* 76 E> */ B(StaCurrentContextSlot), U8(4),
- /* 113 S> */ B(Mov), R(0), R(1),
+ /* 113 S> */ B(Mov), R(1), R(0),
/* 118 S> */ B(LdaCurrentContextSlot), U8(4),
B(JumpIfToBooleanFalse), U8(6),
/* 125 S> */ B(PopContext), R(3),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden
index 440936ffad..1dd2c099eb 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden
@@ -74,7 +74,7 @@ bytecodes: [
B(LdaSmi), I8(2),
B(Star), R(4),
B(Mov), R(this), R(1),
- /* 138 E> */ B(CallRuntime), U16(Runtime::kStoreToSuper_Strict), R(1), U8(4),
+ /* 138 E> */ B(CallRuntime), U16(Runtime::kStoreToSuper), R(1), U8(4),
/* 143 S> */ B(LdaConstant), U8(0),
/* 150 E> */ B(LdaKeyedProperty), R(closure), U8(2),
B(Star), R(2),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden
index 27911a41c2..f79bb9457a 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden
@@ -30,9 +30,9 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
B(LdaUndefined),
/* 149 S> */ B(Return),
]
@@ -70,9 +70,9 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
B(LdaUndefined),
/* 149 S> */ B(Return),
]
@@ -128,9 +128,9 @@ bytecodes: [
B(Star), R(11),
B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(7),
B(Star), R(5),
- B(Mov), R(4), R(0),
+ B(Mov), R(4), R(1),
B(PopContext), R(3),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
B(LdaUndefined),
/* 129 S> */ B(Return),
]
@@ -174,11 +174,11 @@ bytecodes: [
B(Mov), R(4), R(6),
B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3),
B(Star), R(5),
- B(Mov), R(6), R(0),
+ B(Mov), R(6), R(1),
B(PopContext), R(3),
- B(Mov), R(0), R(1),
- /* 87 S> */ B(Ldar), R(1),
- /* 94 E> */ B(Construct), R(1), R(0), U8(0), U8(1),
+ B(Mov), R(1), R(0),
+ /* 87 S> */ B(Ldar), R(0),
+ /* 94 E> */ B(Construct), R(0), R(0), U8(0), U8(1),
/* 102 S> */ B(Return),
]
constant pool: [
@@ -225,9 +225,9 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
B(LdaUndefined),
/* 74 S> */ B(Return),
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden
index 83a267c29f..d9413a1866 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden
@@ -211,7 +211,7 @@ snippet: "
"
frame size: 1
parameter count: 1
-bytecode array length: 14
+bytecode array length: 12
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
@@ -221,8 +221,6 @@ bytecodes: [
/* 74 S> */ B(Return),
/* 86 S> */ B(LdaSmi), I8(2),
/* 95 S> */ B(Return),
- B(LdaUndefined),
- /* 98 S> */ B(Return),
]
constant pool: [
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden
index 73e7e0d8e0..f35ff24b39 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden
@@ -9,16 +9,14 @@ wrap: yes
snippet: "
const x = 10; function f1() {return x;}
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 21
+bytecode array length: 15
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), I8(10),
/* 44 E> */ B(StaCurrentContextSlot), U8(4),
@@ -27,7 +25,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
@@ -36,16 +33,14 @@ handlers: [
snippet: "
const x = 10; function f1() {return x;} return x;
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 22
+bytecode array length: 16
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), I8(10),
/* 44 E> */ B(StaCurrentContextSlot), U8(4),
@@ -54,7 +49,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
@@ -63,21 +57,19 @@ handlers: [
snippet: "
const x = (x = 20); function f1() {return x;}
"
-frame size: 3
+frame size: 2
parameter count: 1
-bytecode array length: 32
+bytecode array length: 26
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), I8(20),
- B(Star), R(2),
+ B(Star), R(1),
B(LdaCurrentContextSlot), U8(4),
- /* 47 E> */ B(ThrowReferenceErrorIfHole), U8(2),
+ /* 47 E> */ B(ThrowReferenceErrorIfHole), U8(1),
B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
/* 44 E> */ B(StaCurrentContextSlot), U8(4),
B(LdaUndefined),
@@ -85,7 +77,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
]
handlers: [
@@ -95,16 +86,14 @@ handlers: [
snippet: "
const x = 10; x = 20; function f1() {return x;}
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 28
+bytecode array length: 22
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), I8(10),
/* 44 E> */ B(StaCurrentContextSlot), U8(4),
@@ -115,7 +104,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden
index 6973d1166a..37daec48ad 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden
@@ -18,7 +18,7 @@ bytecodes: [
B(CreateRestParameter),
B(Star), R(1),
/* 10 E> */ B(StackCheck),
- /* 22 S> */ B(Star), R(0),
+ B(Star), R(0),
/* 42 S> */ B(Return),
]
constant pool: [
@@ -38,8 +38,8 @@ bytecodes: [
B(CreateRestParameter),
B(Star), R(2),
/* 10 E> */ B(StackCheck),
- /* 12 S> */ B(Mov), R(arg0), R(0),
- /* 25 S> */ B(Mov), R(2), R(1),
+ B(Mov), R(arg0), R(0),
+ B(Mov), R(2), R(1),
/* 29 S> */ B(Ldar), R(1),
/* 45 S> */ B(Return),
]
@@ -60,8 +60,8 @@ bytecodes: [
B(CreateRestParameter),
B(Star), R(2),
/* 10 E> */ B(StackCheck),
- /* 12 S> */ B(Mov), R(arg0), R(0),
- /* 25 S> */ B(Mov), R(2), R(1),
+ B(Mov), R(arg0), R(0),
+ B(Mov), R(2), R(1),
/* 29 S> */ B(LdaZero),
/* 44 E> */ B(LdaKeyedProperty), R(1), U8(0),
/* 48 S> */ B(Return),
@@ -85,8 +85,8 @@ bytecodes: [
B(CreateRestParameter),
B(Star), R(2),
/* 10 E> */ B(StackCheck),
- /* 12 S> */ B(Mov), R(arg0), R(0),
- /* 25 S> */ B(Mov), R(2), R(1),
+ B(Mov), R(arg0), R(0),
+ B(Mov), R(2), R(1),
/* 29 S> */ B(LdaZero),
/* 44 E> */ B(LdaKeyedProperty), R(1), U8(1),
B(Star), R(4),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden
index 3a2ea7d5d8..f4a7c340c4 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden
@@ -66,7 +66,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(13),
B(LdaConstant), U8(6),
B(Star), R(14),
@@ -115,7 +115,7 @@ snippet: "
"
frame size: 16
parameter count: 1
-bytecode array length: 266
+bytecode array length: 264
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
@@ -185,7 +185,6 @@ bytecodes: [
B(Star), R(14),
B(JumpLoop), U8(33), I8(0),
B(Mov), R(13), R(1),
- B(Ldar), R(1),
B(LdaSmi), I8(-1),
B(Star), R(10),
B(Star), R(9),
@@ -204,7 +203,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(6),
B(Star), R(15),
@@ -242,8 +241,8 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
]
handlers: [
- [44, 174, 182],
- [228, 241, 243],
+ [44, 172, 180],
+ [226, 239, 241],
]
---
@@ -328,7 +327,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(15),
B(LdaConstant), U8(7),
B(Star), R(16),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
index 3c89cfed30..6fe59da400 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
@@ -16,13 +16,13 @@ snippet: "
"
frame size: 21
parameter count: 1
-bytecode array length: 329
+bytecode array length: 325
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(4),
/* 43 S> */ B(CreateArrayLiteral), U8(2), U8(0), U8(37),
@@ -49,12 +49,12 @@ bytecodes: [
B(Star), R(9),
/* 38 S> */ B(CallProperty0), R(5), R(6), U8(11),
B(Star), R(15),
- B(Mov), R(2), R(14),
+ B(Mov), R(0), R(14),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(14), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(14), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(14),
+ B(SuspendGenerator), R(0), R(0), U8(14), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(14),
B(Star), R(14),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(15),
B(LdaZero),
B(TestReferenceEqual), R(15),
@@ -71,9 +71,9 @@ bytecodes: [
B(Star), R(13),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(13), R(3),
+ B(Mov), R(13), R(1),
/* 23 E> */ B(StackCheck),
- /* 38 S> */ B(Mov), R(3), R(0),
+ /* 38 S> */ B(Mov), R(1), R(3),
B(Ldar), R(13),
B(JumpLoop), U8(77), I8(0),
B(LdaSmi), I8(-1),
@@ -94,7 +94,7 @@ bytecodes: [
B(JumpIfNull), U8(86),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(17),
B(LdaConstant), U8(9),
B(Star), R(18),
@@ -103,12 +103,12 @@ bytecodes: [
B(Mov), R(context), R(17),
B(CallProperty0), R(16), R(6), U8(19),
B(Star), R(19),
- B(Mov), R(2), R(18),
+ B(Mov), R(0), R(18),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(18), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(18), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(18),
+ B(SuspendGenerator), R(0), R(0), U8(18), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(18),
B(Star), R(18),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(19),
B(LdaZero),
B(TestReferenceEqual), R(19),
@@ -137,10 +137,9 @@ bytecodes: [
B(Star), R(6),
B(LdaTrue),
B(Star), R(7),
- B(Mov), R(2), R(5),
+ B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3),
/* 57 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(10),
B(Star), R(4),
@@ -152,11 +151,9 @@ bytecodes: [
B(Star), R(7),
B(LdaTrue),
B(Star), R(8),
- B(Mov), R(2), R(6),
+ B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3),
/* 57 S> */ B(Return),
- B(LdaUndefined),
- /* 57 S> */ B(Return),
]
constant pool: [
Smi [98],
@@ -172,7 +169,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [20, 297, 299],
+ [20, 297, 297],
[77, 157, 165],
[211, 260, 262],
]
@@ -186,13 +183,13 @@ snippet: "
"
frame size: 21
parameter count: 1
-bytecode array length: 350
+bytecode array length: 346
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(4),
/* 43 S> */ B(CreateArrayLiteral), U8(2), U8(0), U8(37),
@@ -219,12 +216,12 @@ bytecodes: [
B(Star), R(9),
/* 38 S> */ B(CallProperty0), R(5), R(6), U8(11),
B(Star), R(15),
- B(Mov), R(2), R(14),
+ B(Mov), R(0), R(14),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(14), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(14), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(14),
+ B(SuspendGenerator), R(0), R(0), U8(14), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(14),
B(Star), R(14),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(15),
B(LdaZero),
B(TestReferenceEqual), R(15),
@@ -241,9 +238,9 @@ bytecodes: [
B(Star), R(13),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(13), R(3),
+ B(Mov), R(13), R(1),
/* 23 E> */ B(StackCheck),
- /* 38 S> */ B(Mov), R(3), R(0),
+ /* 38 S> */ B(Mov), R(1), R(3),
/* 56 S> */ B(LdaSmi), I8(1),
B(Mov), R(13), R(11),
B(Star), R(10),
@@ -266,7 +263,7 @@ bytecodes: [
B(JumpIfNull), U8(86),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(17),
B(LdaConstant), U8(9),
B(Star), R(18),
@@ -275,12 +272,12 @@ bytecodes: [
B(Mov), R(context), R(17),
B(CallProperty0), R(16), R(6), U8(19),
B(Star), R(19),
- B(Mov), R(2), R(18),
+ B(Mov), R(0), R(18),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(18), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(18), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(18),
+ B(SuspendGenerator), R(0), R(0), U8(18), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(18),
B(Star), R(18),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(19),
B(LdaZero),
B(TestReferenceEqual), R(19),
@@ -307,7 +304,7 @@ bytecodes: [
B(ReThrow),
B(LdaTrue),
B(Star), R(18),
- B(Mov), R(2), R(16),
+ B(Mov), R(0), R(16),
B(Mov), R(11), R(17),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(16), U8(3),
/* 68 S> */ B(Return),
@@ -315,10 +312,9 @@ bytecodes: [
B(Star), R(6),
B(LdaTrue),
B(Star), R(7),
- B(Mov), R(2), R(5),
+ B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3),
/* 68 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(12),
B(Star), R(4),
@@ -330,11 +326,9 @@ bytecodes: [
B(Star), R(7),
B(LdaTrue),
B(Star), R(8),
- B(Mov), R(2), R(6),
+ B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3),
/* 68 S> */ B(Return),
- B(LdaUndefined),
- /* 68 S> */ B(Return),
]
constant pool: [
Smi [98],
@@ -352,7 +346,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [20, 318, 320],
+ [20, 318, 318],
[77, 161, 169],
[215, 264, 266],
]
@@ -369,13 +363,13 @@ snippet: "
"
frame size: 21
parameter count: 1
-bytecode array length: 345
+bytecode array length: 341
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(4),
/* 43 S> */ B(CreateArrayLiteral), U8(2), U8(0), U8(37),
@@ -402,12 +396,12 @@ bytecodes: [
B(Star), R(9),
/* 38 S> */ B(CallProperty0), R(5), R(6), U8(11),
B(Star), R(15),
- B(Mov), R(2), R(14),
+ B(Mov), R(0), R(14),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(14), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(14), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(14),
+ B(SuspendGenerator), R(0), R(0), U8(14), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(14),
B(Star), R(14),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(15),
B(LdaZero),
B(TestReferenceEqual), R(15),
@@ -424,15 +418,15 @@ bytecodes: [
B(Star), R(13),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(13), R(3),
+ B(Mov), R(13), R(1),
/* 23 E> */ B(StackCheck),
- /* 38 S> */ B(Mov), R(3), R(0),
+ /* 38 S> */ B(Mov), R(1), R(3),
/* 63 S> */ B(LdaSmi), I8(10),
- /* 69 E> */ B(TestEqual), R(0), U8(17),
+ /* 69 E> */ B(TestEqual), R(3), U8(17),
B(JumpIfFalse), U8(4),
/* 76 S> */ B(Jump), U8(11),
/* 90 S> */ B(LdaSmi), I8(20),
- /* 96 E> */ B(TestEqual), R(0), U8(18),
+ /* 96 E> */ B(TestEqual), R(3), U8(18),
B(JumpIfFalse), U8(4),
/* 103 S> */ B(Jump), U8(5),
B(JumpLoop), U8(93), I8(0),
@@ -454,7 +448,7 @@ bytecodes: [
B(JumpIfNull), U8(86),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(17),
B(LdaConstant), U8(9),
B(Star), R(18),
@@ -463,12 +457,12 @@ bytecodes: [
B(Mov), R(context), R(17),
B(CallProperty0), R(16), R(6), U8(21),
B(Star), R(19),
- B(Mov), R(2), R(18),
+ B(Mov), R(0), R(18),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(18), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(18), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(18),
+ B(SuspendGenerator), R(0), R(0), U8(18), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(18),
B(Star), R(18),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(19),
B(LdaZero),
B(TestReferenceEqual), R(19),
@@ -497,10 +491,9 @@ bytecodes: [
B(Star), R(6),
B(LdaTrue),
B(Star), R(7),
- B(Mov), R(2), R(5),
+ B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3),
/* 114 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(10),
B(Star), R(4),
@@ -512,11 +505,9 @@ bytecodes: [
B(Star), R(7),
B(LdaTrue),
B(Star), R(8),
- B(Mov), R(2), R(6),
+ B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3),
/* 114 S> */ B(Return),
- B(LdaUndefined),
- /* 114 S> */ B(Return),
]
constant pool: [
Smi [98],
@@ -532,7 +523,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [20, 313, 315],
+ [20, 313, 313],
[77, 173, 181],
[227, 276, 278],
]
@@ -547,7 +538,7 @@ snippet: "
"
frame size: 16
parameter count: 1
-bytecode array length: 265
+bytecode array length: 261
bytecodes: [
B(Mov), R(closure), R(2),
B(Mov), R(this), R(3),
@@ -609,7 +600,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(8),
B(Star), R(15),
@@ -647,7 +638,6 @@ bytecodes: [
B(Mov), R(0), R(3),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(3), U8(3),
/* 96 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(3),
B(CreateCatchContext), R(3), U8(11),
B(Star), R(2),
@@ -662,8 +652,6 @@ bytecodes: [
B(Mov), R(0), R(4),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(4), U8(3),
/* 96 S> */ B(Return),
- B(LdaUndefined),
- /* 96 S> */ B(Return),
]
constant pool: [
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
@@ -680,7 +668,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [16, 233, 235],
+ [16, 233, 233],
[59, 112, 120],
[166, 179, 181],
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden
index 67f5c389e6..571002d16e 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden
@@ -62,7 +62,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(12),
B(LdaConstant), U8(6),
B(Star), R(13),
@@ -165,7 +165,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(13),
B(LdaConstant), U8(6),
B(Star), R(14),
@@ -278,7 +278,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(12),
B(LdaConstant), U8(6),
B(Star), R(13),
@@ -384,7 +384,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(12),
B(LdaConstant), U8(8),
B(Star), R(13),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
index 33cccfc896..2672e0688e 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
@@ -42,10 +42,10 @@ bytecodes: [
B(Star), R(12),
B(LdaFalse),
B(Star), R(8),
- B(Mov), R(12), R(3),
+ B(Mov), R(12), R(0),
/* 20 E> */ B(StackCheck),
- /* 29 S> */ B(Mov), R(3), R(1),
- /* 49 S> */ B(Mov), R(1), R(0),
+ /* 29 S> */ B(Mov), R(0), R(2),
+ /* 49 S> */ B(Mov), R(2), R(3),
B(Ldar), R(12),
B(JumpLoop), U8(43), I8(0),
B(LdaSmi), I8(-1),
@@ -66,7 +66,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(5),
B(Star), R(15),
@@ -203,7 +203,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(15),
B(LdaConstant), U8(10),
B(Star), R(16),
@@ -286,19 +286,19 @@ bytecodes: [
B(Star), R(10),
B(LdaFalse),
B(Star), R(6),
- B(Mov), R(10), R(1),
+ B(Mov), R(10), R(0),
/* 20 E> */ B(StackCheck),
B(CreateBlockContext), U8(4),
B(PushContext), R(11),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- /* 29 S> */ B(Ldar), R(1),
+ /* 29 S> */ B(Ldar), R(0),
/* 29 E> */ B(StaCurrentContextSlot), U8(4),
/* 41 S> */ B(CreateClosure), U8(5), U8(12), U8(2),
B(Star), R(12),
/* 67 E> */ B(CallUndefinedReceiver0), R(12), U8(13),
B(PopContext), R(11),
- B(Mov), R(1), R(10),
+ B(Mov), R(0), R(10),
B(JumpLoop), U8(60), I8(0),
B(LdaSmi), I8(-1),
B(Star), R(8),
@@ -318,7 +318,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(13),
B(LdaConstant), U8(7),
B(Star), R(14),
@@ -397,7 +397,7 @@ bytecodes: [
B(Star), R(14),
B(LdaFalse),
B(Star), R(10),
- B(Mov), R(14), R(5),
+ B(Mov), R(14), R(0),
/* 20 E> */ B(StackCheck),
/* 36 S> */ B(Ldar), R(14),
B(JumpIfNull), U8(4),
@@ -405,12 +405,12 @@ bytecodes: [
/* 29 E> */ B(CallRuntime), U16(Runtime::kThrowPatternAssignmentNonCoercible), R(0), U8(0),
B(Star), R(15),
/* 31 S> */ B(LdaNamedProperty), R(15), U8(4), U8(12),
- B(Star), R(1),
+ B(Star), R(3),
/* 34 S> */ B(LdaNamedProperty), R(15), U8(5), U8(14),
- B(Star), R(2),
- /* 56 S> */ B(Ldar), R(2),
- /* 58 E> */ B(Add), R(1), U8(16),
- B(Star), R(0),
+ B(Star), R(4),
+ /* 56 S> */ B(Ldar), R(4),
+ /* 58 E> */ B(Add), R(3), U8(16),
+ B(Star), R(5),
B(JumpLoop), U8(67), I8(0),
B(LdaSmi), I8(-1),
B(Star), R(12),
@@ -430,7 +430,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(16),
B(LdaConstant), U8(7),
B(Star), R(17),
@@ -484,16 +484,16 @@ frame size: 17
parameter count: 2
bytecode array length: 214
bytecodes: [
- B(SwitchOnGeneratorState), R(3), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(Mov), R(closure), R(5),
B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2),
- B(Star), R(3),
+ B(Star), R(0),
/* 11 E> */ B(StackCheck),
- /* 11 E> */ B(SuspendGenerator), R(3), R(0), U8(5), U8(0),
- B(ResumeGenerator), R(3), R(0), U8(5),
+ /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(5),
B(Star), R(5),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
B(Ldar), R(5),
/* 11 E> */ B(Throw),
@@ -523,10 +523,10 @@ bytecodes: [
B(Star), R(13),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(13), R(4),
+ B(Mov), R(13), R(1),
/* 21 E> */ B(StackCheck),
- /* 30 S> */ B(Mov), R(4), R(1),
- /* 50 S> */ B(Mov), R(1), R(0),
+ /* 30 S> */ B(Mov), R(1), R(3),
+ /* 50 S> */ B(Mov), R(3), R(4),
B(Ldar), R(13),
B(JumpLoop), U8(43), I8(0),
B(LdaSmi), I8(-1),
@@ -547,7 +547,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(15),
B(LdaConstant), U8(8),
B(Star), R(16),
@@ -602,16 +602,16 @@ frame size: 16
parameter count: 2
bytecode array length: 258
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 11 E> */ B(StackCheck),
- /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(4),
+ /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 11 E> */ B(Throw),
@@ -641,17 +641,17 @@ bytecodes: [
B(Star), R(12),
B(LdaFalse),
B(Star), R(8),
- B(Mov), R(12), R(3),
+ B(Mov), R(12), R(1),
/* 21 E> */ B(StackCheck),
- /* 30 S> */ B(Mov), R(3), R(0),
+ /* 30 S> */ B(Mov), R(1), R(3),
/* 40 S> */ B(LdaFalse),
B(Star), R(14),
- B(Mov), R(0), R(13),
+ B(Mov), R(3), R(13),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(13), U8(2),
- /* 40 E> */ B(SuspendGenerator), R(2), R(0), U8(13), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(13),
+ /* 40 E> */ B(SuspendGenerator), R(0), R(0), U8(13), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(13),
B(Star), R(13),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(8), U8(2), I8(0),
B(Ldar), R(13),
/* 40 E> */ B(Throw),
@@ -679,7 +679,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(11),
B(Star), R(15),
@@ -739,12 +739,12 @@ snippet: "
"
frame size: 18
parameter count: 2
-bytecode array length: 232
+bytecode array length: 228
bytecodes: [
B(Mov), R(closure), R(5),
B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(5), U8(2),
- B(Star), R(3),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(5),
/* 40 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0),
@@ -771,10 +771,10 @@ bytecodes: [
B(Star), R(14),
B(LdaFalse),
B(Star), R(10),
- B(Mov), R(14), R(4),
+ B(Mov), R(14), R(1),
/* 26 E> */ B(StackCheck),
- /* 35 S> */ B(Mov), R(4), R(1),
- /* 55 S> */ B(Mov), R(1), R(0),
+ /* 35 S> */ B(Mov), R(1), R(3),
+ /* 55 S> */ B(Mov), R(3), R(4),
B(Ldar), R(14),
B(JumpLoop), U8(43), I8(0),
B(LdaSmi), I8(-1),
@@ -795,7 +795,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(16),
B(LdaConstant), U8(5),
B(Star), R(17),
@@ -824,10 +824,9 @@ bytecodes: [
B(Star), R(7),
B(LdaFalse),
B(Star), R(8),
- B(Mov), R(3), R(6),
+ B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(6), U8(3),
/* 60 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(6),
B(CreateCatchContext), R(6), U8(6),
B(Star), R(5),
@@ -839,11 +838,9 @@ bytecodes: [
B(Star), R(8),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(3), R(7),
+ B(Mov), R(0), R(7),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(7), U8(3),
/* 60 S> */ B(Return),
- B(LdaUndefined),
- /* 60 S> */ B(Return),
]
constant pool: [
SYMBOL_TYPE,
@@ -855,7 +852,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [16, 200, 202],
+ [16, 200, 200],
[50, 96, 104],
[150, 163, 165],
]
@@ -869,13 +866,13 @@ snippet: "
"
frame size: 17
parameter count: 2
-bytecode array length: 268
+bytecode array length: 264
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(4),
/* 40 S> */ B(LdaNamedProperty), R(arg0), U8(1), U8(0),
@@ -902,16 +899,16 @@ bytecodes: [
B(Star), R(13),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(13), R(3),
+ B(Mov), R(13), R(1),
/* 26 E> */ B(StackCheck),
- /* 35 S> */ B(Mov), R(3), R(0),
- /* 45 S> */ B(Mov), R(2), R(14),
- B(Mov), R(0), R(15),
+ /* 35 S> */ B(Mov), R(1), R(3),
+ /* 45 S> */ B(Mov), R(0), R(14),
+ B(Mov), R(3), R(15),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(14), U8(2),
- /* 45 E> */ B(SuspendGenerator), R(2), R(0), U8(14), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(14),
+ /* 45 E> */ B(SuspendGenerator), R(0), R(0), U8(14), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(14),
B(Star), R(14),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(15),
B(LdaZero),
B(TestReferenceEqual), R(15),
@@ -938,7 +935,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(15),
B(LdaConstant), U8(6),
B(Star), R(16),
@@ -967,10 +964,9 @@ bytecodes: [
B(Star), R(6),
B(LdaTrue),
B(Star), R(7),
- B(Mov), R(2), R(5),
+ B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3),
/* 54 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(7),
B(Star), R(4),
@@ -982,11 +978,9 @@ bytecodes: [
B(Star), R(7),
B(LdaTrue),
B(Star), R(8),
- B(Mov), R(2), R(6),
+ B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3),
/* 54 S> */ B(Return),
- B(LdaUndefined),
- /* 54 S> */ B(Return),
]
constant pool: [
Smi [107],
@@ -999,7 +993,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [20, 236, 238],
+ [20, 236, 236],
[54, 132, 140],
[186, 199, 201],
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden
index f6520129c1..77b1924c73 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden
@@ -102,16 +102,16 @@ frame size: 16
parameter count: 1
bytecode array length: 261
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 11 E> */ B(StackCheck),
- /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(4),
+ /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 11 E> */ B(Throw),
@@ -142,17 +142,17 @@ bytecodes: [
B(Star), R(12),
B(LdaFalse),
B(Star), R(8),
- B(Mov), R(12), R(3),
+ B(Mov), R(12), R(1),
/* 16 E> */ B(StackCheck),
- /* 25 S> */ B(Mov), R(3), R(0),
+ /* 25 S> */ B(Mov), R(1), R(3),
/* 36 S> */ B(LdaFalse),
B(Star), R(14),
- B(Mov), R(0), R(13),
+ B(Mov), R(3), R(13),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(13), U8(2),
- /* 36 E> */ B(SuspendGenerator), R(2), R(0), U8(13), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(13),
+ /* 36 E> */ B(SuspendGenerator), R(0), R(0), U8(13), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(13),
B(Star), R(13),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0),
B(Ldar), R(13),
/* 36 E> */ B(Throw),
@@ -180,7 +180,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(12),
B(Star), R(15),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden
index e68211a189..46d972af0c 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden
@@ -147,7 +147,7 @@ snippet: "
"
frame size: 0
parameter count: 2
-bytecode array length: 19
+bytecode array length: 17
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 18 S> */ B(LdaZero),
@@ -157,8 +157,6 @@ bytecodes: [
/* 47 S> */ B(Return),
/* 63 S> */ B(Wide), B(LdaSmi), I16(-200),
/* 75 S> */ B(Return),
- B(LdaUndefined),
- /* 80 S> */ B(Return),
]
constant pool: [
]
@@ -171,11 +169,11 @@ snippet: "
"
frame size: 0
parameter count: 3
-bytecode array length: 14
+bytecode array length: 15
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 19 S> */ B(Ldar), R(arg1),
- /* 25 E> */ B(TestIn), R(arg0),
+ /* 25 E> */ B(TestIn), R(arg0), U8(0),
B(JumpIfFalse), U8(7),
/* 33 S> */ B(Wide), B(LdaSmi), I16(200),
/* 44 S> */ B(Return),
@@ -258,7 +256,7 @@ snippet: "
"
frame size: 2
parameter count: 2
-bytecode array length: 29
+bytecode array length: 27
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 24 S> */ B(LdaZero),
@@ -273,8 +271,6 @@ bytecodes: [
/* 1092 S> */ B(Return),
/* 1102 S> */ B(Wide), B(LdaSmi), I16(-200),
/* 1114 S> */ B(Return),
- B(LdaUndefined),
- /* 1117 S> */ B(Return),
]
constant pool: [
HEAP_NUMBER_TYPE [0.01],
@@ -357,7 +353,7 @@ snippet: "
"
frame size: 2
parameter count: 1
-bytecode array length: 26
+bytecode array length: 24
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 25 S> */ B(LdaZero),
@@ -371,8 +367,6 @@ bytecodes: [
/* 1087 S> */ B(Return),
/* 1097 S> */ B(Wide), B(LdaSmi), I16(-200),
/* 1109 S> */ B(Return),
- B(LdaUndefined),
- /* 1112 S> */ B(Return),
]
constant pool: [
]
@@ -396,7 +390,7 @@ snippet: "
"
frame size: 0
parameter count: 3
-bytecode array length: 82
+bytecode array length: 83
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 21 S> */ B(Ldar), R(arg1),
@@ -430,12 +424,12 @@ bytecodes: [
/* 174 S> */ B(LdaSmi), I8(1),
/* 183 S> */ B(Return),
/* 188 S> */ B(Ldar), R(arg1),
- /* 194 E> */ B(TestIn), R(arg0),
+ /* 194 E> */ B(TestIn), R(arg0), U8(6),
B(JumpIfFalse), U8(5),
/* 202 S> */ B(LdaSmi), I8(1),
/* 211 S> */ B(Return),
/* 216 S> */ B(Ldar), R(arg1),
- /* 222 E> */ B(TestInstanceOf), R(arg0), U8(6),
+ /* 222 E> */ B(TestInstanceOf), R(arg0), U8(8),
B(JumpIfFalse), U8(5),
/* 238 S> */ B(LdaSmi), I8(1),
/* 247 S> */ B(Return),
@@ -461,7 +455,7 @@ snippet: "
"
frame size: 1
parameter count: 1
-bytecode array length: 14
+bytecode array length: 12
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 25 S> */ B(LdaZero),
@@ -471,8 +465,6 @@ bytecodes: [
/* 53 S> */ B(Return),
/* 69 S> */ B(LdaSmi), I8(-20),
/* 80 S> */ B(Return),
- B(LdaUndefined),
- /* 85 S> */ B(Return),
]
constant pool: [
]
@@ -494,7 +486,7 @@ snippet: "
"
frame size: 0
parameter count: 3
-bytecode array length: 36
+bytecode array length: 34
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 21 S> */ B(Ldar), R(arg1),
@@ -515,8 +507,6 @@ bytecodes: [
/* 102 S> */ B(Return),
/* 118 S> */ B(LdaSmi), I8(-1),
/* 128 S> */ B(Return),
- B(LdaUndefined),
- /* 133 S> */ B(Return),
]
constant pool: [
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden
index 62d07cef7e..e6bf0f717e 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden
@@ -9,16 +9,14 @@ wrap: yes
snippet: "
let x = 10; function f1() {return x;}
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 21
+bytecode array length: 15
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(10),
/* 42 E> */ B(StaCurrentContextSlot), U8(4),
@@ -27,7 +25,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
@@ -36,16 +33,14 @@ handlers: [
snippet: "
let x = 10; function f1() {return x;} return x;
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 22
+bytecode array length: 16
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(10),
/* 42 E> */ B(StaCurrentContextSlot), U8(4),
@@ -54,7 +49,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
@@ -63,22 +57,20 @@ handlers: [
snippet: "
let x = (x = 20); function f1() {return x;}
"
-frame size: 3
+frame size: 2
parameter count: 1
-bytecode array length: 31
+bytecode array length: 25
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(20),
- B(Star), R(2),
+ B(Star), R(1),
B(LdaCurrentContextSlot), U8(4),
- /* 45 E> */ B(ThrowReferenceErrorIfHole), U8(2),
- B(Ldar), R(2),
+ /* 45 E> */ B(ThrowReferenceErrorIfHole), U8(1),
+ B(Ldar), R(1),
B(StaCurrentContextSlot), U8(4),
/* 42 E> */ B(StaCurrentContextSlot), U8(4),
B(LdaUndefined),
@@ -86,7 +78,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
]
handlers: [
@@ -96,16 +87,14 @@ handlers: [
snippet: "
let x = 10; x = 20; function f1() {return x;}
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 25
+bytecode array length: 19
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(10),
/* 42 E> */ B(StaCurrentContextSlot), U8(4),
@@ -116,7 +105,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden
index 629e4f36d1..55a56a88b3 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden
@@ -99,7 +99,7 @@ frame size: 6
parameter count: 2
bytecode array length: 92
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(3),
@@ -108,12 +108,12 @@ bytecodes: [
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
/* 0 E> */ B(StackCheck),
- /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(4),
+ /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
@@ -126,14 +126,14 @@ bytecodes: [
B(Star), R(5),
/* 32 E> */ B(CallUndefinedReceiver1), R(4), R(5), U8(0),
/* 47 S> */ B(LdaUndefined),
- B(Star), R(0),
+ B(Star), R(2),
/* 52 S> */ B(LdaModuleVariable), I8(-1), U8(0),
B(ThrowReferenceErrorIfHole), U8(4),
B(Star), R(4),
B(LdaSmi), I8(42),
B(Star), R(5),
/* 52 E> */ B(CallUndefinedReceiver1), R(4), R(5), U8(2),
- B(Star), R(2),
+ B(Star), R(1),
/* 65 S> */ B(Return),
]
constant pool: [
@@ -156,7 +156,7 @@ frame size: 6
parameter count: 2
bytecode array length: 90
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(3),
@@ -165,12 +165,12 @@ bytecodes: [
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
/* 0 E> */ B(StackCheck),
- /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(4),
+ /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
@@ -182,14 +182,14 @@ bytecodes: [
B(Inc), U8(0),
/* 24 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 34 S> */ B(LdaUndefined),
- B(Star), R(0),
+ B(Star), R(2),
/* 39 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(ToNumeric), U8(1),
B(Star), R(4),
B(Inc), U8(1),
/* 42 E> */ B(StaModuleVariable), I8(1), U8(0),
- B(Mov), R(4), R(2),
- B(Ldar), R(2),
+ B(Mov), R(4), R(1),
+ B(Ldar), R(1),
/* 50 S> */ B(Return),
]
constant pool: [
@@ -211,7 +211,7 @@ frame size: 6
parameter count: 2
bytecode array length: 96
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(3),
@@ -220,15 +220,15 @@ bytecodes: [
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
- B(Ldar), R(1),
- /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(4),
+ B(Ldar), R(0),
+ /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
@@ -240,14 +240,14 @@ bytecodes: [
B(Inc), U8(0),
/* 24 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 34 S> */ B(LdaUndefined),
- B(Star), R(0),
+ B(Star), R(2),
/* 39 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(ToNumeric), U8(1),
B(Star), R(4),
B(Inc), U8(1),
/* 42 E> */ B(StaModuleVariable), I8(1), U8(0),
- B(Mov), R(4), R(2),
- B(Ldar), R(2),
+ B(Mov), R(4), R(1),
+ B(Ldar), R(1),
/* 50 S> */ B(Return),
]
constant pool: [
@@ -269,7 +269,7 @@ frame size: 6
parameter count: 2
bytecode array length: 100
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(3),
@@ -278,15 +278,15 @@ bytecodes: [
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
- B(Ldar), R(1),
- /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(4),
+ B(Ldar), R(0),
+ /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
@@ -298,14 +298,14 @@ bytecodes: [
B(Inc), U8(0),
/* 26 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
/* 36 S> */ B(LdaUndefined),
- B(Star), R(0),
+ B(Star), R(2),
/* 41 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(ToNumeric), U8(1),
B(Star), R(4),
B(Inc), U8(1),
/* 44 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
- B(Mov), R(4), R(2),
- B(Ldar), R(2),
+ B(Mov), R(4), R(1),
+ B(Ldar), R(1),
/* 52 S> */ B(Return),
]
constant pool: [
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden
index aa89a500db..18fd7989c5 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden
@@ -26,13 +26,13 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
/* 89 S> */ B(CreateArrayLiteral), U8(3), U8(1), U8(37),
B(Star), R(3),
- B(Ldar), R(1),
- /* 89 E> */ B(ConstructWithSpread), R(1), R(3), U8(1), U8(2),
+ B(Ldar), R(0),
+ /* 89 E> */ B(ConstructWithSpread), R(0), R(3), U8(1), U8(2),
B(LdaUndefined),
/* 110 S> */ B(Return),
]
@@ -66,15 +66,15 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
/* 89 S> */ B(LdaZero),
B(Star), R(3),
B(CreateArrayLiteral), U8(3), U8(1), U8(37),
B(Star), R(4),
- B(Ldar), R(1),
- /* 89 E> */ B(ConstructWithSpread), R(1), R(3), U8(2), U8(2),
+ B(Ldar), R(0),
+ /* 89 E> */ B(ConstructWithSpread), R(0), R(3), U8(2), U8(2),
B(LdaUndefined),
/* 113 S> */ B(Return),
]
@@ -108,9 +108,9 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
/* 89 S> */ B(CreateArrayLiteral), U8(3), U8(1), U8(37),
B(Star), R(4),
B(LdaConstant), U8(4),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden
index 9070a36805..be6ef0138b 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden
@@ -240,9 +240,9 @@ handlers: [
snippet: "
var a = 1; return { 1: a };
"
-frame size: 6
+frame size: 5
parameter count: 1
-bytecode array length: 32
+bytecode array length: 29
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(1),
@@ -251,11 +251,9 @@ bytecodes: [
B(Star), R(1),
B(LdaSmi), I8(1),
B(Star), R(3),
- B(LdaZero),
- B(Star), R(5),
B(Mov), R(1), R(2),
B(Mov), R(0), R(4),
- /* 57 E> */ B(CallRuntime), U16(Runtime::kSetKeyedProperty), R(2), U8(4),
+ /* 57 E> */ B(CallRuntime), U16(Runtime::kSetKeyedProperty), R(2), U8(3),
B(Ldar), R(2),
/* 61 S> */ B(Return),
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden
index 71a7119326..5afcdde7f6 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden
@@ -47,12 +47,12 @@ bytecodes: [
B(Mov), R(5), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3),
B(Star), R(6),
- B(Mov), R(7), R(1),
+ B(Mov), R(7), R(3),
B(CreateClosure), U8(4), U8(1), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(5), U8(2),
B(PopContext), R(4),
- B(Mov), R(1), R(2),
+ B(Mov), R(3), R(0),
/* 38 E> */ B(CreateBlockContext), U8(6),
B(PushContext), R(4),
B(LdaTheHole),
@@ -72,16 +72,16 @@ bytecodes: [
B(Mov), R(5), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3),
B(Star), R(6),
- B(Mov), R(7), R(0),
+ B(Mov), R(7), R(2),
B(CreateClosure), U8(9), U8(5), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(5), U8(6),
B(PopContext), R(4),
- B(Mov), R(0), R(3),
- /* 136 S> */ B(Ldar), R(1),
- /* 136 E> */ B(Construct), R(1), R(0), U8(0), U8(8),
- /* 145 S> */ B(Ldar), R(0),
- /* 145 E> */ B(Construct), R(0), R(0), U8(0), U8(10),
+ B(Mov), R(2), R(1),
+ /* 136 S> */ B(Ldar), R(3),
+ /* 136 E> */ B(Construct), R(3), R(0), U8(0), U8(8),
+ /* 145 S> */ B(Ldar), R(2),
+ /* 145 E> */ B(Construct), R(2), R(0), U8(0), U8(10),
B(LdaUndefined),
/* 154 S> */ B(Return),
]
@@ -167,12 +167,12 @@ bytecodes: [
B(Mov), R(13), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(3),
B(Star), R(8),
- B(Mov), R(9), R(2),
+ B(Mov), R(9), R(5),
B(CreateClosure), U8(6), U8(2), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(3),
B(PopContext), R(6),
- B(Mov), R(2), R(3),
+ B(Mov), R(5), R(0),
/* 38 E> */ B(CreateBlockContext), U8(8),
B(PushContext), R(6),
B(LdaTheHole),
@@ -212,12 +212,12 @@ bytecodes: [
B(Mov), R(13), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5),
B(Star), R(8),
- B(Mov), R(9), R(1),
+ B(Mov), R(9), R(4),
B(CreateClosure), U8(16), U8(9), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(10),
B(PopContext), R(6),
- B(Mov), R(1), R(4),
+ B(Mov), R(4), R(1),
/* 140 E> */ B(CreateBlockContext), U8(17),
B(PushContext), R(6),
B(LdaTheHole),
@@ -233,21 +233,21 @@ bytecodes: [
B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(11), U8(1),
B(StaCurrentContextSlot), U8(4),
B(Mov), R(7), R(9),
- B(Mov), R(1), R(10),
+ B(Mov), R(4), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(3),
B(Star), R(8),
- B(Mov), R(9), R(0),
+ B(Mov), R(9), R(3),
B(CreateClosure), U8(20), U8(13), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(14),
B(PopContext), R(6),
- B(Mov), R(0), R(5),
- /* 430 S> */ B(Ldar), R(2),
- /* 430 E> */ B(Construct), R(2), R(0), U8(0), U8(16),
- /* 439 S> */ B(Ldar), R(1),
- /* 439 E> */ B(Construct), R(1), R(0), U8(0), U8(18),
- /* 448 S> */ B(Ldar), R(0),
- /* 448 E> */ B(Construct), R(0), R(0), U8(0), U8(20),
+ B(Mov), R(3), R(2),
+ /* 430 S> */ B(Ldar), R(5),
+ /* 430 E> */ B(Construct), R(5), R(0), U8(0), U8(16),
+ /* 439 S> */ B(Ldar), R(4),
+ /* 439 E> */ B(Construct), R(4), R(0), U8(0), U8(18),
+ /* 448 S> */ B(Ldar), R(3),
+ /* 448 E> */ B(Construct), R(3), R(0), U8(0), U8(20),
B(LdaUndefined),
/* 458 S> */ B(Return),
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden
index cb09c45b1a..23cce9fbab 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden
@@ -43,12 +43,12 @@ bytecodes: [
B(Mov), R(5), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4),
B(Star), R(6),
- B(Mov), R(7), R(1),
+ B(Mov), R(7), R(3),
B(CreateClosure), U8(4), U8(1), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(5), U8(2),
B(PopContext), R(4),
- B(Mov), R(1), R(2),
+ B(Mov), R(3), R(0),
/* 38 E> */ B(CreateBlockContext), U8(6),
B(PushContext), R(4),
B(LdaTheHole),
@@ -65,16 +65,16 @@ bytecodes: [
B(Mov), R(5), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4),
B(Star), R(6),
- B(Mov), R(7), R(0),
+ B(Mov), R(7), R(2),
B(CreateClosure), U8(9), U8(5), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(5), U8(6),
B(PopContext), R(4),
- B(Mov), R(0), R(3),
- /* 120 S> */ B(Ldar), R(1),
- /* 120 E> */ B(Construct), R(1), R(0), U8(0), U8(8),
- /* 129 S> */ B(Ldar), R(0),
- /* 129 E> */ B(Construct), R(0), R(0), U8(0), U8(10),
+ B(Mov), R(2), R(1),
+ /* 120 S> */ B(Ldar), R(3),
+ /* 120 E> */ B(Construct), R(3), R(0), U8(0), U8(8),
+ /* 129 S> */ B(Ldar), R(2),
+ /* 129 E> */ B(Construct), R(2), R(0), U8(0), U8(10),
B(LdaUndefined),
/* 138 S> */ B(Return),
]
@@ -152,12 +152,12 @@ bytecodes: [
B(Mov), R(13), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(4),
B(Star), R(8),
- B(Mov), R(9), R(2),
+ B(Mov), R(9), R(5),
B(CreateClosure), U8(6), U8(2), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(3),
B(PopContext), R(6),
- B(Mov), R(2), R(3),
+ B(Mov), R(5), R(0),
/* 38 E> */ B(CreateBlockContext), U8(8),
B(PushContext), R(6),
B(LdaTheHole),
@@ -184,12 +184,12 @@ bytecodes: [
B(Mov), R(13), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5),
B(Star), R(8),
- B(Mov), R(9), R(1),
+ B(Mov), R(9), R(4),
B(CreateClosure), U8(14), U8(8), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(9),
B(PopContext), R(6),
- B(Mov), R(1), R(4),
+ B(Mov), R(4), R(1),
/* 90 E> */ B(CreateBlockContext), U8(15),
B(PushContext), R(6),
B(LdaTheHole),
@@ -202,21 +202,21 @@ bytecodes: [
B(StaCurrentContextSlot), U8(4),
B(Star), R(11),
B(Mov), R(7), R(9),
- B(Mov), R(1), R(10),
+ B(Mov), R(4), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(4),
B(Star), R(8),
- B(Mov), R(9), R(0),
+ B(Mov), R(9), R(3),
B(CreateClosure), U8(18), U8(12), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(13),
B(PopContext), R(6),
- B(Mov), R(0), R(5),
- /* 329 S> */ B(Ldar), R(2),
- /* 329 E> */ B(Construct), R(2), R(0), U8(0), U8(15),
- /* 338 S> */ B(Ldar), R(1),
- /* 338 E> */ B(Construct), R(1), R(0), U8(0), U8(17),
- /* 347 S> */ B(Ldar), R(0),
- /* 347 E> */ B(Construct), R(0), R(0), U8(0), U8(19),
+ B(Mov), R(3), R(2),
+ /* 329 S> */ B(Ldar), R(5),
+ /* 329 E> */ B(Construct), R(5), R(0), U8(0), U8(15),
+ /* 338 S> */ B(Ldar), R(4),
+ /* 338 E> */ B(Construct), R(4), R(0), U8(0), U8(17),
+ /* 347 S> */ B(Ldar), R(3),
+ /* 347 E> */ B(Construct), R(3), R(0), U8(0), U8(19),
B(LdaUndefined),
/* 356 S> */ B(Return),
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
index 34e5de5443..d72bb35fee 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
@@ -19,15 +19,15 @@ bytecode array length: 26
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 30 S> */ B(LdaZero),
- B(Star), R(1),
+ B(Star), R(0),
/* 35 S> */ B(LdaSmi), I8(10),
- /* 35 E> */ B(TestLessThan), R(1), U8(0),
+ /* 35 E> */ B(TestLessThan), R(0), U8(0),
B(JumpIfFalse), U8(15),
/* 17 E> */ B(StackCheck),
- /* 56 S> */ B(Mov), R(1), R(0),
- /* 43 S> */ B(Ldar), R(0),
+ /* 56 S> */ B(Mov), R(0), R(1),
+ /* 43 S> */ B(Ldar), R(1),
B(Inc), U8(1),
- B(Star), R(1),
+ B(Star), R(0),
B(JumpLoop), U8(17), I8(0),
B(LdaUndefined),
/* 61 S> */ B(Return),
@@ -152,28 +152,28 @@ bytecode array length: 106
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 30 S> */ B(LdaZero),
+ B(Star), R(3),
B(Star), R(0),
- B(Star), R(1),
B(LdaSmi), I8(1),
- B(Star), R(2),
+ B(Star), R(1),
/* 78 E> */ B(StackCheck),
B(CreateBlockContext), U8(0),
B(PushContext), R(4),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(Ldar), R(1),
+ B(Ldar), R(0),
B(StaCurrentContextSlot), U8(4),
B(LdaSmi), I8(1),
- B(TestEqual), R(2), U8(0),
+ B(TestEqual), R(1), U8(0),
B(JumpIfFalse), U8(7),
B(LdaZero),
- B(Star), R(2),
+ B(Star), R(1),
B(Jump), U8(8),
/* 43 S> */ B(LdaCurrentContextSlot), U8(4),
B(Inc), U8(1),
/* 43 E> */ B(StaCurrentContextSlot), U8(4),
B(LdaSmi), I8(1),
- B(Star), R(3),
+ B(Star), R(2),
/* 35 S> */ B(LdaCurrentContextSlot), U8(4),
B(Star), R(5),
B(LdaSmi), I8(10),
@@ -183,19 +183,19 @@ bytecodes: [
B(PopContext), R(4),
B(Jump), U8(45),
B(LdaSmi), I8(1),
- B(TestEqual), R(3), U8(3),
+ B(TestEqual), R(2), U8(3),
B(JumpIfFalse), U8(22),
/* 17 E> */ B(StackCheck),
/* 48 S> */ B(CreateClosure), U8(1), U8(4), U8(2),
B(Star), R(5),
/* 74 E> */ B(CallUndefinedReceiver0), R(5), U8(5),
B(LdaZero),
- B(Star), R(3),
+ B(Star), R(2),
B(LdaCurrentContextSlot), U8(4),
- B(Star), R(1),
+ B(Star), R(0),
B(JumpLoop), U8(24), I8(1),
B(LdaSmi), I8(1),
- /* 78 E> */ B(TestEqual), R(3), U8(7),
+ /* 78 E> */ B(TestEqual), R(2), U8(7),
B(JumpIfFalse), U8(6),
B(PopContext), R(4),
B(Jump), U8(7),
@@ -229,19 +229,19 @@ bytecodes: [
/* 26 E> */ B(CallRuntime), U16(Runtime::kThrowPatternAssignmentNonCoercible), R(0), U8(0),
B(Star), R(3),
/* 28 S> */ B(LdaNamedProperty), R(3), U8(1), U8(1),
- B(Star), R(1),
+ B(Star), R(0),
/* 31 S> */ B(LdaNamedProperty), R(3), U8(2), U8(3),
- B(Star), R(2),
+ B(Star), R(1),
/* 55 S> */ B(LdaZero),
- /* 55 E> */ B(TestGreaterThan), R(2), U8(5),
+ /* 55 E> */ B(TestGreaterThan), R(1), U8(5),
B(JumpIfFalse), U8(19),
/* 17 E> */ B(StackCheck),
- /* 75 S> */ B(Ldar), R(2),
- /* 77 E> */ B(Add), R(1), U8(6),
- B(Star), R(0),
- /* 62 S> */ B(Ldar), R(2),
- B(Dec), U8(7),
+ /* 75 S> */ B(Ldar), R(1),
+ /* 77 E> */ B(Add), R(0), U8(6),
B(Star), R(2),
+ /* 62 S> */ B(Ldar), R(1),
+ B(Dec), U8(7),
+ B(Star), R(1),
B(JumpLoop), U8(20), I8(0),
B(LdaUndefined),
/* 84 S> */ B(Return),
@@ -265,16 +265,16 @@ frame size: 5
parameter count: 1
bytecode array length: 67
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(Mov), R(closure), R(3),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 11 E> */ B(StackCheck),
- /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(3), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(3),
+ /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(3),
B(Star), R(3),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
B(Ldar), R(3),
/* 11 E> */ B(Throw),
@@ -286,8 +286,8 @@ bytecodes: [
/* 36 E> */ B(TestLessThan), R(1), U8(0),
B(JumpIfFalse), U8(15),
/* 18 E> */ B(StackCheck),
- /* 57 S> */ B(Mov), R(1), R(0),
- /* 44 S> */ B(Ldar), R(0),
+ /* 57 S> */ B(Mov), R(1), R(2),
+ /* 44 S> */ B(Ldar), R(2),
B(Inc), U8(1),
B(Star), R(1),
B(JumpLoop), U8(17), I8(0),
@@ -313,43 +313,43 @@ frame size: 4
parameter count: 1
bytecode array length: 99
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(2),
B(Mov), R(this), R(3),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
/* 11 E> */ B(StackCheck),
- /* 11 E> */ B(SuspendGenerator), R(1), R(0), U8(2), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(2),
+ /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(2),
B(Star), R(2),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(2),
/* 11 E> */ B(Throw),
B(Ldar), R(2),
/* 56 S> */ B(Return),
/* 31 S> */ B(LdaZero),
- B(Star), R(0),
+ B(Star), R(1),
/* 36 S> */ B(LdaSmi), I8(10),
- /* 36 E> */ B(TestLessThan), R(0), U8(0),
+ /* 36 E> */ B(TestLessThan), R(1), U8(0),
B(JumpIfFalse), U8(47),
/* 18 E> */ B(StackCheck),
/* 47 S> */ B(LdaFalse),
B(Star), R(3),
- B(Mov), R(0), R(2),
+ B(Mov), R(1), R(2),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(2), U8(2),
- /* 47 E> */ B(SuspendGenerator), R(1), R(0), U8(2), U8(1),
- B(ResumeGenerator), R(1), R(0), U8(2),
+ /* 47 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(2),
B(Star), R(2),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(4), U8(2), I8(0),
B(Ldar), R(2),
/* 47 E> */ B(Throw),
B(Ldar), R(2),
/* 56 S> */ B(Return),
- /* 44 S> */ B(Ldar), R(0),
+ /* 44 S> */ B(Ldar), R(1),
B(Inc), U8(1),
- B(Star), R(0),
+ B(Star), R(1),
B(JumpLoop), U8(49), I8(0),
B(LdaUndefined),
/* 56 S> */ B(Return),
@@ -374,12 +374,12 @@ snippet: "
"
frame size: 8
parameter count: 1
-bytecode array length: 85
+bytecode array length: 81
bytecodes: [
B(Mov), R(closure), R(3),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(3), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(3),
/* 36 S> */ B(LdaZero),
@@ -388,8 +388,8 @@ bytecodes: [
/* 41 E> */ B(TestLessThan), R(1), U8(0),
B(JumpIfFalse), U8(15),
/* 23 E> */ B(StackCheck),
- /* 62 S> */ B(Mov), R(1), R(0),
- /* 49 S> */ B(Ldar), R(0),
+ /* 62 S> */ B(Mov), R(1), R(2),
+ /* 49 S> */ B(Ldar), R(2),
B(Inc), U8(1),
B(Star), R(1),
B(JumpLoop), U8(17), I8(0),
@@ -397,10 +397,9 @@ bytecodes: [
B(Star), R(5),
B(LdaFalse),
B(Star), R(6),
- B(Mov), R(2), R(4),
+ B(Mov), R(0), R(4),
/* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3),
/* 67 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(4),
B(CreateCatchContext), R(4), U8(0),
B(Star), R(3),
@@ -412,17 +411,15 @@ bytecodes: [
B(Star), R(6),
B(LdaFalse),
B(Star), R(7),
- B(Mov), R(2), R(5),
+ B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(5), U8(3),
/* 67 S> */ B(Return),
- B(LdaUndefined),
- /* 67 S> */ B(Return),
]
constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [16, 53, 55],
+ [16, 53, 53],
]
---
@@ -434,46 +431,45 @@ snippet: "
"
frame size: 7
parameter count: 1
-bytecode array length: 121
+bytecode array length: 117
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(Mov), R(closure), R(2),
B(Mov), R(this), R(3),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(2), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(2),
/* 36 S> */ B(LdaZero),
- B(Star), R(0),
+ B(Star), R(1),
/* 41 S> */ B(LdaSmi), I8(10),
- /* 41 E> */ B(TestLessThan), R(0), U8(0),
+ /* 41 E> */ B(TestLessThan), R(1), U8(0),
B(JumpIfFalse), U8(47),
/* 23 E> */ B(StackCheck),
- /* 52 S> */ B(Mov), R(1), R(3),
- B(Mov), R(0), R(4),
+ /* 52 S> */ B(Mov), R(0), R(3),
+ B(Mov), R(1), R(4),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(3), U8(2),
- /* 52 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(3),
+ /* 52 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(3),
B(Star), R(3),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(4),
B(LdaZero),
B(TestReferenceEqual), R(4),
B(JumpIfTrue), U8(5),
B(Ldar), R(3),
B(ReThrow),
- /* 49 S> */ B(Ldar), R(0),
+ /* 49 S> */ B(Ldar), R(1),
B(Inc), U8(1),
- B(Star), R(0),
+ B(Star), R(1),
B(JumpLoop), U8(49), I8(0),
B(LdaUndefined),
B(Star), R(4),
B(LdaTrue),
B(Star), R(5),
- B(Mov), R(1), R(3),
+ B(Mov), R(0), R(3),
/* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(3), U8(3),
/* 61 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(3),
B(CreateCatchContext), R(3), U8(1),
B(Star), R(2),
@@ -485,17 +481,15 @@ bytecodes: [
B(Star), R(5),
B(LdaTrue),
B(Star), R(6),
- B(Mov), R(1), R(4),
+ B(Mov), R(0), R(4),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(4), U8(3),
/* 61 S> */ B(Return),
- B(LdaUndefined),
- /* 61 S> */ B(Return),
]
constant pool: [
Smi [46],
SCOPE_INFO_TYPE,
]
handlers: [
- [20, 89, 91],
+ [20, 89, 89],
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden
index da5c922456..93ba673a0e 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden
@@ -58,15 +58,15 @@ bytecodes: [
B(StaCurrentContextSlot), U8(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(5),
B(Star), R(6),
- B(Mov), R(5), R(1),
+ B(Mov), R(5), R(3),
B(CreateClosure), U8(6), U8(2), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(7), U8(3),
B(CreateClosure), U8(8), U8(5), U8(2),
B(Star), R(9),
- B(CallProperty0), R(9), R(1), U8(6),
+ B(CallProperty0), R(9), R(3), U8(6),
B(PopContext), R(4),
- B(Mov), R(1), R(2),
+ B(Mov), R(3), R(0),
/* 38 E> */ B(CreateBlockContext), U8(9),
B(PushContext), R(4),
B(LdaTheHole),
@@ -93,19 +93,19 @@ bytecodes: [
B(StaCurrentContextSlot), U8(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(5),
B(Star), R(6),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(2),
B(CreateClosure), U8(12), U8(9), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(7), U8(10),
B(CreateClosure), U8(13), U8(12), U8(2),
B(Star), R(9),
- B(CallProperty0), R(9), R(0), U8(13),
+ B(CallProperty0), R(9), R(2), U8(13),
B(PopContext), R(4),
- B(Mov), R(0), R(3),
- /* 197 S> */ B(Ldar), R(2),
- /* 197 E> */ B(Construct), R(2), R(0), U8(0), U8(15),
- /* 206 S> */ B(Ldar), R(0),
- /* 206 E> */ B(Construct), R(0), R(0), U8(0), U8(17),
+ B(Mov), R(2), R(1),
+ /* 197 S> */ B(Ldar), R(0),
+ /* 197 E> */ B(Construct), R(0), R(0), U8(0), U8(15),
+ /* 206 S> */ B(Ldar), R(2),
+ /* 206 E> */ B(Construct), R(2), R(0), U8(0), U8(17),
B(LdaUndefined),
/* 215 S> */ B(Return),
]
@@ -203,15 +203,15 @@ bytecodes: [
B(StaCurrentContextSlot), U8(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5),
B(Star), R(8),
- B(Mov), R(7), R(2),
+ B(Mov), R(7), R(5),
B(CreateClosure), U8(8), U8(3), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(9), U8(4),
B(CreateClosure), U8(10), U8(6), U8(2),
B(Star), R(11),
- B(CallProperty0), R(11), R(2), U8(7),
+ B(CallProperty0), R(11), R(5), U8(7),
B(PopContext), R(6),
- B(Mov), R(2), R(3),
+ B(Mov), R(5), R(0),
/* 38 E> */ B(CreateBlockContext), U8(11),
B(PushContext), R(6),
B(LdaTheHole),
@@ -248,15 +248,15 @@ bytecodes: [
B(Star), R(13),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(6),
B(Star), R(8),
- B(Mov), R(7), R(1),
+ B(Mov), R(7), R(4),
B(CreateClosure), U8(17), U8(12), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(9), U8(13),
B(CreateClosure), U8(18), U8(15), U8(2),
B(Star), R(11),
- B(CallProperty0), R(11), R(1), U8(16),
+ B(CallProperty0), R(11), R(4), U8(16),
B(PopContext), R(6),
- B(Mov), R(1), R(4),
+ B(Mov), R(4), R(1),
/* 122 E> */ B(CreateBlockContext), U8(19),
B(PushContext), R(6),
B(LdaTheHole),
@@ -274,7 +274,7 @@ bytecodes: [
B(Star), R(12),
B(LdaConstant), U8(7),
B(TestEqualStrict), R(12), U8(2),
- B(Mov), R(1), R(10),
+ B(Mov), R(4), R(10),
B(Mov), R(7), R(9),
B(JumpIfFalse), U8(7),
B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0),
@@ -282,23 +282,23 @@ bytecodes: [
B(StaCurrentContextSlot), U8(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5),
B(Star), R(8),
- B(Mov), R(7), R(0),
+ B(Mov), R(7), R(3),
B(CreateClosure), U8(22), U8(19), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(9), U8(20),
B(CreateClosure), U8(23), U8(22), U8(2),
B(Star), R(11),
- B(Ldar), R(0),
+ B(Ldar), R(3),
B(StaNamedProperty), R(11), U8(24), U8(23),
- B(CallProperty0), R(11), R(0), U8(25),
+ B(CallProperty0), R(11), R(3), U8(25),
B(PopContext), R(6),
- B(Mov), R(0), R(5),
- /* 456 S> */ B(Ldar), R(3),
- /* 456 E> */ B(Construct), R(3), R(0), U8(0), U8(27),
- /* 465 S> */ B(Ldar), R(4),
- /* 465 E> */ B(Construct), R(4), R(0), U8(0), U8(29),
- /* 474 S> */ B(Ldar), R(0),
- /* 474 E> */ B(Construct), R(0), R(0), U8(0), U8(31),
+ B(Mov), R(3), R(2),
+ /* 456 S> */ B(Ldar), R(0),
+ /* 456 E> */ B(Construct), R(0), R(0), U8(0), U8(27),
+ /* 465 S> */ B(Ldar), R(1),
+ /* 465 E> */ B(Construct), R(1), R(0), U8(0), U8(29),
+ /* 474 S> */ B(Ldar), R(3),
+ /* 474 E> */ B(Construct), R(3), R(0), U8(0), U8(31),
B(LdaUndefined),
/* 483 S> */ B(Return),
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden
index a84807e5fc..74849d1c85 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden
@@ -57,7 +57,7 @@ bytecodes: [
B(Star), R(3),
B(Mov), R(closure), R(1),
/* 128 E> */ B(StackCheck),
- /* 136 S> */ B(Mov), R(3), R(2),
+ B(Mov), R(3), R(2),
/* 140 S> */ B(Ldar), R(closure),
B(GetSuperConstructor), R(5),
B(LdaSmi), I8(1),
@@ -99,7 +99,7 @@ bytecodes: [
B(Star), R(3),
B(Mov), R(closure), R(1),
/* 128 E> */ B(StackCheck),
- /* 136 S> */ B(Mov), R(3), R(2),
+ B(Mov), R(3), R(2),
/* 140 S> */ B(Ldar), R(closure),
B(GetSuperConstructor), R(5),
B(CreateEmptyArrayLiteral), U8(0),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden
index b078ef048a..ec70270dae 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden
@@ -11,13 +11,12 @@ snippet: "
"
frame size: 2
parameter count: 1
-bytecode array length: 27
+bytecode array length: 23
bytecodes: [
/* 30 E> */ B(StackCheck),
B(Mov), R(context), R(0),
/* 40 S> */ B(LdaSmi), I8(1),
/* 49 S> */ B(Return),
- B(Jump), U8(18),
B(Star), R(1),
B(CreateCatchContext), R(1), U8(0),
B(Star), R(0),
@@ -27,14 +26,12 @@ bytecodes: [
B(PushContext), R(1),
/* 63 S> */ B(LdaSmi), I8(2),
/* 72 S> */ B(Return),
- B(LdaUndefined),
- /* 75 S> */ B(Return),
]
constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [4, 7, 9],
+ [4, 7, 7],
]
---
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden
index 6d7309b732..19a09ba49c 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden
@@ -7,174 +7,488 @@ wrap: yes
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
x0 = x127;
return x0;
"
frame size: 157
parameter count: 1
-bytecode array length: 10
+bytecode array length: 547
bytecodes: [
/* 30 E> */ B(StackCheck),
- /* 1494 S> */ B(Wide), B(Mov), R16(127), R16(0),
- /* 1505 S> */ B(Ldar), R(0),
- /* 1515 S> */ B(Return),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
+ /* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2122 S> */ B(Wide), B(Mov), R16(127), R16(0),
+ /* 2133 S> */ B(Ldar), R(0),
+ /* 2143 S> */ B(Return),
]
constant pool: [
]
@@ -183,174 +497,488 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
x127 = x126;
return x127;
"
frame size: 157
parameter count: 1
-bytecode array length: 12
+bytecode array length: 549
bytecodes: [
/* 30 E> */ B(StackCheck),
- /* 1494 S> */ B(Wide), B(Mov), R16(126), R16(127),
- /* 1507 S> */ B(Wide), B(Ldar), R16(127),
- /* 1519 S> */ B(Return),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
+ /* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2122 S> */ B(Wide), B(Mov), R16(126), R16(127),
+ /* 2135 S> */ B(Wide), B(Ldar), R16(127),
+ /* 2147 S> */ B(Return),
]
constant pool: [
]
@@ -359,178 +987,492 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
if (x2 > 3) { return x129; }
return x128;
"
frame size: 157
parameter count: 1
-bytecode array length: 18
+bytecode array length: 555
bytecodes: [
/* 30 E> */ B(StackCheck),
- /* 1494 S> */ B(LdaSmi), I8(3),
- /* 1501 E> */ B(TestGreaterThan), R(2), U8(0),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
+ /* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2122 S> */ B(LdaSmi), I8(3),
+ /* 2129 E> */ B(TestGreaterThan), R(2), U8(0),
B(JumpIfFalse), U8(7),
- /* 1508 S> */ B(Wide), B(Ldar), R16(129),
- /* 1520 S> */ B(Return),
- /* 1523 S> */ B(Wide), B(Ldar), R16(128),
- /* 1535 S> */ B(Return),
+ /* 2136 S> */ B(Wide), B(Ldar), R16(129),
+ /* 2148 S> */ B(Return),
+ /* 2151 S> */ B(Wide), B(Ldar), R16(128),
+ /* 2163 S> */ B(Return),
]
constant pool: [
]
@@ -539,163 +1481,163 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
var x0 = 0;
if (x129 == 3) { var x129 = x0; }
if (x2 > 3) { return x0; }
@@ -703,23 +1645,337 @@ snippet: "
"
frame size: 157
parameter count: 1
-bytecode array length: 39
+bytecode array length: 576
bytecodes: [
/* 30 E> */ B(StackCheck),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
/* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2131 S> */ B(LdaZero),
B(Star), R(0),
- /* 1506 S> */ B(LdaSmi), I8(3),
- /* 1515 E> */ B(Wide), B(TestEqual), R16(129), U16(0),
+ /* 2134 S> */ B(LdaSmi), I8(3),
+ /* 2143 E> */ B(Wide), B(TestEqual), R16(129), U16(0),
B(JumpIfFalse), U8(12),
- /* 1534 S> */ B(Wide), B(Mov), R16(0), R16(129),
+ /* 2162 S> */ B(Wide), B(Mov), R16(0), R16(129),
B(Wide), B(Ldar), R16(129),
- /* 1540 S> */ B(LdaSmi), I8(3),
- /* 1547 E> */ B(TestGreaterThan), R(2), U8(1),
+ /* 2168 S> */ B(LdaSmi), I8(3),
+ /* 2175 E> */ B(TestGreaterThan), R(2), U8(1),
B(JumpIfFalse), U8(5),
- /* 1554 S> */ B(Ldar), R(0),
- /* 1564 S> */ B(Return),
- /* 1567 S> */ B(Wide), B(Ldar), R16(129),
- /* 1579 S> */ B(Return),
+ /* 2182 S> */ B(Ldar), R(0),
+ /* 2192 S> */ B(Return),
+ /* 2195 S> */ B(Wide), B(Ldar), R16(129),
+ /* 2207 S> */ B(Return),
]
constant pool: [
]
@@ -728,192 +1984,506 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
var x0 = 0;
var x1 = 0;
for (x128 = 0; x128 < 64; x128++) { x1 += x128;}return x128;
"
frame size: 158
parameter count: 1
-bytecode array length: 56
+bytecode array length: 593
bytecodes: [
/* 30 E> */ B(StackCheck),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
/* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2131 S> */ B(LdaZero),
B(Star), R(0),
- /* 1515 S> */ B(LdaZero),
+ /* 2143 S> */ B(LdaZero),
B(Star), R(1),
- /* 1523 S> */ B(LdaZero),
+ /* 2151 S> */ B(LdaZero),
B(Wide), B(Star), R16(128),
- /* 1538 S> */ B(LdaSmi), I8(64),
- /* 1538 E> */ B(Wide), B(TestLessThan), R16(128), U16(0),
+ /* 2166 S> */ B(LdaSmi), I8(64),
+ /* 2166 E> */ B(Wide), B(TestLessThan), R16(128), U16(0),
B(JumpIfFalse), U8(31),
- /* 1518 E> */ B(StackCheck),
- /* 1555 S> */ B(Wide), B(Ldar), R16(128),
- /* 1561 E> */ B(Add), R(1), U8(1),
+ /* 2146 E> */ B(StackCheck),
+ /* 2183 S> */ B(Wide), B(Ldar), R16(128),
+ /* 2189 E> */ B(Add), R(1), U8(1),
B(Wide), B(Mov), R16(1), R16(157),
B(Star), R(1),
- /* 1548 S> */ B(Wide), B(Ldar), R16(128),
+ /* 2176 S> */ B(Wide), B(Ldar), R16(128),
B(Inc), U8(2),
B(Wide), B(Star), R16(128),
B(JumpLoop), U8(36), I8(0),
- /* 1567 S> */ B(Wide), B(Ldar), R16(128),
- /* 1579 S> */ B(Return),
+ /* 2195 S> */ B(Wide), B(Ldar), R16(128),
+ /* 2207 S> */ B(Return),
]
constant pool: [
]
@@ -922,177 +2492,491 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
var x0 = 1234;
var x1 = 0;
for (x128 in x0) { x1 += x128;}return x1;
"
frame size: 163
parameter count: 1
-bytecode array length: 89
+bytecode array length: 626
bytecodes: [
/* 30 E> */ B(StackCheck),
- /* 1503 S> */ B(Wide), B(LdaSmi), I16(1234),
+ /* 43 S> */ B(LdaZero),
B(Star), R(0),
- /* 1518 S> */ B(LdaZero),
+ /* 55 S> */ B(LdaZero),
B(Star), R(1),
- /* 1534 S> */ B(Ldar), R(0),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
+ /* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2131 S> */ B(Wide), B(LdaSmi), I16(1234),
+ B(Star), R(0),
+ /* 2146 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 2162 S> */ B(Ldar), R(0),
B(JumpIfUndefined), U8(74),
B(JumpIfNull), U8(72),
B(Wide), B(ToObject), R16(157),
@@ -1100,21 +2984,21 @@ bytecodes: [
B(Wide), B(ForInPrepare), R16(158), U16(0),
B(LdaZero),
B(Wide), B(Star), R16(161),
- /* 1526 S> */ B(Wide), B(ForInContinue), R16(161), R16(160),
+ /* 2154 S> */ B(Wide), B(ForInContinue), R16(161), R16(160),
B(JumpIfFalse), U8(45),
B(Wide), B(ForInNext), R16(157), R16(161), R16(158), U16(0),
B(JumpIfUndefined), U8(22),
B(Wide), B(Star), R16(128),
- /* 1521 E> */ B(StackCheck),
- /* 1541 S> */ B(Wide), B(Ldar), R16(128),
- /* 1547 E> */ B(Add), R(1), U8(1),
+ /* 2149 E> */ B(StackCheck),
+ /* 2169 S> */ B(Wide), B(Ldar), R16(128),
+ /* 2175 E> */ B(Add), R(1), U8(1),
B(Wide), B(Mov), R16(1), R16(162),
B(Star), R(1),
- /* 1544 E> */ B(Wide), B(ForInStep), R16(161),
+ /* 2172 E> */ B(Wide), B(ForInStep), R16(161),
B(Wide), B(Star), R16(161),
B(JumpLoop), U8(48), I8(0),
- /* 1553 S> */ B(Ldar), R(1),
- /* 1563 S> */ B(Return),
+ /* 2181 S> */ B(Ldar), R(1),
+ /* 2191 S> */ B(Return),
]
constant pool: [
]
@@ -1123,163 +3007,163 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
x0 = %Add(x64, x63);
x1 = %Add(x27, x143);
%TheHole();
@@ -1287,20 +3171,334 @@ snippet: "
"
frame size: 159
parameter count: 1
-bytecode array length: 53
+bytecode array length: 590
bytecodes: [
/* 30 E> */ B(StackCheck),
- /* 1494 S> */ B(Wide), B(Mov), R16(64), R16(157),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
+ /* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2122 S> */ B(Wide), B(Mov), R16(64), R16(157),
B(Wide), B(Mov), R16(63), R16(158),
- /* 1509 E> */ B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2),
+ /* 2137 E> */ B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2),
B(Star), R(0),
- /* 1515 S> */ B(Wide), B(Mov), R16(27), R16(157),
+ /* 2143 S> */ B(Wide), B(Mov), R16(27), R16(157),
B(Wide), B(Mov), R16(143), R16(158),
- /* 1530 E> */ B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2),
+ /* 2158 E> */ B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2),
B(Star), R(1),
- /* 1537 S> */ B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0),
- /* 1549 S> */ B(Ldar), R(1),
- /* 1559 S> */ B(Return),
+ /* 2165 S> */ B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0),
+ /* 2177 S> */ B(Ldar), R(1),
+ /* 2187 S> */ B(Return),
]
constant pool: [
]
diff --git a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc
index 99ab4cd8c0..245d9d9afd 100644
--- a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc
+++ b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc
@@ -25,9 +25,7 @@ using v8::internal::interpreter::BytecodeExpectationsPrinter;
namespace {
-#ifdef V8_OS_POSIX
const char* kGoldenFilesPath = "test/cctest/interpreter/bytecode_expectations/";
-#endif
class ProgramOptions final {
public:
@@ -129,24 +127,23 @@ bool ParseBoolean(const char* string) {
const char* BooleanToString(bool value) { return value ? "yes" : "no"; }
-#ifdef V8_OS_POSIX
-
-bool StrEndsWith(const char* string, const char* suffix) {
- int string_size = i::StrLength(string);
- int suffix_size = i::StrLength(suffix);
- if (string_size < suffix_size) return false;
-
- return strcmp(string + (string_size - suffix_size), suffix) == 0;
-}
-
bool CollectGoldenFiles(std::vector<std::string>* golden_file_list,
const char* directory_path) {
+#ifdef V8_OS_POSIX
DIR* directory = opendir(directory_path);
if (!directory) return false;
+ auto str_ends_with = [](const char* string, const char* suffix) {
+ int string_size = i::StrLength(string);
+ int suffix_size = i::StrLength(suffix);
+ if (string_size < suffix_size) return false;
+
+ return strcmp(string + (string_size - suffix_size), suffix) == 0;
+ };
+
dirent* entry = readdir(directory);
while (entry) {
- if (StrEndsWith(entry->d_name, ".golden")) {
+ if (str_ends_with(entry->d_name, ".golden")) {
std::string golden_filename(kGoldenFilesPath);
golden_filename += entry->d_name;
golden_file_list->push_back(golden_filename);
@@ -155,12 +152,24 @@ bool CollectGoldenFiles(std::vector<std::string>* golden_file_list,
}
closedir(directory);
-
+#elif V8_OS_WIN
+ std::string search_path(directory_path + std::string("/*.golden"));
+ WIN32_FIND_DATAA fd;
+ HANDLE find_handle = FindFirstFileA(search_path.c_str(), &fd);
+ if (find_handle == INVALID_HANDLE_VALUE) return false;
+ do {
+ if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ std::string golden_filename(kGoldenFilesPath);
+ std::string temp_filename(fd.cFileName);
+ golden_filename += temp_filename;
+ golden_file_list->push_back(golden_filename);
+ }
+ } while (FindNextFileA(find_handle, &fd));
+ FindClose(find_handle);
+#endif // V8_OS_POSIX
return true;
}
-#endif // V8_OS_POSIX
-
// static
ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
ProgramOptions options;
@@ -210,7 +219,7 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
}
if (options.rebaseline_ && options.input_filenames_.empty()) {
-#ifdef V8_OS_POSIX
+#if defined(V8_OS_POSIX) || defined(V8_OS_WIN)
if (options.verbose_) {
std::cout << "Looking for golden files in " << kGoldenFilesPath << '\n';
}
@@ -219,7 +228,8 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
options.parsing_failed_ = true;
}
#else
- REPORT_ERROR("Golden files autodiscovery requires a POSIX OS, sorry.");
+ REPORT_ERROR(
+ "Golden files autodiscovery requires a POSIX or Window OS, sorry.");
options.parsing_failed_ = true;
#endif
}
diff --git a/deps/v8/test/cctest/interpreter/interpreter-tester.cc b/deps/v8/test/cctest/interpreter/interpreter-tester.cc
index a361a98a52..c66c1a279b 100644
--- a/deps/v8/test/cctest/interpreter/interpreter-tester.cc
+++ b/deps/v8/test/cctest/interpreter/interpreter-tester.cc
@@ -5,6 +5,7 @@
#include "test/cctest/interpreter/interpreter-tester.h"
#include "src/api-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/objects-inl.h"
namespace v8 {
diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
index fb56d5d98a..168dabd8dc 100644
--- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
@@ -91,6 +91,7 @@ class InitializedIgnitionHandleScope : public InitializedHandleScope {
InitializedIgnitionHandleScope() {
i::FLAG_always_opt = false;
i::FLAG_allow_natives_syntax = true;
+ i::FLAG_enable_lazy_source_positions = false;
}
};
@@ -2420,7 +2421,7 @@ TEST(WideRegisters) {
// Prepare prologue that creates frame for lots of registers.
std::ostringstream os;
for (size_t i = 0; i < 157; ++i) {
- os << "var x" << i << ";\n";
+ os << "var x" << i << " = 0;\n";
}
std::string prologue(os.str());
diff --git a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc
index bfc42aa540..becc46ab9c 100644
--- a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc
+++ b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc
@@ -5,6 +5,7 @@
#include "src/v8.h"
#include "src/api-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/interpreter/interpreter-intrinsics.h"
#include "src/objects-inl.h"
#include "test/cctest/interpreter/interpreter-tester.h"
diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc
index 9ec0c99ce1..3483e7967a 100644
--- a/deps/v8/test/cctest/interpreter/test-interpreter.cc
+++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc
@@ -7,8 +7,12 @@
#include "src/v8.h"
#include "src/api-inl.h"
+#include "src/base/overflowing-math.h"
+#include "src/compiler.h"
#include "src/execution.h"
#include "src/handles.h"
+#include "src/hash-seed-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/interpreter/bytecode-array-builder.h"
#include "src/interpreter/bytecode-array-iterator.h"
#include "src/interpreter/bytecode-flags.h"
@@ -160,7 +164,7 @@ TEST(InterpreterLoadLiteral) {
// Heap numbers.
{
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
BytecodeArrayBuilder builder(zone, 1, 0);
@@ -178,7 +182,7 @@ TEST(InterpreterLoadLiteral) {
// Strings.
{
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
BytecodeArrayBuilder builder(zone, 1, 0);
@@ -239,7 +243,7 @@ static double BinaryOpC(Token::Value op, double lhs, double rhs) {
case Token::Value::MUL:
return lhs * rhs;
case Token::Value::DIV:
- return lhs / rhs;
+ return base::Divide(lhs, rhs);
case Token::Value::MOD:
return Modulo(lhs, rhs);
case Token::Value::BIT_OR:
@@ -252,10 +256,7 @@ static double BinaryOpC(Token::Value op, double lhs, double rhs) {
return (v8::internal::DoubleToInt32(lhs) &
v8::internal::DoubleToInt32(rhs));
case Token::Value::SHL: {
- int32_t val = v8::internal::DoubleToInt32(lhs);
- uint32_t count = v8::internal::DoubleToUint32(rhs) & 0x1F;
- int32_t result = val << count;
- return result;
+ return base::ShlWithWraparound(DoubleToInt32(lhs), DoubleToInt32(rhs));
}
case Token::Value::SAR: {
int32_t val = v8::internal::DoubleToInt32(lhs);
@@ -487,7 +488,7 @@ TEST(InterpreterStringAdd) {
Zone* zone = handles.main_zone();
Factory* factory = isolate->factory();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
struct TestCase {
const AstRawString* lhs;
@@ -580,7 +581,7 @@ TEST(InterpreterParameter8) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
BytecodeArrayBuilder builder(zone, 8, 0, &feedback_spec);
@@ -633,7 +634,7 @@ TEST(InterpreterBinaryOpTypeFeedback) {
i::Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
struct BinaryOpExpectation {
Token::Value op;
@@ -767,7 +768,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) {
i::Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
struct BinaryOpExpectation {
Token::Value op;
@@ -1132,7 +1133,7 @@ TEST(InterpreterLoadNamedProperty) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
FeedbackSlot slot = feedback_spec.AddLoadICSlot();
@@ -1184,7 +1185,7 @@ TEST(InterpreterLoadKeyedProperty) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
FeedbackSlot slot = feedback_spec.AddKeyedLoadICSlot();
@@ -1226,7 +1227,7 @@ TEST(InterpreterStoreNamedProperty) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
FeedbackSlot slot = feedback_spec.AddStoreICSlot(LanguageMode::kStrict);
@@ -1289,7 +1290,7 @@ TEST(InterpreterStoreKeyedProperty) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
FeedbackSlot slot = feedback_spec.AddKeyedStoreICSlot(LanguageMode::kSloppy);
@@ -1341,7 +1342,7 @@ TEST(InterpreterCall) {
Zone* zone = handles.main_zone();
Factory* factory = isolate->factory();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
FeedbackSlot slot = feedback_spec.AddLoadICSlot();
@@ -1527,17 +1528,18 @@ TEST(InterpreterJumps) {
NewFeedbackMetadata(isolate, &feedback_spec);
Register reg(0), scratch(1);
- BytecodeLabel label[3];
+ BytecodeLoopHeader loop_header;
+ BytecodeLabel label[2];
builder.LoadLiteral(Smi::zero())
.StoreAccumulatorInRegister(reg)
- .Jump(&label[1]);
- SetRegister(builder, reg, 1024, scratch).Bind(&label[0]);
- IncrementRegister(builder, reg, 1, scratch, GetIndex(slot)).Jump(&label[2]);
- SetRegister(builder, reg, 2048, scratch).Bind(&label[1]);
+ .Jump(&label[0]);
+ SetRegister(builder, reg, 1024, scratch).Bind(&loop_header);
+ IncrementRegister(builder, reg, 1, scratch, GetIndex(slot)).Jump(&label[1]);
+ SetRegister(builder, reg, 2048, scratch).Bind(&label[0]);
IncrementRegister(builder, reg, 2, scratch, GetIndex(slot1))
- .JumpLoop(&label[0], 0);
- SetRegister(builder, reg, 4096, scratch).Bind(&label[2]);
+ .JumpLoop(&loop_header, 0);
+ SetRegister(builder, reg, 4096, scratch).Bind(&label[1]);
IncrementRegister(builder, reg, 4, scratch, GetIndex(slot2))
.LoadAccumulatorWithRegister(reg)
.Return();
@@ -1653,7 +1655,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
BytecodeArrayBuilder builder(zone, 1, 257, &feedback_spec);
@@ -1666,6 +1668,8 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
builder.LoadLiteral(Smi::zero());
builder.StoreAccumulatorInRegister(reg);
+ // Conditional jump to the fake label, to force both basic blocks to be live.
+ builder.JumpIfTrue(ToBooleanMode::kConvertToBoolean, &fake);
// Consume all 8-bit operands
for (int i = 1; i <= 256; i++) {
builder.LoadLiteral(i + 0.5);
@@ -1714,7 +1718,7 @@ TEST(InterpreterJumpWith32BitOperand) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
BytecodeArrayBuilder builder(zone, 1, 1);
Register reg(0);
BytecodeLabel done;
@@ -1853,7 +1857,7 @@ TEST(InterpreterHeapNumberComparisons) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
BytecodeArrayBuilder builder(zone, 1, 1, &feedback_spec);
@@ -1900,7 +1904,7 @@ TEST(InterpreterBigIntComparisons) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
BytecodeArrayBuilder builder(zone, 1, 1, &feedback_spec);
@@ -1945,7 +1949,7 @@ TEST(InterpreterStringComparisons) {
for (size_t i = 0; i < arraysize(inputs); i++) {
for (size_t j = 0; j < arraysize(inputs); j++) {
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
CanonicalHandleScope canonical(isolate);
const char* lhs = inputs[i].c_str();
@@ -2028,7 +2032,7 @@ TEST(InterpreterMixedComparisons) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
BytecodeArrayBuilder builder(zone, 1, 0, &feedback_spec);
@@ -2266,7 +2270,7 @@ TEST(InterpreterTestIn) {
Zone* zone = handles.main_zone();
Factory* factory = isolate->factory();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
// Allocate an array
Handle<i::JSArray> array =
factory->NewJSArray(0, i::ElementsKind::PACKED_SMI_ELEMENTS);
@@ -2274,21 +2278,26 @@ TEST(InterpreterTestIn) {
const char* properties[] = {"length", "fuzzle", "x", "0"};
for (size_t i = 0; i < arraysize(properties); i++) {
bool expected_value = (i == 0);
- BytecodeArrayBuilder builder(zone, 1, 1);
+ FeedbackVectorSpec feedback_spec(zone);
+ BytecodeArrayBuilder builder(zone, 1, 1, &feedback_spec);
Register r0(0);
builder.LoadLiteral(ast_factory.GetOneByteString(properties[i]))
.StoreAccumulatorInRegister(r0);
+ FeedbackSlot slot = feedback_spec.AddKeyedHasICSlot();
+ Handle<i::FeedbackMetadata> metadata =
+ NewFeedbackMetadata(isolate, &feedback_spec);
+
size_t array_entry = builder.AllocateDeferredConstantPoolEntry();
builder.SetDeferredConstantPoolEntry(array_entry, array);
builder.LoadConstantPoolEntry(array_entry)
- .CompareOperation(Token::Value::IN, r0)
+ .CompareOperation(Token::Value::IN, r0, GetIndex(slot))
.Return();
ast_factory.Internalize(isolate);
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
@@ -2324,7 +2333,7 @@ TEST(InterpreterUnaryNotNonBoolean) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
std::pair<LiteralForTest, bool> object_type_tuples[] = {
std::make_pair(LiteralForTest(LiteralForTest::kUndefined), true),
@@ -4946,7 +4955,7 @@ TEST(InterpreterIllegalConstDeclaration) {
std::pair<const char*, const char*> const_decl[] = {
{"const x = x = 10 + 3; return x;",
- "Uncaught ReferenceError: x is not defined"},
+ "Uncaught ReferenceError: Cannot access 'x' before initialization"},
{"const x = 10; x = 20; return x;",
"Uncaught TypeError: Assignment to constant variable."},
{"const x = 10; { x = 20; } return x;",
@@ -4954,7 +4963,7 @@ TEST(InterpreterIllegalConstDeclaration) {
{"const x = 10; eval('x = 20;'); return x;",
"Uncaught TypeError: Assignment to constant variable."},
{"let x = x + 10; return x;",
- "Uncaught ReferenceError: x is not defined"},
+ "Uncaught ReferenceError: Cannot access 'x' before initialization"},
{"'use strict'; (function f1() { f1 = 123; })() ",
"Uncaught TypeError: Assignment to constant variable."},
};
@@ -5061,6 +5070,82 @@ TEST(InterpreterGetBytecodeHandler) {
CHECK_EQ(add_wide_handler->builtin_index(), Builtins::kAddWideHandler);
}
+TEST(InterpreterCollectSourcePositions) {
+ FLAG_enable_lazy_source_positions = true;
+ HandleAndZoneScope handles;
+ Isolate* isolate = handles.main_isolate();
+
+ const char* source =
+ "(function () {\n"
+ " return 1;\n"
+ "})";
+
+ Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(source))));
+
+ Handle<SharedFunctionInfo> sfi = handle(function->shared(), isolate);
+ Handle<BytecodeArray> bytecode_array =
+ handle(sfi->GetBytecodeArray(), isolate);
+ ByteArray source_position_table = bytecode_array->SourcePositionTable();
+ CHECK_EQ(source_position_table->length(), 0);
+
+ Compiler::CollectSourcePositions(isolate, sfi);
+
+ source_position_table = bytecode_array->SourcePositionTable();
+ CHECK_GT(source_position_table->length(), 0);
+}
+
+namespace {
+
+void CheckStringEqual(const char* expected_ptr, Handle<Object> actual_handle) {
+ v8::String::Utf8Value utf8(
+ v8::Isolate::GetCurrent(),
+ v8::Utils::ToLocal(Handle<String>::cast(actual_handle)));
+ std::string expected(expected_ptr);
+ std::string actual(*utf8);
+ CHECK_EQ(expected, actual);
+}
+
+} // namespace
+
+TEST(InterpreterCollectSourcePositions_GenerateStackTrace) {
+ FLAG_enable_lazy_source_positions = true;
+ HandleAndZoneScope handles;
+ Isolate* isolate = handles.main_isolate();
+
+ const char* source =
+ R"javascript(
+ (function () {
+ try {
+ throw new Error();
+ } catch (e) {
+ return e.stack;
+ }
+ });
+ )javascript";
+
+ Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(source))));
+
+ Handle<SharedFunctionInfo> sfi = handle(function->shared(), isolate);
+ Handle<BytecodeArray> bytecode_array =
+ handle(sfi->GetBytecodeArray(), isolate);
+ ByteArray source_position_table = bytecode_array->SourcePositionTable();
+ CHECK_EQ(source_position_table->length(), 0);
+
+ {
+ Handle<Object> result =
+ Execution::Call(isolate, function,
+ ReadOnlyRoots(isolate).undefined_value_handle(), 0,
+ nullptr)
+ .ToHandleChecked();
+ CheckStringEqual("Error\n at <anonymous>:4:17", result);
+ }
+
+ source_position_table = bytecode_array->SourcePositionTable();
+ CHECK_GT(source_position_table->length(), 0);
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/interpreter/test-source-positions.cc b/deps/v8/test/cctest/interpreter/test-source-positions.cc
index 2a8e354e54..ccdbd53558 100644
--- a/deps/v8/test/cctest/interpreter/test-source-positions.cc
+++ b/deps/v8/test/cctest/interpreter/test-source-positions.cc
@@ -113,6 +113,7 @@ class OptimizedBytecodeSourcePositionTester final {
SaveOptimizationFlags();
saved_flag_always_opt_ = FLAG_always_opt;
FLAG_always_opt = false;
+ FLAG_enable_lazy_source_positions = false;
}
~OptimizedBytecodeSourcePositionTester() {
diff --git a/deps/v8/test/cctest/libplatform/test-tracing.cc b/deps/v8/test/cctest/libplatform/test-tracing.cc
index b949785bcf..3b449f4b09 100644
--- a/deps/v8/test/cctest/libplatform/test-tracing.cc
+++ b/deps/v8/test/cctest/libplatform/test-tracing.cc
@@ -4,6 +4,7 @@
#include <limits>
#include "include/libplatform/v8-tracing.h"
+#include "src/base/platform/platform.h"
#include "src/libplatform/default-platform.h"
#include "src/tracing/trace-event.h"
#include "test/cctest/cctest.h"
@@ -439,6 +440,59 @@ TEST(TracingObservers) {
i::V8::SetPlatformForTesting(old_platform);
}
+class TraceWritingThread : public base::Thread {
+ public:
+ TraceWritingThread(
+ v8::platform::tracing::TracingController* tracing_controller)
+ : base::Thread(base::Thread::Options("TraceWritingThread")),
+ tracing_controller_(tracing_controller) {}
+
+ void Run() override {
+ for (int i = 0; i < 1000; i++) {
+ TRACE_EVENT0("v8", "v8.Test");
+ tracing_controller_->AddTraceEvent('A', nullptr, "v8", "", 1, 1, 0,
+ nullptr, nullptr, nullptr, nullptr, 0);
+ tracing_controller_->AddTraceEventWithTimestamp('A', nullptr, "v8", "", 1,
+ 1, 0, nullptr, nullptr,
+ nullptr, nullptr, 0, 0);
+ base::OS::Sleep(base::TimeDelta::FromMilliseconds(1));
+ }
+ }
+
+ private:
+ v8::platform::tracing::TracingController* tracing_controller_;
+};
+
+TEST(AddTraceEventMultiThreaded) {
+ v8::Platform* old_platform = i::V8::GetCurrentPlatform();
+ std::unique_ptr<v8::Platform> default_platform(
+ v8::platform::NewDefaultPlatform());
+ i::V8::SetPlatformForTesting(default_platform.get());
+
+ auto tracing = base::make_unique<v8::platform::tracing::TracingController>();
+ v8::platform::tracing::TracingController* tracing_controller = tracing.get();
+ static_cast<v8::platform::DefaultPlatform*>(default_platform.get())
+ ->SetTracingController(std::move(tracing));
+
+ MockTraceWriter* writer = new MockTraceWriter();
+ TraceBuffer* ring_buffer =
+ TraceBuffer::CreateTraceBufferRingBuffer(1, writer);
+ tracing_controller->Initialize(ring_buffer);
+ TraceConfig* trace_config = new TraceConfig();
+ trace_config->AddIncludedCategory("v8");
+ tracing_controller->StartTracing(trace_config);
+
+ TraceWritingThread thread(tracing_controller);
+ thread.StartSynchronously();
+
+ base::OS::Sleep(base::TimeDelta::FromMilliseconds(100));
+ tracing_controller->StopTracing();
+
+ thread.Join();
+
+ i::V8::SetPlatformForTesting(old_platform);
+}
+
} // namespace tracing
} // namespace platform
} // namespace v8
diff --git a/deps/v8/test/cctest/libsampler/test-sampler.cc b/deps/v8/test/cctest/libsampler/test-sampler.cc
index e00861ddcf..fdb9bbda89 100644
--- a/deps/v8/test/cctest/libsampler/test-sampler.cc
+++ b/deps/v8/test/cctest/libsampler/test-sampler.cc
@@ -141,6 +141,7 @@ class CountingSampler : public Sampler {
int sample_count() { return sample_count_; }
void set_active(bool active) { SetActive(active); }
+ void set_should_record_sample() { SetShouldRecordSample(); }
private:
int sample_count_ = 0;
@@ -153,6 +154,7 @@ TEST(SamplerManager_AddRemoveSampler) {
SamplerManager* manager = SamplerManager::instance();
CountingSampler sampler1(isolate);
sampler1.set_active(true);
+ sampler1.set_should_record_sample();
CHECK_EQ(0, sampler1.sample_count());
manager->AddSampler(&sampler1);
@@ -162,6 +164,7 @@ TEST(SamplerManager_AddRemoveSampler) {
CHECK_EQ(1, sampler1.sample_count());
sampler1.set_active(true);
+ sampler1.set_should_record_sample();
manager->RemoveSampler(&sampler1);
sampler1.set_active(false);
@@ -177,6 +180,7 @@ TEST(SamplerManager_DoesNotReAdd) {
SamplerManager* manager = SamplerManager::instance();
CountingSampler sampler1(isolate);
sampler1.set_active(true);
+ sampler1.set_should_record_sample();
manager->AddSampler(&sampler1);
manager->AddSampler(&sampler1);
diff --git a/deps/v8/test/cctest/parsing/test-preparser.cc b/deps/v8/test/cctest/parsing/test-preparser.cc
index 4d2aba768c..64dd802c64 100644
--- a/deps/v8/test/cctest/parsing/test-preparser.cc
+++ b/deps/v8/test/cctest/parsing/test-preparser.cc
@@ -804,6 +804,14 @@ TEST(ProducingAndConsumingByteData) {
std::vector<uint8_t> buffer;
i::PreparseDataBuilder::ByteData bytes;
bytes.Start(&buffer);
+
+ bytes.Reserve(32);
+ bytes.Reserve(32);
+ CHECK_EQ(buffer.size(), 32);
+ const int kBufferSize = 64;
+ bytes.Reserve(kBufferSize);
+ CHECK_EQ(buffer.size(), kBufferSize);
+
// Write some data.
#ifdef DEBUG
bytes.WriteUint32(1983); // This will be overwritten.
@@ -818,7 +826,8 @@ TEST(ProducingAndConsumingByteData) {
#ifdef DEBUG
bytes.SaveCurrentSizeAtFirstUint32();
int saved_size = 21;
- CHECK_EQ(buffer.size(), saved_size);
+ CHECK_EQ(buffer.size(), kBufferSize);
+ CHECK_EQ(bytes.length(), saved_size);
#endif
bytes.WriteUint8(100);
// Write quarter bytes between uint8s and uint32s to verify they're stored
@@ -845,11 +854,14 @@ TEST(ProducingAndConsumingByteData) {
// End with a lonely quarter.
bytes.WriteQuarter(2);
+ CHECK_EQ(buffer.size(), 64);
#ifdef DEBUG
- CHECK_EQ(buffer.size(), 42);
+ const int kDataSize = 42;
#else
- CHECK_EQ(buffer.size(), 21);
+ const int kDataSize = 21;
#endif
+ CHECK_EQ(bytes.length(), kDataSize);
+ CHECK_EQ(buffer.size(), kBufferSize);
// Copy buffer for sanity checks later-on.
std::vector<uint8_t> copied_buffer(buffer);
@@ -858,7 +870,7 @@ TEST(ProducingAndConsumingByteData) {
// serialization.
bytes.Finalize(&zone);
CHECK_EQ(buffer.size(), 0);
- CHECK_LT(0, copied_buffer.size());
+ CHECK_EQ(copied_buffer.size(), kBufferSize);
{
// Serialize as a ZoneConsumedPreparseData, and read back data.
@@ -868,7 +880,9 @@ TEST(ProducingAndConsumingByteData) {
i::ZoneConsumedPreparseData::ByteData::ReadingScope reading_scope(
&bytes_for_reading, wrapper);
- for (int i = 0; i < static_cast<int>(copied_buffer.size()); i++) {
+ CHECK_EQ(wrapper.data_length(), kDataSize);
+
+ for (int i = 0; i < kDataSize; i++) {
CHECK_EQ(copied_buffer.at(i), wrapper.get(i));
}
@@ -910,13 +924,13 @@ TEST(ProducingAndConsumingByteData) {
{
// Serialize as an OnHeapConsumedPreparseData, and read back data.
i::Handle<i::PreparseData> data_on_heap = bytes.CopyToHeap(isolate, 0);
- CHECK_EQ(copied_buffer.size(), data_on_heap->data_length());
+ CHECK_EQ(data_on_heap->data_length(), kDataSize);
CHECK_EQ(data_on_heap->children_length(), 0);
i::OnHeapConsumedPreparseData::ByteData bytes_for_reading;
i::OnHeapConsumedPreparseData::ByteData::ReadingScope reading_scope(
&bytes_for_reading, *data_on_heap);
- for (int i = 0; i < static_cast<int>(copied_buffer.size()); i++) {
+ for (int i = 0; i < kDataSize; i++) {
CHECK_EQ(copied_buffer[i], data_on_heap->get(i));
}
diff --git a/deps/v8/test/cctest/parsing/test-scanner-streams.cc b/deps/v8/test/cctest/parsing/test-scanner-streams.cc
index ef3d0f7df8..ec6c2bc10b 100644
--- a/deps/v8/test/cctest/parsing/test-scanner-streams.cc
+++ b/deps/v8/test/cctest/parsing/test-scanner-streams.cc
@@ -47,7 +47,9 @@ class ChunkSource : public v8::ScriptCompiler::ExternalSourceStream {
DCHECK_LT(current_, chunks_.size());
Chunk& next = chunks_[current_++];
uint8_t* chunk = new uint8_t[next.len];
- i::MemMove(chunk, next.ptr, next.len);
+ if (next.len > 0) {
+ i::MemMove(chunk, next.ptr, next.len);
+ }
*src = chunk;
return next.len;
}
@@ -164,6 +166,20 @@ TEST(Utf8StreamAsciiOnly) {
} while (c != v8::internal::Utf16CharacterStream::kEndOfInput);
}
+TEST(Utf8StreamMaxNonSurrogateCharCode) {
+ const char* chunks[] = {"\uffff\uffff", ""};
+ ChunkSource chunk_source(chunks);
+ std::unique_ptr<v8::internal::Utf16CharacterStream> stream(
+ v8::internal::ScannerStream::For(
+ &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8));
+
+ // Read the correct character.
+ uint16_t max = unibrow::Utf16::kMaxNonSurrogateCharCode;
+ CHECK_EQ(max, static_cast<uint32_t>(stream->Advance()));
+ CHECK_EQ(max, static_cast<uint32_t>(stream->Advance()));
+ CHECK_EQ(i::Utf16CharacterStream::kEndOfInput, stream->Advance());
+}
+
TEST(Utf8StreamBOM) {
// Construct test string w/ UTF-8 BOM (byte order mark)
char data[3 + arraysize(unicode_utf8)] = {"\xef\xbb\xbf"};
diff --git a/deps/v8/test/cctest/scope-test-helper.h b/deps/v8/test/cctest/scope-test-helper.h
index a10d8af96f..c733f9dbf5 100644
--- a/deps/v8/test/cctest/scope-test-helper.h
+++ b/deps/v8/test/cctest/scope-test-helper.h
@@ -24,16 +24,14 @@ class ScopeTestHelper {
baseline->AsDeclarationScope()->function_kind() ==
scope->AsDeclarationScope()->function_kind());
- if (!PreparseDataBuilder::ScopeNeedsData(baseline)) {
- return;
- }
+ if (!PreparseDataBuilder::ScopeNeedsData(baseline)) return;
if (scope->is_declaration_scope() &&
scope->AsDeclarationScope()->is_skipped_function()) {
return;
}
- if (baseline->scope_type() == ScopeType::FUNCTION_SCOPE) {
+ if (baseline->is_function_scope()) {
Variable* function = baseline->AsDeclarationScope()->function_var();
if (function != nullptr) {
CompareVariables(function, scope->AsDeclarationScope()->function_var(),
@@ -99,7 +97,7 @@ class ScopeTestHelper {
static void MarkInnerFunctionsAsSkipped(Scope* scope) {
for (Scope* inner = scope->inner_scope(); inner != nullptr;
inner = inner->sibling()) {
- if (inner->scope_type() == ScopeType::FUNCTION_SCOPE &&
+ if (inner->is_function_scope() &&
!inner->AsDeclarationScope()->is_arrow_scope()) {
inner->AsDeclarationScope()->set_is_skipped_function(true);
}
@@ -108,15 +106,13 @@ class ScopeTestHelper {
}
static bool HasSkippedFunctionInside(Scope* scope) {
- if (scope->scope_type() == ScopeType::FUNCTION_SCOPE &&
+ if (scope->is_function_scope() &&
scope->AsDeclarationScope()->is_skipped_function()) {
return true;
}
for (Scope* inner = scope->inner_scope(); inner != nullptr;
inner = inner->sibling()) {
- if (HasSkippedFunctionInside(inner)) {
- return true;
- }
+ if (HasSkippedFunctionInside(inner)) return true;
}
return false;
}
diff --git a/deps/v8/test/cctest/test-allocation.cc b/deps/v8/test/cctest/test-allocation.cc
index d5ba49c537..dd06535a98 100644
--- a/deps/v8/test/cctest/test-allocation.cc
+++ b/deps/v8/test/cctest/test-allocation.cc
@@ -99,7 +99,8 @@ TEST(AccountingAllocatorOOM) {
AllocationPlatform platform;
v8::internal::AccountingAllocator allocator;
CHECK(!platform.oom_callback_called);
- v8::internal::Segment* result = allocator.GetSegment(GetHugeMemoryAmount());
+ v8::internal::Segment* result =
+ allocator.AllocateSegment(GetHugeMemoryAmount());
// On a few systems, allocation somehow succeeds.
CHECK_EQ(result == nullptr, platform.oom_callback_called);
}
diff --git a/deps/v8/test/cctest/test-api-interceptors.cc b/deps/v8/test/cctest/test-api-interceptors.cc
index 2ca473dea7..41678032af 100644
--- a/deps/v8/test/cctest/test-api-interceptors.cc
+++ b/deps/v8/test/cctest/test-api-interceptors.cc
@@ -470,6 +470,9 @@ THREADED_TEST(QueryInterceptor) {
v8_compile("Object.isFrozen('obj.x');")->Run(env.local()).ToLocalChecked();
CHECK_EQ(8, query_counter_int);
+
+ v8_compile("'x' in obj;")->Run(env.local()).ToLocalChecked();
+ CHECK_EQ(9, query_counter_int);
}
namespace {
@@ -874,15 +877,14 @@ THREADED_TEST(InterceptorHasOwnPropertyCausingGC) {
CHECK(!value->BooleanValue(isolate));
}
-
-static void CheckInterceptorLoadIC(
- v8::GenericNamedPropertyGetterCallback getter, const char* source,
- int expected) {
+static void CheckInterceptorIC(v8::GenericNamedPropertyGetterCallback getter,
+ v8::GenericNamedPropertyQueryCallback query,
+ const char* source, int expected) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::Local<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- getter, nullptr, nullptr, nullptr, nullptr, v8_str("data")));
+ getter, nullptr, query, nullptr, nullptr, v8_str("data")));
LocalContext context;
context->Global()
->Set(context.local(), v8_str("o"),
@@ -892,6 +894,11 @@ static void CheckInterceptorLoadIC(
CHECK_EQ(expected, value->Int32Value(context.local()).FromJust());
}
+static void CheckInterceptorLoadIC(
+ v8::GenericNamedPropertyGetterCallback getter, const char* source,
+ int expected) {
+ CheckInterceptorIC(getter, nullptr, source, expected);
+}
static void InterceptorLoadICGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
@@ -1432,6 +1439,92 @@ THREADED_TEST(InterceptorReturningZero) {
0);
}
+namespace {
+
+template <typename TKey, v8::internal::PropertyAttributes attribute>
+void HasICQuery(TKey name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ ApiTestFuzzer::Fuzz();
+ v8::Isolate* isolate = CcTest::isolate();
+ CHECK_EQ(isolate, info.GetIsolate());
+ info.GetReturnValue().Set(v8::Integer::New(isolate, attribute));
+}
+
+template <typename TKey>
+void HasICQueryToggle(TKey name,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ ApiTestFuzzer::Fuzz();
+ static bool toggle = false;
+ toggle = !toggle;
+ v8::Isolate* isolate = CcTest::isolate();
+ CHECK_EQ(isolate, info.GetIsolate());
+ info.GetReturnValue().Set(v8::Integer::New(
+ isolate, toggle ? v8::internal::ABSENT : v8::internal::NONE));
+}
+
+int named_query_counter = 0;
+void NamedQueryCallback(Local<Name> name,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ named_query_counter++;
+}
+
+} // namespace
+
+THREADED_TEST(InterceptorHasIC) {
+ named_query_counter = 0;
+ CheckInterceptorIC(nullptr, NamedQueryCallback,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " 'x' in o;"
+ "}",
+ 0);
+ CHECK_EQ(1000, named_query_counter);
+}
+
+THREADED_TEST(InterceptorHasICQueryAbsent) {
+ CheckInterceptorIC(nullptr, HasICQuery<Local<Name>, v8::internal::ABSENT>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if ('x' in o) ++result;"
+ "}",
+ 0);
+}
+
+THREADED_TEST(InterceptorHasICQueryNone) {
+ CheckInterceptorIC(nullptr, HasICQuery<Local<Name>, v8::internal::NONE>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if ('x' in o) ++result;"
+ "}",
+ 1000);
+}
+
+THREADED_TEST(InterceptorHasICGetter) {
+ CheckInterceptorIC(InterceptorLoadICGetter, nullptr,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if ('x' in o) ++result;"
+ "}",
+ 1000);
+}
+
+THREADED_TEST(InterceptorHasICQueryGetter) {
+ CheckInterceptorIC(InterceptorLoadICGetter,
+ HasICQuery<Local<Name>, v8::internal::ABSENT>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if ('x' in o) ++result;"
+ "}",
+ 0);
+}
+
+THREADED_TEST(InterceptorHasICQueryToggle) {
+ CheckInterceptorIC(InterceptorLoadICGetter, HasICQueryToggle<Local<Name>>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if ('x' in o) ++result;"
+ "}",
+ 500);
+}
static void InterceptorStoreICSetter(
Local<Name> key, Local<Value> value,
@@ -3273,6 +3366,101 @@ THREADED_TEST(IndexedInterceptorOnProto) {
ExpectString(code, "PASSED");
}
+namespace {
+
+void CheckIndexedInterceptorHasIC(v8::IndexedPropertyGetterCallback getter,
+ v8::IndexedPropertyQueryCallback query,
+ const char* source, int expected) {
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
+ templ->SetHandler(v8::IndexedPropertyHandlerConfiguration(
+ getter, nullptr, query, nullptr, nullptr, v8_str("data")));
+ LocalContext context;
+ context->Global()
+ ->Set(context.local(), v8_str("o"),
+ templ->NewInstance(context.local()).ToLocalChecked())
+ .FromJust();
+ v8::Local<Value> value = CompileRun(source);
+ CHECK_EQ(expected, value->Int32Value(context.local()).FromJust());
+}
+
+int indexed_query_counter = 0;
+void IndexedQueryCallback(uint32_t index,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ indexed_query_counter++;
+}
+
+void IndexHasICQueryAbsent(uint32_t index,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ ApiTestFuzzer::Fuzz();
+ v8::Isolate* isolate = CcTest::isolate();
+ CHECK_EQ(isolate, info.GetIsolate());
+ info.GetReturnValue().Set(v8::Integer::New(isolate, v8::internal::ABSENT));
+}
+
+} // namespace
+
+THREADED_TEST(IndexedInterceptorHasIC) {
+ indexed_query_counter = 0;
+ CheckIndexedInterceptorHasIC(nullptr, IndexedQueryCallback,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " i in o;"
+ "}",
+ 0);
+ CHECK_EQ(1000, indexed_query_counter);
+}
+
+THREADED_TEST(IndexedInterceptorHasICQueryAbsent) {
+ CheckIndexedInterceptorHasIC(nullptr,
+ // HasICQuery<uint32_t, v8::internal::ABSENT>,
+ IndexHasICQueryAbsent,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if (i in o) ++result;"
+ "}",
+ 0);
+}
+
+THREADED_TEST(IndexedInterceptorHasICQueryNone) {
+ CheckIndexedInterceptorHasIC(nullptr,
+ HasICQuery<uint32_t, v8::internal::NONE>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if (i in o) ++result;"
+ "}",
+ 1000);
+}
+
+THREADED_TEST(IndexedInterceptorHasICGetter) {
+ CheckIndexedInterceptorHasIC(IdentityIndexedPropertyGetter, nullptr,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if (i in o) ++result;"
+ "}",
+ 1000);
+}
+
+THREADED_TEST(IndexedInterceptorHasICQueryGetter) {
+ CheckIndexedInterceptorHasIC(IdentityIndexedPropertyGetter,
+ HasICQuery<uint32_t, v8::internal::ABSENT>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if (i in o) ++result;"
+ "}",
+ 0);
+}
+
+THREADED_TEST(IndexedInterceptorHasICQueryToggle) {
+ CheckIndexedInterceptorHasIC(IdentityIndexedPropertyGetter,
+ HasICQueryToggle<uint32_t>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if (i in o) ++result;"
+ "}",
+ 500);
+}
static void NoBlockGetterX(Local<Name> name,
const v8::PropertyCallbackInfo<v8::Value>&) {}
diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc
index 6615f1583a..9dfe1155d9 100644
--- a/deps/v8/test/cctest/test-api.cc
+++ b/deps/v8/test/cctest/test-api.cc
@@ -45,8 +45,11 @@
#include "src/compilation-cache.h"
#include "src/debug/debug.h"
#include "src/execution.h"
+#include "src/feedback-vector-inl.h"
+#include "src/feedback-vector.h"
#include "src/futex-emulation.h"
#include "src/global-handles.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/local-allocator.h"
#include "src/lookup.h"
@@ -62,6 +65,8 @@
#include "src/wasm/wasm-js.h"
#include "test/cctest/heap/heap-tester.h"
#include "test/cctest/heap/heap-utils.h"
+#include "test/cctest/wasm/wasm-run-utils.h"
+#include "test/common/wasm/wasm-macro-gen.h"
static const bool kLogThreading = false;
@@ -619,6 +624,13 @@ TEST(MakingExternalStringConditions) {
CcTest::CollectGarbage(i::NEW_SPACE);
uint16_t* two_byte_string = AsciiToTwoByteString("s1");
+ Local<String> tiny_local_string =
+ String::NewFromTwoByte(env->GetIsolate(), two_byte_string,
+ v8::NewStringType::kNormal)
+ .ToLocalChecked();
+ i::DeleteArray(two_byte_string);
+
+ two_byte_string = AsciiToTwoByteString("s1234");
Local<String> local_string =
String::NewFromTwoByte(env->GetIsolate(), two_byte_string,
v8::NewStringType::kNormal)
@@ -632,6 +644,11 @@ TEST(MakingExternalStringConditions) {
CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now
// Old space strings should be accepted.
CHECK(local_string->CanMakeExternal());
+
+ // Tiny strings are not in-place externalizable when pointer compression is
+ // enabled.
+ CHECK_EQ(i::kTaggedSize == i::kSystemPointerSize,
+ tiny_local_string->CanMakeExternal());
}
@@ -643,7 +660,8 @@ TEST(MakingExternalOneByteStringConditions) {
CcTest::CollectGarbage(i::NEW_SPACE);
CcTest::CollectGarbage(i::NEW_SPACE);
- Local<String> local_string = v8_str("s1");
+ Local<String> tiny_local_string = v8_str("s");
+ Local<String> local_string = v8_str("s1234");
// We should refuse to externalize new space strings.
CHECK(!local_string->CanMakeExternal());
// Trigger GCs so that the newly allocated string moves to old gen.
@@ -651,6 +669,11 @@ TEST(MakingExternalOneByteStringConditions) {
CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now
// Old space strings should be accepted.
CHECK(local_string->CanMakeExternal());
+
+ // Tiny strings are not in-place externalizable when pointer compression is
+ // enabled.
+ CHECK_EQ(i::kTaggedSize == i::kSystemPointerSize,
+ tiny_local_string->CanMakeExternal());
}
@@ -786,7 +809,7 @@ TEST(ScavengeExternalString) {
i::FLAG_stress_compaction = false;
i::FLAG_gc_global = false;
int dispose_count = 0;
- bool in_new_space = false;
+ bool in_young_generation = false;
{
v8::HandleScope scope(CcTest::isolate());
uint16_t* two_byte_string = AsciiToTwoByteString("test string");
@@ -797,11 +820,12 @@ TEST(ScavengeExternalString) {
.ToLocalChecked();
i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
CcTest::CollectGarbage(i::NEW_SPACE);
- in_new_space = i::Heap::InNewSpace(*istring);
- CHECK(in_new_space || CcTest::heap()->old_space()->Contains(*istring));
+ in_young_generation = i::Heap::InYoungGeneration(*istring);
+ CHECK_IMPLIES(!in_young_generation,
+ CcTest::heap()->old_space()->Contains(*istring));
CHECK_EQ(0, dispose_count);
}
- CcTest::CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_SPACE);
+ CcTest::CollectGarbage(in_young_generation ? i::NEW_SPACE : i::OLD_SPACE);
CHECK_EQ(1, dispose_count);
}
@@ -810,7 +834,7 @@ TEST(ScavengeExternalOneByteString) {
i::FLAG_stress_compaction = false;
i::FLAG_gc_global = false;
int dispose_count = 0;
- bool in_new_space = false;
+ bool in_young_generation = false;
{
v8::HandleScope scope(CcTest::isolate());
const char* one_byte_string = "test string";
@@ -821,11 +845,12 @@ TEST(ScavengeExternalOneByteString) {
.ToLocalChecked();
i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
CcTest::CollectGarbage(i::NEW_SPACE);
- in_new_space = i::Heap::InNewSpace(*istring);
- CHECK(in_new_space || CcTest::heap()->old_space()->Contains(*istring));
+ in_young_generation = i::Heap::InYoungGeneration(*istring);
+ CHECK_IMPLIES(!in_young_generation,
+ CcTest::heap()->old_space()->Contains(*istring));
CHECK_EQ(0, dispose_count);
}
- CcTest::CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_SPACE);
+ CcTest::CollectGarbage(in_young_generation ? i::NEW_SPACE : i::OLD_SPACE);
CHECK_EQ(1, dispose_count);
}
@@ -2813,7 +2838,7 @@ TEST(InternalFieldsSubclassing) {
if (in_object_only) {
CHECK_LE(nof_properties, i_value->map()->GetInObjectProperties());
} else {
- CHECK_LE(kMaxNofProperties, i_value->map()->GetInObjectProperties());
+ CHECK_LE(i_value->map()->GetInObjectProperties(), kMaxNofProperties);
}
// Make Sure we get the precise property count.
@@ -2824,7 +2849,7 @@ TEST(InternalFieldsSubclassing) {
if (in_object_only) {
CHECK_EQ(nof_properties, i_value->map()->GetInObjectProperties());
} else {
- CHECK_LE(kMaxNofProperties, i_value->map()->GetInObjectProperties());
+ CHECK_LE(i_value->map()->GetInObjectProperties(), kMaxNofProperties);
}
}
}
@@ -7361,7 +7386,8 @@ static const char* kSimpleExtensionSource =
TEST(SimpleExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(new Extension("simpletest", kSimpleExtensionSource));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("simpletest", kSimpleExtensionSource));
const char* extension_names[] = {"simpletest"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7383,8 +7409,8 @@ static const char* kStackTraceFromExtensionSource =
TEST(StackTraceInExtension) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(
- new Extension("stacktracetest", kStackTraceFromExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ "stacktracetest", kStackTraceFromExtensionSource));
const char* extension_names[] = {"stacktracetest"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7401,7 +7427,7 @@ TEST(StackTraceInExtension) {
TEST(NullExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(new Extension("nulltest", nullptr));
+ v8::RegisterExtension(v8::base::make_unique<Extension>("nulltest", nullptr));
const char* extension_names[] = {"nulltest"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7419,8 +7445,8 @@ static const int kEmbeddedExtensionSourceValidLen = 34;
TEST(ExtensionMissingSourceLength) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(
- new Extension("srclentest_fail", kEmbeddedExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ "srclentest_fail", kEmbeddedExtensionSource));
const char* extension_names[] = {"srclentest_fail"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7434,9 +7460,9 @@ TEST(ExtensionWithSourceLength) {
v8::HandleScope handle_scope(CcTest::isolate());
i::ScopedVector<char> extension_name(32);
i::SNPrintF(extension_name, "ext #%d", source_len);
- v8::RegisterExtension(new Extension(extension_name.start(),
- kEmbeddedExtensionSource, 0, nullptr,
- source_len));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ extension_name.start(), kEmbeddedExtensionSource, 0, nullptr,
+ source_len));
const char* extension_names[1] = {extension_name.start()};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7473,8 +7499,10 @@ static const char* kEvalExtensionSource2 =
TEST(UseEvalFromExtension) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(new Extension("evaltest1", kEvalExtensionSource1));
- v8::RegisterExtension(new Extension("evaltest2", kEvalExtensionSource2));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("evaltest1", kEvalExtensionSource1));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("evaltest2", kEvalExtensionSource2));
const char* extension_names[] = {"evaltest1", "evaltest2"};
v8::ExtensionConfiguration extensions(2, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7507,8 +7535,10 @@ static const char* kWithExtensionSource2 =
TEST(UseWithFromExtension) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(new Extension("withtest1", kWithExtensionSource1));
- v8::RegisterExtension(new Extension("withtest2", kWithExtensionSource2));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("withtest1", kWithExtensionSource1));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("withtest2", kWithExtensionSource2));
const char* extension_names[] = {"withtest1", "withtest2"};
v8::ExtensionConfiguration extensions(2, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7524,9 +7554,10 @@ TEST(UseWithFromExtension) {
TEST(AutoExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- Extension* extension = new Extension("autotest", kSimpleExtensionSource);
+ auto extension =
+ v8::base::make_unique<Extension>("autotest", kSimpleExtensionSource);
extension->set_auto_enable(true);
- v8::RegisterExtension(extension);
+ v8::RegisterExtension(std::move(extension));
v8::Local<Context> context = Context::New(CcTest::isolate());
Context::Scope lock(context);
v8::Local<Value> result = CompileRun("Foo()");
@@ -7542,8 +7573,8 @@ static const char* kSyntaxErrorInExtensionSource = "[";
// error but results in an empty context.
TEST(SyntaxErrorExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(
- new Extension("syntaxerror", kSyntaxErrorInExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ "syntaxerror", kSyntaxErrorInExtensionSource));
const char* extension_names[] = {"syntaxerror"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7558,8 +7589,8 @@ static const char* kExceptionInExtensionSource = "throw 42";
// a fatal error but results in an empty context.
TEST(ExceptionExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(
- new Extension("exception", kExceptionInExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ "exception", kExceptionInExtensionSource));
const char* extension_names[] = {"exception"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7577,8 +7608,8 @@ static const char* kNativeCallTest =
// Test that a native runtime calls are supported in extensions.
TEST(NativeCallInExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(
- new Extension("nativecall", kNativeCallInExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ "nativecall", kNativeCallInExtensionSource));
const char* extension_names[] = {"nativecall"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7612,8 +7643,8 @@ class NativeFunctionExtension : public Extension {
TEST(NativeFunctionDeclaration) {
v8::HandleScope handle_scope(CcTest::isolate());
const char* name = "nativedecl";
- v8::RegisterExtension(
- new NativeFunctionExtension(name, "native function foo();"));
+ v8::RegisterExtension(v8::base::make_unique<NativeFunctionExtension>(
+ name, "native function foo();"));
const char* extension_names[] = {name};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7628,8 +7659,8 @@ TEST(NativeFunctionDeclarationError) {
v8::HandleScope handle_scope(CcTest::isolate());
const char* name = "nativedeclerr";
// Syntax error in extension code.
- v8::RegisterExtension(
- new NativeFunctionExtension(name, "native\nfunction foo();"));
+ v8::RegisterExtension(v8::base::make_unique<NativeFunctionExtension>(
+ name, "native\nfunction foo();"));
const char* extension_names[] = {name};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7642,8 +7673,8 @@ TEST(NativeFunctionDeclarationErrorEscape) {
const char* name = "nativedeclerresc";
// Syntax error in extension code - escape code in "native" means that
// it's not treated as a keyword.
- v8::RegisterExtension(
- new NativeFunctionExtension(name, "nativ\\u0065 function foo();"));
+ v8::RegisterExtension(v8::base::make_unique<NativeFunctionExtension>(
+ name, "nativ\\u0065 function foo();"));
const char* extension_names[] = {name};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7673,13 +7704,18 @@ static void CheckDependencies(const char* name, const char* expected) {
*/
THREADED_TEST(ExtensionDependency) {
static const char* kEDeps[] = {"D"};
- v8::RegisterExtension(new Extension("E", "this.loaded += 'E';", 1, kEDeps));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("E", "this.loaded += 'E';", 1, kEDeps));
static const char* kDDeps[] = {"B", "C"};
- v8::RegisterExtension(new Extension("D", "this.loaded += 'D';", 2, kDDeps));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("D", "this.loaded += 'D';", 2, kDDeps));
static const char* kBCDeps[] = {"A"};
- v8::RegisterExtension(new Extension("B", "this.loaded += 'B';", 1, kBCDeps));
- v8::RegisterExtension(new Extension("C", "this.loaded += 'C';", 1, kBCDeps));
- v8::RegisterExtension(new Extension("A", "this.loaded += 'A';"));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("B", "this.loaded += 'B';", 1, kBCDeps));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("C", "this.loaded += 'C';", 1, kBCDeps));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("A", "this.loaded += 'A';"));
CheckDependencies("A", "undefinedA");
CheckDependencies("B", "undefinedAB");
CheckDependencies("C", "undefinedAC");
@@ -7751,7 +7787,7 @@ v8::Local<v8::FunctionTemplate> FunctionExtension::GetNativeFunctionTemplate(
THREADED_TEST(FunctionLookup) {
- v8::RegisterExtension(new FunctionExtension());
+ v8::RegisterExtension(v8::base::make_unique<FunctionExtension>());
v8::HandleScope handle_scope(CcTest::isolate());
static const char* exts[1] = {"functiontest"};
v8::ExtensionConfiguration config(1, exts);
@@ -7770,7 +7806,7 @@ THREADED_TEST(FunctionLookup) {
THREADED_TEST(NativeFunctionConstructCall) {
- v8::RegisterExtension(new FunctionExtension());
+ v8::RegisterExtension(v8::base::make_unique<FunctionExtension>());
v8::HandleScope handle_scope(CcTest::isolate());
static const char* exts[1] = {"functiontest"};
v8::ExtensionConfiguration config(1, exts);
@@ -7807,9 +7843,9 @@ void StoringErrorCallback(const char* location, const char* message) {
TEST(ErrorReporting) {
CcTest::isolate()->SetFatalErrorHandler(StoringErrorCallback);
static const char* aDeps[] = {"B"};
- v8::RegisterExtension(new Extension("A", "", 1, aDeps));
+ v8::RegisterExtension(v8::base::make_unique<Extension>("A", "", 1, aDeps));
static const char* bDeps[] = {"A"};
- v8::RegisterExtension(new Extension("B", "", 1, bDeps));
+ v8::RegisterExtension(v8::base::make_unique<Extension>("B", "", 1, bDeps));
last_location = nullptr;
v8::ExtensionConfiguration config(1, bDeps);
v8::Local<Context> context = Context::New(CcTest::isolate(), &config);
@@ -10940,7 +10976,6 @@ static void ShadowIndexedGet(uint32_t index,
static void ShadowNamedGet(Local<Name> key,
const v8::PropertyCallbackInfo<v8::Value>&) {}
-
THREADED_TEST(ShadowObject) {
shadow_y = shadow_y_setter_call_count = shadow_y_getter_call_count = 0;
v8::Isolate* isolate = CcTest::isolate();
@@ -10991,198 +11026,103 @@ THREADED_TEST(ShadowObject) {
CHECK_EQ(42, value->Int32Value(context.local()).FromJust());
}
-
-THREADED_TEST(HiddenPrototype) {
- LocalContext context;
- v8::Isolate* isolate = context->GetIsolate();
+THREADED_TEST(ShadowObjectAndDataProperty) {
+ // Lite mode doesn't make use of feedback vectors, which is what we
+ // want to ensure has the correct form.
+ if (i::FLAG_lite_mode) return;
+ // This test mimics the kind of shadow property the Chromium embedder
+ // uses for undeclared globals. The IC subsystem has special handling
+ // for this case, using a PREMONOMORPHIC state to delay entering
+ // MONOMORPHIC state until enough information is available to support
+ // efficient access and good feedback for optimization.
+ v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
- Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
- t0->InstanceTemplate()->Set(v8_str("x"), v8_num(0));
- Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
- t1->SetHiddenPrototype(true);
- t1->InstanceTemplate()->Set(v8_str("y"), v8_num(1));
- Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(isolate);
- t2->SetHiddenPrototype(true);
- t2->InstanceTemplate()->Set(v8_str("z"), v8_num(2));
- Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(isolate);
- t3->InstanceTemplate()->Set(v8_str("u"), v8_num(3));
-
- Local<v8::Object> o0 = t0->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::Object> o1 = t1->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::Object> o2 = t2->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::Object> o3 = t3->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
+ Local<ObjectTemplate> global_template = v8::ObjectTemplate::New(isolate);
+ LocalContext context(nullptr, global_template);
- // Setting the prototype on an object skips hidden prototypes.
- CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(o0->Set(context.local(), v8_str("__proto__"), o1).FromJust());
- CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(o0->Set(context.local(), v8_str("__proto__"), o2).FromJust());
- CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(2, o0->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(o0->Set(context.local(), v8_str("__proto__"), o3).FromJust());
- CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(2, o0->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(3, o0->Get(context.local(), v8_str("u"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
+ Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
+ t->InstanceTemplate()->SetHandler(
+ v8::NamedPropertyHandlerConfiguration(ShadowNamedGet));
- // Getting the prototype of o0 should get the first visible one
- // which is o3. Therefore, z should not be defined on the prototype
- // object.
- Local<Value> proto =
- o0->Get(context.local(), v8_str("__proto__")).ToLocalChecked();
- CHECK(proto->IsObject());
- CHECK(proto.As<v8::Object>()
- ->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->IsUndefined());
-}
+ Local<Value> o = t->GetFunction(context.local())
+ .ToLocalChecked()
+ ->NewInstance(context.local())
+ .ToLocalChecked();
+ CHECK(context->Global()
+ ->Set(context.local(), v8_str("__proto__"), o)
+ .FromJust());
+ CompileRun(
+ "function foo(x) { i = x; }"
+ "foo(0)");
+
+ i::Handle<i::JSFunction> foo(i::Handle<i::JSFunction>::cast(
+ v8::Utils::OpenHandle(*context->Global()
+ ->Get(context.local(), v8_str("foo"))
+ .ToLocalChecked())));
+ CHECK(foo->has_feedback_vector());
+ i::FeedbackSlot slot = i::FeedbackVector::ToSlot(0);
+ i::FeedbackNexus nexus(foo->feedback_vector(), slot);
+ CHECK_EQ(i::FeedbackSlotKind::kStoreGlobalSloppy, nexus.kind());
+ CHECK_EQ(i::PREMONOMORPHIC, nexus.ic_state());
+ CompileRun("foo(1)");
+ CHECK_EQ(i::MONOMORPHIC, nexus.ic_state());
+ // We go a bit further, checking that the form of monomorphism is
+ // a PropertyCell in the vector. This is because we want to make sure
+ // we didn't settle for a "poor man's monomorphism," such as a
+ // slow_stub bailout which would mean a trip to the runtime on all
+ // subsequent stores, and a lack of feedback for the optimizing
+ // compiler downstream.
+ i::HeapObject heap_object;
+ CHECK(nexus.GetFeedback().GetHeapObject(&heap_object));
+ CHECK(heap_object->IsPropertyCell());
+}
+
+THREADED_TEST(ShadowObjectAndDataPropertyTurbo) {
+ // This test is the same as the previous one except that it triggers
+ // optimization of {foo} after its first invocation.
+ i::FLAG_allow_natives_syntax = true;
-THREADED_TEST(HiddenPrototypeSet) {
- LocalContext context;
- v8::Isolate* isolate = context->GetIsolate();
+ if (i::FLAG_lite_mode) return;
+ v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
- Local<v8::FunctionTemplate> ot = v8::FunctionTemplate::New(isolate);
- Local<v8::FunctionTemplate> ht = v8::FunctionTemplate::New(isolate);
- ht->SetHiddenPrototype(true);
- Local<v8::FunctionTemplate> pt = v8::FunctionTemplate::New(isolate);
- ht->InstanceTemplate()->Set(v8_str("x"), v8_num(0));
-
- Local<v8::Object> o = ot->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::Object> h = ht->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::Object> p = pt->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- CHECK(o->Set(context.local(), v8_str("__proto__"), h).FromJust());
- CHECK(h->Set(context.local(), v8_str("__proto__"), p).FromJust());
-
- // Setting a property that exists on the hidden prototype goes there.
- CHECK(o->Set(context.local(), v8_str("x"), v8_num(7)).FromJust());
- CHECK_EQ(7, o->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(7, h->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(p->Get(context.local(), v8_str("x")).ToLocalChecked()->IsUndefined());
-
- // Setting a new property should not be forwarded to the hidden prototype.
- CHECK(o->Set(context.local(), v8_str("y"), v8_num(6)).FromJust());
- CHECK_EQ(6, o->Get(context.local(), v8_str("y"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(h->Get(context.local(), v8_str("y")).ToLocalChecked()->IsUndefined());
- CHECK(p->Get(context.local(), v8_str("y")).ToLocalChecked()->IsUndefined());
-
- // Setting a property that only exists on a prototype of the hidden prototype
- // is treated normally again.
- CHECK(p->Set(context.local(), v8_str("z"), v8_num(8)).FromJust());
- CHECK_EQ(8, o->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(8, h->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(8, p->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(o->Set(context.local(), v8_str("z"), v8_num(9)).FromJust());
- CHECK_EQ(9, o->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(8, h->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(8, p->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
-}
-
+ Local<ObjectTemplate> global_template = v8::ObjectTemplate::New(isolate);
+ LocalContext context(nullptr, global_template);
-// Regression test for issue 2457.
-THREADED_TEST(HiddenPrototypeIdentityHash) {
- LocalContext context;
- v8::HandleScope handle_scope(context->GetIsolate());
+ Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
+ t->InstanceTemplate()->SetHandler(
+ v8::NamedPropertyHandlerConfiguration(ShadowNamedGet));
- Local<FunctionTemplate> t = FunctionTemplate::New(context->GetIsolate());
- t->SetHiddenPrototype(true);
- t->InstanceTemplate()->Set(v8_str("foo"), v8_num(75));
- Local<Object> p = t->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<Object> o = Object::New(context->GetIsolate());
- CHECK(o->SetPrototype(context.local(), p).FromJust());
+ Local<Value> o = t->GetFunction(context.local())
+ .ToLocalChecked()
+ ->NewInstance(context.local())
+ .ToLocalChecked();
+ CHECK(context->Global()
+ ->Set(context.local(), v8_str("__proto__"), o)
+ .FromJust());
- int hash = o->GetIdentityHash();
- USE(hash);
- CHECK(o->Set(context.local(), v8_str("foo"), v8_num(42)).FromJust());
- CHECK_EQ(hash, o->GetIdentityHash());
+ CompileRun(
+ "function foo(x) { i = x; }"
+ "foo(0)");
+
+ i::Handle<i::JSFunction> foo(i::Handle<i::JSFunction>::cast(
+ v8::Utils::OpenHandle(*context->Global()
+ ->Get(context.local(), v8_str("foo"))
+ .ToLocalChecked())));
+ CHECK(foo->has_feedback_vector());
+ i::FeedbackSlot slot = i::FeedbackVector::ToSlot(0);
+ i::FeedbackNexus nexus(foo->feedback_vector(), slot);
+ CHECK_EQ(i::FeedbackSlotKind::kStoreGlobalSloppy, nexus.kind());
+ CHECK_EQ(i::PREMONOMORPHIC, nexus.ic_state());
+ CompileRun("%OptimizeFunctionOnNextCall(foo); foo(1)");
+ CHECK_EQ(i::MONOMORPHIC, nexus.ic_state());
+ i::HeapObject heap_object;
+ CHECK(nexus.GetFeedback().GetHeapObject(&heap_object));
+ CHECK(heap_object->IsPropertyCell());
}
-
THREADED_TEST(SetPrototype) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
@@ -11191,10 +11131,8 @@ THREADED_TEST(SetPrototype) {
Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
t0->InstanceTemplate()->Set(v8_str("x"), v8_num(0));
Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
- t1->SetHiddenPrototype(true);
t1->InstanceTemplate()->Set(v8_str("y"), v8_num(1));
Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(isolate);
- t2->SetHiddenPrototype(true);
t2->InstanceTemplate()->Set(v8_str("z"), v8_num(2));
Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(isolate);
t3->InstanceTemplate()->Set(v8_str("u"), v8_num(3));
@@ -11216,7 +11154,6 @@ THREADED_TEST(SetPrototype) {
->NewInstance(context.local())
.ToLocalChecked();
- // Setting the prototype on an object does not skip hidden prototypes.
CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
.ToLocalChecked()
->Int32Value(context.local())
@@ -11261,15 +11198,11 @@ THREADED_TEST(SetPrototype) {
->Int32Value(context.local())
.FromJust());
- // Getting the prototype of o0 should get the first visible one
- // which is o3. Therefore, z should not be defined on the prototype
- // object.
Local<Value> proto =
o0->Get(context.local(), v8_str("__proto__")).ToLocalChecked();
CHECK(proto->IsObject());
- CHECK(proto.As<v8::Object>()->Equals(context.local(), o3).FromJust());
+ CHECK(proto.As<v8::Object>()->Equals(context.local(), o1).FromJust());
- // However, Object::GetPrototype ignores hidden prototype.
Local<Value> proto0 = o0->GetPrototype();
CHECK(proto0->IsObject());
CHECK(proto0.As<v8::Object>()->Equals(context.local(), o1).FromJust());
@@ -11294,16 +11227,13 @@ THREADED_TEST(Regress91517) {
v8::HandleScope handle_scope(isolate);
Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
- t1->SetHiddenPrototype(true);
t1->InstanceTemplate()->Set(v8_str("foo"), v8_num(1));
Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(isolate);
- t2->SetHiddenPrototype(true);
t2->InstanceTemplate()->Set(v8_str("fuz1"), v8_num(2));
t2->InstanceTemplate()->Set(v8_str("objects"),
v8::ObjectTemplate::New(isolate));
t2->InstanceTemplate()->Set(v8_str("fuz2"), v8_num(2));
Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(isolate);
- t3->SetHiddenPrototype(true);
t3->InstanceTemplate()->Set(v8_str("boo"), v8_num(3));
Local<v8::FunctionTemplate> t4 = v8::FunctionTemplate::New(isolate);
t4->InstanceTemplate()->Set(v8_str("baz"), v8_num(4));
@@ -11332,7 +11262,6 @@ THREADED_TEST(Regress91517) {
->NewInstance(context.local())
.ToLocalChecked();
- // Create prototype chain of hidden prototypes.
CHECK(o4->SetPrototype(context.local(), o3).FromJust());
CHECK(o3->SetPrototype(context.local(), o2).FromJust());
CHECK(o2->SetPrototype(context.local(), o1).FromJust());
@@ -11343,79 +11272,14 @@ THREADED_TEST(Regress91517) {
// PROPERTY_FILTER_NONE = 0
CompileRun("var names = %GetOwnPropertyKeys(obj, 0);");
- ExpectInt32("names.length", 1006);
+ ExpectInt32("names.length", 1);
ExpectTrue("names.indexOf(\"baz\") >= 0");
- ExpectTrue("names.indexOf(\"boo\") >= 0");
- ExpectTrue("names.indexOf(\"foo\") >= 0");
- ExpectTrue("names.indexOf(\"fuz1\") >= 0");
- ExpectTrue("names.indexOf(\"objects\") >= 0");
- ExpectTrue("names.indexOf(\"fuz2\") >= 0");
- ExpectFalse("names[1005] == undefined");
-}
-
-
-// Getting property names of an object with a hidden and inherited
-// prototype should not duplicate the accessor properties inherited.
-THREADED_TEST(Regress269562) {
- i::FLAG_allow_natives_syntax = true;
- LocalContext context;
- v8::HandleScope handle_scope(context->GetIsolate());
-
- Local<v8::FunctionTemplate> t1 =
- v8::FunctionTemplate::New(context->GetIsolate());
- t1->SetHiddenPrototype(true);
-
- Local<v8::ObjectTemplate> i1 = t1->InstanceTemplate();
- i1->SetAccessor(v8_str("foo"),
- SimpleAccessorGetter, SimpleAccessorSetter);
- i1->SetAccessor(v8_str("bar"),
- SimpleAccessorGetter, SimpleAccessorSetter);
- i1->SetAccessor(v8_str("baz"),
- SimpleAccessorGetter, SimpleAccessorSetter);
- i1->Set(v8_str("n1"), v8_num(1));
- i1->Set(v8_str("n2"), v8_num(2));
-
- Local<v8::Object> o1 = t1->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::FunctionTemplate> t2 =
- v8::FunctionTemplate::New(context->GetIsolate());
- t2->SetHiddenPrototype(true);
-
- // Inherit from t1 and mark prototype as hidden.
- t2->Inherit(t1);
- t2->InstanceTemplate()->Set(v8_str("mine"), v8_num(4));
-
- Local<v8::Object> o2 = t2->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- CHECK(o2->SetPrototype(context.local(), o1).FromJust());
-
- v8::Local<v8::Symbol> sym =
- v8::Symbol::New(context->GetIsolate(), v8_str("s1"));
- CHECK(o1->Set(context.local(), sym, v8_num(3)).FromJust());
- o1->SetPrivate(context.local(),
- v8::Private::New(context->GetIsolate(), v8_str("h1")),
- v8::Integer::New(context->GetIsolate(), 2013))
- .FromJust();
-
- // Call the runtime version of GetOwnPropertyNames() on
- // the natively created object through JavaScript.
- CHECK(context->Global()->Set(context.local(), v8_str("obj"), o2).FromJust());
- CHECK(context->Global()->Set(context.local(), v8_str("sym"), sym).FromJust());
- // PROPERTY_FILTER_NONE = 0
- CompileRun("var names = %GetOwnPropertyKeys(obj, 0);");
-
- ExpectInt32("names.length", 7);
- ExpectTrue("names.indexOf(\"foo\") >= 0");
- ExpectTrue("names.indexOf(\"bar\") >= 0");
- ExpectTrue("names.indexOf(\"baz\") >= 0");
- ExpectTrue("names.indexOf(\"n1\") >= 0");
- ExpectTrue("names.indexOf(\"n2\") >= 0");
- ExpectTrue("names.indexOf(sym) >= 0");
- ExpectTrue("names.indexOf(\"mine\") >= 0");
+ ExpectFalse("names.indexOf(\"boo\") >= 0");
+ ExpectFalse("names.indexOf(\"foo\") >= 0");
+ ExpectFalse("names.indexOf(\"fuz1\") >= 0");
+ ExpectFalse("names.indexOf(\"objects\") >= 0");
+ ExpectFalse("names.indexOf(\"fuz2\") >= 0");
+ ExpectTrue("names[1005] == undefined");
}
@@ -12278,30 +12142,28 @@ THREADED_TEST(CallICFastApi_DirectCall_GCMoveStub) {
.FromJust());
// call the api function multiple times to ensure direct call stub creation.
CompileRun(
- "function f() {"
- " for (var i = 1; i <= 30; i++) {"
- " nativeobject.callback();"
- " }"
- "}"
- "f();");
+ "function f() {"
+ " for (var i = 1; i <= 30; i++) {"
+ " nativeobject.callback();"
+ " }"
+ "}"
+ "f();");
}
-
void ThrowingDirectApiCallback(
const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetIsolate()->ThrowException(v8_str("g"));
}
-
THREADED_TEST(CallICFastApi_DirectCall_Throw) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Local<v8::ObjectTemplate> nativeobject_templ =
v8::ObjectTemplate::New(isolate);
- nativeobject_templ->Set(isolate, "callback",
- v8::FunctionTemplate::New(isolate,
- ThrowingDirectApiCallback));
+ nativeobject_templ->Set(
+ isolate, "callback",
+ v8::FunctionTemplate::New(isolate, ThrowingDirectApiCallback));
v8::Local<v8::Object> nativeobject_obj =
nativeobject_templ->NewInstance(context.local()).ToLocalChecked();
CHECK(context->Global()
@@ -12319,10 +12181,8 @@ THREADED_TEST(CallICFastApi_DirectCall_Throw) {
CHECK(v8_str("ggggg")->Equals(context.local(), result).FromJust());
}
-
static int p_getter_count_3;
-
static Local<Value> DoDirectGetter() {
if (++p_getter_count_3 % 3 == 0) {
CcTest::CollectAllGarbage();
@@ -12331,16 +12191,13 @@ static Local<Value> DoDirectGetter() {
return v8_str("Direct Getter Result");
}
-
static void DirectGetterCallback(
- Local<String> name,
- const v8::PropertyCallbackInfo<v8::Value>& info) {
+ Local<String> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
CheckReturnValue(info, FUNCTION_ADDR(DirectGetterCallback));
info.GetReturnValue().Set(DoDirectGetter());
}
-
-template<typename Accessor>
+template <typename Accessor>
static void LoadICFastApi_DirectCall_GCMoveStub(Accessor accessor) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
@@ -12364,19 +12221,15 @@ static void LoadICFastApi_DirectCall_GCMoveStub(Accessor accessor) {
CHECK_EQ(31, p_getter_count_3);
}
-
THREADED_PROFILED_TEST(LoadICFastApi_DirectCall_GCMoveStub) {
LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback);
}
-
void ThrowingDirectGetterCallback(
- Local<String> name,
- const v8::PropertyCallbackInfo<v8::Value>& info) {
+ Local<String> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
info.GetIsolate()->ThrowException(v8_str("g"));
}
-
THREADED_TEST(LoadICFastApi_DirectCall_Throw) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
@@ -12396,7 +12249,6 @@ THREADED_TEST(LoadICFastApi_DirectCall_Throw) {
CHECK(v8_str("ggggg")->Equals(context.local(), result).FromJust());
}
-
THREADED_PROFILED_TEST(InterceptorCallICFastApi_TrivialSignature) {
int interceptor_call_count = 0;
v8::Isolate* isolate = CcTest::isolate();
@@ -12433,259 +12285,6 @@ THREADED_PROFILED_TEST(InterceptorCallICFastApi_TrivialSignature) {
CHECK_EQ(100, interceptor_call_count);
}
-
-THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature) {
- int interceptor_call_count = 0;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- InterceptorCallICFastApi, nullptr, nullptr, nullptr, nullptr,
- v8::External::New(isolate, &interceptor_call_count)));
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- "}");
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(100, interceptor_call_count);
-}
-
-
-THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
- int interceptor_call_count = 0;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- InterceptorCallICFastApi, nullptr, nullptr, nullptr, nullptr,
- v8::External::New(isolate, &interceptor_call_count)));
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = {method: function(x) { return x - 1 }};"
- " }"
- "}");
- CHECK_EQ(40, context->Global()
- ->Get(context.local(), v8_str("result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_GE(interceptor_call_count, 50);
-}
-
-
-THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
- int interceptor_call_count = 0;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- InterceptorCallICFastApi, nullptr, nullptr, nullptr, nullptr,
- v8::External::New(isolate, &interceptor_call_count)));
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " o.method = function(x) { return x - 1 };"
- " }"
- "}");
- CHECK_EQ(40, context->Global()
- ->Get(context.local(), v8_str("result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_GE(interceptor_call_count, 50);
-}
-
-
-THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
- int interceptor_call_count = 0;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- InterceptorCallICFastApi, nullptr, nullptr, nullptr, nullptr,
- v8::External::New(isolate, &interceptor_call_count)));
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- v8::TryCatch try_catch(isolate);
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = 333;"
- " }"
- "}");
- CHECK(try_catch.HasCaught());
- // TODO(verwaest): Adjust message.
- CHECK(
- v8_str("TypeError: receiver.method is not a function")
- ->Equals(
- context.local(),
- try_catch.Exception()->ToString(context.local()).ToLocalChecked())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_GE(interceptor_call_count, 50);
-}
-
-
-THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
- int interceptor_call_count = 0;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- InterceptorCallICFastApi, nullptr, nullptr, nullptr, nullptr,
- v8::External::New(isolate, &interceptor_call_count)));
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- v8::TryCatch try_catch(isolate);
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = {method: receiver.method};"
- " }"
- "}");
- CHECK(try_catch.HasCaught());
- CHECK(
- v8_str("TypeError: Illegal invocation")
- ->Equals(
- context.local(),
- try_catch.Exception()->ToString(context.local()).ToLocalChecked())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_GE(interceptor_call_count, 50);
-}
-
-
THREADED_PROFILED_TEST(CallICFastApi_TrivialSignature) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
@@ -12719,193 +12318,6 @@ THREADED_PROFILED_TEST(CallICFastApi_TrivialSignature) {
.FromJust());
}
-
-THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature) {
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
- CHECK(!templ.IsEmpty());
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- "}");
-
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
-}
-
-
-THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss1) {
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
- CHECK(!templ.IsEmpty());
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = {method: function(x) { return x - 1 }};"
- " }"
- "}");
- CHECK_EQ(40, context->Global()
- ->Get(context.local(), v8_str("result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
-}
-
-
-THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss2) {
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
- CHECK(!templ.IsEmpty());
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- v8::TryCatch try_catch(isolate);
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = 333;"
- " }"
- "}");
- CHECK(try_catch.HasCaught());
- // TODO(verwaest): Adjust message.
- CHECK(
- v8_str("TypeError: receiver.method is not a function")
- ->Equals(
- context.local(),
- try_catch.Exception()->ToString(context.local()).ToLocalChecked())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
-}
-
-
-THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_TypeError) {
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
- CHECK(!templ.IsEmpty());
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- v8::TryCatch try_catch(isolate);
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = Object.create(receiver);"
- " }"
- "}");
- CHECK(try_catch.HasCaught());
- CHECK(
- v8_str("TypeError: Illegal invocation")
- ->Equals(
- context.local(),
- try_catch.Exception()->ToString(context.local()).ToLocalChecked())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
-}
-
-
static void ThrowingGetter(Local<String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
@@ -15690,9 +15102,6 @@ TEST(CompileExternalTwoByteSource) {
}
}
-
-#ifndef V8_INTERPRETED_REGEXP
-
struct RegExpInterruptionData {
v8::base::Atomic32 loop_count;
UC16VectorResource* string_resource;
@@ -15768,9 +15177,6 @@ TEST(RegExpInterruption) {
i::DeleteArray(uc16_content);
}
-#endif // V8_INTERPRETED_REGEXP
-
-
// Test that we cannot set a property on the global object if there
// is a read-only property in the prototype chain.
TEST(ReadOnlyPropertyInGlobalProto) {
@@ -19012,16 +18418,9 @@ TEST(GetHeapSpaceStatistics) {
v8::HeapSpaceStatistics space_statistics;
isolate->GetHeapSpaceStatistics(&space_statistics, i);
CHECK_NOT_NULL(space_statistics.space_name());
- if (strcmp(space_statistics.space_name(), "new_large_object_space") == 0 ||
- strcmp(space_statistics.space_name(), "code_large_object_space") == 0) {
- continue;
- }
- CHECK_GT(space_statistics.space_size(), 0u);
total_size += space_statistics.space_size();
- CHECK_GT(space_statistics.space_used_size(), 0u);
total_used_size += space_statistics.space_used_size();
total_available_size += space_statistics.space_available_size();
- CHECK_GT(space_statistics.physical_space_size(), 0u);
total_physical_size += space_statistics.physical_space_size();
}
total_available_size += CcTest::heap()->memory_allocator()->Available();
@@ -21879,92 +21278,6 @@ THREADED_TEST(Regress1516) {
}
-THREADED_TEST(Regress93759) {
- v8::Isolate* isolate = CcTest::isolate();
- HandleScope scope(isolate);
-
- // Template for object with security check.
- Local<ObjectTemplate> no_proto_template = v8::ObjectTemplate::New(isolate);
- no_proto_template->SetAccessCheckCallback(AccessAlwaysBlocked);
-
- // Templates for objects with hidden prototypes and possibly security check.
- Local<FunctionTemplate> hidden_proto_template =
- v8::FunctionTemplate::New(isolate);
- hidden_proto_template->SetHiddenPrototype(true);
-
- Local<FunctionTemplate> protected_hidden_proto_template =
- v8::FunctionTemplate::New(isolate);
- protected_hidden_proto_template->InstanceTemplate()->SetAccessCheckCallback(
- AccessAlwaysBlocked);
- protected_hidden_proto_template->SetHiddenPrototype(true);
-
- // Context for "foreign" objects used in test.
- Local<Context> context = v8::Context::New(isolate);
- context->Enter();
-
- // Plain object, no security check.
- Local<Object> simple_object = Object::New(isolate);
-
- // Object with explicit security check.
- Local<Object> protected_object =
- no_proto_template->NewInstance(context).ToLocalChecked();
-
- // JSGlobalProxy object, always have security check.
- Local<Object> proxy_object = context->Global();
-
- // Global object, the prototype of proxy_object. No security checks.
- Local<Object> global_object =
- proxy_object->GetPrototype()->ToObject(context).ToLocalChecked();
-
- // Hidden prototype without security check.
- Local<Object> hidden_prototype = hidden_proto_template->GetFunction(context)
- .ToLocalChecked()
- ->NewInstance(context)
- .ToLocalChecked();
- Local<Object> object_with_hidden =
- Object::New(isolate);
- object_with_hidden->SetPrototype(context, hidden_prototype).FromJust();
-
- context->Exit();
-
- LocalContext context2;
- v8::Local<v8::Object> global = context2->Global();
-
- // Setup global variables.
- CHECK(global->Set(context2.local(), v8_str("simple"), simple_object)
- .FromJust());
- CHECK(global->Set(context2.local(), v8_str("protected"), protected_object)
- .FromJust());
- CHECK(global->Set(context2.local(), v8_str("global"), global_object)
- .FromJust());
- CHECK(
- global->Set(context2.local(), v8_str("proxy"), proxy_object).FromJust());
- CHECK(global->Set(context2.local(), v8_str("hidden"), object_with_hidden)
- .FromJust());
-
- Local<Value> result1 = CompileRun("Object.getPrototypeOf(simple)");
- CHECK(result1->Equals(context2.local(), simple_object->GetPrototype())
- .FromJust());
-
- Local<Value> result2 = CompileRun("Object.getPrototypeOf(protected)");
- CHECK(result2->IsNull());
-
- Local<Value> result3 = CompileRun("Object.getPrototypeOf(global)");
- CHECK(result3->Equals(context2.local(), global_object->GetPrototype())
- .FromJust());
-
- Local<Value> result4 = CompileRun("Object.getPrototypeOf(proxy)");
- CHECK(result4->IsNull());
-
- Local<Value> result5 = CompileRun("Object.getPrototypeOf(hidden)");
- CHECK(result5->Equals(context2.local(), object_with_hidden->GetPrototype()
- ->ToObject(context2.local())
- .ToLocalChecked()
- ->GetPrototype())
- .FromJust());
-}
-
-
static void TestReceiver(Local<Value> expected_result,
Local<Value> expected_receiver,
const char* code) {
@@ -23511,8 +22824,8 @@ TEST(AccessCheckThrows) {
CheckCorrectThrow("JSON.stringify(other)");
CheckCorrectThrow("has_own_property(other, 'x')");
CheckCorrectThrow("%GetProperty(other, 'x')");
- CheckCorrectThrow("%SetKeyedProperty(other, 'x', 'foo', 0)");
- CheckCorrectThrow("%SetNamedProperty(other, 'y', 'foo', 1)");
+ CheckCorrectThrow("%SetKeyedProperty(other, 'x', 'foo')");
+ CheckCorrectThrow("%SetNamedProperty(other, 'y', 'foo')");
STATIC_ASSERT(static_cast<int>(i::LanguageMode::kSloppy) == 0);
STATIC_ASSERT(static_cast<int>(i::LanguageMode::kStrict) == 1);
CheckCorrectThrow("%DeleteProperty(other, 'x', 0)"); // 0 == SLOPPY
@@ -24178,7 +23491,6 @@ class ApiCallOptimizationChecker {
{
Local<v8::FunctionTemplate> parent_template =
FunctionTemplate::New(isolate);
- parent_template->SetHiddenPrototype(true);
Local<v8::FunctionTemplate> function_template
= FunctionTemplate::New(isolate);
function_template->Inherit(parent_template);
@@ -24207,7 +23519,6 @@ class ApiCallOptimizationChecker {
// Get the holder objects.
Local<Object> inner_global =
Local<Object>::Cast(context->Global()->GetPrototype());
- // Install functions on hidden prototype object if there is one.
data = Object::New(isolate);
Local<FunctionTemplate> function_template = FunctionTemplate::New(
isolate, OptimizationCallback, data, signature);
@@ -24486,47 +23797,6 @@ TEST(ChainSignatureCheck) {
}
-TEST(PrototypeSignatureCheck) {
- LocalContext context;
- auto isolate = context->GetIsolate();
- v8::HandleScope scope(isolate);
- auto global = context->Global();
- auto sig_obj = FunctionTemplate::New(isolate);
- sig_obj->SetHiddenPrototype(true);
- auto sig = v8::Signature::New(isolate, sig_obj);
- auto x = FunctionTemplate::New(isolate, Returns42, Local<Value>(), sig);
- global->Set(context.local(), v8_str("sig_obj"),
- sig_obj->GetFunction(context.local()).ToLocalChecked())
- .FromJust();
- global->Set(context.local(), v8_str("x"),
- x->GetFunction(context.local()).ToLocalChecked())
- .FromJust();
- CompileRun("s = {}; s.__proto__ = new sig_obj();");
- {
- TryCatch try_catch(isolate);
- CompileRun("x()");
- CHECK(try_catch.HasCaught());
- }
- {
- TryCatch try_catch(isolate);
- CompileRun("x.call(1)");
- CHECK(try_catch.HasCaught());
- }
- {
- TryCatch try_catch(isolate);
- auto result = CompileRun("s.x = x; s.x()");
- CHECK(!try_catch.HasCaught());
- CHECK_EQ(42, result->Int32Value(context.local()).FromJust());
- }
- {
- TryCatch try_catch(isolate);
- auto result = CompileRun("x.call(s)");
- CHECK(!try_catch.HasCaught());
- CHECK_EQ(42, result->Int32Value(context.local()).FromJust());
- }
-}
-
-
static const char* last_event_message;
static int last_event_status;
void StoringEventLoggerCallback(const char* message, int status) {
@@ -28308,15 +27578,10 @@ void AtomicsWaitCallbackForTesting(
}
}
-TEST(AtomicsWaitCallback) {
- LocalContext env;
- v8::Isolate* isolate = env->GetIsolate();
- v8::HandleScope scope(isolate);
-
- Local<Value> sab = CompileRun(
- "sab = new SharedArrayBuffer(12);"
- "int32arr = new Int32Array(sab, 4);"
- "sab");
+// Must be called from within HandleScope
+void AtomicsWaitCallbackCommon(v8::Isolate* isolate, Local<Value> sab,
+ size_t initial_offset,
+ size_t offset_multiplier) {
CHECK(sab->IsSharedArrayBuffer());
AtomicsWaitCallbackInfo info;
@@ -28326,52 +27591,52 @@ TEST(AtomicsWaitCallback) {
{
v8::TryCatch try_catch(isolate);
- info.expected_offset = 4;
+ info.expected_offset = initial_offset;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 0;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kTerminatedExecution;
info.action = AtomicsWaitCallbackAction::Interrupt;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 0, 0);");
+ CompileRun("wait(0, 0);");
CHECK_EQ(info.ncalls, 2);
CHECK(try_catch.HasTerminated());
}
{
v8::TryCatch try_catch(isolate);
- info.expected_offset = 8;
+ info.expected_offset = initial_offset + offset_multiplier;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 1;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kNotEqual;
info.action = AtomicsWaitCallbackAction::KeepWaiting;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 1, 1);"); // real value is 0 != 1
+ CompileRun("wait(1, 1);"); // real value is 0 != 1
CHECK_EQ(info.ncalls, 2);
CHECK(!try_catch.HasCaught());
}
{
v8::TryCatch try_catch(isolate);
- info.expected_offset = 8;
+ info.expected_offset = initial_offset + offset_multiplier;
info.expected_timeout = 0.125;
info.expected_value = 0;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kTimedOut;
info.action = AtomicsWaitCallbackAction::KeepWaiting;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 1, 0, 0.125);"); // timeout
+ CompileRun("wait(1, 0, 0.125);"); // timeout
CHECK_EQ(info.ncalls, 2);
CHECK(!try_catch.HasCaught());
}
{
v8::TryCatch try_catch(isolate);
- info.expected_offset = 8;
+ info.expected_offset = initial_offset + offset_multiplier;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 0;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kAPIStopped;
info.action = AtomicsWaitCallbackAction::StopAndThrowInFirstCall;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 1, 0);");
+ CompileRun("wait(1, 0);");
CHECK_EQ(info.ncalls, 1); // Only one extra call
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsInt32());
@@ -28380,13 +27645,13 @@ TEST(AtomicsWaitCallback) {
{
v8::TryCatch try_catch(isolate);
- info.expected_offset = 8;
+ info.expected_offset = initial_offset + offset_multiplier;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 0;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kAPIStopped;
info.action = AtomicsWaitCallbackAction::StopAndThrowInSecondCall;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 1, 0);");
+ CompileRun("wait(1, 0);");
CHECK_EQ(info.ncalls, 2);
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsInt32());
@@ -28396,15 +27661,15 @@ TEST(AtomicsWaitCallback) {
{
// Same test as before, but with a different `expected_value`.
v8::TryCatch try_catch(isolate);
- info.expected_offset = 8;
+ info.expected_offset = initial_offset + offset_multiplier;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 200;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kAPIStopped;
info.action = AtomicsWaitCallbackAction::StopAndThrowInSecondCall;
info.ncalls = 0;
CompileRun(
- "int32arr[1] = 200;"
- "Atomics.wait(int32arr, 1, 200);");
+ "setArrayElemAs(1, 200);"
+ "wait(1, 200);");
CHECK_EQ(info.ncalls, 2);
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsInt32());
@@ -28414,13 +27679,15 @@ TEST(AtomicsWaitCallback) {
{
// Wake the `Atomics.wait()` call from a thread.
v8::TryCatch try_catch(isolate);
- info.expected_offset = 4;
+ info.expected_offset = initial_offset;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 0;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kAPIStopped;
info.action = AtomicsWaitCallbackAction::StopFromThreadAndThrow;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 0, 0);");
+ CompileRun(
+ "setArrayElemAs(1, 0);"
+ "wait(0, 0);");
CHECK_EQ(info.ncalls, 2);
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsInt32());
@@ -28428,6 +27695,105 @@ TEST(AtomicsWaitCallback) {
}
}
+TEST(AtomicsWaitCallback) {
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ const char* init = R"(
+ let sab = new SharedArrayBuffer(16);
+ let int32arr = new Int32Array(sab, 4);
+ let setArrayElemAs = function(id, val) {
+ int32arr[id] = val;
+ };
+ let wait = function(id, val, timeout) {
+ if(arguments.length == 2) return Atomics.wait(int32arr, id, val);
+ return Atomics.wait(int32arr, id, val, timeout);
+ };
+ sab;)";
+ AtomicsWaitCallbackCommon(isolate, CompileRun(init), 4, 4);
+}
+
+namespace v8 {
+namespace internal {
+namespace wasm {
+TEST(WasmI32AtomicWaitCallback) {
+ FlagScope<bool> wasm_threads_flag(&i::FLAG_experimental_wasm_threads, true);
+ WasmRunner<int32_t, int32_t, int32_t, double> r(ExecutionTier::kOptimized);
+ r.builder().AddMemory(kWasmPageSize, SharedFlag::kShared);
+ r.builder().SetHasSharedMemory();
+ BUILD(r, WASM_ATOMICS_WAIT(kExprI32AtomicWait, WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1),
+ WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(2)), 4));
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ Handle<JSFunction> func = r.builder().WrapCode(0);
+ CHECK(env->Global()
+ ->Set(env.local(), v8_str("func"), v8::Utils::ToLocal(func))
+ .FromJust());
+ Handle<JSArrayBuffer> memory(
+ r.builder().instance_object()->memory_object()->array_buffer(),
+ i_isolate);
+ CHECK(env->Global()
+ ->Set(env.local(), v8_str("sab"), v8::Utils::ToLocal(memory))
+ .FromJust());
+
+ const char* init = R"(
+ let int32arr = new Int32Array(sab, 4);
+ let setArrayElemAs = function(id, val) {
+ int32arr[id] = val;
+ };
+ let wait = function(id, val, timeout) {
+ if(arguments.length === 2)
+ return func(id << 2, val, -1);
+ return func(id << 2, val, timeout*1000000);
+ };
+ sab;)";
+ AtomicsWaitCallbackCommon(isolate, CompileRun(init), 4, 4);
+}
+
+TEST(WasmI64AtomicWaitCallback) {
+ FlagScope<bool> wasm_threads_flag(&i::FLAG_experimental_wasm_threads, true);
+ WasmRunner<int32_t, int32_t, double, double> r(ExecutionTier::kOptimized);
+ r.builder().AddMemory(kWasmPageSize, SharedFlag::kShared);
+ r.builder().SetHasSharedMemory();
+ BUILD(r, WASM_ATOMICS_WAIT(kExprI64AtomicWait, WASM_GET_LOCAL(0),
+ WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(1)),
+ WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(2)), 8));
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ Handle<JSFunction> func = r.builder().WrapCode(0);
+ CHECK(env->Global()
+ ->Set(env.local(), v8_str("func"), v8::Utils::ToLocal(func))
+ .FromJust());
+ Handle<JSArrayBuffer> memory(
+ r.builder().instance_object()->memory_object()->array_buffer(),
+ i_isolate);
+ CHECK(env->Global()
+ ->Set(env.local(), v8_str("sab"), v8::Utils::ToLocal(memory))
+ .FromJust());
+
+ const char* init = R"(
+ let int64arr = new BigInt64Array(sab, 8);
+ let setArrayElemAs = function(id, val) {
+ int64arr[id] = BigInt(val);
+ };
+ let wait = function(id, val, timeout) {
+ if(arguments.length === 2)
+ return func(id << 3, val, -1);
+ return func(id << 3, val, timeout*1000000);
+ };
+ sab;)";
+ AtomicsWaitCallbackCommon(isolate, CompileRun(init), 8, 8);
+}
+
+} // namespace wasm
+} // namespace internal
+} // namespace v8
+
TEST(BigIntAPI) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc
index d66027b5fd..f93163c985 100644
--- a/deps/v8/test/cctest/test-assembler-arm.cc
+++ b/deps/v8/test/cctest/test-assembler-arm.cc
@@ -167,7 +167,6 @@ TEST(3) {
T t;
Assembler assm(AssemblerOptions{});
- Label L, C;
__ mov(ip, Operand(sp));
__ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit());
@@ -236,7 +235,6 @@ TEST(4) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the doubles and floats.
Assembler assm(AssemblerOptions{});
- Label L, C;
if (CpuFeatures::IsSupported(VFPv3)) {
CpuFeatureScope scope(&assm, VFPv3);
@@ -1029,7 +1027,6 @@ TEST(13) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the doubles and floats.
Assembler assm(AssemblerOptions{});
- Label L, C;
if (CpuFeatures::IsSupported(VFPv3)) {
CpuFeatureScope scope(&assm, VFPv3);
@@ -2935,7 +2932,6 @@ TEST(ARMv8_float32_vrintX) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the floats.
Assembler assm(AssemblerOptions{});
- Label L, C;
if (CpuFeatures::IsSupported(ARMv8)) {
@@ -3037,7 +3033,6 @@ TEST(ARMv8_vrintX) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the doubles and floats.
Assembler assm(AssemblerOptions{});
- Label L, C;
if (CpuFeatures::IsSupported(ARMv8)) {
@@ -4094,18 +4089,18 @@ namespace {
std::vector<Float32> Float32Inputs() {
std::vector<Float32> inputs;
FOR_FLOAT32_INPUTS(f) {
- inputs.push_back(Float32::FromBits(bit_cast<uint32_t>(*f)));
+ inputs.push_back(Float32::FromBits(bit_cast<uint32_t>(f)));
}
- FOR_UINT32_INPUTS(bits) { inputs.push_back(Float32::FromBits(*bits)); }
+ FOR_UINT32_INPUTS(bits) { inputs.push_back(Float32::FromBits(bits)); }
return inputs;
}
std::vector<Float64> Float64Inputs() {
std::vector<Float64> inputs;
FOR_FLOAT64_INPUTS(f) {
- inputs.push_back(Float64::FromBits(bit_cast<uint64_t>(*f)));
+ inputs.push_back(Float64::FromBits(bit_cast<uint64_t>(f)));
}
- FOR_UINT64_INPUTS(bits) { inputs.push_back(Float64::FromBits(*bits)); }
+ FOR_UINT64_INPUTS(bits) { inputs.push_back(Float64::FromBits(bits)); }
return inputs;
}
@@ -4187,6 +4182,81 @@ TEST(vneg_64) {
}
}
+TEST(move_pair) {
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope scope(isolate);
+
+ auto f = AssembleCode<F_piiii>([](MacroAssembler& assm) {
+ RegList used_callee_saved =
+ r4.bit() | r5.bit() | r6.bit() | r7.bit() | r8.bit();
+ __ stm(db_w, sp, used_callee_saved);
+
+ // Save output register bank pointer to r8.
+ __ mov(r8, r0);
+
+ __ mov(r0, Operand(0xabababab));
+ __ mov(r1, Operand(0xbabababa));
+ __ mov(r2, Operand(0x12341234));
+ __ mov(r3, Operand(0x43214321));
+
+ // No overlap:
+ // r4 <- r0
+ // r5 <- r1
+ __ MovePair(r4, r0, r5, r1);
+
+ // Overlap but we can swap moves:
+ // r2 <- r0
+ // r6 <- r2
+ __ MovePair(r2, r0, r6, r2);
+
+ // Overlap but can be done:
+ // r7 <- r3
+ // r3 <- r0
+ __ MovePair(r7, r3, r3, r0);
+
+ // Swap.
+ // r0 <- r1
+ // r1 <- r0
+ __ MovePair(r0, r1, r1, r0);
+
+ // Fill the fake register bank.
+ __ str(r0, MemOperand(r8, 0 * kPointerSize));
+ __ str(r1, MemOperand(r8, 1 * kPointerSize));
+ __ str(r2, MemOperand(r8, 2 * kPointerSize));
+ __ str(r3, MemOperand(r8, 3 * kPointerSize));
+ __ str(r4, MemOperand(r8, 4 * kPointerSize));
+ __ str(r5, MemOperand(r8, 5 * kPointerSize));
+ __ str(r6, MemOperand(r8, 6 * kPointerSize));
+ __ str(r7, MemOperand(r8, 7 * kPointerSize));
+
+ __ ldm(ia_w, sp, used_callee_saved);
+ });
+
+ // Create a fake register bank.
+ uint32_t r[] = {0, 0, 0, 0, 0, 0, 0, 0};
+ f.Call(r, 0, 0, 0, 0);
+
+ // r4 <- r0
+ // r5 <- r1
+ CHECK_EQ(0xabababab, r[4]);
+ CHECK_EQ(0xbabababa, r[5]);
+
+ // r2 <- r0
+ // r6 <- r2
+ CHECK_EQ(0xabababab, r[2]);
+ CHECK_EQ(0x12341234, r[6]);
+
+ // r7 <- r3
+ // r3 <- r0
+ CHECK_EQ(0x43214321, r[7]);
+ CHECK_EQ(0xabababab, r[3]);
+
+ // r0 and r1 should be swapped.
+ CHECK_EQ(0xbabababa, r[0]);
+ CHECK_EQ(0xabababab, r[1]);
+}
+
+
#undef __
} // namespace test_assembler_arm
diff --git a/deps/v8/test/cctest/test-assembler-arm64.cc b/deps/v8/test/cctest/test-assembler-arm64.cc
index a500c9cb51..44a54df80e 100644
--- a/deps/v8/test/cctest/test-assembler-arm64.cc
+++ b/deps/v8/test/cctest/test-assembler-arm64.cc
@@ -162,7 +162,10 @@ static void InitializeVM() {
core.Dump(&masm); \
__ PopCalleeSavedRegisters(); \
__ Ret(); \
- __ GetCode(masm.isolate(), nullptr);
+ { \
+ CodeDesc desc; \
+ __ GetCode(masm.isolate(), &desc); \
+ }
#else // ifdef USE_SIMULATOR.
// Run the test on real hardware or models.
@@ -198,11 +201,14 @@ static void InitializeVM() {
test_function(); \
}
-#define END() \
- core.Dump(&masm); \
- __ PopCalleeSavedRegisters(); \
- __ Ret(); \
- __ GetCode(masm.isolate(), nullptr);
+#define END() \
+ core.Dump(&masm); \
+ __ PopCalleeSavedRegisters(); \
+ __ Ret(); \
+ { \
+ CodeDesc desc; \
+ __ GetCode(masm.isolate(), &desc); \
+ }
#endif // ifdef USE_SIMULATOR.
@@ -405,6 +411,60 @@ TEST(mov) {
CHECK_EQUAL_64(0x000000000001FFE0UL, x27);
}
+TEST(move_pair) {
+ INIT_V8();
+ SETUP();
+
+ START();
+ __ Mov(x0, 0xabababab);
+ __ Mov(x1, 0xbabababa);
+ __ Mov(x2, 0x12341234);
+ __ Mov(x3, 0x43214321);
+
+ // No overlap:
+ // x4 <- x0
+ // x5 <- x1
+ __ MovePair(x4, x0, x5, x1);
+
+ // Overlap but we can swap moves:
+ // x2 <- x0
+ // x6 <- x2
+ __ MovePair(x2, x0, x6, x2);
+
+ // Overlap but can be done:
+ // x7 <- x3
+ // x3 <- x0
+ __ MovePair(x7, x3, x3, x0);
+
+ // Swap.
+ // x0 <- x1
+ // x1 <- x0
+ __ MovePair(x0, x1, x1, x0);
+
+ END();
+
+ RUN();
+
+ // x4 <- x0
+ // x5 <- x1
+ CHECK_EQUAL_64(0xabababab, x4);
+ CHECK_EQUAL_64(0xbabababa, x5);
+
+ // x2 <- x0
+ // x6 <- x2
+ CHECK_EQUAL_64(0xabababab, x2);
+ CHECK_EQUAL_64(0x12341234, x6);
+
+ // x7 <- x3
+ // x3 <- x0
+ CHECK_EQUAL_64(0x43214321, x7);
+ CHECK_EQUAL_64(0xabababab, x3);
+
+ // x0 and x1 should be swapped.
+ CHECK_EQUAL_64(0xbabababa, x0);
+ CHECK_EQUAL_64(0xabababab, x1);
+}
+
TEST(mov_imm_w) {
INIT_V8();
SETUP();
@@ -2160,7 +2220,7 @@ TEST(far_branch_veneer_broken_link_chain) {
START();
- Label skip, fail, done;
+ Label fail, done;
Label test_1, test_2, test_3;
Label far_target;
@@ -14525,7 +14585,7 @@ static void AbsHelperX(int64_t value) {
__ Mov(x1, value);
if (value != kXMinInt) {
- expected = labs(value);
+ expected = std::abs(value);
Label next;
// The result is representable.
@@ -14535,7 +14595,7 @@ static void AbsHelperX(int64_t value) {
__ Bind(&next);
__ Abs(x13, x1, nullptr, &done);
} else {
- // labs is undefined for kXMinInt but our implementation in the
+ // std::abs is undefined for kXMinInt but our implementation in the
// MacroAssembler will return kXMinInt in such a case.
expected = kXMinInt;
@@ -14715,7 +14775,7 @@ TEST(jump_tables_forward) {
Label base;
__ Adr(x10, &base);
- __ Ldr(x11, MemOperand(x10, index, LSL, kPointerSizeLog2));
+ __ Ldr(x11, MemOperand(x10, index, LSL, kSystemPointerSizeLog2));
__ Br(x11);
__ Bind(&base);
for (int i = 0; i < kNumCases; ++i) {
@@ -14783,7 +14843,7 @@ TEST(jump_tables_backward) {
Label base;
__ Adr(x10, &base);
- __ Ldr(x11, MemOperand(x10, index, LSL, kPointerSizeLog2));
+ __ Ldr(x11, MemOperand(x10, index, LSL, kSystemPointerSizeLog2));
__ Br(x11);
__ Bind(&base);
for (int i = 0; i < kNumCases; ++i) {
diff --git a/deps/v8/test/cctest/test-assembler-ia32.cc b/deps/v8/test/cctest/test-assembler-ia32.cc
index 781dbfcc10..a9c0b60485 100644
--- a/deps/v8/test/cctest/test-assembler-ia32.cc
+++ b/deps/v8/test/cctest/test-assembler-ia32.cc
@@ -250,8 +250,8 @@ TEST(AssemblerIa326) {
Assembler assm(AssemblerOptions{},
ExternalAssemblerBuffer(buffer, sizeof buffer));
- __ movsd(xmm0, Operand(esp, 1 * kPointerSize));
- __ movsd(xmm1, Operand(esp, 3 * kPointerSize));
+ __ movsd(xmm0, Operand(esp, 1 * kSystemPointerSize));
+ __ movsd(xmm1, Operand(esp, 3 * kSystemPointerSize));
__ addsd(xmm0, xmm1);
__ mulsd(xmm0, xmm1);
__ subsd(xmm0, xmm1);
@@ -522,8 +522,8 @@ TEST(AssemblerIa32SSE) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes,
ExternalAssemblerBuffer(buffer, sizeof(buffer)));
{
- __ movss(xmm0, Operand(esp, kPointerSize));
- __ movss(xmm1, Operand(esp, 2 * kPointerSize));
+ __ movss(xmm0, Operand(esp, kSystemPointerSize));
+ __ movss(xmm1, Operand(esp, 2 * kSystemPointerSize));
__ shufps(xmm0, xmm0, 0x0);
__ shufps(xmm1, xmm1, 0x0);
__ movaps(xmm2, xmm1);
@@ -559,8 +559,8 @@ TEST(AssemblerIa32SSE3) {
ExternalAssemblerBuffer(buffer, sizeof(buffer)));
{
CpuFeatureScope fscope(&assm, SSE3);
- __ movss(xmm0, Operand(esp, kPointerSize));
- __ movss(xmm1, Operand(esp, 2 * kPointerSize));
+ __ movss(xmm0, Operand(esp, kSystemPointerSize));
+ __ movss(xmm1, Operand(esp, 2 * kSystemPointerSize));
__ shufps(xmm0, xmm0, 0x0);
__ shufps(xmm1, xmm1, 0x0);
__ haddps(xmm1, xmm0);
@@ -594,9 +594,9 @@ TEST(AssemblerX64FMA_sd) {
{
CpuFeatureScope fscope(&assm, FMA3);
Label exit;
- __ movsd(xmm0, Operand(esp, 1 * kPointerSize));
- __ movsd(xmm1, Operand(esp, 3 * kPointerSize));
- __ movsd(xmm2, Operand(esp, 5 * kPointerSize));
+ __ movsd(xmm0, Operand(esp, 1 * kSystemPointerSize));
+ __ movsd(xmm1, Operand(esp, 3 * kSystemPointerSize));
+ __ movsd(xmm2, Operand(esp, 5 * kSystemPointerSize));
// argument in xmm0, xmm1 and xmm2
// xmm0 * xmm1 + xmm2
__ movaps(xmm3, xmm0);
@@ -823,9 +823,9 @@ TEST(AssemblerX64FMA_ss) {
{
CpuFeatureScope fscope(&assm, FMA3);
Label exit;
- __ movss(xmm0, Operand(esp, 1 * kPointerSize));
- __ movss(xmm1, Operand(esp, 2 * kPointerSize));
- __ movss(xmm2, Operand(esp, 3 * kPointerSize));
+ __ movss(xmm0, Operand(esp, 1 * kSystemPointerSize));
+ __ movss(xmm1, Operand(esp, 2 * kSystemPointerSize));
+ __ movss(xmm2, Operand(esp, 3 * kSystemPointerSize));
// arguments in xmm0, xmm1 and xmm2
// xmm0 * xmm1 + xmm2
__ movaps(xmm3, xmm0);
@@ -1403,7 +1403,7 @@ TEST(AssemblerIa32JumpTables1) {
Label done, table;
__ mov(eax, Operand(esp, 4));
- __ jmp(Operand::JumpTable(eax, times_4, &table));
+ __ jmp(Operand::JumpTable(eax, times_system_pointer_size, &table));
__ ud2();
__ bind(&table);
for (int i = 0; i < kNumCases; ++i) {
@@ -1450,7 +1450,7 @@ TEST(AssemblerIa32JumpTables2) {
Label done, table;
__ mov(eax, Operand(esp, 4));
- __ jmp(Operand::JumpTable(eax, times_4, &table));
+ __ jmp(Operand::JumpTable(eax, times_system_pointer_size, &table));
__ ud2();
for (int i = 0; i < kNumCases; ++i) {
diff --git a/deps/v8/test/cctest/test-assembler-mips.cc b/deps/v8/test/cctest/test-assembler-mips.cc
index 2f5b13f725..bf45427532 100644
--- a/deps/v8/test/cctest/test-assembler-mips.cc
+++ b/deps/v8/test/cctest/test-assembler-mips.cc
@@ -273,7 +273,6 @@ TEST(MIPS3) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the doubles t.a ... t.f.
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Double precision floating point instructions.
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
@@ -401,7 +400,6 @@ TEST(MIPS4) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
__ Ldc1(f6, MemOperand(a0, offsetof(T, b)));
@@ -469,7 +467,6 @@ TEST(MIPS5) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Load all structure elements to registers.
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
@@ -537,7 +534,6 @@ TEST(MIPS6) {
T t;
Assembler assm(AssemblerOptions{});
- Label L, C;
// Basic word load/store.
__ lw(t0, MemOperand(a0, offsetof(T, ui)) );
@@ -825,7 +821,6 @@ TEST(MIPS10) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
if (IsMipsArchVariant(kMips32r1) || IsMipsArchVariant(kLoongson)) return;
@@ -4742,7 +4737,7 @@ uint32_t run_jic(int16_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label get_program_counter, stop_execution;
+ Label stop_execution;
__ push(ra);
__ li(v0, 0);
__ li(t1, 0x66);
@@ -5074,7 +5069,7 @@ uint32_t run_jialc(int16_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label main_block, get_program_counter;
+ Label main_block;
__ push(ra);
__ li(v0, 0);
__ beq(v0, v0, &main_block);
@@ -5291,7 +5286,7 @@ int32_t run_balc(int32_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label continue_1, stop_execution;
+ Label continue_1;
__ push(ra);
__ li(v0, 0);
__ li(t8, 0);
diff --git a/deps/v8/test/cctest/test-assembler-mips64.cc b/deps/v8/test/cctest/test-assembler-mips64.cc
index aa82b359f2..ec5e0e283e 100644
--- a/deps/v8/test/cctest/test-assembler-mips64.cc
+++ b/deps/v8/test/cctest/test-assembler-mips64.cc
@@ -283,7 +283,6 @@ TEST(MIPS3) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the doubles t.a ... t.f.
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Double precision floating point instructions.
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
@@ -406,7 +405,6 @@ TEST(MIPS4) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
__ Ldc1(f5, MemOperand(a0, offsetof(T, b)));
@@ -472,7 +470,6 @@ TEST(MIPS5) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Load all structure elements to registers.
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
@@ -540,7 +537,6 @@ TEST(MIPS6) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Basic word load/store.
__ Lw(a4, MemOperand(a0, offsetof(T, ui)));
@@ -828,7 +824,6 @@ TEST(MIPS10) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
if (kArchVariant == kMips64r2) {
// Rewritten for FR=1 FPU mode:
@@ -1386,7 +1381,6 @@ TEST(MIPS16) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Basic 32-bit word load/store, with un-signed data.
__ Lw(a4, MemOperand(a0, offsetof(T, ui)));
@@ -5358,7 +5352,7 @@ uint64_t run_jic(int16_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label get_program_counter, stop_execution;
+ Label stop_execution;
__ push(ra);
__ li(v0, 0l);
__ li(t1, 0x66);
@@ -5690,7 +5684,7 @@ uint64_t run_jialc(int16_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label main_block, get_program_counter;
+ Label main_block;
__ push(ra);
__ li(v0, 0l);
__ beq(v0, v0, &main_block);
@@ -5991,7 +5985,7 @@ int64_t run_balc(int32_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label continue_1, stop_execution;
+ Label continue_1;
__ push(ra);
__ li(v0, 0l);
__ li(t8, 0l);
diff --git a/deps/v8/test/cctest/test-assembler-ppc.cc b/deps/v8/test/cctest/test-assembler-ppc.cc
index 196a3d91df..1f7a9e0eec 100644
--- a/deps/v8/test/cctest/test-assembler-ppc.cc
+++ b/deps/v8/test/cctest/test-assembler-ppc.cc
@@ -169,7 +169,6 @@ TEST(3) {
T t;
Assembler assm(AssemblerOptions{});
- Label L, C;
// build a frame
#if V8_TARGET_ARCH_PPC64
diff --git a/deps/v8/test/cctest/test-code-layout.cc b/deps/v8/test/cctest/test-code-layout.cc
index 5dbe81cb62..fa55e40af6 100644
--- a/deps/v8/test/cctest/test-code-layout.cc
+++ b/deps/v8/test/cctest/test-code-layout.cc
@@ -24,13 +24,20 @@ TEST(CodeLayoutWithoutUnwindingInfo) {
CodeDesc code_desc;
code_desc.buffer = buffer;
code_desc.buffer_size = buffer_size;
- code_desc.constant_pool_size = 0;
code_desc.instr_size = buffer_size;
+ code_desc.safepoint_table_offset = buffer_size;
+ code_desc.safepoint_table_size = 0;
+ code_desc.handler_table_offset = buffer_size;
+ code_desc.handler_table_size = 0;
+ code_desc.constant_pool_offset = buffer_size;
+ code_desc.constant_pool_size = 0;
+ code_desc.code_comments_offset = buffer_size;
+ code_desc.code_comments_size = 0;
+ code_desc.reloc_offset = buffer_size;
code_desc.reloc_size = 0;
- code_desc.origin = nullptr;
code_desc.unwinding_info = nullptr;
code_desc.unwinding_info_size = 0;
- code_desc.code_comments_size = 0;
+ code_desc.origin = nullptr;
Handle<Code> code = CcTest::i_isolate()->factory()->NewCode(
code_desc, Code::STUB, Handle<Object>::null());
@@ -63,13 +70,20 @@ TEST(CodeLayoutWithUnwindingInfo) {
CodeDesc code_desc;
code_desc.buffer = buffer;
code_desc.buffer_size = buffer_size;
- code_desc.constant_pool_size = 0;
code_desc.instr_size = buffer_size;
+ code_desc.safepoint_table_offset = buffer_size;
+ code_desc.safepoint_table_size = 0;
+ code_desc.handler_table_offset = buffer_size;
+ code_desc.handler_table_size = 0;
+ code_desc.constant_pool_offset = buffer_size;
+ code_desc.constant_pool_size = 0;
+ code_desc.code_comments_offset = buffer_size;
+ code_desc.code_comments_size = 0;
+ code_desc.reloc_offset = buffer_size;
code_desc.reloc_size = 0;
- code_desc.origin = nullptr;
code_desc.unwinding_info = unwinding_info;
code_desc.unwinding_info_size = unwinding_info_size;
- code_desc.code_comments_size = 0;
+ code_desc.origin = nullptr;
Handle<Code> code = CcTest::i_isolate()->factory()->NewCode(
code_desc, Code::STUB, Handle<Object>::null());
diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc
index 0c22f4503b..e7f592d1c5 100644
--- a/deps/v8/test/cctest/test-code-stub-assembler.cc
+++ b/deps/v8/test/cctest/test-code-stub-assembler.cc
@@ -14,6 +14,7 @@
#include "src/code-stub-assembler.h"
#include "src/compiler/node.h"
#include "src/debug/debug.h"
+#include "src/hash-seed-inl.h"
#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
@@ -21,9 +22,11 @@
#include "src/objects/heap-number-inl.h"
#include "src/objects/js-array-buffer-inl.h"
#include "src/objects/js-array-inl.h"
+#include "src/objects/ordered-hash-table-inl.h"
#include "src/objects/promise-inl.h"
#include "src/objects/smi.h"
#include "src/objects/struct-inl.h"
+#include "src/transitions-inl.h"
#include "test/cctest/compiler/code-assembler-tester.h"
#include "test/cctest/compiler/function-tester.h"
@@ -348,7 +351,7 @@ TEST(ComputeIntegerHash) {
Handle<Smi> key(Smi::FromInt(k), isolate);
Handle<Object> result = ft.Call(key).ToHandleChecked();
- uint32_t hash = ComputeSeededHash(k, isolate->heap()->HashSeed());
+ uint32_t hash = ComputeSeededHash(k, HashSeed(isolate));
Smi expected = Smi::FromInt(hash);
CHECK_EQ(expected, Smi::cast(*result));
}
@@ -1708,14 +1711,13 @@ TEST(AllocateNameDictionary) {
{
for (int i = 0; i < 256; i = i * 1.1 + 1) {
- Handle<Object> result =
- ft.Call(handle(Smi::FromInt(i), isolate)).ToHandleChecked();
+ Handle<HeapObject> result = Handle<HeapObject>::cast(
+ ft.Call(handle(Smi::FromInt(i), isolate)).ToHandleChecked());
Handle<NameDictionary> dict = NameDictionary::New(isolate, i);
// Both dictionaries should be memory equal.
- int size =
- FixedArrayBase::kHeaderSize + (dict->length() - 1) * kPointerSize;
- CHECK_EQ(0, memcmp(reinterpret_cast<void*>(dict->ptr()),
- reinterpret_cast<void*>(result->ptr()), size));
+ int size = dict->Size();
+ CHECK_EQ(0, memcmp(reinterpret_cast<void*>(dict->address()),
+ reinterpret_cast<void*>(result->address()), size));
}
}
}
@@ -2089,10 +2091,10 @@ class AppendJSArrayCodeStubAssembler : public CodeStubAssembler {
Handle<JSArray> array = isolate->factory()->NewJSArray(
kind_, 2, initial_size, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE);
Object::SetElement(isolate, array, 0, Handle<Smi>(Smi::FromInt(1), isolate),
- LanguageMode::kSloppy)
+ kDontThrow)
.Check();
Object::SetElement(isolate, array, 1, Handle<Smi>(Smi::FromInt(2), isolate),
- LanguageMode::kSloppy)
+ kDontThrow)
.Check();
CodeStubArguments args(this, IntPtrConstant(kNumParams));
TVariable<IntPtrT> arg_index(this);
diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc
index f05056a2de..17f7a7d851 100644
--- a/deps/v8/test/cctest/test-compiler.cc
+++ b/deps/v8/test/cctest/test-compiler.cc
@@ -35,8 +35,10 @@
#include "src/compiler.h"
#include "src/disasm.h"
#include "src/heap/factory.h"
+#include "src/heap/spaces.h"
#include "src/interpreter/interpreter.h"
#include "src/objects-inl.h"
+#include "src/objects/allocation-site-inl.h"
#include "test/cctest/cctest.h"
namespace v8 {
@@ -55,7 +57,7 @@ static void SetGlobalProperty(const char* name, Object value) {
isolate->factory()->InternalizeUtf8String(name);
Handle<JSObject> global(isolate->context()->global_object(), isolate);
Runtime::SetObjectProperty(isolate, global, internalized_name, object,
- LanguageMode::kSloppy, StoreOrigin::kMaybeKeyed)
+ StoreOrigin::kMaybeKeyed, Just(kDontThrow))
.Check();
}
@@ -791,6 +793,30 @@ TEST(InvocationCount) {
CHECK_EQ(4, foo->feedback_vector()->invocation_count());
}
+TEST(SafeToSkipArgumentsAdaptor) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ CompileRun(
+ "function a() { \"use strict\"; }; a();"
+ "function b() { }; b();"
+ "function c() { \"use strict\"; return arguments; }; c();"
+ "function d(...args) { return args; }; d();"
+ "function e() { \"use strict\"; return eval(\"\"); }; e();"
+ "function f(x, y) { \"use strict\"; return x + y; }; f(1, 2);");
+ Handle<JSFunction> a = Handle<JSFunction>::cast(GetGlobalProperty("a"));
+ CHECK(a->shared()->is_safe_to_skip_arguments_adaptor());
+ Handle<JSFunction> b = Handle<JSFunction>::cast(GetGlobalProperty("b"));
+ CHECK(!b->shared()->is_safe_to_skip_arguments_adaptor());
+ Handle<JSFunction> c = Handle<JSFunction>::cast(GetGlobalProperty("c"));
+ CHECK(!c->shared()->is_safe_to_skip_arguments_adaptor());
+ Handle<JSFunction> d = Handle<JSFunction>::cast(GetGlobalProperty("d"));
+ CHECK(!d->shared()->is_safe_to_skip_arguments_adaptor());
+ Handle<JSFunction> e = Handle<JSFunction>::cast(GetGlobalProperty("e"));
+ CHECK(!e->shared()->is_safe_to_skip_arguments_adaptor());
+ Handle<JSFunction> f = Handle<JSFunction>::cast(GetGlobalProperty("f"));
+ CHECK(f->shared()->is_safe_to_skip_arguments_adaptor());
+}
+
TEST(ShallowEagerCompilation) {
i::FLAG_always_opt = false;
CcTest::InitializeVM();
diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc
index 3a3063ed3c..e26838d0a8 100644
--- a/deps/v8/test/cctest/test-cpu-profiler.cc
+++ b/deps/v8/test/cctest/test-cpu-profiler.cc
@@ -41,6 +41,7 @@
#include "src/objects-inl.h"
#include "src/profiler/cpu-profiler-inl.h"
#include "src/profiler/profiler-listener.h"
+#include "src/profiler/tracing-cpu-profiler.h"
#include "src/source-position-table.h"
#include "src/utils.h"
#include "test/cctest/cctest.h"
@@ -2405,11 +2406,16 @@ class CpuProfileEventChecker : public v8::platform::tracing::TraceWriter {
profile_id_ = trace_event->id();
v8::ConvertableToTraceFormat* arg =
trace_event->arg_convertables()[0].get();
+ result_json_ += result_json_.empty() ? "[" : ",\n";
arg->AppendAsTraceFormat(&result_json_);
}
- void Flush() override {}
+ void Flush() override { result_json_ += "]"; }
- std::string result_json() const { return result_json_; }
+ const std::string& result_json() const { return result_json_; }
+ void Reset() {
+ result_json_.clear();
+ profile_id_ = 0;
+ }
private:
std::string result_json_;
@@ -2419,50 +2425,61 @@ class CpuProfileEventChecker : public v8::platform::tracing::TraceWriter {
} // namespace
TEST(TracingCpuProfiler) {
- v8::Platform* old_platform = i::V8::GetCurrentPlatform();
- std::unique_ptr<v8::Platform> default_platform =
- v8::platform::NewDefaultPlatform();
- i::V8::SetPlatformForTesting(default_platform.get());
-
- auto tracing = base::make_unique<v8::platform::tracing::TracingController>();
- v8::platform::tracing::TracingController* tracing_controller = tracing.get();
- static_cast<v8::platform::DefaultPlatform*>(default_platform.get())
- ->SetTracingController(std::move(tracing));
+ v8::HandleScope scope(CcTest::isolate());
+ v8::Local<v8::Context> env = CcTest::NewContext({PROFILER_EXTENSION_ID});
+ v8::Context::Scope context_scope(env);
CpuProfileEventChecker* event_checker = new CpuProfileEventChecker();
TraceBuffer* ring_buffer =
TraceBuffer::CreateTraceBufferRingBuffer(1, event_checker);
+ auto* tracing_controller =
+ static_cast<v8::platform::tracing::TracingController*>(
+ i::V8::GetCurrentPlatform()->GetTracingController());
tracing_controller->Initialize(ring_buffer);
- TraceConfig* trace_config = new TraceConfig();
- trace_config->AddIncludedCategory(
- TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"));
- LocalContext env;
- v8::HandleScope scope(env->GetIsolate());
- {
+ bool result = false;
+ for (int run_duration = 50; !result; run_duration += 50) {
+ TraceConfig* trace_config = new TraceConfig();
+ trace_config->AddIncludedCategory(
+ TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"));
+ trace_config->AddIncludedCategory(
+ TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler.hires"));
+
+ std::string test_code = R"(
+ function foo() {
+ let s = 0;
+ const endTime = Date.now() + )" +
+ std::to_string(run_duration) + R"(
+ while (Date.now() < endTime) s += Math.cos(s);
+ return s;
+ }
+ foo();)";
+
tracing_controller->StartTracing(trace_config);
- CompileRun("function foo() { } foo();");
+ CompileRun(test_code.c_str());
tracing_controller->StopTracing();
- CompileRun("function bar() { } bar();");
- }
- const char* profile_checker =
- "function checkProfile(profile) {\n"
- " if (typeof profile['startTime'] !== 'number') return 'startTime';\n"
- " return '';\n"
- "}\n"
- "checkProfile(";
- std::string profile_json = event_checker->result_json();
- CHECK_LT(0u, profile_json.length());
- printf("Profile JSON: %s\n", profile_json.c_str());
- std::string code = profile_checker + profile_json + ")";
- v8::Local<v8::Value> result =
- CompileRunChecked(CcTest::isolate(), code.c_str());
- v8::String::Utf8Value value(CcTest::isolate(), result);
- printf("Check result: %*s\n", value.length(), *value);
- CHECK_EQ(0, value.length());
+ std::string profile_json = event_checker->result_json();
+ event_checker->Reset();
+ CHECK_LT(0u, profile_json.length());
+ printf("Profile JSON: %s\n", profile_json.c_str());
+
+ std::string profile_checker_code = R"(
+ function checkProfile(json) {
+ const profile_header = json[0];
+ if (typeof profile_header['startTime'] !== 'number')
+ return false;
+ return json.some(event => (event.lines || []).some(line => line));
+ }
+ checkProfile()" + profile_json +
+ ")";
+ result = CompileRunChecked(CcTest::isolate(), profile_checker_code.c_str())
+ ->IsTrue();
+ }
- i::V8::SetPlatformForTesting(old_platform);
+ static_cast<v8::platform::tracing::TracingController*>(
+ i::V8::GetCurrentPlatform()->GetTracingController())
+ ->Initialize(nullptr);
}
TEST(Issue763073) {
@@ -2688,6 +2705,54 @@ TEST(MultipleProfilers) {
profiler2->StopProfiling("2");
}
+// Tests that logged CodeCreateEvent calls do not crash a reused CpuProfiler.
+// crbug.com/929928
+TEST(CrashReusedProfiler) {
+ LocalContext env;
+ i::Isolate* isolate = CcTest::i_isolate();
+ i::HandleScope scope(isolate);
+
+ std::unique_ptr<CpuProfiler> profiler(new CpuProfiler(isolate));
+ profiler->StartProfiling("1");
+ profiler->StopProfiling("1");
+
+ profiler->StartProfiling("2");
+ CreateCode(&env);
+ profiler->StopProfiling("2");
+}
+
+// Tests that samples from different profilers on the same isolate do not leak
+// samples to each other. See crbug.com/v8/8835.
+TEST(MultipleProfilersSampleIndependently) {
+ LocalContext env;
+ i::Isolate* isolate = CcTest::i_isolate();
+ i::HandleScope scope(isolate);
+
+ // Create two profilers- one slow ticking one, and one fast ticking one.
+ // Ensure that the slow ticking profiler does not receive samples from the
+ // fast ticking one.
+ std::unique_ptr<CpuProfiler> slow_profiler(
+ new CpuProfiler(CcTest::i_isolate()));
+ slow_profiler->set_sampling_interval(base::TimeDelta::FromSeconds(1));
+ slow_profiler->StartProfiling("1", true);
+
+ CompileRun(R"(
+ function start() {
+ let val = 1;
+ for (let i = 0; i < 10e3; i++) {
+ val = (val * 2) % 3;
+ }
+ return val;
+ }
+ )");
+ v8::Local<v8::Function> function = GetFunction(env.local(), "start");
+ ProfilerHelper helper(env.local());
+ v8::CpuProfile* profile = helper.Run(function, nullptr, 0, 100, 0, true);
+
+ auto slow_profile = slow_profiler->StopProfiling("1");
+ CHECK_GT(profile->GetSamplesCount(), slow_profile->samples_count());
+}
+
void ProfileSomeCode(v8::Isolate* isolate) {
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope scope(isolate);
@@ -2740,19 +2805,45 @@ TEST(MultipleIsolates) {
thread2.Join();
}
-int GetSourcePositionEntryCount(i::Isolate* isolate, const char* source) {
+// Tests that StopProfiling doesn't wait for the next sample tick in order to
+// stop, but rather exits early before a given wait threshold.
+TEST(FastStopProfiling) {
+ static const base::TimeDelta kLongInterval = base::TimeDelta::FromSeconds(10);
+ static const base::TimeDelta kWaitThreshold = base::TimeDelta::FromSeconds(5);
+
+ std::unique_ptr<CpuProfiler> profiler(new CpuProfiler(CcTest::i_isolate()));
+ profiler->set_sampling_interval(kLongInterval);
+ profiler->StartProfiling("", true);
+
+ v8::Platform* platform = v8::internal::V8::GetCurrentPlatform();
+ double start = platform->CurrentClockTimeMillis();
+ profiler->StopProfiling("");
+ double duration = platform->CurrentClockTimeMillis() - start;
+
+ CHECK_LT(duration, kWaitThreshold.InMillisecondsF());
+}
+
+enum class EntryCountMode { kAll, kOnlyInlined };
+
+// Count the number of unique source positions.
+int GetSourcePositionEntryCount(i::Isolate* isolate, const char* source,
+ EntryCountMode mode = EntryCountMode::kAll) {
+ std::unordered_set<int64_t> raw_position_set;
i::Handle<i::JSFunction> function = i::Handle<i::JSFunction>::cast(
v8::Utils::OpenHandle(*CompileRun(source)));
if (function->IsInterpreted()) return -1;
i::Handle<i::Code> code(function->code(), isolate);
i::SourcePositionTableIterator iterator(
ByteArray::cast(code->source_position_table()));
- int count = 0;
+
while (!iterator.done()) {
- count++;
+ if (mode == EntryCountMode::kAll ||
+ iterator.source_position().isInlined()) {
+ raw_position_set.insert(iterator.source_position().raw());
+ }
iterator.Advance();
}
- return count;
+ return static_cast<int>(raw_position_set.size());
}
UNINITIALIZED_TEST(DetailedSourcePositionAPI) {
@@ -2795,6 +2886,68 @@ UNINITIALIZED_TEST(DetailedSourcePositionAPI) {
isolate->Dispose();
}
+UNINITIALIZED_TEST(DetailedSourcePositionAPI_Inlining) {
+ i::FLAG_detailed_line_info = false;
+ i::FLAG_turbo_inlining = true;
+ i::FLAG_stress_inline = true;
+ i::FLAG_always_opt = false;
+ i::FLAG_allow_natives_syntax = true;
+ v8::Isolate::CreateParams create_params;
+ create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+ v8::Isolate* isolate = v8::Isolate::New(create_params);
+
+ const char* source = R"(
+ function foo(x) {
+ return bar(x) + 1;
+ }
+
+ function bar(x) {
+ var y = 1;
+ for (var i = 0; i < x; ++i) {
+ y = y * x;
+ }
+ return x;
+ }
+
+ foo(5);
+ %OptimizeFunctionOnNextCall(foo);
+ foo(5);
+ foo;
+ )";
+
+ {
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ v8::Context::Scope context_scope(context);
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+
+ CHECK(!i_isolate->NeedsDetailedOptimizedCodeLineInfo());
+
+ int non_detailed_positions =
+ GetSourcePositionEntryCount(i_isolate, source, EntryCountMode::kAll);
+ int non_detailed_inlined_positions = GetSourcePositionEntryCount(
+ i_isolate, source, EntryCountMode::kOnlyInlined);
+
+ v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate);
+ CHECK(i_isolate->NeedsDetailedOptimizedCodeLineInfo());
+
+ int detailed_positions =
+ GetSourcePositionEntryCount(i_isolate, source, EntryCountMode::kAll);
+ int detailed_inlined_positions = GetSourcePositionEntryCount(
+ i_isolate, source, EntryCountMode::kOnlyInlined);
+
+ if (non_detailed_positions == -1) {
+ CHECK_EQ(non_detailed_positions, detailed_positions);
+ } else {
+ CHECK_LT(non_detailed_positions, detailed_positions);
+ CHECK_LT(non_detailed_inlined_positions, detailed_inlined_positions);
+ }
+ }
+
+ isolate->Dispose();
+}
+
} // namespace test_cpu_profiler
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc
index bc9a11a9f1..c6a163f554 100644
--- a/deps/v8/test/cctest/test-debug.cc
+++ b/deps/v8/test/cctest/test-debug.cc
@@ -2949,8 +2949,8 @@ TEST(NoBreakWhenBootstrapping) {
{
// Create a context with an extension to make sure that some JavaScript
// code is executed during bootstrapping.
- v8::RegisterExtension(new v8::Extension("simpletest",
- kSimpleExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<v8::Extension>(
+ "simpletest", kSimpleExtensionSource));
const char* extension_names[] = { "simpletest" };
v8::ExtensionConfiguration extensions(1, extension_names);
v8::HandleScope handle_scope(isolate);
@@ -4022,7 +4022,7 @@ UNINITIALIZED_TEST(DebugSetOutOfMemoryListener) {
CHECK(!near_heap_limit_callback_called);
// The following allocation fails unless the out-of-memory callback
// increases the heap limit.
- int length = 10 * i::MB / i::kPointerSize;
+ int length = 10 * i::MB / i::kTaggedSize;
i_isolate->factory()->NewFixedArray(length, i::TENURED);
CHECK(near_heap_limit_callback_called);
isolate->RemoveNearHeapLimitCallback(NearHeapLimitCallback, 0);
@@ -4037,7 +4037,8 @@ TEST(DebugCoverage) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
- v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kPreciseCount);
+ v8::debug::Coverage::SelectMode(isolate,
+ v8::debug::CoverageMode::kPreciseCount);
v8::Local<v8::String> source = v8_str(
"function f() {\n"
"}\n"
@@ -4092,7 +4093,8 @@ TEST(DebugCoverageWithCoverageOutOfScope) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
- v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kPreciseCount);
+ v8::debug::Coverage::SelectMode(isolate,
+ v8::debug::CoverageMode::kPreciseCount);
v8::Local<v8::String> source = v8_str(
"function f() {\n"
"}\n"
@@ -4163,7 +4165,8 @@ TEST(DebugCoverageWithScriptDataOutOfScope) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
- v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kPreciseCount);
+ v8::debug::Coverage::SelectMode(isolate,
+ v8::debug::CoverageMode::kPreciseCount);
v8::Local<v8::String> source = v8_str(
"function f() {\n"
"}\n"
@@ -4500,3 +4503,99 @@ TEST(Regress517592) {
CHECK_EQ(delegate.break_count(), 1);
v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr);
}
+
+TEST(GetPrivateFields) {
+ LocalContext env;
+ v8::Isolate* v8_isolate = CcTest::isolate();
+ v8::internal::Isolate* isolate = CcTest::i_isolate();
+ v8::HandleScope scope(v8_isolate);
+ v8::Local<v8::Context> context = env.local();
+ v8::internal::FLAG_harmony_class_fields = true;
+ v8::internal::FLAG_harmony_private_fields = true;
+ v8::Local<v8::String> source = v8_str(
+ "var X = class {\n"
+ " #foo = 1;\n"
+ " #bar = function() {};\n"
+ "}\n"
+ "var x = new X()");
+ CompileRun(source);
+ v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(
+ env->Global()
+ ->Get(context, v8_str(env->GetIsolate(), "x"))
+ .ToLocalChecked());
+ v8::Local<v8::Array> private_names =
+ v8::debug::GetPrivateFields(context, object).ToLocalChecked();
+
+ for (int i = 0; i < 4; i = i + 2) {
+ Handle<v8::internal::JSReceiver> private_name =
+ v8::Utils::OpenHandle(*private_names->Get(context, i)
+ .ToLocalChecked()
+ ->ToObject(context)
+ .ToLocalChecked());
+ Handle<v8::internal::JSValue> private_value =
+ Handle<v8::internal::JSValue>::cast(private_name);
+ Handle<v8::internal::Symbol> priv_symbol(
+ v8::internal::Symbol::cast(private_value->value()), isolate);
+ CHECK(priv_symbol->is_private_name());
+ }
+
+ source = v8_str(
+ "var Y = class {\n"
+ " #baz = 2;\n"
+ "}\n"
+ "var X = class extends Y{\n"
+ " #foo = 1;\n"
+ " #bar = function() {};\n"
+ "}\n"
+ "var x = new X()");
+ CompileRun(source);
+ object = v8::Local<v8::Object>::Cast(
+ env->Global()
+ ->Get(context, v8_str(env->GetIsolate(), "x"))
+ .ToLocalChecked());
+ private_names = v8::debug::GetPrivateFields(context, object).ToLocalChecked();
+
+ for (int i = 0; i < 6; i = i + 2) {
+ Handle<v8::internal::JSReceiver> private_name =
+ v8::Utils::OpenHandle(*private_names->Get(context, i)
+ .ToLocalChecked()
+ ->ToObject(context)
+ .ToLocalChecked());
+ Handle<v8::internal::JSValue> private_value =
+ Handle<v8::internal::JSValue>::cast(private_name);
+ Handle<v8::internal::Symbol> priv_symbol(
+ v8::internal::Symbol::cast(private_value->value()), isolate);
+ CHECK(priv_symbol->is_private_name());
+ }
+
+ source = v8_str(
+ "var Y = class {\n"
+ " constructor() {"
+ " return new Proxy({}, {});"
+ " }"
+ "}\n"
+ "var X = class extends Y{\n"
+ " #foo = 1;\n"
+ " #bar = function() {};\n"
+ "}\n"
+ "var x = new X()");
+ CompileRun(source);
+ object = v8::Local<v8::Object>::Cast(
+ env->Global()
+ ->Get(context, v8_str(env->GetIsolate(), "x"))
+ .ToLocalChecked());
+ private_names = v8::debug::GetPrivateFields(context, object).ToLocalChecked();
+
+ for (int i = 0; i < 4; i = i + 2) {
+ Handle<v8::internal::JSReceiver> private_name =
+ v8::Utils::OpenHandle(*private_names->Get(context, i)
+ .ToLocalChecked()
+ ->ToObject(context)
+ .ToLocalChecked());
+ Handle<v8::internal::JSValue> private_value =
+ Handle<v8::internal::JSValue>::cast(private_name);
+ Handle<v8::internal::Symbol> priv_symbol(
+ v8::internal::Symbol::cast(private_value->value()), isolate);
+ CHECK(priv_symbol->is_private_name());
+ }
+}
diff --git a/deps/v8/test/cctest/test-decls.cc b/deps/v8/test/cctest/test-decls.cc
index cce41a3738..2e9bc90fac 100644
--- a/deps/v8/test/cctest/test-decls.cc
+++ b/deps/v8/test/cctest/test-decls.cc
@@ -427,61 +427,6 @@ TEST(AbsentInPrototype) {
-class ExistsInHiddenPrototypeContext: public DeclarationContext {
- public:
- ExistsInHiddenPrototypeContext() {
- hidden_proto_ = FunctionTemplate::New(CcTest::isolate());
- hidden_proto_->SetHiddenPrototype(true);
- }
-
- protected:
- v8::Local<Integer> Query(Local<Name> key) override {
- // Let it seem that the property exists in the hidden prototype object.
- return Integer::New(isolate(), v8::None);
- }
-
- // Install the hidden prototype after the global object has been created.
- void PostInitializeContext(Local<Context> context) override {
- Local<Object> global_object = context->Global();
- Local<Object> hidden_proto = hidden_proto_->GetFunction(context)
- .ToLocalChecked()
- ->NewInstance(context)
- .ToLocalChecked();
- Local<Object> inner_global =
- Local<Object>::Cast(global_object->GetPrototype());
- inner_global->SetPrototype(context, hidden_proto).FromJust();
- }
-
- // Use the hidden prototype as the holder for the interceptors.
- Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) override {
- return hidden_proto_->InstanceTemplate();
- }
-
- private:
- Local<FunctionTemplate> hidden_proto_;
-};
-
-
-TEST(ExistsInHiddenPrototype) {
- HandleScope scope(CcTest::isolate());
-
- { ExistsInHiddenPrototypeContext context;
- context.Check("var x; x", 0, 0, 0, EXPECT_RESULT,
- Undefined(CcTest::isolate()));
- }
-
- { ExistsInHiddenPrototypeContext context;
- context.Check("var x = 0; x", 0, 0, 0, EXPECT_RESULT,
- Number::New(CcTest::isolate(), 0));
- }
-
- { ExistsInHiddenPrototypeContext context;
- context.Check("function x() { }; x", 0, 1, 1, EXPECT_RESULT);
- }
-}
-
-
-
class SimpleContext {
public:
SimpleContext()
diff --git a/deps/v8/test/cctest/test-dictionary.cc b/deps/v8/test/cctest/test-dictionary.cc
index feeaeb4214..a06c18df02 100644
--- a/deps/v8/test/cctest/test-dictionary.cc
+++ b/deps/v8/test/cctest/test-dictionary.cc
@@ -36,6 +36,7 @@
#include "src/heap/spaces.h"
#include "src/objects-inl.h"
#include "src/objects/hash-table-inl.h"
+#include "src/roots.h"
#include "test/cctest/heap/heap-utils.h"
namespace v8 {
@@ -218,7 +219,7 @@ TEST(HashTableRehash) {
for (int i = 0; i < capacity - 1; i++) {
t->insert(i, i * i, i);
}
- t->Rehash(isolate);
+ t->Rehash(ReadOnlyRoots(isolate));
for (int i = 0; i < capacity - 1; i++) {
CHECK_EQ(i, t->lookup(i * i));
}
@@ -231,7 +232,7 @@ TEST(HashTableRehash) {
for (int i = 0; i < capacity / 2; i++) {
t->insert(i, i * i, i);
}
- t->Rehash(isolate);
+ t->Rehash(ReadOnlyRoots(isolate));
for (int i = 0; i < capacity / 2; i++) {
CHECK_EQ(i, t->lookup(i * i));
}
diff --git a/deps/v8/test/cctest/test-disasm-arm64.cc b/deps/v8/test/cctest/test-disasm-arm64.cc
index 20ccf77fd0..a401e031f9 100644
--- a/deps/v8/test/cctest/test-disasm-arm64.cc
+++ b/deps/v8/test/cctest/test-disasm-arm64.cc
@@ -74,7 +74,10 @@ namespace internal {
#define COMPARE(ASM, EXP) \
assm->Reset(); \
assm->ASM; \
- assm->GetCode(isolate, nullptr); \
+ { \
+ CodeDesc desc; \
+ assm->GetCode(isolate, &desc); \
+ } \
decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
encoding = *reinterpret_cast<uint32_t*>(buf); \
if (strcmp(disasm->GetOutput(), EXP) != 0) { \
@@ -86,7 +89,10 @@ namespace internal {
#define COMPARE_PREFIX(ASM, EXP) \
assm->Reset(); \
assm->ASM; \
- assm->GetCode(isolate, nullptr); \
+ { \
+ CodeDesc desc; \
+ assm->GetCode(isolate, &desc); \
+ } \
decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
encoding = *reinterpret_cast<uint32_t*>(buf); \
if (strncmp(disasm->GetOutput(), EXP, strlen(EXP)) != 0) { \
diff --git a/deps/v8/test/cctest/test-disasm-x64.cc b/deps/v8/test/cctest/test-disasm-x64.cc
index 085fd4be7c..15eef72a6b 100644
--- a/deps/v8/test/cctest/test-disasm-x64.cc
+++ b/deps/v8/test/cctest/test-disasm-x64.cc
@@ -205,8 +205,7 @@ TEST(DisasmX64) {
__ incq(Operand(rbx, rcx, times_4, 10000));
__ pushq(Operand(rbx, rcx, times_4, 10000));
__ popq(Operand(rbx, rcx, times_4, 10000));
- // TODO(mstarzinger): The following is protected.
- // __ jmp(Operand(rbx, rcx, times_4, 10000));
+ __ jmp(Operand(rbx, rcx, times_4, 10000));
__ leaq(rdx, Operand(rbx, rcx, times_4, 10000));
__ orq(rdx, Immediate(12345));
@@ -291,8 +290,7 @@ TEST(DisasmX64) {
__ nop();
__ jmp(&L1);
- // TODO(mstarzinger): The following is protected.
- // __ jmp(Operand(rbx, rcx, times_4, 10000));
+ __ jmp(Operand(rbx, rcx, times_4, 10000));
__ jmp(ic, RelocInfo::CODE_TARGET);
__ nop();
diff --git a/deps/v8/test/cctest/test-elements-kind.cc b/deps/v8/test/cctest/test-elements-kind.cc
index ca382a60c1..d7f6ccb852 100644
--- a/deps/v8/test/cctest/test-elements-kind.cc
+++ b/deps/v8/test/cctest/test-elements-kind.cc
@@ -113,7 +113,8 @@ TEST(JSObjectInObjectAddingProperties) {
factory->NewFunctionForTest(factory->empty_string());
int nof_inobject_properties = 10;
// force in object properties by changing the expected_nof_properties
- function->shared()->set_expected_nof_properties(nof_inobject_properties);
+ // (we always reserve 8 inobject properties slack on top).
+ function->shared()->set_expected_nof_properties(nof_inobject_properties - 8);
Handle<Object> value(Smi::FromInt(42), isolate);
Handle<JSObject> object = factory->NewJSObject(function);
diff --git a/deps/v8/test/cctest/test-factory.cc b/deps/v8/test/cctest/test-factory.cc
index a282f4bccd..abb77b5b6b 100644
--- a/deps/v8/test/cctest/test-factory.cc
+++ b/deps/v8/test/cctest/test-factory.cc
@@ -4,6 +4,7 @@
#include "include/v8.h"
+#include "src/code-desc.h"
#include "src/handles-inl.h"
#include "src/isolate.h"
#include "test/cctest/cctest.h"
diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc
index c241ac6b7d..c8ffddbf7b 100644
--- a/deps/v8/test/cctest/test-feedback-vector.cc
+++ b/deps/v8/test/cctest/test-feedback-vector.cc
@@ -176,14 +176,14 @@ TEST(VectorCallICStates) {
Handle<FeedbackVector>(f->feedback_vector(), isolate);
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
CompileRun("f(function() { return 16; })");
- CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+ CHECK_EQ(GENERIC, nexus.ic_state());
// After a collection, state should remain GENERIC.
CcTest::CollectAllGarbage();
- CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+ CHECK_EQ(GENERIC, nexus.ic_state());
}
TEST(VectorCallFeedback) {
@@ -206,14 +206,14 @@ TEST(VectorCallFeedback) {
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
HeapObject heap_object;
CHECK(nexus.GetFeedback()->GetHeapObjectIfWeak(&heap_object));
CHECK_EQ(*foo, heap_object);
CcTest::CollectAllGarbage();
// It should stay monomorphic even after a GC.
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
}
TEST(VectorCallFeedbackForArray) {
@@ -233,14 +233,14 @@ TEST(VectorCallFeedbackForArray) {
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
HeapObject heap_object;
CHECK(nexus.GetFeedback()->GetHeapObjectIfWeak(&heap_object));
CHECK_EQ(*isolate->array_function(), heap_object);
CcTest::CollectAllGarbage();
// It should stay monomorphic even after a GC.
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
}
size_t GetFeedbackVectorLength(Isolate* isolate, const char* src,
@@ -326,15 +326,15 @@ TEST(VectorCallCounts) {
Handle<FeedbackVector>(f->feedback_vector(), isolate);
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
CompileRun("f(foo); f(foo);");
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
CHECK_EQ(3, nexus.GetCallCount());
// Send the IC megamorphic, but we should still have incrementing counts.
CompileRun("f(function() { return 12; });");
- CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+ CHECK_EQ(GENERIC, nexus.ic_state());
CHECK_EQ(4, nexus.GetCallCount());
}
@@ -357,17 +357,17 @@ TEST(VectorConstructCounts) {
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
CHECK(feedback_vector->Get(slot)->IsWeak());
CompileRun("f(Foo); f(Foo);");
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
CHECK_EQ(3, nexus.GetCallCount());
// Send the IC megamorphic, but we should still have incrementing counts.
CompileRun("f(function() {});");
- CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+ CHECK_EQ(GENERIC, nexus.ic_state());
CHECK_EQ(4, nexus.GetCallCount());
}
@@ -424,40 +424,40 @@ TEST(VectorLoadICStates) {
Handle<FeedbackVector>(f->feedback_vector(), isolate);
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(PREMONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(PREMONOMORPHIC, nexus.ic_state());
CompileRun("f(o)");
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
// Verify that the monomorphic map is the one we expect.
v8::MaybeLocal<v8::Value> v8_o =
CcTest::global()->Get(context.local(), v8_str("o"));
Handle<JSObject> o =
Handle<JSObject>::cast(v8::Utils::OpenHandle(*v8_o.ToLocalChecked()));
- CHECK_EQ(o->map(), nexus.FindFirstMap());
+ CHECK_EQ(o->map(), nexus.GetFirstMap());
// Now go polymorphic.
CompileRun("f({ blarg: 3, foo: 2 })");
- CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(POLYMORPHIC, nexus.ic_state());
CompileRun(
"delete o.foo;"
"f(o)");
- CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(POLYMORPHIC, nexus.ic_state());
CompileRun("f({ blarg: 3, torino: 10, foo: 2 })");
- CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(POLYMORPHIC, nexus.ic_state());
MapHandles maps;
nexus.ExtractMaps(&maps);
CHECK_EQ(4, maps.size());
// Finally driven megamorphic.
CompileRun("f({ blarg: 3, gran: 3, torino: 10, foo: 2 })");
- CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback());
- CHECK(nexus.FindFirstMap().is_null());
+ CHECK_EQ(MEGAMORPHIC, nexus.ic_state());
+ CHECK(nexus.GetFirstMap().is_null());
// After a collection, state should not be reset to PREMONOMORPHIC.
CcTest::CollectAllGarbage();
- CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MEGAMORPHIC, nexus.ic_state());
}
TEST(VectorLoadGlobalICSlotSharing) {
@@ -490,10 +490,8 @@ TEST(VectorLoadGlobalICSlotSharing) {
CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kLoadGlobalInsideTypeof);
FeedbackSlot slot1 = helper.slot(0);
FeedbackSlot slot2 = helper.slot(1);
- CHECK_EQ(MONOMORPHIC,
- FeedbackNexus(feedback_vector, slot1).StateFromFeedback());
- CHECK_EQ(MONOMORPHIC,
- FeedbackNexus(feedback_vector, slot2).StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, FeedbackNexus(feedback_vector, slot1).ic_state());
+ CHECK_EQ(MONOMORPHIC, FeedbackNexus(feedback_vector, slot2).ic_state());
}
@@ -517,17 +515,17 @@ TEST(VectorLoadICOnSmi) {
Handle<FeedbackVector>(f->feedback_vector(), isolate);
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(PREMONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(PREMONOMORPHIC, nexus.ic_state());
CompileRun("f(34)");
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
// Verify that the monomorphic map is the one we expect.
Map number_map = ReadOnlyRoots(heap).heap_number_map();
- CHECK_EQ(number_map, nexus.FindFirstMap());
+ CHECK_EQ(number_map, nexus.GetFirstMap());
// Now go polymorphic on o.
CompileRun("f(o)");
- CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(POLYMORPHIC, nexus.ic_state());
MapHandles maps;
nexus.ExtractMaps(&maps);
@@ -550,7 +548,7 @@ TEST(VectorLoadICOnSmi) {
// The degree of polymorphism doesn't change.
CompileRun("f(100)");
- CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(POLYMORPHIC, nexus.ic_state());
MapHandles maps2;
nexus.ExtractMaps(&maps2);
CHECK_EQ(2, maps2.size());
@@ -720,7 +718,7 @@ TEST(VectorStoreICBasic) {
CHECK_EQ(1, helper.slot_count());
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
}
TEST(StoreOwnIC) {
@@ -746,7 +744,7 @@ TEST(StoreOwnIC) {
CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLiteral);
CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kStoreOwnNamed);
FeedbackNexus nexus(feedback_vector, helper.slot(1));
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
}
} // namespace
diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc
index dca13242ba..49b0f92011 100644
--- a/deps/v8/test/cctest/test-field-type-tracking.cc
+++ b/deps/v8/test/cctest/test-field-type-tracking.cc
@@ -124,18 +124,10 @@ class Expectations {
kinds_[index] = kind;
locations_[index] = location;
if (kind == kData && location == kField &&
- IsTransitionableFastElementsKind(elements_kind_) &&
- Map::IsInplaceGeneralizableField(constness, representation,
- FieldType::cast(*value))) {
- // Maps with transitionable elements kinds must have non in-place
- // generalizable fields.
- if (FLAG_track_constant_fields && FLAG_modify_map_inplace &&
- constness == PropertyConstness::kConst) {
- constness = PropertyConstness::kMutable;
- }
- if (representation.IsHeapObject() && !FieldType::cast(*value)->IsAny()) {
- value = FieldType::Any(isolate_);
- }
+ IsTransitionableFastElementsKind(elements_kind_)) {
+ // Maps with transitionable elements kinds must have the most general
+ // field type.
+ value = FieldType::Any(isolate_);
}
constnesses_[index] = constness;
attributes_[index] = attributes;
@@ -278,6 +270,7 @@ class Expectations {
if (details.attributes() != expected_attributes) return false;
Representation expected_representation = representations_[descriptor];
+
if (!details.representation().Equals(expected_representation)) return false;
Object expected_value = *values_[descriptor];
@@ -341,6 +334,12 @@ class Expectations {
return map;
}
+ void ChangeAttributesForAllProperties(PropertyAttributes attributes) {
+ for (int i = 0; i < number_of_properties_; i++) {
+ attributes_[i] = attributes;
+ }
+ }
+
Handle<Map> AddDataField(Handle<Map> map, PropertyAttributes attributes,
PropertyConstness constness,
Representation representation,
@@ -665,7 +664,7 @@ static void TestGeneralizeField(int detach_property_at_index,
// Create new maps by generalizing representation of propX field.
CanonicalHandleScope canonical(isolate);
JSHeapBroker broker(isolate, &zone);
- CompilationDependencies dependencies(isolate, &zone);
+ CompilationDependencies dependencies(&broker, &zone);
MapRef map_ref(&broker, map);
map_ref.SerializeOwnDescriptors();
dependencies.DependOnFieldType(map_ref, property_index);
@@ -1042,7 +1041,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeField(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
JSHeapBroker broker(isolate, &zone);
- CompilationDependencies dependencies(isolate, &zone);
+ CompilationDependencies dependencies(&broker, &zone);
MapRef map_ref(&broker, map);
map_ref.SerializeOwnDescriptors();
dependencies.DependOnFieldType(map_ref, kSplitProp);
@@ -1129,10 +1128,11 @@ static void TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
JSHeapBroker broker(isolate, &zone);
- CompilationDependencies dependencies(isolate, &zone);
+ CompilationDependencies dependencies(&broker, &zone);
MapRef map_ref(&broker, map);
map_ref.SerializeOwnDescriptors();
dependencies.DependOnFieldType(map_ref, kSplitProp);
+ dependencies.DependOnFieldConstness(map_ref, kSplitProp);
// Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which
// should generalize representations in |map1|.
@@ -1813,7 +1813,7 @@ static void TestReconfigureElementsKind_GeneralizeField(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
JSHeapBroker broker(isolate, &zone);
- CompilationDependencies dependencies(isolate, &zone);
+ CompilationDependencies dependencies(&broker, &zone);
MapRef map_ref(&broker, map);
map_ref.SerializeOwnDescriptors();
dependencies.DependOnFieldType(map_ref, kDiffProp);
@@ -1911,10 +1911,12 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
JSHeapBroker broker(isolate, &zone);
- CompilationDependencies dependencies(isolate, &zone);
+ CompilationDependencies dependencies(&broker, &zone);
MapRef map_ref(&broker, map);
map_ref.SerializeOwnDescriptors();
+
dependencies.DependOnFieldType(map_ref, kDiffProp);
+ dependencies.DependOnFieldConstness(map_ref, kDiffProp);
// Reconfigure elements kinds of |map2|, which should generalize
// representations in |map|.
@@ -1935,7 +1937,8 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
expected.representation, expected.type);
CHECK(!map->is_deprecated());
CHECK_EQ(*map, *new_map);
- CHECK(dependencies.AreValid());
+ CHECK_EQ(IsGeneralizableTo(to.constness, from.constness),
+ dependencies.AreValid());
CHECK(!new_map->is_deprecated());
CHECK(expectations.Check(*new_map));
@@ -2333,9 +2336,12 @@ static void TestGeneralizeFieldWithSpecialTransition(TestConfig& config,
// If Map::TryUpdate() manages to succeed the result must match the result
// of Map::Update().
CHECK_EQ(*new_map2, *tmp_map);
+ } else {
+ // Equivalent transitions should always find the updated map.
+ CHECK(config.is_non_equivalent_transition());
}
- if (config.is_non_equevalent_transition()) {
+ if (config.is_non_equivalent_transition()) {
// In case of non-equivalent transition currently we generalize all
// representations.
for (int i = 0; i < kPropCount; i++) {
@@ -2344,6 +2350,9 @@ static void TestGeneralizeFieldWithSpecialTransition(TestConfig& config,
CHECK(new_map2->GetBackPointer()->IsUndefined(isolate));
CHECK(expectations2.Check(*new_map2));
} else {
+ expectations2.SetDataField(i, expected.constness, expected.representation,
+ expected.type);
+
CHECK(!new_map2->GetBackPointer()->IsUndefined(isolate));
CHECK(expectations2.Check(*new_map2));
}
@@ -2374,23 +2383,33 @@ TEST(ElementsKindTransitionFromMapOwningDescriptor) {
FieldType::Class(Map::Create(isolate, 0), isolate);
struct TestConfig {
+ TestConfig(PropertyAttributes attributes, Handle<Symbol> symbol)
+ : attributes(attributes), symbol(symbol) {}
+
Handle<Map> Transition(Handle<Map> map, Expectations& expectations) {
- Handle<Symbol> frozen_symbol(map->GetReadOnlyRoots().frozen_symbol(),
- CcTest::i_isolate());
expectations.SetElementsKind(DICTIONARY_ELEMENTS);
- return Map::CopyForPreventExtensions(CcTest::i_isolate(), map, NONE,
- frozen_symbol,
- "CopyForPreventExtensions");
+ expectations.ChangeAttributesForAllProperties(attributes);
+ return Map::CopyForPreventExtensions(CcTest::i_isolate(), map, attributes,
+ symbol, "CopyForPreventExtensions");
}
// TODO(ishell): remove once IS_PROTO_TRANS_ISSUE_FIXED is removed.
bool generalizes_representations() const { return false; }
- bool is_non_equevalent_transition() const { return true; }
+ bool is_non_equivalent_transition() const { return false; }
+
+ PropertyAttributes attributes;
+ Handle<Symbol> symbol;
};
- TestConfig config;
- TestGeneralizeFieldWithSpecialTransition(
- config, {PropertyConstness::kMutable, Representation::Smi(), any_type},
- {PropertyConstness::kMutable, Representation::HeapObject(), value_type},
- {PropertyConstness::kMutable, Representation::Tagged(), any_type});
+ Factory* factory = isolate->factory();
+ TestConfig configs[] = {{FROZEN, factory->frozen_symbol()},
+ {SEALED, factory->sealed_symbol()},
+ {NONE, factory->nonextensible_symbol()}};
+ for (size_t i = 0; i < arraysize(configs); i++) {
+ TestGeneralizeFieldWithSpecialTransition(
+ configs[i],
+ {PropertyConstness::kMutable, Representation::Smi(), any_type},
+ {PropertyConstness::kMutable, Representation::HeapObject(), value_type},
+ {PropertyConstness::kMutable, Representation::Tagged(), any_type});
+ }
}
@@ -2404,6 +2423,9 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) {
FieldType::Class(Map::Create(isolate, 0), isolate);
struct TestConfig {
+ TestConfig(PropertyAttributes attributes, Handle<Symbol> symbol)
+ : attributes(attributes), symbol(symbol) {}
+
Handle<Map> Transition(Handle<Map> map, Expectations& expectations) {
Isolate* isolate = CcTest::i_isolate();
Handle<FieldType> any_type = FieldType::Any(isolate);
@@ -2417,21 +2439,29 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) {
.ToHandleChecked();
CHECK(!map->owns_descriptors());
- Handle<Symbol> frozen_symbol(ReadOnlyRoots(isolate).frozen_symbol(),
- isolate);
expectations.SetElementsKind(DICTIONARY_ELEMENTS);
- return Map::CopyForPreventExtensions(isolate, map, NONE, frozen_symbol,
+ expectations.ChangeAttributesForAllProperties(attributes);
+ return Map::CopyForPreventExtensions(isolate, map, attributes, symbol,
"CopyForPreventExtensions");
}
// TODO(ishell): remove once IS_PROTO_TRANS_ISSUE_FIXED is removed.
bool generalizes_representations() const { return false; }
- bool is_non_equevalent_transition() const { return true; }
+ bool is_non_equivalent_transition() const { return false; }
+
+ PropertyAttributes attributes;
+ Handle<Symbol> symbol;
};
- TestConfig config;
- TestGeneralizeFieldWithSpecialTransition(
- config, {PropertyConstness::kMutable, Representation::Smi(), any_type},
- {PropertyConstness::kMutable, Representation::HeapObject(), value_type},
- {PropertyConstness::kMutable, Representation::Tagged(), any_type});
+ Factory* factory = isolate->factory();
+ TestConfig configs[] = {{FROZEN, factory->frozen_symbol()},
+ {SEALED, factory->sealed_symbol()},
+ {NONE, factory->nonextensible_symbol()}};
+ for (size_t i = 0; i < arraysize(configs); i++) {
+ TestGeneralizeFieldWithSpecialTransition(
+ configs[i],
+ {PropertyConstness::kMutable, Representation::Smi(), any_type},
+ {PropertyConstness::kMutable, Representation::HeapObject(), value_type},
+ {PropertyConstness::kMutable, Representation::Tagged(), any_type});
+ }
}
@@ -2460,7 +2490,7 @@ TEST(PrototypeTransitionFromMapOwningDescriptor) {
bool generalizes_representations() const {
return !IS_PROTO_TRANS_ISSUE_FIXED;
}
- bool is_non_equevalent_transition() const { return true; }
+ bool is_non_equivalent_transition() const { return true; }
};
TestConfig config;
TestGeneralizeFieldWithSpecialTransition(
@@ -2507,7 +2537,7 @@ TEST(PrototypeTransitionFromMapNotOwningDescriptor) {
bool generalizes_representations() const {
return !IS_PROTO_TRANS_ISSUE_FIXED;
}
- bool is_non_equevalent_transition() const { return true; }
+ bool is_non_equivalent_transition() const { return true; }
};
TestConfig config;
TestGeneralizeFieldWithSpecialTransition(
diff --git a/deps/v8/test/cctest/test-func-name-inference.cc b/deps/v8/test/cctest/test-func-name-inference.cc
index 23ac83a953..538be20e71 100644
--- a/deps/v8/test/cctest/test-func-name-inference.cc
+++ b/deps/v8/test/cctest/test-func-name-inference.cc
@@ -453,8 +453,8 @@ TEST(FactoryHashmapVariable) {
" return obj;\n"
"}");
// Can't infer function names statically.
- CheckFunctionName(script, "return 1", "obj.(anonymous function)");
- CheckFunctionName(script, "return 2", "obj.(anonymous function)");
+ CheckFunctionName(script, "return 1", "obj.<computed>");
+ CheckFunctionName(script, "return 2", "obj.<computed>");
}
@@ -470,7 +470,7 @@ TEST(FactoryHashmapConditional) {
" return obj;\n"
"}");
// Can't infer the function name statically.
- CheckFunctionName(script, "return 1", "obj.(anonymous function)");
+ CheckFunctionName(script, "return 1", "obj.<computed>");
}
diff --git a/deps/v8/test/cctest/test-global-handles.cc b/deps/v8/test/cctest/test-global-handles.cc
index 0db56e382a..b81007f40e 100644
--- a/deps/v8/test/cctest/test-global-handles.cc
+++ b/deps/v8/test/cctest/test-global-handles.cc
@@ -28,9 +28,11 @@
#include "src/api-inl.h"
#include "src/global-handles.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "test/cctest/cctest.h"
+#include "test/cctest/heap/heap-utils.h"
namespace v8 {
namespace internal {
@@ -69,6 +71,14 @@ void ConstructJSObject(v8::Isolate* isolate, v8::Local<v8::Context> context,
CHECK(!flag_and_persistent->handle.IsEmpty());
}
+void ConstructJSObject(v8::Isolate* isolate, v8::Global<v8::Object>* global) {
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Object> object(v8::Object::New(isolate));
+ CHECK(!object.IsEmpty());
+ *global = v8::Global<v8::Object>(isolate, object);
+ CHECK(!global->IsEmpty());
+}
+
void ConstructJSApiObject(v8::Isolate* isolate, v8::Local<v8::Context> context,
FlagAndPersistent* flag_and_persistent) {
v8::HandleScope handle_scope(isolate);
@@ -95,12 +105,7 @@ void WeakHandleTest(v8::Isolate* isolate, ConstructFunction construct_function,
FlagAndPersistent fp;
construct_function(isolate, context, &fp);
- {
- v8::HandleScope scope(isolate);
- v8::Local<v8::Object> tmp = v8::Local<v8::Object>::New(isolate, fp.handle);
- CHECK(i::Heap::InNewSpace(*v8::Utils::OpenHandle(*tmp)));
- }
-
+ CHECK(heap::InYoungGeneration(isolate, fp.handle));
fp.handle.SetWeak(&fp, &ResetHandleAndSetFlag,
v8::WeakCallbackType::kParameter);
fp.flag = false;
@@ -340,7 +345,16 @@ TEST(WeakHandleToActiveUnmodifiedJSApiObjectSurvivesScavenge) {
CcTest::InitializeVM();
WeakHandleTest(
CcTest::isolate(), &ConstructJSApiObject,
- [](FlagAndPersistent* fp) { fp->handle.MarkActive(); },
+ [](FlagAndPersistent* fp) {
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+#endif
+ fp->handle.MarkActive();
+#if __clang__
+#pragma clang diagnostic pop
+#endif
+ },
[]() { InvokeScavenge(); }, SurvivalMode::kSurvives);
}
@@ -348,7 +362,16 @@ TEST(WeakHandleToActiveUnmodifiedJSApiObjectDiesOnMarkCompact) {
CcTest::InitializeVM();
WeakHandleTest(
CcTest::isolate(), &ConstructJSApiObject,
- [](FlagAndPersistent* fp) { fp->handle.MarkActive(); },
+ [](FlagAndPersistent* fp) {
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+#endif
+ fp->handle.MarkActive();
+#if __clang__
+#pragma clang diagnostic pop
+#endif
+ },
[]() { InvokeMarkSweep(); }, SurvivalMode::kDies);
}
@@ -357,7 +380,14 @@ TEST(WeakHandleToActiveUnmodifiedJSApiObjectSurvivesMarkCompactWhenInHandle) {
WeakHandleTest(
CcTest::isolate(), &ConstructJSApiObject,
[](FlagAndPersistent* fp) {
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+#endif
fp->handle.MarkActive();
+#if __clang__
+#pragma clang diagnostic pop
+#endif
v8::Local<v8::Object> handle =
v8::Local<v8::Object>::New(CcTest::isolate(), fp->handle);
USE(handle);
@@ -487,12 +517,7 @@ TEST(GCFromWeakCallbacks) {
for (int inner_gc = 0; inner_gc < kNumberOfGCTypes; inner_gc++) {
FlagAndPersistent fp;
ConstructJSApiObject(isolate, context, &fp);
- {
- v8::HandleScope scope(isolate);
- v8::Local<v8::Object> tmp =
- v8::Local<v8::Object>::New(isolate, fp.handle);
- CHECK(i::Heap::InNewSpace(*v8::Utils::OpenHandle(*tmp)));
- }
+ CHECK(heap::InYoungGeneration(isolate, fp.handle));
fp.flag = false;
fp.handle.SetWeak(&fp, gc_forcing_callback[inner_gc],
v8::WeakCallbackType::kParameter);
@@ -532,5 +557,32 @@ TEST(SecondPassPhantomCallbacks) {
CHECK(fp.flag);
}
+TEST(MoveStrongGlobal) {
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ v8::Global<v8::Object>* global = new Global<v8::Object>();
+ ConstructJSObject(isolate, global);
+ InvokeMarkSweep();
+ v8::Global<v8::Object> global2(std::move(*global));
+ delete global;
+ InvokeMarkSweep();
+}
+
+TEST(MoveWeakGlobal) {
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ v8::Global<v8::Object>* global = new Global<v8::Object>();
+ ConstructJSObject(isolate, global);
+ InvokeMarkSweep();
+ global->SetWeak();
+ v8::Global<v8::Object> global2(std::move(*global));
+ delete global;
+ InvokeMarkSweep();
+}
+
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc
index 84ecc78ff3..5e61199e86 100644
--- a/deps/v8/test/cctest/test-heap-profiler.cc
+++ b/deps/v8/test/cctest/test-heap-profiler.cc
@@ -40,6 +40,7 @@
#include "src/base/optional.h"
#include "src/collector.h"
#include "src/debug/debug.h"
+#include "src/heap/heap-inl.h"
#include "src/objects-inl.h"
#include "src/profiler/allocation-tracker.h"
#include "src/profiler/heap-profiler.h"
@@ -2693,6 +2694,9 @@ TEST(TrackHeapAllocationsWithInlining) {
CHECK(node);
// In lite mode, there is feedback and feedback metadata.
unsigned int num_nodes = (i::FLAG_lite_mode) ? 6 : 8;
+ // Without forced source position collection, there is no source position
+ // table.
+ if (i::FLAG_enable_lazy_source_positions) num_nodes -= 1;
CHECK_GE(node->allocation_count(), num_nodes);
CHECK_GE(node->allocation_size(), 4 * node->allocation_count());
heap_profiler->StopTrackingHeapObjects();
diff --git a/deps/v8/test/cctest/test-icache.cc b/deps/v8/test/cctest/test-icache.cc
index c1dde75a93..ac03a6fc59 100644
--- a/deps/v8/test/cctest/test-icache.cc
+++ b/deps/v8/test/cctest/test-icache.cc
@@ -24,7 +24,7 @@ static constexpr int kBufferSize = 8 * KB;
static void FloodWithInc(Isolate* isolate, TestingAssemblerBuffer* buffer) {
MacroAssembler masm(isolate, CodeObjectRequired::kYes, buffer->CreateView());
#if V8_TARGET_ARCH_IA32
- __ mov(eax, Operand(esp, kPointerSize));
+ __ mov(eax, Operand(esp, kSystemPointerSize));
for (int i = 0; i < kNumInstr; ++i) {
__ add(eax, Immediate(1));
}
@@ -70,7 +70,7 @@ static void FloodWithInc(Isolate* isolate, TestingAssemblerBuffer* buffer) {
static void FloodWithNop(Isolate* isolate, TestingAssemblerBuffer* buffer) {
MacroAssembler masm(isolate, CodeObjectRequired::kYes, buffer->CreateView());
#if V8_TARGET_ARCH_IA32
- __ mov(eax, Operand(esp, kPointerSize));
+ __ mov(eax, Operand(esp, kSystemPointerSize));
#elif V8_TARGET_ARCH_X64
__ movl(rax, arg_reg_1);
#elif V8_TARGET_ARCH_MIPS
@@ -101,14 +101,14 @@ TEST(TestFlushICacheOfWritable) {
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadWrite));
FloodWithInc(isolate, buffer.get());
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadExecute));
CHECK_EQ(23 + kNumInstr, f.Call(23)); // Call into generated code.
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadWrite));
FloodWithNop(isolate, buffer.get());
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadExecute));
CHECK_EQ(23, f.Call(23)); // Call into generated code.
@@ -148,14 +148,14 @@ CONDITIONAL_TEST(TestFlushICacheOfExecutable) {
FloodWithInc(isolate, buffer.get());
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadExecute));
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK_EQ(23 + kNumInstr, f.Call(23)); // Call into generated code.
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadWrite));
FloodWithNop(isolate, buffer.get());
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadExecute));
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK_EQ(23, f.Call(23)); // Call into generated code.
}
}
@@ -177,10 +177,10 @@ TEST(TestFlushICacheOfWritableAndExecutable) {
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadWriteExecute));
FloodWithInc(isolate, buffer.get());
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK_EQ(23 + kNumInstr, f.Call(23)); // Call into generated code.
FloodWithNop(isolate, buffer.get());
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK_EQ(23, f.Call(23)); // Call into generated code.
}
}
diff --git a/deps/v8/test/cctest/test-inobject-slack-tracking.cc b/deps/v8/test/cctest/test-inobject-slack-tracking.cc
index 61984afe23..5646f97a33 100644
--- a/deps/v8/test/cctest/test-inobject-slack-tracking.cc
+++ b/deps/v8/test/cctest/test-inobject-slack-tracking.cc
@@ -47,7 +47,7 @@ Handle<T> GetLexical(const char* name) {
isolate->native_context()->script_context_table(), isolate);
ScriptContextTable::LookupResult lookup_result;
- if (ScriptContextTable::Lookup(isolate, script_contexts, str_name,
+ if (ScriptContextTable::Lookup(isolate, *script_contexts, *str_name,
&lookup_result)) {
Handle<Context> script_context = ScriptContextTable::GetContext(
isolate, script_contexts, lookup_result.context_index);
@@ -1210,6 +1210,154 @@ TEST(SubclassPromiseBuiltinNoInlineNew) {
TestSubclassPromiseBuiltin();
}
+TEST(SubclassTranspiledClassHierarchy) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ CompileRun(
+ "Object.setPrototypeOf(B, A);\n"
+ "function A() {\n"
+ " this.a0 = 0;\n"
+ " this.a1 = 1;\n"
+ " this.a2 = 1;\n"
+ " this.a3 = 1;\n"
+ " this.a4 = 1;\n"
+ " this.a5 = 1;\n"
+ " this.a6 = 1;\n"
+ " this.a7 = 1;\n"
+ " this.a8 = 1;\n"
+ " this.a9 = 1;\n"
+ " this.a10 = 1;\n"
+ " this.a11 = 1;\n"
+ " this.a12 = 1;\n"
+ " this.a13 = 1;\n"
+ " this.a14 = 1;\n"
+ " this.a15 = 1;\n"
+ " this.a16 = 1;\n"
+ " this.a17 = 1;\n"
+ " this.a18 = 1;\n"
+ " this.a19 = 1;\n"
+ "};\n"
+ "function B() {\n"
+ " A.call(this);\n"
+ " this.b = 1;\n"
+ "};\n");
+
+ Handle<JSFunction> func = GetGlobal<JSFunction>("B");
+
+ // Zero instances have been created so far.
+ CHECK(!func->has_initial_map());
+
+ v8::Local<v8::Script> new_script = v8_compile("new B()");
+
+ RunI<JSObject>(new_script);
+
+ CHECK(func->has_initial_map());
+ Handle<Map> initial_map(func->initial_map(), func->GetIsolate());
+
+ CHECK_EQ(JS_OBJECT_TYPE, initial_map->instance_type());
+
+ // One instance of a subclass created.
+ CHECK_EQ(Map::kSlackTrackingCounterStart - 1,
+ initial_map->construction_counter());
+ CHECK(initial_map->IsInobjectSlackTrackingInProgress());
+
+ // Create two instances in order to ensure that |obj|.o is a data field
+ // in case of Function subclassing.
+ Handle<JSObject> obj = RunI<JSObject>(new_script);
+
+ // Two instances of a subclass created.
+ CHECK_EQ(Map::kSlackTrackingCounterStart - 2,
+ initial_map->construction_counter());
+ CHECK(initial_map->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+
+ // Create several subclass instances to complete the tracking.
+ for (int i = 2; i < Map::kGenerousAllocationCount; i++) {
+ CHECK(initial_map->IsInobjectSlackTrackingInProgress());
+ Handle<JSObject> tmp = RunI<JSObject>(new_script);
+ CHECK_EQ(initial_map->IsInobjectSlackTrackingInProgress(),
+ IsObjectShrinkable(*tmp));
+ }
+ CHECK(!initial_map->IsInobjectSlackTrackingInProgress());
+ CHECK(!IsObjectShrinkable(*obj));
+
+ // No slack left.
+ CHECK_EQ(21, obj->map()->GetInObjectProperties());
+ CHECK_EQ(JS_OBJECT_TYPE, obj->map()->instance_type());
+}
+
+TEST(Regress8853_ClassConstructor) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ // For classes without any this.prop assignments in their
+ // constructors we start out with 10 inobject properties.
+ Handle<JSObject> obj = CompileRunI<JSObject>("new (class {});\n");
+ CHECK(obj->map()->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+ CHECK_EQ(10, obj->map()->GetInObjectProperties());
+
+ // For classes with N explicit this.prop assignments in their
+ // constructors we start out with N+8 inobject properties.
+ obj = CompileRunI<JSObject>(
+ "new (class {\n"
+ " constructor() {\n"
+ " this.x = 1;\n"
+ " this.y = 2;\n"
+ " this.z = 3;\n"
+ " }\n"
+ "});\n");
+ CHECK(obj->map()->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+ CHECK_EQ(3 + 8, obj->map()->GetInObjectProperties());
+}
+
+TEST(Regress8853_ClassHierarchy) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ // For class hierarchies without any this.prop assignments in their
+ // constructors we reserve 2 inobject properties per constructor plus
+ // 8 inobject properties slack on top.
+ std::string base = "(class {})";
+ for (int i = 1; i < 10; ++i) {
+ std::string script = "new " + base + ";\n";
+ Handle<JSObject> obj = CompileRunI<JSObject>(script.c_str());
+ CHECK(obj->map()->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+ CHECK_EQ(8 + 2 * i, obj->map()->GetInObjectProperties());
+ base = "(class extends " + base + " {})";
+ }
+}
+
+TEST(Regress8853_FunctionConstructor) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ // For constructor functions without any this.prop assignments in
+ // them we start out with 10 inobject properties.
+ Handle<JSObject> obj = CompileRunI<JSObject>("new (function() {});\n");
+ CHECK(obj->map()->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+ CHECK_EQ(10, obj->map()->GetInObjectProperties());
+
+ // For constructor functions with N explicit this.prop assignments
+ // in them we start out with N+8 inobject properties.
+ obj = CompileRunI<JSObject>(
+ "new (function() {\n"
+ " this.a = 1;\n"
+ " this.b = 2;\n"
+ " this.c = 3;\n"
+ " this.d = 3;\n"
+ " this.c = 3;\n"
+ " this.f = 3;\n"
+ "});\n");
+ CHECK(obj->map()->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+ CHECK_EQ(6 + 8, obj->map()->GetInObjectProperties());
+}
+
} // namespace test_inobject_slack_tracking
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-intl.cc b/deps/v8/test/cctest/test-intl.cc
index 0670340227..d916507760 100644
--- a/deps/v8/test/cctest/test-intl.cc
+++ b/deps/v8/test/cctest/test-intl.cc
@@ -132,7 +132,8 @@ TEST(GetStringOption) {
Handle<String> key = isolate->factory()->NewStringFromAsciiChecked("foo");
v8::internal::LookupIterator it(isolate, options, key);
CHECK(Object::SetProperty(&it, Handle<Smi>(Smi::FromInt(42), isolate),
- LanguageMode::kStrict, StoreOrigin::kMaybeKeyed)
+ StoreOrigin::kMaybeKeyed,
+ Just(ShouldThrow::kThrowOnError))
.FromJust());
{
@@ -191,7 +192,8 @@ TEST(GetBoolOption) {
Handle<Object> false_value =
handle(i::ReadOnlyRoots(isolate).false_value(), isolate);
Object::SetProperty(isolate, options, key, false_value,
- LanguageMode::kStrict)
+ StoreOrigin::kMaybeKeyed,
+ Just(ShouldThrow::kThrowOnError))
.Assert();
bool result = false;
Maybe<bool> found =
@@ -205,7 +207,8 @@ TEST(GetBoolOption) {
Handle<Object> true_value =
handle(i::ReadOnlyRoots(isolate).true_value(), isolate);
Object::SetProperty(isolate, options, key, true_value,
- LanguageMode::kStrict)
+ StoreOrigin::kMaybeKeyed,
+ Just(ShouldThrow::kThrowOnError))
.Assert();
bool result = false;
Maybe<bool> found =
diff --git a/deps/v8/test/cctest/test-js-weak-refs.cc b/deps/v8/test/cctest/test-js-weak-refs.cc
index ffa2ba54f0..e529c7cac9 100644
--- a/deps/v8/test/cctest/test-js-weak-refs.cc
+++ b/deps/v8/test/cctest/test-js-weak-refs.cc
@@ -14,26 +14,29 @@
namespace v8 {
namespace internal {
-Handle<JSWeakFactory> ConstructJSWeakFactory(Isolate* isolate) {
+namespace {
+
+Handle<JSFinalizationGroup> ConstructJSFinalizationGroup(Isolate* isolate) {
Factory* factory = isolate->factory();
- Handle<String> weak_factory_name = factory->WeakFactory_string();
+ Handle<String> finalization_group_name =
+ factory->NewStringFromStaticChars("FinalizationGroup");
Handle<Object> global =
handle(isolate->native_context()->global_object(), isolate);
- Handle<JSFunction> weak_factory_fun = Handle<JSFunction>::cast(
- Object::GetProperty(isolate, global, weak_factory_name)
+ Handle<JSFunction> finalization_group_fun = Handle<JSFunction>::cast(
+ Object::GetProperty(isolate, global, finalization_group_name)
.ToHandleChecked());
- auto weak_factory = Handle<JSWeakFactory>::cast(
- JSObject::New(weak_factory_fun, weak_factory_fun,
+ auto finalization_group = Handle<JSFinalizationGroup>::cast(
+ JSObject::New(finalization_group_fun, finalization_group_fun,
Handle<AllocationSite>::null())
.ToHandleChecked());
#ifdef VERIFY_HEAP
- weak_factory->JSWeakFactoryVerify(isolate);
+ finalization_group->JSFinalizationGroupVerify(isolate);
#endif // VERIFY_HEAP
- return weak_factory;
+ return finalization_group;
}
-Handle<JSWeakRef> ConstructJSWeakRef(Isolate* isolate,
- Handle<JSReceiver> target) {
+Handle<JSWeakRef> ConstructJSWeakRef(Handle<JSReceiver> target,
+ Isolate* isolate) {
Factory* factory = isolate->factory();
Handle<String> weak_ref_name = factory->WeakRef_string();
Handle<Object> global =
@@ -50,290 +53,590 @@ Handle<JSWeakRef> ConstructJSWeakRef(Isolate* isolate,
return weak_ref;
}
-Handle<JSWeakCell> MakeCell(Isolate* isolate, Handle<JSObject> js_object,
- Handle<JSWeakFactory> weak_factory) {
- Handle<Map> weak_cell_map(isolate->native_context()->js_weak_cell_map(),
- isolate);
- Handle<JSWeakCell> weak_cell =
- Handle<JSWeakCell>::cast(isolate->factory()->NewJSObjectFromMap(
- weak_cell_map, TENURED, Handle<AllocationSite>::null()));
- weak_cell->set_target(*js_object);
- weak_factory->AddWeakCell(*weak_cell);
+Handle<JSObject> CreateKey(const char* key_prop_value, Isolate* isolate) {
+ Factory* factory = isolate->factory();
+ Handle<String> key_string = factory->NewStringFromStaticChars("key_string");
+ Handle<JSObject> key =
+ isolate->factory()->NewJSObject(isolate->object_function());
+ JSObject::AddProperty(isolate, key, key_string,
+ factory->NewStringFromAsciiChecked(key_prop_value),
+ NONE);
+ return key;
+}
+
+Handle<WeakCell> FinalizationGroupRegister(
+ Handle<JSFinalizationGroup> finalization_group, Handle<JSObject> target,
+ Handle<Object> holdings, Handle<Object> key, Isolate* isolate) {
+ JSFinalizationGroup::Register(finalization_group, target, holdings, key,
+ isolate);
+ CHECK(finalization_group->active_cells()->IsWeakCell());
+ Handle<WeakCell> weak_cell =
+ handle(WeakCell::cast(finalization_group->active_cells()), isolate);
#ifdef VERIFY_HEAP
- weak_cell->JSWeakCellVerify(isolate);
+ weak_cell->WeakCellVerify(isolate);
#endif // VERIFY_HEAP
return weak_cell;
}
-void NullifyWeakCell(Handle<JSWeakCell> weak_cell, Isolate* isolate) {
+Handle<WeakCell> FinalizationGroupRegister(
+ Handle<JSFinalizationGroup> finalization_group, Handle<JSObject> target,
+ Isolate* isolate) {
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
+ return FinalizationGroupRegister(finalization_group, target, undefined,
+ undefined, isolate);
+}
+
+void NullifyWeakCell(Handle<WeakCell> weak_cell, Isolate* isolate) {
auto empty_func = [](HeapObject object, ObjectSlot slot, Object target) {};
weak_cell->Nullify(isolate, empty_func);
#ifdef VERIFY_HEAP
- weak_cell->JSWeakCellVerify(isolate);
+ weak_cell->WeakCellVerify(isolate);
#endif // VERIFY_HEAP
}
-void ClearWeakCell(Handle<JSWeakCell> weak_cell, Isolate* isolate) {
- weak_cell->Clear(isolate);
- CHECK(weak_cell->next()->IsUndefined(isolate));
- CHECK(weak_cell->prev()->IsUndefined(isolate));
-#ifdef VERIFY_HEAP
- weak_cell->JSWeakCellVerify(isolate);
-#endif // VERIFY_HEAP
+// Usage: VerifyWeakCellChain(isolate, list_head, n, cell1, cell2, ..., celln);
+// verifies that list_head == cell1 and cell1, cell2, ..., celln. form a list.
+void VerifyWeakCellChain(Isolate* isolate, Object list_head, int n_args, ...) {
+ CHECK_GE(n_args, 0);
+
+ va_list args;
+ va_start(args, n_args);
+
+ if (n_args == 0) {
+ // Verify empty list
+ CHECK(list_head->IsUndefined(isolate));
+ } else {
+ WeakCell current = WeakCell::cast(Object(va_arg(args, Address)));
+ CHECK_EQ(current, list_head);
+ CHECK(current->prev()->IsUndefined(isolate));
+
+ for (int i = 1; i < n_args; i++) {
+ WeakCell next = WeakCell::cast(Object(va_arg(args, Address)));
+ CHECK_EQ(current->next(), next);
+ CHECK_EQ(next->prev(), current);
+ current = next;
+ }
+ CHECK(current->next()->IsUndefined(isolate));
+ }
+ va_end(args);
+}
+
+// Like VerifyWeakCellChain but verifies the chain created with key_list_prev
+// and key_list_next instead of prev and next.
+void VerifyWeakCellKeyChain(Isolate* isolate, Object list_head, int n_args,
+ ...) {
+ CHECK_GE(n_args, 0);
+
+ va_list args;
+ va_start(args, n_args);
+
+ if (n_args == 0) {
+ // Verify empty list
+ CHECK(list_head->IsTheHole(isolate));
+ } else {
+ WeakCell current = WeakCell::cast(Object(va_arg(args, Address)));
+ CHECK_EQ(current, list_head);
+ CHECK(current->key_list_prev()->IsUndefined(isolate));
+
+ for (int i = 1; i < n_args; i++) {
+ WeakCell next = WeakCell::cast(Object(va_arg(args, Address)));
+ CHECK_EQ(current->key_list_next(), next);
+ CHECK_EQ(next->key_list_prev(), current);
+ current = next;
+ }
+ CHECK(current->key_list_next()->IsUndefined(isolate));
+ }
+ va_end(args);
}
-TEST(TestJSWeakCellCreation) {
+} // namespace
+
+TEST(TestRegister) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- // Create JSWeakCell and verify internal data structures.
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- CHECK(weak_cell1->prev()->IsUndefined(isolate));
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ // Register a weak reference and verify internal data structures.
+ Handle<WeakCell> weak_cell1 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell1);
- CHECK(weak_factory->cleared_cells()->IsUndefined(isolate));
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 1,
+ *weak_cell1);
+ CHECK(weak_cell1->key_list_prev()->IsUndefined(isolate));
+ CHECK(weak_cell1->key_list_next()->IsUndefined(isolate));
- // Create another JSWeakCell and verify internal data structures.
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
- CHECK(weak_cell2->prev()->IsUndefined(isolate));
- CHECK_EQ(weak_cell2->next(), *weak_cell1);
- CHECK_EQ(weak_cell1->prev(), *weak_cell2);
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ CHECK(finalization_group->cleared_cells()->IsUndefined(isolate));
+
+ // No key was used during registration, key-based map stays uninitialized.
+ CHECK(finalization_group->key_map()->IsUndefined(isolate));
+
+ // Register another weak reference and verify internal data structures.
+ Handle<WeakCell> weak_cell2 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 2,
+ *weak_cell2, *weak_cell1);
+ CHECK(weak_cell2->key_list_prev()->IsUndefined(isolate));
+ CHECK(weak_cell2->key_list_next()->IsUndefined(isolate));
+
+ CHECK(finalization_group->cleared_cells()->IsUndefined(isolate));
+ CHECK(finalization_group->key_map()->IsUndefined(isolate));
+}
+
+TEST(TestRegisterWithKey) {
+ FLAG_harmony_weak_refs = true;
+ CcTest::InitializeVM();
+ LocalContext context;
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope outer_scope(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
+ Handle<JSObject> js_object =
+ isolate->factory()->NewJSObject(isolate->object_function());
+
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+ Handle<JSObject> key2 = CreateKey("key2", isolate);
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
+
+ // Register a weak reference with a key and verify internal data structures.
+ Handle<WeakCell> weak_cell1 = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+
+ {
+ CHECK(finalization_group->key_map()->IsObjectHashTable());
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 1, *weak_cell1);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 0);
+ }
+
+ // Register another weak reference with a different key and verify internal
+ // data structures.
+ Handle<WeakCell> weak_cell2 = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key2, isolate);
+
+ {
+ CHECK(finalization_group->key_map()->IsObjectHashTable());
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 1, *weak_cell1);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 1, *weak_cell2);
+ }
- CHECK_EQ(weak_factory->active_cells(), *weak_cell2);
- CHECK(weak_factory->cleared_cells()->IsUndefined(isolate));
+ // Register another weak reference with key1 and verify internal data
+ // structures.
+ Handle<WeakCell> weak_cell3 = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+
+ {
+ CHECK(finalization_group->key_map()->IsObjectHashTable());
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 2, *weak_cell3,
+ *weak_cell1);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 1, *weak_cell2);
+ }
}
-TEST(TestJSWeakCellNullify1) {
+TEST(TestWeakCellNullify1) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
+ Handle<WeakCell> weak_cell1 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
+ Handle<WeakCell> weak_cell2 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
- // Nullify the first JSWeakCell and verify internal data structures.
+ // Nullify the first WeakCell and verify internal data structures.
NullifyWeakCell(weak_cell1, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell2);
+ CHECK_EQ(finalization_group->active_cells(), *weak_cell2);
CHECK(weak_cell2->prev()->IsUndefined(isolate));
CHECK(weak_cell2->next()->IsUndefined(isolate));
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell1);
+ CHECK_EQ(finalization_group->cleared_cells(), *weak_cell1);
CHECK(weak_cell1->prev()->IsUndefined(isolate));
CHECK(weak_cell1->next()->IsUndefined(isolate));
- // Nullify the second JSWeakCell and verify internal data structures.
+ // Nullify the second WeakCell and verify internal data structures.
NullifyWeakCell(weak_cell2, isolate);
- CHECK(weak_factory->active_cells()->IsUndefined(isolate));
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell2);
+ CHECK(finalization_group->active_cells()->IsUndefined(isolate));
+ CHECK_EQ(finalization_group->cleared_cells(), *weak_cell2);
CHECK_EQ(weak_cell2->next(), *weak_cell1);
CHECK(weak_cell2->prev()->IsUndefined(isolate));
CHECK_EQ(weak_cell1->prev(), *weak_cell2);
CHECK(weak_cell1->next()->IsUndefined(isolate));
}
-TEST(TestJSWeakCellNullify2) {
+TEST(TestWeakCellNullify2) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
+ Handle<WeakCell> weak_cell1 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
+ Handle<WeakCell> weak_cell2 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
- // Like TestJSWeakCellNullify1 but clear the JSWeakCells in opposite order.
+ // Like TestWeakCellNullify1 but nullify the WeakCells in opposite order.
NullifyWeakCell(weak_cell2, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell1);
+ CHECK_EQ(finalization_group->active_cells(), *weak_cell1);
CHECK(weak_cell1->prev()->IsUndefined(isolate));
CHECK(weak_cell1->next()->IsUndefined(isolate));
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell2);
+ CHECK_EQ(finalization_group->cleared_cells(), *weak_cell2);
CHECK(weak_cell2->prev()->IsUndefined(isolate));
CHECK(weak_cell2->next()->IsUndefined(isolate));
NullifyWeakCell(weak_cell1, isolate);
- CHECK(weak_factory->active_cells()->IsUndefined(isolate));
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell1);
+ CHECK(finalization_group->active_cells()->IsUndefined(isolate));
+ CHECK_EQ(finalization_group->cleared_cells(), *weak_cell1);
CHECK_EQ(weak_cell1->next(), *weak_cell2);
CHECK(weak_cell1->prev()->IsUndefined(isolate));
CHECK_EQ(weak_cell2->prev(), *weak_cell1);
CHECK(weak_cell2->next()->IsUndefined(isolate));
}
-TEST(TestJSWeakFactoryPopClearedCell) {
+TEST(TestJSFinalizationGroupPopClearedCellHoldings1) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
-
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell3 = MakeCell(isolate, js_object, weak_factory);
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
+
+ Handle<Object> holdings1 = factory->NewStringFromAsciiChecked("holdings1");
+ Handle<WeakCell> weak_cell1 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings1, undefined, isolate);
+ Handle<Object> holdings2 = factory->NewStringFromAsciiChecked("holdings2");
+ Handle<WeakCell> weak_cell2 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings2, undefined, isolate);
+ Handle<Object> holdings3 = factory->NewStringFromAsciiChecked("holdings3");
+ Handle<WeakCell> weak_cell3 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings3, undefined, isolate);
NullifyWeakCell(weak_cell2, isolate);
NullifyWeakCell(weak_cell3, isolate);
- CHECK(weak_factory->NeedsCleanup());
- JSWeakCell cleared1 = weak_factory->PopClearedCell(isolate);
- CHECK_EQ(cleared1, *weak_cell3);
+ CHECK(finalization_group->NeedsCleanup());
+ Object cleared1 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared1, *holdings3);
CHECK(weak_cell3->prev()->IsUndefined(isolate));
CHECK(weak_cell3->next()->IsUndefined(isolate));
- CHECK(weak_factory->NeedsCleanup());
- JSWeakCell cleared2 = weak_factory->PopClearedCell(isolate);
- CHECK_EQ(cleared2, *weak_cell2);
+ CHECK(finalization_group->NeedsCleanup());
+ Object cleared2 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared2, *holdings2);
CHECK(weak_cell2->prev()->IsUndefined(isolate));
CHECK(weak_cell2->next()->IsUndefined(isolate));
- CHECK(!weak_factory->NeedsCleanup());
+ CHECK(!finalization_group->NeedsCleanup());
NullifyWeakCell(weak_cell1, isolate);
- CHECK(weak_factory->NeedsCleanup());
- JSWeakCell cleared3 = weak_factory->PopClearedCell(isolate);
- CHECK_EQ(cleared3, *weak_cell1);
+ CHECK(finalization_group->NeedsCleanup());
+ Object cleared3 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared3, *holdings1);
CHECK(weak_cell1->prev()->IsUndefined(isolate));
CHECK(weak_cell1->next()->IsUndefined(isolate));
- CHECK(!weak_factory->NeedsCleanup());
- CHECK(weak_factory->active_cells()->IsUndefined(isolate));
- CHECK(weak_factory->cleared_cells()->IsUndefined(isolate));
+ CHECK(!finalization_group->NeedsCleanup());
+ CHECK(finalization_group->active_cells()->IsUndefined(isolate));
+ CHECK(finalization_group->cleared_cells()->IsUndefined(isolate));
}
-TEST(TestJSWeakCellClearActiveCells) {
+TEST(TestJSFinalizationGroupPopClearedCellHoldings2) {
+ // Test that when all WeakCells for a key are popped, the key is removed from
+ // the key map.
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell3 = MakeCell(isolate, js_object, weak_factory);
+ Handle<Object> holdings1 = factory->NewStringFromAsciiChecked("holdings1");
+ Handle<WeakCell> weak_cell1 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings1, key1, isolate);
+ Handle<Object> holdings2 = factory->NewStringFromAsciiChecked("holdings2");
+ Handle<WeakCell> weak_cell2 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings2, key1, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell3);
- CHECK(weak_cell3->prev()->IsUndefined(isolate));
- CHECK_EQ(weak_cell3->next(), *weak_cell2);
- CHECK_EQ(weak_cell2->prev(), *weak_cell3);
- CHECK_EQ(weak_cell2->next(), *weak_cell1);
- CHECK_EQ(weak_cell1->prev(), *weak_cell2);
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ NullifyWeakCell(weak_cell1, isolate);
+ NullifyWeakCell(weak_cell2, isolate);
- // Clear all JSWeakCells in active_cells and verify the consistency of the
- // active_cells list in all stages.
- ClearWeakCell(weak_cell2, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell3);
- CHECK(weak_cell3->prev()->IsUndefined(isolate));
- CHECK_EQ(weak_cell3->next(), *weak_cell1);
- CHECK_EQ(weak_cell1->prev(), *weak_cell3);
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ // Nullifying doesn't affect the key chains (just moves WeakCells from
+ // active_cells to cleared_cells).
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 2, *weak_cell2,
+ *weak_cell1);
+ }
- ClearWeakCell(weak_cell3, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell1);
- CHECK(weak_cell1->prev()->IsUndefined(isolate));
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ Object cleared1 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared1, *holdings2);
+
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 1, *weak_cell1);
+ }
+
+ Object cleared2 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared2, *holdings1);
- ClearWeakCell(weak_cell1, isolate);
- CHECK(weak_factory->active_cells()->IsUndefined(isolate));
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ }
}
-TEST(TestJSWeakCellClearClearedCells) {
+TEST(TestUnregisterActiveCells) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell3 = MakeCell(isolate, js_object, weak_factory);
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+ Handle<JSObject> key2 = CreateKey("key2", isolate);
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
- NullifyWeakCell(weak_cell1, isolate);
- NullifyWeakCell(weak_cell2, isolate);
- NullifyWeakCell(weak_cell3, isolate);
+ Handle<WeakCell> weak_cell1a = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+ Handle<WeakCell> weak_cell1b = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell3);
- CHECK(weak_cell3->prev()->IsUndefined(isolate));
- CHECK_EQ(weak_cell3->next(), *weak_cell2);
- CHECK_EQ(weak_cell2->prev(), *weak_cell3);
- CHECK_EQ(weak_cell2->next(), *weak_cell1);
- CHECK_EQ(weak_cell1->prev(), *weak_cell2);
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ Handle<WeakCell> weak_cell2a = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key2, isolate);
+ Handle<WeakCell> weak_cell2b = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key2, isolate);
- // Clear all JSWeakCells in cleared_cells and verify the consistency of the
- // cleared_cells list in all stages.
- ClearWeakCell(weak_cell2, isolate);
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell3);
- CHECK(weak_cell3->prev()->IsUndefined(isolate));
- CHECK_EQ(weak_cell3->next(), *weak_cell1);
- CHECK_EQ(weak_cell1->prev(), *weak_cell3);
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 4,
+ *weak_cell2b, *weak_cell2a, *weak_cell1b, *weak_cell1a);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 2, *weak_cell1b,
+ *weak_cell1a);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 2, *weak_cell2b,
+ *weak_cell2a);
+ }
- ClearWeakCell(weak_cell3, isolate);
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell1);
- CHECK(weak_cell1->prev()->IsUndefined(isolate));
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ JSFinalizationGroup::Unregister(finalization_group, key1, isolate);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 2, *weak_cell2b,
+ *weak_cell2a);
+ }
+
+ // Both weak_cell1a and weak_cell1b removed from active_cells.
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 2,
+ *weak_cell2b, *weak_cell2a);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+}
+
+TEST(TestUnregisterActiveAndClearedCells) {
+ FLAG_harmony_weak_refs = true;
+ CcTest::InitializeVM();
+ LocalContext context;
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope outer_scope(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
+ Handle<JSObject> js_object =
+ isolate->factory()->NewJSObject(isolate->object_function());
+
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+ Handle<JSObject> key2 = CreateKey("key2", isolate);
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
+
+ Handle<WeakCell> weak_cell1a = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+ Handle<WeakCell> weak_cell1b = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+
+ Handle<WeakCell> weak_cell2a = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key2, isolate);
+ Handle<WeakCell> weak_cell2b = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key2, isolate);
+
+ NullifyWeakCell(weak_cell2a, isolate);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 3,
+ *weak_cell2b, *weak_cell1b, *weak_cell1a);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 1,
+ *weak_cell2a);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 2, *weak_cell1b,
+ *weak_cell1a);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 2, *weak_cell2b,
+ *weak_cell2a);
+ }
- ClearWeakCell(weak_cell1, isolate);
- CHECK(weak_factory->cleared_cells()->IsUndefined(isolate));
+ JSFinalizationGroup::Unregister(finalization_group, key2, isolate);
+
+ // Both weak_cell2a and weak_cell2b removed.
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 2,
+ *weak_cell1b, *weak_cell1a);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 2, *weak_cell1b,
+ *weak_cell1a);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 0);
+ }
}
-TEST(TestJSWeakCellClearTwice) {
+TEST(TestWeakCellUnregisterTwice) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
+
+ Handle<WeakCell> weak_cell1 = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 1,
+ *weak_cell1);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 1, *weak_cell1);
+ }
+
+ JSFinalizationGroup::Unregister(finalization_group, key1, isolate);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ }
+
+ JSFinalizationGroup::Unregister(finalization_group, key1, isolate);
- ClearWeakCell(weak_cell1, isolate);
- ClearWeakCell(weak_cell1, isolate);
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ }
}
-TEST(TestJSWeakCellClearPopped) {
+TEST(TestWeakCellUnregisterPopped) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+ Handle<Object> holdings1 = factory->NewStringFromAsciiChecked("holdings1");
+ Handle<WeakCell> weak_cell1 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings1, key1, isolate);
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
NullifyWeakCell(weak_cell1, isolate);
- JSWeakCell cleared1 = weak_factory->PopClearedCell(isolate);
- CHECK_EQ(cleared1, *weak_cell1);
- ClearWeakCell(weak_cell1, isolate);
+ CHECK(finalization_group->NeedsCleanup());
+ Object cleared1 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared1, *holdings1);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ }
+
+ JSFinalizationGroup::Unregister(finalization_group, key1, isolate);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ }
+}
+
+TEST(TestWeakCellUnregisterNonexistentKey) {
+ FLAG_harmony_weak_refs = true;
+ CcTest::InitializeVM();
+ LocalContext context;
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope outer_scope(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+
+ JSFinalizationGroup::Unregister(finalization_group, key1, isolate);
}
TEST(TestJSWeakRef) {
@@ -350,7 +653,7 @@ TEST(TestJSWeakRef) {
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
// This doesn't add the target into the KeepDuringJob set.
- Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(isolate, js_object);
+ Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate);
CcTest::CollectAllGarbage();
CHECK(!inner_weak_ref->target()->IsUndefined(isolate));
@@ -384,7 +687,7 @@ TEST(TestJSWeakRefIncrementalMarking) {
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
// This doesn't add the target into the KeepDuringJob set.
- Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(isolate, js_object);
+ Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate);
heap::SimulateIncrementalMarking(heap, true);
CcTest::CollectAllGarbage();
@@ -415,7 +718,7 @@ TEST(TestJSWeakRefKeepDuringJob) {
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(isolate, js_object);
+ Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate);
heap->AddKeepDuringJobTarget(js_object);
weak_ref = inner_scope.CloseAndEscape(inner_weak_ref);
@@ -452,7 +755,7 @@ TEST(TestJSWeakRefKeepDuringJobIncrementalMarking) {
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(isolate, js_object);
+ Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate);
heap->AddKeepDuringJobTarget(js_object);
weak_ref = inner_scope.CloseAndEscape(inner_weak_ref);
diff --git a/deps/v8/test/cctest/test-lockers.cc b/deps/v8/test/cctest/test-lockers.cc
index 5a4dcd588e..d7c13f8d5d 100644
--- a/deps/v8/test/cctest/test-lockers.cc
+++ b/deps/v8/test/cctest/test-lockers.cc
@@ -938,32 +938,17 @@ class IsolateGenesisThread : public JoinableThread {
TEST(ExtensionsRegistration) {
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS
const int kNThreads = 10;
-#elif V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
- const int kNThreads = 4;
#elif V8_TARGET_ARCH_S390 && V8_TARGET_ARCH_32_BIT
const int kNThreads = 10;
#else
const int kNThreads = 40;
#endif
- v8::RegisterExtension(new v8::Extension("test0",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test1",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test2",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test3",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test4",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test5",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test6",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test7",
- kSimpleExtensionSource));
- const char* extension_names[] = { "test0", "test1",
- "test2", "test3", "test4",
- "test5", "test6", "test7" };
+ const char* extension_names[] = {"test0", "test1", "test2", "test3",
+ "test4", "test5", "test6", "test7"};
+ for (const char* name : extension_names) {
+ v8::RegisterExtension(
+ v8::base::make_unique<v8::Extension>(name, kSimpleExtensionSource));
+ }
std::vector<JoinableThread*> threads;
threads.reserve(kNThreads);
for (int i = 0; i < kNThreads; i++) {
diff --git a/deps/v8/test/cctest/test-macro-assembler-arm.cc b/deps/v8/test/cctest/test-macro-assembler-arm.cc
index c1789560fa..271c57b92d 100644
--- a/deps/v8/test/cctest/test-macro-assembler-arm.cc
+++ b/deps/v8/test/cctest/test-macro-assembler-arm.cc
@@ -47,93 +47,6 @@ using F = void*(int x, int y, int p2, int p3, int p4);
using F3 = void*(void* p0, int p1, int p2, int p3, int p4);
using F5 = int(void*, void*, void*, void*, void*);
-TEST(LoadAndStoreWithRepresentation) {
- Isolate* isolate = CcTest::i_isolate();
- HandleScope handles(isolate);
-
- auto buffer = AllocateAssemblerBuffer();
- MacroAssembler assembler(isolate, v8::internal::CodeObjectRequired::kYes,
- buffer->CreateView());
- MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
-
- __ sub(sp, sp, Operand(1 * kPointerSize));
- Label exit;
-
- // Test 1.
- __ mov(r0, Operand(1)); // Test number.
- __ mov(r1, Operand(0));
- __ str(r1, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(-1));
- __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::UInteger8());
- __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(255));
- __ cmp(r3, r2);
- __ b(ne, &exit);
- __ mov(r2, Operand(255));
- __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::UInteger8());
- __ cmp(r3, r2);
- __ b(ne, &exit);
-
- // Test 2.
- __ mov(r0, Operand(2)); // Test number.
- __ mov(r1, Operand(0));
- __ str(r1, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(-1));
- __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::Integer8());
- __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(255));
- __ cmp(r3, r2);
- __ b(ne, &exit);
- __ mov(r2, Operand(-1));
- __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::Integer8());
- __ cmp(r3, r2);
- __ b(ne, &exit);
-
- // Test 3.
- __ mov(r0, Operand(3)); // Test number.
- __ mov(r1, Operand(0));
- __ str(r1, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(-1));
- __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::UInteger16());
- __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(65535));
- __ cmp(r3, r2);
- __ b(ne, &exit);
- __ mov(r2, Operand(65535));
- __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::UInteger16());
- __ cmp(r3, r2);
- __ b(ne, &exit);
-
- // Test 4.
- __ mov(r0, Operand(4)); // Test number.
- __ mov(r1, Operand(0));
- __ str(r1, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(-1));
- __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::Integer16());
- __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(65535));
- __ cmp(r3, r2);
- __ b(ne, &exit);
- __ mov(r2, Operand(-1));
- __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::Integer16());
- __ cmp(r3, r2);
- __ b(ne, &exit);
-
- __ mov(r0, Operand(0)); // Success.
- __ bind(&exit);
- __ add(sp, sp, Operand(1 * kPointerSize));
- __ bx(lr);
-
- CodeDesc desc;
- masm->GetCode(isolate, &desc);
- Handle<Code> code =
- isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>());
-
- // Call the function from C++.
- auto f = GeneratedCode<F5>::FromCode(*code);
- CHECK(!f.Call(0, 0, 0, 0, 0));
-}
-
TEST(ExtractLane) {
if (!CpuFeatures::IsSupported(NEON)) return;
diff --git a/deps/v8/test/cctest/test-macro-assembler-x64.cc b/deps/v8/test/cctest/test-macro-assembler-x64.cc
index a110ed76aa..7dff5dbe8c 100644
--- a/deps/v8/test/cctest/test-macro-assembler-x64.cc
+++ b/deps/v8/test/cctest/test-macro-assembler-x64.cc
@@ -528,7 +528,8 @@ TEST(OperandOffset) {
__ j(not_equal, &exit);
__ incq(rax);
- Operand sp2c2 = Operand(rsp, rcx, times_pointer_size, 2 * kSystemPointerSize);
+ Operand sp2c2 =
+ Operand(rsp, rcx, times_system_pointer_size, 2 * kSystemPointerSize);
// Test 6.
__ movl(rdx, sp2c2); // Sanity check.
@@ -582,7 +583,7 @@ TEST(OperandOffset) {
__ incq(rax);
Operand bp2c4 =
- Operand(rbp, rcx, times_pointer_size, -4 * kSystemPointerSize);
+ Operand(rbp, rcx, times_system_pointer_size, -4 * kSystemPointerSize);
// Test 14:
__ movl(rdx, bp2c4); // Sanity check.
@@ -638,7 +639,7 @@ TEST(OperandOffset) {
__ incq(rax);
Operand bx2c2 =
- Operand(rbx, rcx, times_pointer_size, -2 * kSystemPointerSize);
+ Operand(rbx, rcx, times_system_pointer_size, -2 * kSystemPointerSize);
// Test 23.
__ movl(rdx, bx2c2); // Sanity check.
@@ -807,167 +808,6 @@ TEST(OperandOffset) {
CHECK_EQ(0, result);
}
-
-TEST(LoadAndStoreWithRepresentation) {
- Isolate* isolate = CcTest::i_isolate();
- HandleScope handles(isolate);
- auto buffer = AllocateAssemblerBuffer();
- MacroAssembler assembler(isolate, v8::internal::CodeObjectRequired::kYes,
- buffer->CreateView());
-
- MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
- EntryCode(masm);
- __ subq(rsp, Immediate(1 * kSystemPointerSize));
- Label exit;
-
- // Test 1.
- __ movq(rax, Immediate(1)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movq(rcx, Immediate(-1));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::UInteger8());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(255));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::UInteger8());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 2.
- __ movq(rax, Immediate(2)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ Set(rcx, V8_2PART_UINT64_C(0xDEADBEAF, 12345678));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx, Representation::Smi());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ Set(rdx, V8_2PART_UINT64_C(0xDEADBEAF, 12345678));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize), Representation::Smi());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 3.
- __ movq(rax, Immediate(3)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movq(rcx, Immediate(-1));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::Integer32());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(-1));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::Integer32());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 4.
- __ movq(rax, Immediate(4)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movl(rcx, Immediate(0x44332211));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::HeapObject());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(0x44332211));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::HeapObject());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 5.
- __ movq(rax, Immediate(5)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ Set(rcx, V8_2PART_UINT64_C(0x12345678, DEADBEAF));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx, Representation::Tagged());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ Set(rdx, V8_2PART_UINT64_C(0x12345678, DEADBEAF));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize), Representation::Tagged());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 6.
- __ movq(rax, Immediate(6)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ Set(rcx, V8_2PART_UINT64_C(0x11223344, 55667788));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::External());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ Set(rdx, V8_2PART_UINT64_C(0x11223344, 55667788));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::External());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 7.
- __ movq(rax, Immediate(7)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movq(rcx, Immediate(-1));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::Integer8());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(255));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::Integer8());
- __ movq(rcx, Immediate(-1));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 8.
- __ movq(rax, Immediate(8)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movq(rcx, Immediate(-1));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::Integer16());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(65535));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::Integer16());
- __ movq(rcx, Immediate(-1));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 9.
- __ movq(rax, Immediate(9)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movq(rcx, Immediate(-1));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::UInteger16());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(65535));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::UInteger16());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- __ xorq(rax, rax); // Success.
- __ bind(&exit);
- __ addq(rsp, Immediate(1 * kSystemPointerSize));
- ExitCode(masm);
- __ ret(0);
-
- CodeDesc desc;
- masm->GetCode(isolate, &desc);
- buffer->MakeExecutable();
- // Call the function from C++.
- auto f = GeneratedCode<F0>::FromBuffer(CcTest::i_isolate(), buffer->start());
- int result = f.Call();
- CHECK_EQ(0, result);
-}
-
void TestFloat32x4Abs(MacroAssembler* masm, Label* exit, float x, float y,
float z, float w) {
__ subq(rsp, Immediate(kSimd128Size));
diff --git a/deps/v8/test/cctest/test-mementos.cc b/deps/v8/test/cctest/test-mementos.cc
index aa2b23c413..78b1e6a981 100644
--- a/deps/v8/test/cctest/test-mementos.cc
+++ b/deps/v8/test/cctest/test-mementos.cc
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "src/heap/factory.h"
-#include "src/heap/heap.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "test/cctest/cctest.h"
diff --git a/deps/v8/test/cctest/test-object.cc b/deps/v8/test/cctest/test-object.cc
index 7d76b170d9..61945bc1fe 100644
--- a/deps/v8/test/cctest/test-object.cc
+++ b/deps/v8/test/cctest/test-object.cc
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include "src/api-inl.h"
+#include "src/function-kind.h"
+#include "src/globals.h"
#include "src/handles-inl.h"
#include "src/heap/factory.h"
#include "src/isolate.h"
@@ -251,5 +253,162 @@ TEST(EnumCache) {
}
}
+#define TEST_FUNCTION_KIND(Name) \
+ TEST(Name) { \
+ for (int i = 0; i < FunctionKind::kLastFunctionKind; i++) { \
+ FunctionKind kind = static_cast<FunctionKind>(i); \
+ CHECK_EQ(FunctionKind##Name(kind), Name(kind)); \
+ } \
+ }
+
+bool FunctionKindIsArrowFunction(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kArrowFunction:
+ case FunctionKind::kAsyncArrowFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsArrowFunction)
+
+bool FunctionKindIsAsyncGeneratorFunction(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kAsyncConciseGeneratorMethod:
+ case FunctionKind::kAsyncGeneratorFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsAsyncGeneratorFunction)
+
+bool FunctionKindIsGeneratorFunction(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kConciseGeneratorMethod:
+ case FunctionKind::kAsyncConciseGeneratorMethod:
+ case FunctionKind::kGeneratorFunction:
+ case FunctionKind::kAsyncGeneratorFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsGeneratorFunction)
+
+bool FunctionKindIsAsyncFunction(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kAsyncFunction:
+ case FunctionKind::kAsyncArrowFunction:
+ case FunctionKind::kAsyncConciseMethod:
+ case FunctionKind::kAsyncConciseGeneratorMethod:
+ case FunctionKind::kAsyncGeneratorFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsAsyncFunction)
+
+bool FunctionKindIsConciseMethod(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kConciseMethod:
+ case FunctionKind::kConciseGeneratorMethod:
+ case FunctionKind::kAsyncConciseMethod:
+ case FunctionKind::kAsyncConciseGeneratorMethod:
+ case FunctionKind::kClassMembersInitializerFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsConciseMethod)
+
+bool FunctionKindIsAccessorFunction(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kGetterFunction:
+ case FunctionKind::kSetterFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsAccessorFunction)
+
+bool FunctionKindIsDefaultConstructor(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kDefaultBaseConstructor:
+ case FunctionKind::kDefaultDerivedConstructor:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsDefaultConstructor)
+
+bool FunctionKindIsBaseConstructor(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kBaseConstructor:
+ case FunctionKind::kDefaultBaseConstructor:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsBaseConstructor)
+
+bool FunctionKindIsDerivedConstructor(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kDefaultDerivedConstructor:
+ case FunctionKind::kDerivedConstructor:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsDerivedConstructor)
+
+bool FunctionKindIsClassConstructor(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kBaseConstructor:
+ case FunctionKind::kDefaultBaseConstructor:
+ case FunctionKind::kDefaultDerivedConstructor:
+ case FunctionKind::kDerivedConstructor:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsClassConstructor)
+
+bool FunctionKindIsConstructable(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kGetterFunction:
+ case FunctionKind::kSetterFunction:
+ case FunctionKind::kArrowFunction:
+ case FunctionKind::kAsyncArrowFunction:
+ case FunctionKind::kAsyncFunction:
+ case FunctionKind::kAsyncConciseMethod:
+ case FunctionKind::kAsyncConciseGeneratorMethod:
+ case FunctionKind::kAsyncGeneratorFunction:
+ case FunctionKind::kGeneratorFunction:
+ case FunctionKind::kConciseGeneratorMethod:
+ case FunctionKind::kConciseMethod:
+ case FunctionKind::kClassMembersInitializerFunction:
+ return false;
+ default:
+ return true;
+ }
+}
+TEST_FUNCTION_KIND(IsConstructable)
+
+bool FunctionKindIsStrictFunctionWithoutPrototype(FunctionKind kind) {
+ return IsArrowFunction(kind) || IsConciseMethod(kind) ||
+ IsAccessorFunction(kind);
+}
+TEST_FUNCTION_KIND(IsStrictFunctionWithoutPrototype)
+
+#undef TEST_FUNCTION_KIND
+
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc
index 2634c30ec0..2722e820ed 100644
--- a/deps/v8/test/cctest/test-parsing.cc
+++ b/deps/v8/test/cctest/test-parsing.cc
@@ -50,6 +50,7 @@
#include "src/parsing/rewriter.h"
#include "src/parsing/scanner-character-streams.h"
#include "src/parsing/token.h"
+#include "src/zone/zone-list-inl.h" // crbug.com/v8/8816
#include "test/cctest/cctest.h"
#include "test/cctest/scope-test-helper.h"
@@ -91,6 +92,8 @@ TEST(AutoSemicolonToken) {
bool TokenIsAnyIdentifier(Token::Value token) {
switch (token) {
case Token::IDENTIFIER:
+ case Token::GET:
+ case Token::SET:
case Token::ASYNC:
case Token::AWAIT:
case Token::YIELD:
@@ -115,6 +118,8 @@ bool TokenIsCallable(Token::Value token) {
switch (token) {
case Token::SUPER:
case Token::IDENTIFIER:
+ case Token::GET:
+ case Token::SET:
case Token::ASYNC:
case Token::AWAIT:
case Token::YIELD:
@@ -139,6 +144,8 @@ bool TokenIsValidIdentifier(Token::Value token, LanguageMode language_mode,
bool is_generator, bool disallow_await) {
switch (token) {
case Token::IDENTIFIER:
+ case Token::GET:
+ case Token::SET:
case Token::ASYNC:
return true;
case Token::YIELD:
@@ -613,9 +620,8 @@ TEST(ScanHTMLEndComments) {
i::Scanner scanner(stream.get(), false);
scanner.Initialize();
i::Zone zone(i_isolate->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(&zone,
- i_isolate->ast_string_constants(),
- i_isolate->heap()->HashSeed());
+ i::AstValueFactory ast_value_factory(
+ &zone, i_isolate->ast_string_constants(), HashSeed(i_isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
@@ -632,9 +638,8 @@ TEST(ScanHTMLEndComments) {
i::Scanner scanner(stream.get(), false);
scanner.Initialize();
i::Zone zone(i_isolate->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(&zone,
- i_isolate->ast_string_constants(),
- i_isolate->heap()->HashSeed());
+ i::AstValueFactory ast_value_factory(
+ &zone, i_isolate->ast_string_constants(), HashSeed(i_isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
@@ -705,9 +710,8 @@ TEST(StandAlonePreParser) {
scanner.Initialize();
i::Zone zone(i_isolate->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(&zone,
- i_isolate->ast_string_constants(),
- i_isolate->heap()->HashSeed());
+ i::AstValueFactory ast_value_factory(
+ &zone, i_isolate->ast_string_constants(), HashSeed(i_isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
@@ -725,8 +729,8 @@ TEST(StandAlonePreParserNoNatives) {
v8::V8::Initialize();
i::Isolate* isolate = CcTest::i_isolate();
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- i::GetCurrentStackPosition() - 128 * 1024);
+ isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
+ 128 * 1024);
const char* programs[] = {"%ArgleBargle(glop);", "var x = %_IsSmi(42);",
nullptr};
@@ -738,10 +742,9 @@ TEST(StandAlonePreParserNoNatives) {
scanner.Initialize();
// Preparser defaults to disallowing natives syntax.
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(
- &zone, CcTest::i_isolate()->ast_string_constants(),
- CcTest::i_isolate()->heap()->HashSeed());
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
+ i::AstValueFactory ast_value_factory(&zone, isolate->ast_string_constants(),
+ HashSeed(isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
@@ -772,15 +775,14 @@ TEST(RegressChromium62639) {
auto stream = i::ScannerStream::ForTesting(program);
i::Scanner scanner(stream.get(), false);
scanner.Initialize();
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(
- &zone, CcTest::i_isolate()->ast_string_constants(),
- CcTest::i_isolate()->heap()->HashSeed());
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
+ i::AstValueFactory ast_value_factory(&zone, isolate->ast_string_constants(),
+ HashSeed(isolate));
i::PendingCompilationErrorHandler pending_error_handler;
- i::PreParser preparser(
- &zone, &scanner, CcTest::i_isolate()->stack_guard()->real_climit(),
- &ast_value_factory, &pending_error_handler,
- isolate->counters()->runtime_call_stats(), isolate->logger());
+ i::PreParser preparser(&zone, &scanner, isolate->stack_guard()->real_climit(),
+ &ast_value_factory, &pending_error_handler,
+ isolate->counters()->runtime_call_stats(),
+ isolate->logger());
i::PreParser::PreParseResult result = preparser.PreParseProgram();
// Even in the case of a syntax error, kPreParseSuccess is returned.
CHECK_EQ(i::PreParser::kPreParseSuccess, result);
@@ -807,10 +809,9 @@ TEST(PreParseOverflow) {
i::Scanner scanner(stream.get(), false);
scanner.Initialize();
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(
- &zone, CcTest::i_isolate()->ast_string_constants(),
- CcTest::i_isolate()->heap()->HashSeed());
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
+ i::AstValueFactory ast_value_factory(&zone, isolate->ast_string_constants(),
+ HashSeed(isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(
&zone, &scanner, stack_limit, &ast_value_factory, &pending_error_handler,
@@ -845,19 +846,9 @@ TEST(StreamScanner) {
std::unique_ptr<i::Utf16CharacterStream> stream1(
i::ScannerStream::ForTesting(str1));
i::Token::Value expectations1[] = {
- i::Token::LBRACE,
- i::Token::IDENTIFIER,
- i::Token::IDENTIFIER,
- i::Token::FOR,
- i::Token::COLON,
- i::Token::MUL,
- i::Token::DIV,
- i::Token::LT,
- i::Token::SUB,
- i::Token::IDENTIFIER,
- i::Token::EOS,
- i::Token::ILLEGAL
- };
+ i::Token::LBRACE, i::Token::IDENTIFIER, i::Token::GET, i::Token::FOR,
+ i::Token::COLON, i::Token::MUL, i::Token::DIV, i::Token::LT,
+ i::Token::SUB, i::Token::IDENTIFIER, i::Token::EOS, i::Token::ILLEGAL};
TestStreamScanner(stream1.get(), expectations1, 0, 0);
const char* str2 = "case default const {THIS\nPART\nSKIPPED} do";
@@ -911,7 +902,7 @@ void TestScanRegExp(const char* re_source, const char* expected) {
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
i::AstValueFactory ast_value_factory(
&zone, CcTest::i_isolate()->ast_string_constants(),
- CcTest::i_isolate()->heap()->HashSeed());
+ HashSeed(CcTest::i_isolate()));
const i::AstRawString* current_symbol =
scanner.CurrentSymbol(&ast_value_factory);
ast_value_factory.Internalize(CcTest::i_isolate());
@@ -1101,8 +1092,7 @@ TEST(ScopeUsesArgumentsSuperThis) {
if ((source_data[i].expected & THIS) != 0) {
// Currently the is_used() flag is conservative; all variables in a
// script scope are marked as used.
- CHECK(scope->LookupForTesting(info.ast_value_factory()->this_string())
- ->is_used());
+ CHECK(scope->GetReceiverScope()->receiver()->is_used());
}
if (is_sloppy(scope->language_mode())) {
CHECK_EQ((source_data[i].expected & EVAL) != 0,
@@ -1596,10 +1586,9 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
std::unique_ptr<i::Utf16CharacterStream> stream(
i::ScannerStream::For(isolate, source));
i::Scanner scanner(stream.get(), is_module);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(
- &zone, CcTest::i_isolate()->ast_string_constants(),
- CcTest::i_isolate()->heap()->HashSeed());
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
+ i::AstValueFactory ast_value_factory(&zone, isolate->ast_string_constants(),
+ HashSeed(isolate));
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
isolate->counters()->runtime_call_stats(),
@@ -3118,8 +3107,7 @@ TEST(FuncNameInferrerBasic) {
ExpectString("Ctor()", "Ctor.foo5");
ExpectString("%FunctionGetInferredName(obj1.foo6)", "obj1.foo6");
ExpectString("%FunctionGetInferredName(obj2.foo7)", "obj2.foo7");
- ExpectString("%FunctionGetInferredName(obj3[1])",
- "obj3.(anonymous function)");
+ ExpectString("%FunctionGetInferredName(obj3[1])", "obj3.<computed>");
ExpectString("%FunctionGetInferredName(obj4[1])", "");
ExpectString("%FunctionGetInferredName(obj5['foo9'])", "obj5.foo9");
ExpectString("%FunctionGetInferredName(obj6.obj7.foo10)", "obj6.obj7.foo10");
@@ -3236,7 +3224,7 @@ TEST(SerializationOfMaybeAssignmentFlag) {
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Context context = f->context();
i::AstValueFactory avf(&zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
const i::AstRawString* name = avf.GetOneByteString("result");
avf.Internalize(isolate);
i::Handle<i::String> str = name->string();
@@ -3286,7 +3274,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) {
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Context context = f->context();
i::AstValueFactory avf(&zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
const i::AstRawString* name_x = avf.GetOneByteString("x");
avf.Internalize(isolate);
@@ -3473,7 +3461,6 @@ TEST(InnerAssignment) {
i::Variable* var = scope->LookupForTesting(var_name);
bool expected = outers[i].assigned || inners[j].assigned;
CHECK_NOT_NULL(var);
- CHECK(var->is_used() || !expected);
bool is_maybe_assigned = var->maybe_assigned() == i::kMaybeAssigned;
CHECK(is_maybe_assigned == expected ||
(is_maybe_assigned && inners[j].allow_error_in_inner_function));
@@ -3615,7 +3602,7 @@ static void TestMaybeAssigned(Input input, const char* variable, bool module,
}
CHECK_NOT_NULL(var);
- CHECK(var->is_used());
+ CHECK_IMPLIES(input.assigned, var->is_used());
STATIC_ASSERT(true == i::kMaybeAssigned);
CHECK_EQ(input.assigned, var->maybe_assigned() == i::kMaybeAssigned);
}
@@ -4202,7 +4189,7 @@ namespace {
i::Scope* DeserializeFunctionScope(i::Isolate* isolate, i::Zone* zone,
i::Handle<i::JSObject> m, const char* name) {
i::AstValueFactory avf(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(
i::JSReceiver::GetProperty(isolate, m, name).ToHandleChecked());
i::DeclarationScope* script_scope =
@@ -5622,6 +5609,8 @@ TEST(PrivateMembersInNonClassNoErrors) {
{"function() {", "}"},
{"() => {", "}"},
{"class C { test() {", "} }"},
+ {"const {", "} = {}"},
+ {"({", "} = {})"},
{nullptr, nullptr}};
const char* class_body_data[] = {
"#a = 1",
@@ -6086,7 +6075,7 @@ TEST(PrivateStaticClassFieldsErrors) {
TEST(PrivateNameNoErrors) {
// clang-format off
const char* context_data[][2] = {
- {"", ""},
+ {"class X { bar() { ", " } }"},
{"\"use strict\";", ""},
{nullptr, nullptr}
};
@@ -6138,6 +6127,9 @@ TEST(PrivateNameErrors) {
// clang-format off
const char* context_data[][2] = {
{"", ""},
+ {"function t() { ", " }"},
+ {"var t => { ", " }"},
+ {"var t = { [ ", " ] }"},
{"\"use strict\";", ""},
{nullptr, nullptr}
};
@@ -7599,7 +7591,7 @@ TEST(ModuleParsingInternals) {
i::VariableLocation::MODULE);
CHECK(declarations->AtForTest(7)->var()->raw_name()->IsOneByteEqualTo(
- "*default*"));
+ ".default"));
CHECK(declarations->AtForTest(7)->var()->mode() == i::VariableMode::kConst);
CHECK(declarations->AtForTest(7)->var()->binding_needs_init());
CHECK(declarations->AtForTest(7)->var()->location() ==
@@ -7688,7 +7680,7 @@ TEST(ModuleParsingInternals) {
entry = descriptor->regular_exports()
.find(declarations->AtForTest(7)->var()->raw_name())
->second;
- CheckEntry(entry, "default", "*default*", nullptr, -1);
+ CheckEntry(entry, "default", ".default", nullptr, -1);
entry = descriptor->regular_exports()
.find(declarations->AtForTest(12)->var()->raw_name())
->second;
@@ -9385,11 +9377,10 @@ TEST(EscapedKeywords) {
"class C { st\\u0061tic *bar() {} }",
"class C { st\\u0061tic get bar() {} }",
"class C { st\\u0061tic set bar() {} }",
-
- // TODO(adamk): These should not be errors in sloppy mode.
- "(y\\u0069eld);",
- "var y\\u0069eld = 1;",
- "var { y\\u0069eld } = {};",
+ "(async ()=>{\\u0061wait 100})()",
+ "({\\u0067et get(){}})",
+ "({\\u0073et set(){}})",
+ "(async ()=>{var \\u0061wait = 100})()",
nullptr
};
// clang-format on
@@ -9403,6 +9394,9 @@ TEST(EscapedKeywords) {
"var l\\u0065t = 1;",
"l\\u0065t = 1;",
"(l\\u0065t === 1);",
+ "(y\\u0069eld);",
+ "var y\\u0069eld = 1;",
+ "var { y\\u0069eld } = {};",
nullptr
};
// clang-format on
@@ -11297,7 +11291,7 @@ TEST(LexicalLoopVariable) {
}
}
-TEST(PrivateNamesSyntaxError) {
+TEST(PrivateNamesSyntaxErrorWithScopeAnalysis) {
i::Isolate* isolate = CcTest::i_isolate();
i::HandleScope scope(isolate);
LocalContext env;
@@ -11379,23 +11373,10 @@ TEST(PrivateNamesSyntaxError) {
"}",
};
- // TODO(gsathya): The preparser does not track unresolved
- // variables in top level function which fails this test.
- // https://bugs.chromium.org/p/v8/issues/detail?id=7468
- const char* parser_data[] = {
- "function t() {"
- " return this.#foo;"
- "}",
- };
-
for (const char* source : data) {
CHECK(test(source, true));
CHECK(test(source, false));
}
-
- for (const char* source : parser_data) {
- CHECK(test(source, false));
- }
}
TEST(HashbangSyntax) {
diff --git a/deps/v8/test/cctest/test-profile-generator.cc b/deps/v8/test/cctest/test-profile-generator.cc
index c9d7f1da68..27cb4f841b 100644
--- a/deps/v8/test/cctest/test-profile-generator.cc
+++ b/deps/v8/test/cctest/test-profile-generator.cc
@@ -491,7 +491,7 @@ TEST(SampleIds) {
CHECK_EQ(3, profile->samples_count());
unsigned expected_id[] = {3, 5, 7};
for (int i = 0; i < 3; i++) {
- CHECK_EQ(expected_id[i], profile->sample(i)->id());
+ CHECK_EQ(expected_id[i], profile->sample(i).node->id());
}
}
diff --git a/deps/v8/test/cctest/test-regexp.cc b/deps/v8/test/cctest/test-regexp.cc
index 950237a105..49dcc49c3e 100644
--- a/deps/v8/test/cctest/test-regexp.cc
+++ b/deps/v8/test/cctest/test-regexp.cc
@@ -34,8 +34,10 @@
#include "src/assembler-arch.h"
#include "src/ast/ast.h"
#include "src/char-predicates-inl.h"
+#include "src/macro-assembler.h"
#include "src/objects-inl.h"
#include "src/ostreams.h"
+#include "src/regexp/interpreter-irregexp.h"
#include "src/regexp/jsregexp.h"
#include "src/regexp/regexp-macro-assembler-irregexp.h"
#include "src/regexp/regexp-macro-assembler.h"
@@ -44,36 +46,28 @@
#include "src/string-stream.h"
#include "src/unicode-inl.h"
#include "src/v8.h"
+#include "src/zone/zone-list-inl.h"
-#ifdef V8_INTERPRETED_REGEXP
-#include "src/regexp/interpreter-irregexp.h"
-#else // V8_INTERPRETED_REGEXP
-#include "src/macro-assembler.h"
#if V8_TARGET_ARCH_ARM
#include "src/regexp/arm/regexp-macro-assembler-arm.h"
-#endif
-#if V8_TARGET_ARCH_ARM64
+#elif V8_TARGET_ARCH_ARM64
#include "src/regexp/arm64/regexp-macro-assembler-arm64.h"
-#endif
-#if V8_TARGET_ARCH_S390
+#elif V8_TARGET_ARCH_S390
#include "src/regexp/s390/regexp-macro-assembler-s390.h"
-#endif
-#if V8_TARGET_ARCH_PPC
+#elif V8_TARGET_ARCH_PPC
#include "src/regexp/ppc/regexp-macro-assembler-ppc.h"
-#endif
-#if V8_TARGET_ARCH_MIPS
+#elif V8_TARGET_ARCH_MIPS
#include "src/regexp/mips/regexp-macro-assembler-mips.h"
-#endif
-#if V8_TARGET_ARCH_MIPS64
+#elif V8_TARGET_ARCH_MIPS64
#include "src/regexp/mips64/regexp-macro-assembler-mips64.h"
-#endif
-#if V8_TARGET_ARCH_X64
+#elif V8_TARGET_ARCH_X64
#include "src/regexp/x64/regexp-macro-assembler-x64.h"
-#endif
-#if V8_TARGET_ARCH_IA32
+#elif V8_TARGET_ARCH_IA32
#include "src/regexp/ia32/regexp-macro-assembler-ia32.h"
+#else
+#error Unknown architecture.
#endif
-#endif // V8_INTERPRETED_REGEXP
+
#include "test/cctest/cctest.h"
namespace v8 {
@@ -738,9 +732,6 @@ TEST(ParsePossessiveRepetition) {
// Tests of interpreter.
-
-#ifndef V8_INTERPRETED_REGEXP
-
#if V8_TARGET_ARCH_IA32
typedef RegExpMacroAssemblerIA32 ArchRegExpMacroAssembler;
#elif V8_TARGET_ARCH_X64
@@ -781,9 +772,11 @@ static ArchRegExpMacroAssembler::Result Execute(Code code, String input,
Address input_start,
Address input_end,
int* captures) {
- return NativeRegExpMacroAssembler::Execute(
- code, input, start_offset, reinterpret_cast<byte*>(input_start),
- reinterpret_cast<byte*>(input_end), captures, 0, CcTest::i_isolate());
+ return static_cast<NativeRegExpMacroAssembler::Result>(
+ NativeRegExpMacroAssembler::Execute(code, input, start_offset,
+ reinterpret_cast<byte*>(input_start),
+ reinterpret_cast<byte*>(input_end),
+ captures, 0, CcTest::i_isolate()));
}
TEST(MacroAssemblerNativeSuccess) {
@@ -1397,13 +1390,9 @@ TEST(MacroAssemblerNativeLotsOfRegisters) {
isolate->clear_pending_exception();
}
-#else // V8_INTERPRETED_REGEXP
-
TEST(MacroAssembler) {
- byte codes[1024];
Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- RegExpMacroAssemblerIrregexp m(CcTest::i_isolate(), Vector<byte>(codes, 1024),
- &zone);
+ RegExpMacroAssemblerIrregexp m(CcTest::i_isolate(), &zone);
// ^f(o)o.
Label start, fail, backtrack;
@@ -1462,9 +1451,6 @@ TEST(MacroAssembler) {
CHECK_EQ(42, captures[0]);
}
-#endif // V8_INTERPRETED_REGEXP
-
-
TEST(AddInverseToTable) {
static const int kLimit = 1000;
static const int kRangeCount = 16;
diff --git a/deps/v8/test/cctest/test-representation.cc b/deps/v8/test/cctest/test-representation.cc
index e839f528f3..af0051e0af 100644
--- a/deps/v8/test/cctest/test-representation.cc
+++ b/deps/v8/test/cctest/test-representation.cc
@@ -46,85 +46,16 @@ void TestPairNegative(Representation more_general,
TEST(RepresentationMoreGeneralThan) {
TestPairNegative(Representation::None(), Representation::None());
- TestPairPositive(Representation::Integer8(), Representation::None());
- TestPairPositive(Representation::UInteger8(), Representation::None());
- TestPairPositive(Representation::Integer16(), Representation::None());
- TestPairPositive(Representation::UInteger16(), Representation::None());
TestPairPositive(Representation::Smi(), Representation::None());
- TestPairPositive(Representation::Integer32(), Representation::None());
TestPairPositive(Representation::HeapObject(), Representation::None());
TestPairPositive(Representation::Double(), Representation::None());
TestPairPositive(Representation::Tagged(), Representation::None());
- TestPairNegative(Representation::None(), Representation::Integer8());
- TestPairNegative(Representation::Integer8(), Representation::Integer8());
- TestPairNegative(Representation::UInteger8(), Representation::Integer8());
- TestPairPositive(Representation::Integer16(), Representation::Integer8());
- TestPairPositive(Representation::UInteger16(), Representation::Integer8());
- TestPairPositive(Representation::Smi(), Representation::Integer8());
- TestPairPositive(Representation::Integer32(), Representation::Integer8());
- TestPairNegative(Representation::HeapObject(), Representation::Integer8());
- TestPairPositive(Representation::Double(), Representation::Integer8());
- TestPairPositive(Representation::Tagged(), Representation::Integer8());
-
- TestPairNegative(Representation::None(), Representation::UInteger8());
- TestPairNegative(Representation::Integer8(), Representation::UInteger8());
- TestPairNegative(Representation::UInteger8(), Representation::UInteger8());
- TestPairPositive(Representation::Integer16(), Representation::UInteger8());
- TestPairPositive(Representation::UInteger16(), Representation::UInteger8());
- TestPairPositive(Representation::Smi(), Representation::UInteger8());
- TestPairPositive(Representation::Integer32(), Representation::UInteger8());
- TestPairNegative(Representation::HeapObject(), Representation::UInteger8());
- TestPairPositive(Representation::Double(), Representation::UInteger8());
- TestPairPositive(Representation::Tagged(), Representation::UInteger8());
-
- TestPairNegative(Representation::None(), Representation::Integer16());
- TestPairNegative(Representation::Integer8(), Representation::Integer16());
- TestPairNegative(Representation::UInteger8(), Representation::Integer16());
- TestPairNegative(Representation::Integer16(), Representation::Integer16());
- TestPairNegative(Representation::UInteger16(), Representation::Integer16());
- TestPairPositive(Representation::Smi(), Representation::Integer16());
- TestPairPositive(Representation::Integer32(), Representation::Integer16());
- TestPairNegative(Representation::HeapObject(), Representation::Integer16());
- TestPairPositive(Representation::Double(), Representation::Integer16());
- TestPairPositive(Representation::Tagged(), Representation::Integer16());
-
- TestPairNegative(Representation::None(), Representation::UInteger16());
- TestPairNegative(Representation::Integer8(), Representation::UInteger16());
- TestPairNegative(Representation::UInteger8(), Representation::UInteger16());
- TestPairNegative(Representation::Integer16(), Representation::UInteger16());
- TestPairNegative(Representation::UInteger16(), Representation::UInteger16());
- TestPairPositive(Representation::Smi(), Representation::UInteger16());
- TestPairPositive(Representation::Integer32(), Representation::UInteger16());
- TestPairNegative(Representation::HeapObject(), Representation::UInteger16());
- TestPairPositive(Representation::Double(), Representation::UInteger16());
- TestPairPositive(Representation::Tagged(), Representation::UInteger16());
-
TestPairNegative(Representation::None(), Representation::Smi());
- TestPairNegative(Representation::Integer8(), Representation::Smi());
- TestPairNegative(Representation::UInteger8(), Representation::Smi());
- TestPairNegative(Representation::Integer16(), Representation::Smi());
- TestPairNegative(Representation::UInteger16(), Representation::Smi());
TestPairNegative(Representation::Smi(), Representation::Smi());
- TestPairPositive(Representation::Integer32(), Representation::Smi());
TestPairNegative(Representation::HeapObject(), Representation::Smi());
TestPairPositive(Representation::Double(), Representation::Smi());
TestPairPositive(Representation::Tagged(), Representation::Smi());
-
- TestPairNegative(Representation::None(), Representation::Integer32());
- TestPairNegative(Representation::Integer8(), Representation::Integer32());
- TestPairNegative(Representation::UInteger8(), Representation::Integer32());
- TestPairNegative(Representation::Integer16(), Representation::Integer32());
- TestPairNegative(Representation::UInteger16(), Representation::Integer32());
- TestPairNegative(Representation::Smi(), Representation::Integer32());
- TestPairNegative(Representation::Integer32(), Representation::Integer32());
- TestPairNegative(Representation::HeapObject(), Representation::Integer32());
- TestPairPositive(Representation::Double(), Representation::Integer32());
- TestPairPositive(Representation::Tagged(), Representation::Integer32());
-
- TestPairNegative(Representation::None(), Representation::External());
- TestPairNegative(Representation::External(), Representation::External());
- TestPairPositive(Representation::External(), Representation::None());
}
} // namespace internal
diff --git a/deps/v8/test/cctest/test-roots.cc b/deps/v8/test/cctest/test-roots.cc
index bb4e09d8a4..a0ad1f06c6 100644
--- a/deps/v8/test/cctest/test-roots.cc
+++ b/deps/v8/test/cctest/test-roots.cc
@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/heap/heap.h"
+#include "src/heap/heap-inl.h"
+#include "src/objects/cell.h"
+#include "src/objects/feedback-cell.h"
+#include "src/objects/script.h"
#include "src/roots-inl.h"
#include "test/cctest/cctest.h"
@@ -42,7 +45,7 @@ bool IsInitiallyMutable(Factory* factory, Address object_address) {
V(builtins_constants_table) \
V(current_microtask) \
V(detached_contexts) \
- V(dirty_js_weak_factories) \
+ V(dirty_js_finalization_groups) \
V(feedback_vectors_for_profiling_tools) \
V(materialized_objects) \
V(noscript_shared_function_infos) \
diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc
index ed1718adde..818505febc 100644
--- a/deps/v8/test/cctest/test-serialize.cc
+++ b/deps/v8/test/cctest/test-serialize.cc
@@ -37,6 +37,8 @@
#include "src/compilation-cache.h"
#include "src/compiler.h"
#include "src/debug/debug.h"
+#include "src/hash-seed-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/spaces.h"
#include "src/interpreter/interpreter.h"
#include "src/macro-assembler-inl.h"
@@ -49,6 +51,7 @@
#include "src/snapshot/natives.h"
#include "src/snapshot/partial-deserializer.h"
#include "src/snapshot/partial-serializer.h"
+#include "src/snapshot/read-only-deserializer.h"
#include "src/snapshot/read-only-serializer.h"
#include "src/snapshot/snapshot.h"
#include "src/snapshot/startup-deserializer.h"
@@ -90,7 +93,7 @@ class TestSerializer {
v8::Isolate* v8_isolate = NewIsolate(kEnableSerializer, kGenerateHeap);
v8::Isolate::Scope isolate_scope(v8_isolate);
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
- isolate->Init(nullptr);
+ isolate->Init(nullptr, nullptr);
isolate->heap()->read_only_space()->ClearStringPaddingIfNeeded();
return v8_isolate;
}
@@ -98,13 +101,14 @@ class TestSerializer {
static v8::Isolate* NewIsolateFromBlob(StartupBlobs& blobs) {
SnapshotData startup_snapshot(blobs.startup);
SnapshotData read_only_snapshot(blobs.read_only);
- StartupDeserializer deserializer(&startup_snapshot, &read_only_snapshot);
+ ReadOnlyDeserializer read_only_deserializer(&read_only_snapshot);
+ StartupDeserializer startup_deserializer(&startup_snapshot);
const bool kEnableSerializer = false;
const bool kGenerateHeap = false;
v8::Isolate* v8_isolate = NewIsolate(kEnableSerializer, kGenerateHeap);
v8::Isolate::Scope isolate_scope(v8_isolate);
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
- isolate->Init(&deserializer);
+ isolate->Init(&read_only_deserializer, &startup_deserializer);
return v8_isolate;
}
@@ -860,7 +864,6 @@ UNINITIALIZED_TEST(CustomSnapshotDataBlobStringNotInternalized) {
FreeCurrentEmbeddedBlob();
}
-#ifndef V8_INTERPRETED_REGEXP
namespace {
void TestCustomSnapshotDataBlobWithIrregexpCode(
@@ -937,7 +940,6 @@ UNINITIALIZED_TEST(CustomSnapshotDataBlobWithIrregexpCodeClearCode) {
TestCustomSnapshotDataBlobWithIrregexpCode(
v8::SnapshotCreator::FunctionCodeHandling::kClear);
}
-#endif // V8_INTERPRETED_REGEXP
UNINITIALIZED_TEST(SnapshotChecksum) {
DisableAlwaysOpt();
@@ -1339,9 +1341,9 @@ UNINITIALIZED_TEST(CustomSnapshotDataBlobOutdatedContextWithOverflow) {
UNINITIALIZED_TEST(CustomSnapshotDataBlobWithLocker) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
- DisableEmbeddedBlobRefcounting();
v8::Isolate* isolate0 = v8::Isolate::New(create_params);
{
v8::Locker locker(isolate0);
@@ -1929,21 +1931,25 @@ TEST(CodeSerializerThreeBigStrings) {
v8::HandleScope scope(CcTest::isolate());
+ const int32_t length_of_a = kMaxRegularHeapObjectSize * 2;
+ const int32_t length_of_b = kMaxRegularHeapObjectSize / 2;
+ const int32_t length_of_c = kMaxRegularHeapObjectSize / 2;
+
Vector<const uint8_t> source_a =
ConstructSource(StaticCharVector("var a = \""), StaticCharVector("a"),
- StaticCharVector("\";"), 700000);
+ StaticCharVector("\";"), length_of_a);
Handle<String> source_a_str =
f->NewStringFromOneByte(source_a).ToHandleChecked();
Vector<const uint8_t> source_b =
ConstructSource(StaticCharVector("var b = \""), StaticCharVector("b"),
- StaticCharVector("\";"), 400000);
+ StaticCharVector("\";"), length_of_b);
Handle<String> source_b_str =
f->NewStringFromOneByte(source_b).ToHandleChecked();
Vector<const uint8_t> source_c =
ConstructSource(StaticCharVector("var c = \""), StaticCharVector("c"),
- StaticCharVector("\";"), 400000);
+ StaticCharVector("\";"), length_of_c);
Handle<String> source_c_str =
f->NewStringFromOneByte(source_c).ToHandleChecked();
@@ -1976,10 +1982,10 @@ TEST(CodeSerializerThreeBigStrings) {
v8::Maybe<int32_t> result =
CompileRun("(a + b).length")
->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext());
- CHECK_EQ(400000 + 700000, result.FromJust());
+ CHECK_EQ(length_of_a + length_of_b, result.FromJust());
result = CompileRun("(b + c).length")
->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext());
- CHECK_EQ(400000 + 400000, result.FromJust());
+ CHECK_EQ(length_of_b + length_of_c, result.FromJust());
Heap* heap = isolate->heap();
v8::Local<v8::String> result_str =
CompileRun("a")
@@ -1989,20 +1995,12 @@ TEST(CodeSerializerThreeBigStrings) {
result_str = CompileRun("b")
->ToString(CcTest::isolate()->GetCurrentContext())
.ToLocalChecked();
-#if V8_HOST_ARCH_PPC
- CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), LO_SPACE));
-#else
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE));
-#endif
result_str = CompileRun("c")
->ToString(CcTest::isolate()->GetCurrentContext())
.ToLocalChecked();
-#if V8_HOST_ARCH_PPC
- CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), LO_SPACE));
-#else
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE));
-#endif
delete cache;
source_a.Dispose();
@@ -2577,8 +2575,9 @@ TEST(Regress503552) {
delete cache_data;
}
-TEST(SnapshotCreatorMultipleContexts) {
+UNINITIALIZED_TEST(SnapshotCreatorMultipleContexts) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
v8::SnapshotCreator creator;
@@ -2637,6 +2636,7 @@ TEST(SnapshotCreatorMultipleContexts) {
isolate->Dispose();
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
static int serialized_static_field = 314;
@@ -2699,8 +2699,9 @@ intptr_t replaced_external_references[] = {
intptr_t short_external_references[] = {
reinterpret_cast<intptr_t>(SerializedCallbackReplacement), 0};
-TEST(SnapshotCreatorExternalReferences) {
+UNINITIALIZED_TEST(SnapshotCreatorExternalReferences) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
v8::SnapshotCreator creator(original_external_references);
@@ -2787,10 +2788,12 @@ TEST(SnapshotCreatorExternalReferences) {
CHECK_EQ(3, serializable_two_byte_resource.dispose_count());
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
-TEST(SnapshotCreatorShortExternalReferences) {
+UNINITIALIZED_TEST(SnapshotCreatorShortExternalReferences) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
v8::SnapshotCreator creator(original_external_references);
@@ -2829,6 +2832,7 @@ TEST(SnapshotCreatorShortExternalReferences) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
v8::StartupData CreateSnapshotWithDefaultAndCustom() {
@@ -2865,8 +2869,9 @@ v8::StartupData CreateSnapshotWithDefaultAndCustom() {
return creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
}
-TEST(SnapshotCreatorNoExternalReferencesDefault) {
+UNINITIALIZED_TEST(SnapshotCreatorNoExternalReferencesDefault) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob = CreateSnapshotWithDefaultAndCustom();
// Deserialize with an incomplete list of external references.
@@ -2887,6 +2892,7 @@ TEST(SnapshotCreatorNoExternalReferencesDefault) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
v8::StartupData CreateCustomSnapshotWithPreparseDataAndNoOuterScope() {
@@ -2912,8 +2918,9 @@ v8::StartupData CreateCustomSnapshotWithPreparseDataAndNoOuterScope() {
return creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
}
-TEST(SnapshotCreatorPreparseDataAndNoOuterScope) {
+UNINITIALIZED_TEST(SnapshotCreatorPreparseDataAndNoOuterScope) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob = CreateCustomSnapshotWithPreparseDataAndNoOuterScope();
// Deserialize with an incomplete list of external references.
@@ -2932,6 +2939,7 @@ TEST(SnapshotCreatorPreparseDataAndNoOuterScope) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
v8::StartupData CreateCustomSnapshotArrayJoinWithKeep() {
@@ -2952,8 +2960,9 @@ v8::StartupData CreateCustomSnapshotArrayJoinWithKeep() {
return creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep);
}
-TEST(SnapshotCreatorArrayJoinWithKeep) {
+UNINITIALIZED_TEST(SnapshotCreatorArrayJoinWithKeep) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob = CreateCustomSnapshotArrayJoinWithKeep();
// Deserialize with an incomplete list of external references.
@@ -2973,6 +2982,7 @@ TEST(SnapshotCreatorArrayJoinWithKeep) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
TEST(SnapshotCreatorNoExternalReferencesCustomFail1) {
@@ -3025,8 +3035,9 @@ TEST(SnapshotCreatorNoExternalReferencesCustomFail2) {
delete[] blob.data;
}
-TEST(SnapshotCreatorUnknownExternalReferences) {
+UNINITIALIZED_TEST(SnapshotCreatorUnknownExternalReferences) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::SnapshotCreator creator;
v8::Isolate* isolate = creator.GetIsolate();
{
@@ -3047,10 +3058,12 @@ TEST(SnapshotCreatorUnknownExternalReferences) {
creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
-TEST(SnapshotCreatorTemplates) {
+UNINITIALIZED_TEST(SnapshotCreatorTemplates) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
@@ -3214,10 +3227,12 @@ TEST(SnapshotCreatorTemplates) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
-TEST(SnapshotCreatorAddData) {
+UNINITIALIZED_TEST(SnapshotCreatorAddData) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
@@ -3414,6 +3429,7 @@ TEST(SnapshotCreatorAddData) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
TEST(SnapshotCreatorUnknownHandles) {
@@ -3441,8 +3457,9 @@ TEST(SnapshotCreatorUnknownHandles) {
delete[] blob.data;
}
-TEST(SnapshotCreatorIncludeGlobalProxy) {
+UNINITIALIZED_TEST(SnapshotCreatorIncludeGlobalProxy) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
@@ -3537,14 +3554,15 @@ TEST(SnapshotCreatorIncludeGlobalProxy) {
v8::Isolate::Scope isolate_scope(isolate);
// We can introduce new extensions, which could override functions already
// in the snapshot.
- v8::Extension* extension = new v8::Extension("new extension",
- "function i() { return 24; }"
- "function j() { return 25; }"
- "try {"
- " if (o.p == 7) o.p++;"
- "} catch {}");
+ auto extension =
+ base::make_unique<v8::Extension>("new extension",
+ "function i() { return 24; }"
+ "function j() { return 25; }"
+ "try {"
+ " if (o.p == 7) o.p++;"
+ "} catch {}");
extension->set_auto_enable(true);
- v8::RegisterExtension(extension);
+ v8::RegisterExtension(std::move(extension));
{
// Create a new context from default context snapshot. This will
// create a new global object from a new global object template
@@ -3630,6 +3648,7 @@ TEST(SnapshotCreatorIncludeGlobalProxy) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
UNINITIALIZED_TEST(ReinitializeHashSeedNotRehashable) {
@@ -3666,7 +3685,7 @@ UNINITIALIZED_TEST(ReinitializeHashSeedNotRehashable) {
{
// Check that no rehashing has been performed.
CHECK_EQ(static_cast<uint64_t>(42),
- reinterpret_cast<i::Isolate*>(isolate)->heap()->HashSeed());
+ HashSeed(reinterpret_cast<i::Isolate*>(isolate)));
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
@@ -3731,7 +3750,7 @@ UNINITIALIZED_TEST(ReinitializeHashSeedRehashable) {
{
// Check that rehashing has been performed.
CHECK_EQ(static_cast<uint64_t>(1337),
- reinterpret_cast<i::Isolate*>(isolate)->heap()->HashSeed());
+ HashSeed(reinterpret_cast<i::Isolate*>(isolate)));
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
@@ -3751,7 +3770,7 @@ UNINITIALIZED_TEST(ReinitializeHashSeedRehashable) {
FreeCurrentEmbeddedBlob();
}
-TEST(SerializationStats) {
+UNINITIALIZED_TEST(SerializationStats) {
FLAG_profile_deserialization = true;
FLAG_always_opt = false;
v8::StartupData blob = CreateSnapshotDataBlob();
@@ -3766,6 +3785,8 @@ TEST(SerializationStats) {
}
PrintF("Embedded blob is %d bytes\n", embedded_blob_size);
}
+
+ FreeCurrentEmbeddedBlob();
}
void CheckSFIsAreWeak(WeakFixedArray sfis, Isolate* isolate) {
@@ -3784,10 +3805,11 @@ void CheckSFIsAreWeak(WeakFixedArray sfis, Isolate* isolate) {
CHECK_GT(no_of_weak, 0);
}
-TEST(WeakArraySerializizationInSnapshot) {
+UNINITIALIZED_TEST(WeakArraySerializationInSnapshot) {
const char* code = "var my_func = function() { }";
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
i::FLAG_allow_natives_syntax = true;
v8::StartupData blob;
{
@@ -3829,10 +3851,11 @@ TEST(WeakArraySerializizationInSnapshot) {
// Verify that the pointers in shared_function_infos are weak.
WeakFixedArray sfis =
Script::cast(function->shared()->script())->shared_function_infos();
- CheckSFIsAreWeak(sfis, CcTest::i_isolate());
+ CheckSFIsAreWeak(sfis, reinterpret_cast<i::Isolate*>(isolate));
}
isolate->Dispose();
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
TEST(WeakArraySerializationInCodeCache) {
@@ -3900,5 +3923,27 @@ TEST(CachedCompileFunctionInContext) {
}
}
+UNINITIALIZED_TEST(SnapshotCreatorAnonClassWithKeep) {
+ DisableAlwaysOpt();
+ v8::SnapshotCreator creator;
+ v8::Isolate* isolate = creator.GetIsolate();
+ {
+ v8::HandleScope handle_scope(isolate);
+ {
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ v8::Context::Scope context_scope(context);
+ CompileRun(
+ "function Foo() { return class {}; } \n"
+ "class Bar extends Foo() {}\n"
+ "Foo()\n");
+ creator.SetDefaultContext(context);
+ }
+ }
+ v8::StartupData blob =
+ creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep);
+
+ delete[] blob.data;
+}
+
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc
index 9afde32287..0871992ec6 100644
--- a/deps/v8/test/cctest/test-strings.cc
+++ b/deps/v8/test/cctest/test-strings.cc
@@ -37,6 +37,7 @@
#include "src/api-inl.h"
#include "src/base/platform/elapsed-timer.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/messages.h"
#include "src/objects-inl.h"
#include "src/unicode-decoder.h"
@@ -1425,7 +1426,7 @@ TEST(InternalizeExternal) {
Handle<String> string = v8::Utils::OpenHandle(*ext_string);
CHECK(string->IsExternalString());
CHECK(!string->IsInternalizedString());
- CHECK(!i::Heap::InNewSpace(*string));
+ CHECK(!i::Heap::InYoungGeneration(*string));
CHECK_EQ(
isolate->factory()->string_table()->LookupStringIfExists_NoAllocate(
isolate, string->ptr()),
@@ -1433,7 +1434,7 @@ TEST(InternalizeExternal) {
factory->InternalizeName(string);
CHECK(string->IsExternalString());
CHECK(string->IsInternalizedString());
- CHECK(!i::Heap::InNewSpace(*string));
+ CHECK(!i::Heap::InYoungGeneration(*string));
}
CcTest::CollectGarbage(i::OLD_SPACE);
CcTest::CollectGarbage(i::OLD_SPACE);
@@ -1817,7 +1818,7 @@ TEST(ExternalStringIndexOf) {
->NewStringFromOneByte(Vector<const uint8_t>( \
reinterpret_cast<const uint8_t*>(buf), len)) \
.ToHandleChecked(); \
- CHECK(Heap::InNewSpace(*main_string)); \
+ CHECK(Heap::InYoungGeneration(*main_string)); \
/* Next allocation will cause GC. */ \
heap::SimulateFullSpace(CcTest::i_isolate()->heap()->new_space()); \
/* Offset by two to check substring-ing. */ \
diff --git a/deps/v8/test/cctest/test-thread-termination.cc b/deps/v8/test/cctest/test-thread-termination.cc
index 72d01c2b7b..074e516220 100644
--- a/deps/v8/test/cctest/test-thread-termination.cc
+++ b/deps/v8/test/cctest/test-thread-termination.cc
@@ -176,10 +176,7 @@ class TerminatorThread : public v8::base::Thread {
v8::Isolate* isolate_;
};
-
-// Test that a single thread of JavaScript execution can be terminated
-// from the side by another thread.
-TEST(TerminateOnlyV8ThreadFromOtherThread) {
+void TestTerminatingSlowOperation(const char* source) {
semaphore = new v8::base::Semaphore(0);
TerminatorThread thread(CcTest::i_isolate());
thread.Start();
@@ -191,40 +188,55 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) {
v8::Context::New(CcTest::isolate(), nullptr, global);
v8::Context::Scope context_scope(context);
CHECK(!CcTest::isolate()->IsExecutionTerminating());
- // Run a loop that will be infinite if thread termination does not work.
v8::MaybeLocal<v8::Value> result =
- CompileRun(CcTest::isolate()->GetCurrentContext(),
- "try { loop(); fail(); } catch(e) { fail(); }");
+ CompileRun(CcTest::isolate()->GetCurrentContext(), source);
CHECK(result.IsEmpty());
thread.Join();
delete semaphore;
semaphore = nullptr;
}
+// Test that a single thread of JavaScript execution can be terminated
+// from the side by another thread.
+TEST(TerminateOnlyV8ThreadFromOtherThread) {
+ // Run a loop that will be infinite if thread termination does not work.
+ TestTerminatingSlowOperation("try { loop(); fail(); } catch(e) { fail(); }");
+}
+
// Test that execution can be terminated from within JSON.stringify.
TEST(TerminateJsonStringify) {
- semaphore = new v8::base::Semaphore(0);
- TerminatorThread thread(CcTest::i_isolate());
- thread.Start();
+ TestTerminatingSlowOperation(
+ "var x = [];"
+ "x[2**31]=1;"
+ "terminate();"
+ "JSON.stringify(x);"
+ "fail();");
+}
- v8::HandleScope scope(CcTest::isolate());
- v8::Local<v8::ObjectTemplate> global =
- CreateGlobalTemplate(CcTest::isolate(), Signal, DoLoop);
- v8::Local<v8::Context> context =
- v8::Context::New(CcTest::isolate(), nullptr, global);
- v8::Context::Scope context_scope(context);
- CHECK(!CcTest::isolate()->IsExecutionTerminating());
- v8::MaybeLocal<v8::Value> result =
- CompileRun(CcTest::isolate()->GetCurrentContext(),
- "var x = [];"
- "x[2**31]=1;"
- "terminate();"
- "JSON.stringify(x);"
- "fail();");
- CHECK(result.IsEmpty());
- thread.Join();
- delete semaphore;
- semaphore = nullptr;
+TEST(TerminateBigIntMultiplication) {
+ TestTerminatingSlowOperation(
+ "terminate();"
+ "var a = 5n ** 555555n;"
+ "var b = 3n ** 3333333n;"
+ "a * b;"
+ "fail();");
+}
+
+TEST(TerminateBigIntDivision) {
+ TestTerminatingSlowOperation(
+ "var a = 2n ** 2222222n;"
+ "var b = 3n ** 333333n;"
+ "terminate();"
+ "a / b;"
+ "fail();");
+}
+
+TEST(TerminateBigIntToString) {
+ TestTerminatingSlowOperation(
+ "var a = 2n ** 2222222n;"
+ "terminate();"
+ "a.toString();"
+ "fail();");
}
int call_count = 0;
@@ -854,26 +866,26 @@ class TerminatorSleeperThread : public v8::base::Thread {
};
TEST(TerminateRegExp) {
-// regexp interpreter does not support preemption.
-#ifndef V8_INTERPRETED_REGEXP
- i::FLAG_allow_natives_syntax = true;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::ObjectTemplate> global = CreateGlobalTemplate(
- isolate, TerminateCurrentThread, DoLoopCancelTerminate);
- v8::Local<v8::Context> context = v8::Context::New(isolate, nullptr, global);
- v8::Context::Scope context_scope(context);
- CHECK(!isolate->IsExecutionTerminating());
- v8::TryCatch try_catch(isolate);
- CHECK(!isolate->IsExecutionTerminating());
- CHECK(!CompileRun("var re = /(x+)+y$/; re.test('x');").IsEmpty());
- TerminatorSleeperThread terminator(isolate, 100);
- terminator.Start();
- CHECK(CompileRun("re.test('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); fail();")
- .IsEmpty());
- CHECK(try_catch.HasCaught());
- CHECK(isolate->IsExecutionTerminating());
-#endif // V8_INTERPRETED_REGEXP
+ // The regexp interpreter does not support preemption.
+ if (!i::FLAG_regexp_interpret_all) {
+ i::FLAG_allow_natives_syntax = true;
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::ObjectTemplate> global = CreateGlobalTemplate(
+ isolate, TerminateCurrentThread, DoLoopCancelTerminate);
+ v8::Local<v8::Context> context = v8::Context::New(isolate, nullptr, global);
+ v8::Context::Scope context_scope(context);
+ CHECK(!isolate->IsExecutionTerminating());
+ v8::TryCatch try_catch(isolate);
+ CHECK(!isolate->IsExecutionTerminating());
+ CHECK(!CompileRun("var re = /(x+)+y$/; re.test('x');").IsEmpty());
+ TerminatorSleeperThread terminator(isolate, 100);
+ terminator.Start();
+ CHECK(CompileRun("re.test('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); fail();")
+ .IsEmpty());
+ CHECK(try_catch.HasCaught());
+ CHECK(isolate->IsExecutionTerminating());
+ }
}
TEST(TerminateInMicrotask) {
diff --git a/deps/v8/test/cctest/test-trace-event.cc b/deps/v8/test/cctest/test-trace-event.cc
index f73641d9cf..ed04a247ab 100644
--- a/deps/v8/test/cctest/test-trace-event.cc
+++ b/deps/v8/test/cctest/test-trace-event.cc
@@ -234,26 +234,6 @@ TEST(TestEventWithId) {
CHECK_EQ(event_id, GET_TRACE_OBJECT(1)->id);
}
-TEST(TestEventInContext) {
- MockTracingPlatform platform;
-
- static uint64_t isolate_id = 0x20151021;
- {
- TRACE_EVENT_SCOPED_CONTEXT("v8-cat", "Isolate", isolate_id);
- TRACE_EVENT0("v8-cat", "e");
- }
-
- CHECK_EQ(3, GET_TRACE_OBJECTS_LIST->size());
- CHECK_EQ(TRACE_EVENT_PHASE_ENTER_CONTEXT, GET_TRACE_OBJECT(0)->phase);
- CHECK_EQ("Isolate", GET_TRACE_OBJECT(0)->name);
- CHECK_EQ(isolate_id, GET_TRACE_OBJECT(0)->id);
- CHECK_EQ(TRACE_EVENT_PHASE_COMPLETE, GET_TRACE_OBJECT(1)->phase);
- CHECK_EQ("e", GET_TRACE_OBJECT(1)->name);
- CHECK_EQ(TRACE_EVENT_PHASE_LEAVE_CONTEXT, GET_TRACE_OBJECT(2)->phase);
- CHECK_EQ("Isolate", GET_TRACE_OBJECT(2)->name);
- CHECK_EQ(isolate_id, GET_TRACE_OBJECT(2)->id);
-}
-
TEST(TestEventWithTimestamp) {
MockTracingPlatform platform;
diff --git a/deps/v8/test/cctest/test-transitions.cc b/deps/v8/test/cctest/test-transitions.cc
index c4b7451147..c43d7ba9b7 100644
--- a/deps/v8/test/cctest/test-transitions.cc
+++ b/deps/v8/test/cctest/test-transitions.cc
@@ -13,7 +13,7 @@
#include "src/global-handles.h"
#include "src/heap/factory.h"
#include "src/objects-inl.h"
-#include "src/transitions.h"
+#include "src/transitions-inl.h"
#include "test/cctest/cctest.h"
#include "test/cctest/test-transitions.h"
diff --git a/deps/v8/test/cctest/test-types.cc b/deps/v8/test/cctest/test-types.cc
index c8d5e37fa2..73257cc057 100644
--- a/deps/v8/test/cctest/test-types.cc
+++ b/deps/v8/test/cctest/test-types.cc
@@ -10,7 +10,7 @@
#include "src/isolate.h"
#include "src/objects.h"
#include "test/cctest/cctest.h"
-#include "test/cctest/types-fuzz.h"
+#include "test/common/types-fuzz.h"
namespace v8 {
namespace internal {
diff --git a/deps/v8/test/cctest/test-unboxed-doubles.cc b/deps/v8/test/cctest/test-unboxed-doubles.cc
index 0d1ebe6759..c202140f42 100644
--- a/deps/v8/test/cctest/test-unboxed-doubles.cc
+++ b/deps/v8/test/cctest/test-unboxed-doubles.cc
@@ -15,6 +15,7 @@
#include "src/field-type.h"
#include "src/global-handles.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/spaces.h"
#include "src/ic/ic.h"
@@ -1114,7 +1115,7 @@ TEST(DoScavenge) {
// Construct a double value that looks like a pointer to the new space object
// and store it into the obj.
- Address fake_object = temp->ptr() + kPointerSize;
+ Address fake_object = temp->ptr() + kSystemPointerSize;
double boom_value = bit_cast<double>(fake_object);
FieldIndex field_index = FieldIndex::ForDescriptor(obj->map(), 0);
@@ -1261,11 +1262,11 @@ static void TestLayoutDescriptorHelper(Isolate* isolate,
CHECK_EQ(expected_tagged, helper.IsTagged(index.offset(), instance_size,
&end_of_region_offset));
CHECK_GT(end_of_region_offset, 0);
- CHECK_EQ(end_of_region_offset % kPointerSize, 0);
+ CHECK_EQ(end_of_region_offset % kTaggedSize, 0);
CHECK(end_of_region_offset <= instance_size);
for (int offset = index.offset(); offset < end_of_region_offset;
- offset += kPointerSize) {
+ offset += kTaggedSize) {
CHECK_EQ(expected_tagged, helper.IsTagged(index.offset()));
}
if (end_of_region_offset < instance_size) {
@@ -1275,7 +1276,7 @@ static void TestLayoutDescriptorHelper(Isolate* isolate,
}
}
- for (int offset = 0; offset < JSObject::kHeaderSize; offset += kPointerSize) {
+ for (int offset = 0; offset < JSObject::kHeaderSize; offset += kTaggedSize) {
// Header queries
CHECK(helper.IsTagged(offset));
int end_of_region_offset;
@@ -1454,7 +1455,7 @@ static void TestWriteBarrier(Handle<Map> map, Handle<Map> new_map,
obj_value = factory->NewHeapNumber(0.);
}
- CHECK(Heap::InNewSpace(*obj_value));
+ CHECK(Heap::InYoungGeneration(*obj_value));
{
FieldIndex index = FieldIndex::ForDescriptor(*map, tagged_descriptor);
@@ -1468,7 +1469,7 @@ static void TestWriteBarrier(Handle<Map> map, Handle<Map> new_map,
// |boom_value| to the slot that was earlier recorded by write barrier.
JSObject::MigrateToMap(obj, new_map);
- Address fake_object = obj_value->ptr() + kPointerSize;
+ Address fake_object = obj_value->ptr() + kTaggedSize;
uint64_t boom_value = bit_cast<uint64_t>(fake_object);
FieldIndex double_field_index =
diff --git a/deps/v8/test/cctest/test-unscopables-hidden-prototype.cc b/deps/v8/test/cctest/test-unscopables-hidden-prototype.cc
index de0976825d..d98e2739d5 100644
--- a/deps/v8/test/cctest/test-unscopables-hidden-prototype.cc
+++ b/deps/v8/test/cctest/test-unscopables-hidden-prototype.cc
@@ -28,8 +28,6 @@ TEST(Unscopables) {
v8::Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
v8::Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
- t1->SetHiddenPrototype(true);
-
v8::Local<v8::Object> object = t0->GetFunction(current_context)
.ToLocalChecked()
->NewInstance(current_context)
diff --git a/deps/v8/test/cctest/test-unwinder.cc b/deps/v8/test/cctest/test-unwinder.cc
index 26b7c99b2f..63ce17d57c 100644
--- a/deps/v8/test/cctest/test-unwinder.cc
+++ b/deps/v8/test/cctest/test-unwinder.cc
@@ -6,6 +6,7 @@
#include "src/api-inl.h"
#include "src/builtins/builtins.h"
+#include "src/heap/spaces.h"
#include "src/isolate.h"
#include "src/objects/code-inl.h"
#include "test/cctest/cctest.h"
diff --git a/deps/v8/test/cctest/test-weakmaps.cc b/deps/v8/test/cctest/test-weakmaps.cc
index b6fe4e7597..4ef3766473 100644
--- a/deps/v8/test/cctest/test-weakmaps.cc
+++ b/deps/v8/test/cctest/test-weakmaps.cc
@@ -29,6 +29,7 @@
#include "src/global-handles.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/objects/hash-table-inl.h"
@@ -173,7 +174,7 @@ TEST(Regress2060a) {
HandleScope scope(isolate);
for (int i = 0; i < 32; i++) {
Handle<JSObject> object = factory->NewJSObject(function, TENURED);
- CHECK(!Heap::InNewSpace(*object));
+ CHECK(!Heap::InYoungGeneration(*object));
CHECK(!first_page->Contains(object->address()));
int32_t hash = key->GetOrCreateHash(isolate)->value();
JSWeakCollection::Set(weakmap, key, object, hash);
@@ -211,7 +212,7 @@ TEST(Regress2060b) {
Handle<JSObject> keys[32];
for (int i = 0; i < 32; i++) {
keys[i] = factory->NewJSObject(function, TENURED);
- CHECK(!Heap::InNewSpace(*keys[i]));
+ CHECK(!Heap::InYoungGeneration(*keys[i]));
CHECK(!first_page->Contains(keys[i]->address()));
}
Handle<JSWeakMap> weakmap = isolate->factory()->NewJSWeakMap();
@@ -247,6 +248,39 @@ TEST(Regress399527) {
CcTest::CollectAllGarbage();
}
+TEST(WeakMapsWithChainedEntries) {
+ ManualGCScope manual_gc_scope;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ i::Isolate* i_isolate = CcTest::i_isolate();
+ v8::HandleScope scope(isolate);
+
+ const int initial_gc_count = i_isolate->heap()->gc_count();
+ Handle<JSWeakMap> weakmap1 = i_isolate->factory()->NewJSWeakMap();
+ Handle<JSWeakMap> weakmap2 = i_isolate->factory()->NewJSWeakMap();
+ v8::Global<v8::Object> g1;
+ v8::Global<v8::Object> g2;
+ {
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Object> o1 = v8::Object::New(isolate);
+ g1.Reset(isolate, o1);
+ g1.SetWeak();
+ v8::Local<v8::Object> o2 = v8::Object::New(isolate);
+ g2.Reset(isolate, o2);
+ g2.SetWeak();
+ Handle<Object> i_o1 = v8::Utils::OpenHandle(*o1);
+ Handle<Object> i_o2 = v8::Utils::OpenHandle(*o2);
+ int32_t hash1 = i_o1->GetOrCreateHash(i_isolate)->value();
+ int32_t hash2 = i_o2->GetOrCreateHash(i_isolate)->value();
+ JSWeakCollection::Set(weakmap1, i_o1, i_o2, hash1);
+ JSWeakCollection::Set(weakmap2, i_o2, i_o1, hash2);
+ }
+ CcTest::CollectGarbage(OLD_SPACE);
+ CHECK(g1.IsEmpty());
+ CHECK(g2.IsEmpty());
+ CHECK_EQ(1, i_isolate->heap()->gc_count() - initial_gc_count);
+}
+
} // namespace test_weakmaps
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-weaksets.cc b/deps/v8/test/cctest/test-weaksets.cc
index 763a809f87..36c9e339b8 100644
--- a/deps/v8/test/cctest/test-weaksets.cc
+++ b/deps/v8/test/cctest/test-weaksets.cc
@@ -29,6 +29,7 @@
#include "src/global-handles.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/objects/hash-table-inl.h"
@@ -184,7 +185,7 @@ TEST(WeakSet_Regress2060a) {
HandleScope scope(isolate);
for (int i = 0; i < 32; i++) {
Handle<JSObject> object = factory->NewJSObject(function, TENURED);
- CHECK(!Heap::InNewSpace(*object));
+ CHECK(!Heap::InYoungGeneration(*object));
CHECK(!first_page->Contains(object->address()));
int32_t hash = key->GetOrCreateHash(isolate)->value();
JSWeakCollection::Set(weakset, key, object, hash);
@@ -222,7 +223,7 @@ TEST(WeakSet_Regress2060b) {
Handle<JSObject> keys[32];
for (int i = 0; i < 32; i++) {
keys[i] = factory->NewJSObject(function, TENURED);
- CHECK(!Heap::InNewSpace(*keys[i]));
+ CHECK(!Heap::InYoungGeneration(*keys[i]));
CHECK(!first_page->Contains(keys[i]->address()));
}
Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate);
diff --git a/deps/v8/test/cctest/testcfg.py b/deps/v8/test/cctest/testcfg.py
index 562f44098a..5c09dedbd2 100644
--- a/deps/v8/test/cctest/testcfg.py
+++ b/deps/v8/test/cctest/testcfg.py
@@ -36,8 +36,8 @@ from testrunner.objects import testcase
SHELL = 'cctest'
-class TestSuite(testsuite.TestSuite):
- def ListTests(self):
+class TestLoader(testsuite.TestLoader):
+ def _list_test_filenames(self):
shell = os.path.abspath(os.path.join(self.test_config.shell_dir, SHELL))
if utils.IsWindows():
shell += ".exe"
@@ -46,14 +46,19 @@ class TestSuite(testsuite.TestSuite):
shell=shell,
args=["--list"] + self.test_config.extra_flags)
output = cmd.execute()
+ # TODO make errors visible (see duplicated code in 'unittests')
if output.exit_code != 0:
print cmd
print output.stdout
print output.stderr
return []
- tests = map(self._create_test, output.stdout.strip().split())
- tests.sort(key=lambda t: t.path)
- return tests
+
+ return sorted(output.stdout.strip().split())
+
+
+class TestSuite(testsuite.TestSuite):
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/cctest/torque/test-torque.cc b/deps/v8/test/cctest/torque/test-torque.cc
index 0941795bd6..067bccea02 100644
--- a/deps/v8/test/cctest/torque/test-torque.cc
+++ b/deps/v8/test/cctest/torque/test-torque.cc
@@ -275,6 +275,22 @@ TEST(TestGenericOverload) {
ft.Call();
}
+TEST(TestEquality) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate, 0);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ m.TestEquality(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
TEST(TestLogicalOperators) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
@@ -423,6 +439,22 @@ TEST(TestStructConstructor) {
ft.Call();
}
+TEST(TestInternalClass) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ m.TestInternalClass(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/types-fuzz.h b/deps/v8/test/cctest/types-fuzz.h
deleted file mode 100644
index b6b5bf2dc5..0000000000
--- a/deps/v8/test/cctest/types-fuzz.h
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef V8_TEST_CCTEST_TYPES_H_
-#define V8_TEST_CCTEST_TYPES_H_
-
-#include "src/base/utils/random-number-generator.h"
-#include "src/heap/factory.h"
-#include "src/isolate.h"
-#include "src/v8.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-class Types {
- public:
- Types(Zone* zone, Isolate* isolate, v8::base::RandomNumberGenerator* rng)
- : zone_(zone), js_heap_broker_(isolate, zone), rng_(rng) {
-#define DECLARE_TYPE(name, value) \
- name = Type::name(); \
- types.push_back(name);
- PROPER_BITSET_TYPE_LIST(DECLARE_TYPE)
- #undef DECLARE_TYPE
-
- SignedSmall = Type::SignedSmall();
- UnsignedSmall = Type::UnsignedSmall();
-
- object_map = isolate->factory()->NewMap(
- JS_OBJECT_TYPE, JSObject::kHeaderSize);
-
- smi = handle(Smi::FromInt(666), isolate);
- boxed_smi = isolate->factory()->NewHeapNumber(666);
- signed32 = isolate->factory()->NewHeapNumber(0x40000000);
- float1 = isolate->factory()->NewHeapNumber(1.53);
- float2 = isolate->factory()->NewHeapNumber(0.53);
- // float3 is identical to float1 in order to test that OtherNumberConstant
- // types are equal by double value and not by handle pointer value.
- float3 = isolate->factory()->NewHeapNumber(1.53);
- object1 = isolate->factory()->NewJSObjectFromMap(object_map);
- object2 = isolate->factory()->NewJSObjectFromMap(object_map);
- array = isolate->factory()->NewJSArray(20);
- uninitialized = isolate->factory()->uninitialized_value();
- SmiConstant = Type::NewConstant(js_heap_broker(), smi, zone);
- Signed32Constant = Type::NewConstant(js_heap_broker(), signed32, zone);
-
- ObjectConstant1 = Type::HeapConstant(js_heap_broker(), object1, zone);
- ObjectConstant2 = Type::HeapConstant(js_heap_broker(), object2, zone);
- ArrayConstant = Type::HeapConstant(js_heap_broker(), array, zone);
- UninitializedConstant =
- Type::HeapConstant(js_heap_broker(), uninitialized, zone);
-
- values.push_back(smi);
- values.push_back(boxed_smi);
- values.push_back(signed32);
- values.push_back(object1);
- values.push_back(object2);
- values.push_back(array);
- values.push_back(uninitialized);
- values.push_back(float1);
- values.push_back(float2);
- values.push_back(float3);
- for (ValueVector::iterator it = values.begin(); it != values.end(); ++it) {
- types.push_back(Type::NewConstant(js_heap_broker(), *it, zone));
- }
-
- integers.push_back(isolate->factory()->NewNumber(-V8_INFINITY));
- integers.push_back(isolate->factory()->NewNumber(+V8_INFINITY));
- integers.push_back(isolate->factory()->NewNumber(-rng_->NextInt(10)));
- integers.push_back(isolate->factory()->NewNumber(+rng_->NextInt(10)));
- for (int i = 0; i < 10; ++i) {
- double x = rng_->NextInt();
- integers.push_back(isolate->factory()->NewNumber(x));
- x *= rng_->NextInt();
- if (!IsMinusZero(x)) integers.push_back(isolate->factory()->NewNumber(x));
- }
-
- Integer = Type::Range(-V8_INFINITY, +V8_INFINITY, zone);
-
- for (int i = 0; i < 30; ++i) {
- types.push_back(Fuzz());
- }
- }
-
- Handle<i::Map> object_map;
-
- Handle<i::Smi> smi;
- Handle<i::HeapNumber> boxed_smi;
- Handle<i::HeapNumber> signed32;
- Handle<i::HeapNumber> float1;
- Handle<i::HeapNumber> float2;
- Handle<i::HeapNumber> float3;
- Handle<i::JSObject> object1;
- Handle<i::JSObject> object2;
- Handle<i::JSArray> array;
- Handle<i::Oddball> uninitialized;
-
-#define DECLARE_TYPE(name, value) Type name;
- PROPER_BITSET_TYPE_LIST(DECLARE_TYPE)
-#undef DECLARE_TYPE
-
- Type SignedSmall;
- Type UnsignedSmall;
-
- Type SmiConstant;
- Type Signed32Constant;
- Type ObjectConstant1;
- Type ObjectConstant2;
- Type ArrayConstant;
- Type UninitializedConstant;
-
- Type Integer;
-
- typedef std::vector<Type> TypeVector;
- typedef std::vector<Handle<i::Object> > ValueVector;
-
- TypeVector types;
- ValueVector values;
- ValueVector integers; // "Integer" values used for range limits.
-
- Type NewConstant(Handle<i::Object> value) {
- return Type::NewConstant(js_heap_broker(), value, zone_);
- }
-
- Type HeapConstant(Handle<i::HeapObject> value) {
- return Type::HeapConstant(js_heap_broker(), value, zone_);
- }
-
- Type Range(double min, double max) { return Type::Range(min, max, zone_); }
-
- Type Union(Type t1, Type t2) { return Type::Union(t1, t2, zone_); }
-
- Type Intersect(Type t1, Type t2) { return Type::Intersect(t1, t2, zone_); }
-
- Type Random() { return types[rng_->NextInt(static_cast<int>(types.size()))]; }
-
- Type Fuzz(int depth = 4) {
- switch (rng_->NextInt(depth == 0 ? 3 : 20)) {
- case 0: { // bitset
- #define COUNT_BITSET_TYPES(type, value) + 1
- int n = 0 PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES);
- #undef COUNT_BITSET_TYPES
- // Pick a bunch of named bitsets and return their intersection.
- Type result = Type::Any();
- for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) {
- int j = rng_->NextInt(n);
-#define PICK_BITSET_TYPE(type, value) \
- if (j-- == 0) { \
- Type tmp = Type::Intersect(result, Type::type(), zone_); \
- if (tmp.Is(Type::None()) && i != 0) { \
- break; \
- } else { \
- result = tmp; \
- continue; \
- } \
- }
- PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE)
- #undef PICK_BITSET_TYPE
- }
- return result;
- }
- case 1: { // constant
- int i = rng_->NextInt(static_cast<int>(values.size()));
- return Type::NewConstant(js_heap_broker(), values[i], zone_);
- }
- case 2: { // range
- int i = rng_->NextInt(static_cast<int>(integers.size()));
- int j = rng_->NextInt(static_cast<int>(integers.size()));
- double min = integers[i]->Number();
- double max = integers[j]->Number();
- if (min > max) std::swap(min, max);
- return Type::Range(min, max, zone_);
- }
- default: { // union
- int n = rng_->NextInt(10);
- Type type = None;
- for (int i = 0; i < n; ++i) {
- Type operand = Fuzz(depth - 1);
- type = Type::Union(type, operand, zone_);
- }
- return type;
- }
- }
- UNREACHABLE();
- }
-
- Zone* zone() { return zone_; }
- JSHeapBroker* js_heap_broker() { return &js_heap_broker_; }
-
- private:
- Zone* zone_;
- JSHeapBroker js_heap_broker_;
- v8::base::RandomNumberGenerator* rng_;
-};
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
-
-#endif
diff --git a/deps/v8/test/cctest/unicode-helpers.cc b/deps/v8/test/cctest/unicode-helpers.cc
index 524e5936fc..1a74e0ca94 100644
--- a/deps/v8/test/cctest/unicode-helpers.cc
+++ b/deps/v8/test/cctest/unicode-helpers.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "test/cctest/unicode-helpers.h"
+#include "src/unicode-inl.h"
int Ucs2CharLength(unibrow::uchar c) {
if (c == unibrow::Utf8::kIncomplete || c == unibrow::Utf8::kBufferEmpty) {
@@ -19,10 +20,9 @@ int Utf8LengthHelper(const char* s) {
unibrow::Utf8::State state = unibrow::Utf8::State::kAccept;
int length = 0;
- size_t i = 0;
- while (s[i] != '\0') {
- unibrow::uchar tmp =
- unibrow::Utf8::ValueOfIncremental(s[i], &i, &state, &buffer);
+ const uint8_t* c = reinterpret_cast<const uint8_t*>(s);
+ while (*c != '\0') {
+ unibrow::uchar tmp = unibrow::Utf8::ValueOfIncremental(&c, &state, &buffer);
length += Ucs2CharLength(tmp);
}
unibrow::uchar tmp = unibrow::Utf8::ValueOfIncrementalFinish(&state);
diff --git a/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc b/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc
index 6c246bc48c..fc711aa7a7 100644
--- a/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc
+++ b/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc
@@ -109,7 +109,7 @@ TEST(TestCWasmEntryArgPassing_int32) {
return base::AddWithWraparound(base::MulWithWraparound(2, a), 1);
});
- FOR_INT32_INPUTS(v) { tester.CheckCall(*v); }
+ FOR_INT32_INPUTS(v) { tester.CheckCall(v); }
}
// Pass int64_t, return double.
@@ -119,7 +119,7 @@ TEST(TestCWasmEntryArgPassing_double_int64) {
WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))},
[](int64_t a) { return static_cast<double>(a); });
- FOR_INT64_INPUTS(v) { tester.CheckCall(*v); }
+ FOR_INT64_INPUTS(v) { tester.CheckCall(v); }
}
// Pass double, return int64_t.
@@ -129,7 +129,7 @@ TEST(TestCWasmEntryArgPassing_int64_double) {
WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))},
[](double d) { return static_cast<int64_t>(d); });
- FOR_INT64_INPUTS(i) { tester.CheckCall(*i); }
+ FOR_INT64_INPUTS(i) { tester.CheckCall(i); }
}
// Pass float, return double.
@@ -141,7 +141,7 @@ TEST(TestCWasmEntryArgPassing_float_double) {
WASM_F64(1))},
[](float f) { return 2. * static_cast<double>(f) + 1.; });
- FOR_FLOAT32_INPUTS(f) { tester.CheckCall(*f); }
+ FOR_FLOAT32_INPUTS(f) { tester.CheckCall(f); }
}
// Pass two doubles, return double.
@@ -152,7 +152,7 @@ TEST(TestCWasmEntryArgPassing_double_double) {
[](double a, double b) { return a + b; });
FOR_FLOAT64_INPUTS(d1) {
- FOR_FLOAT64_INPUTS(d2) { tester.CheckCall(*d1, *d2); }
+ FOR_FLOAT64_INPUTS(d2) { tester.CheckCall(d1, d2); }
}
}
diff --git a/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc b/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc
index d8d9e0412e..1472196504 100644
--- a/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc
+++ b/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc
@@ -24,10 +24,6 @@ namespace wasm {
#define __ masm.
-// TODO(v8:7424,v8:8018): Extend this test to all architectures.
-#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM || \
- V8_TARGET_ARCH_ARM64
-
namespace {
static volatile int global_stop_bit = 0;
@@ -109,6 +105,30 @@ Address GenerateJumpTableThunk(
__ Tbnz(scratch, 0, &exit);
__ Mov(scratch, Immediate(jump_target, RelocInfo::NONE));
__ Br(scratch);
+#elif V8_TARGET_ARCH_PPC64
+ __ mov(scratch, Operand(stop_bit_address, RelocInfo::NONE));
+ __ LoadP(scratch, MemOperand(scratch));
+ __ cmpi(scratch, Operand::Zero());
+ __ bne(&exit);
+ __ mov(scratch, Operand(jump_target, RelocInfo::NONE));
+ __ Jump(scratch);
+#elif V8_TARGET_ARCH_S390X
+ __ mov(scratch, Operand(stop_bit_address, RelocInfo::NONE));
+ __ LoadP(scratch, MemOperand(scratch));
+ __ CmpP(scratch, Operand(0));
+ __ bne(&exit);
+ __ mov(scratch, Operand(jump_target, RelocInfo::NONE));
+ __ Jump(scratch);
+#elif V8_TARGET_ARCH_MIPS64
+ __ li(scratch, Operand(stop_bit_address, RelocInfo::NONE));
+ __ Lw(scratch, MemOperand(scratch, 0));
+ __ Branch(&exit, ne, scratch, Operand(zero_reg));
+ __ Jump(jump_target, RelocInfo::NONE);
+#elif V8_TARGET_ARCH_MIPS
+ __ li(scratch, Operand(stop_bit_address, RelocInfo::NONE));
+ __ lw(scratch, MemOperand(scratch, 0));
+ __ Branch(&exit, ne, scratch, Operand(zero_reg));
+ __ Jump(jump_target, RelocInfo::NONE);
#else
#error Unsupported architecture
#endif
@@ -236,9 +256,6 @@ TEST(JumpTablePatchingStress) {
}
}
-#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM ||
- // V8_TARGET_ARCH_ARM64
-
#undef __
#undef TRACE
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc
index cca0c1b061..dfce94b20c 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc
@@ -32,9 +32,9 @@ WASM_EXEC_TEST(I64Const) {
WASM_EXEC_TEST(I64Const_many) {
int cntr = 0;
- FOR_INT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(i) {
WasmRunner<int64_t> r(execution_tier);
- const int64_t kExpectedValue = (static_cast<int64_t>(*i) << 32) | cntr;
+ const int64_t kExpectedValue = (static_cast<uint64_t>(i) << 32) | cntr;
// return(kExpectedValue)
BUILD(r, WASM_I64V(kExpectedValue));
CHECK_EQ(kExpectedValue, r.Call());
@@ -47,7 +47,7 @@ WASM_EXEC_TEST(Return_I64) {
BUILD(r, WASM_RETURN1(WASM_GET_LOCAL(0)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(I64Add) {
@@ -55,7 +55,7 @@ WASM_EXEC_TEST(I64Add) {
BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(base::AddWithWraparound(*i, *j), r.Call(*i, *j));
+ CHECK_EQ(base::AddWithWraparound(i, j), r.Call(i, j));
}
}
}
@@ -79,7 +79,7 @@ WASM_EXEC_TEST(I64Sub) {
BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(base::SubWithWraparound(*i, *j), r.Call(*i, *j));
+ CHECK_EQ(base::SubWithWraparound(i, j), r.Call(i, j));
}
}
}
@@ -99,8 +99,8 @@ WASM_EXEC_TEST(I64AddUseOnlyLowWord) {
WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(static_cast<int32_t>(base::AddWithWraparound(*i, *j)),
- r.Call(*i, *j));
+ CHECK_EQ(static_cast<int32_t>(base::AddWithWraparound(i, j)),
+ r.Call(i, j));
}
}
}
@@ -111,8 +111,8 @@ WASM_EXEC_TEST(I64SubUseOnlyLowWord) {
WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(static_cast<int32_t>(base::SubWithWraparound(*i, *j)),
- r.Call(*i, *j));
+ CHECK_EQ(static_cast<int32_t>(base::SubWithWraparound(i, j)),
+ r.Call(i, j));
}
}
}
@@ -123,8 +123,8 @@ WASM_EXEC_TEST(I64MulUseOnlyLowWord) {
WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(static_cast<int32_t>(base::MulWithWraparound(*i, *j)),
- r.Call(*i, *j));
+ CHECK_EQ(static_cast<int32_t>(base::MulWithWraparound(i, j)),
+ r.Call(i, j));
}
}
}
@@ -135,8 +135,8 @@ WASM_EXEC_TEST(I64ShlUseOnlyLowWord) {
WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(base::ShlWithWraparound(*i, *j));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>(base::ShlWithWraparound(i, j));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -147,8 +147,8 @@ WASM_EXEC_TEST(I64ShrUseOnlyLowWord) {
WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3F));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>((i) >> (j & 0x3F));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -159,8 +159,8 @@ WASM_EXEC_TEST(I64SarUseOnlyLowWord) {
WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3F));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>((i) >> (j & 0x3F));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -170,12 +170,12 @@ WASM_EXEC_TEST(I64DivS) {
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- if (*j == 0) {
- CHECK_TRAP64(r.Call(*i, *j));
- } else if (*j == -1 && *i == std::numeric_limits<int64_t>::min()) {
- CHECK_TRAP64(r.Call(*i, *j));
+ if (j == 0) {
+ CHECK_TRAP64(r.Call(i, j));
+ } else if (j == -1 && i == std::numeric_limits<int64_t>::min()) {
+ CHECK_TRAP64(r.Call(i, j));
} else {
- CHECK_EQ(*i / *j, r.Call(*i, *j));
+ CHECK_EQ(i / j, r.Call(i, j));
}
}
}
@@ -210,10 +210,10 @@ WASM_EXEC_TEST(I64DivU) {
BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- if (*j == 0) {
- CHECK_TRAP64(r.Call(*i, *j));
+ if (j == 0) {
+ CHECK_TRAP64(r.Call(i, j));
} else {
- CHECK_EQ(*i / *j, r.Call(*i, *j));
+ CHECK_EQ(i / j, r.Call(i, j));
}
}
}
@@ -248,10 +248,10 @@ WASM_EXEC_TEST(I64RemS) {
BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- if (*j == 0) {
- CHECK_TRAP64(r.Call(*i, *j));
+ if (j == 0) {
+ CHECK_TRAP64(r.Call(i, j));
} else {
- CHECK_EQ(*i % *j, r.Call(*i, *j));
+ CHECK_EQ(i % j, r.Call(i, j));
}
}
}
@@ -272,10 +272,10 @@ WASM_EXEC_TEST(I64RemU) {
BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- if (*j == 0) {
- CHECK_TRAP64(r.Call(*i, *j));
+ if (j == 0) {
+ CHECK_TRAP64(r.Call(i, j));
} else {
- CHECK_EQ(*i % *j, r.Call(*i, *j));
+ CHECK_EQ(i % j, r.Call(i, j));
}
}
}
@@ -294,7 +294,7 @@ WASM_EXEC_TEST(I64And) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ((*i) & (*j), r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ((i) & (j), r.Call(i, j)); }
}
}
@@ -302,7 +302,7 @@ WASM_EXEC_TEST(I64Ior) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ((*i) | (*j), r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ((i) | (j), r.Call(i, j)); }
}
}
@@ -310,7 +310,7 @@ WASM_EXEC_TEST(I64Xor) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ((i) ^ (j), r.Call(i, j)); }
}
}
@@ -321,30 +321,30 @@ WASM_EXEC_TEST(I64Shl) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- uint64_t expected = (*i) << (*j & 0x3F);
- CHECK_EQ(expected, r.Call(*i, *j));
+ uint64_t expected = (i) << (j & 0x3F);
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 0, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i << 0, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 32, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i << 32, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i << 20, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i << 40, r.Call(i)); }
}
}
@@ -355,30 +355,30 @@ WASM_EXEC_TEST(I64ShrU) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- uint64_t expected = (*i) >> (*j & 0x3F);
- CHECK_EQ(expected, r.Call(*i, *j));
+ uint64_t expected = (i) >> (j & 0x3F);
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i >> 0, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i >> 32, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i >> 20, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i >> 40, r.Call(i)); }
}
}
@@ -389,30 +389,30 @@ WASM_EXEC_TEST(I64ShrS) {
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- int64_t expected = (*i) >> (*j & 0x3F);
- CHECK_EQ(expected, r.Call(*i, *j));
+ int64_t expected = (i) >> (j & 0x3F);
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
{
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i >> 0, r.Call(i)); }
}
{
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i >> 32, r.Call(i)); }
}
{
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i >> 20, r.Call(i)); }
}
{
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i >> 40, r.Call(i)); }
}
}
@@ -420,7 +420,7 @@ WASM_EXEC_TEST(I64Eq) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i == j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -428,7 +428,7 @@ WASM_EXEC_TEST(I64Ne) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i != *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i != j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -436,7 +436,7 @@ WASM_EXEC_TEST(I64LtS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i < j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -444,7 +444,7 @@ WASM_EXEC_TEST(I64LeS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i <= j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -452,7 +452,7 @@ WASM_EXEC_TEST(I64LtU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
- FOR_UINT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_UINT64_INPUTS(j) { CHECK_EQ(i < j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -460,7 +460,7 @@ WASM_EXEC_TEST(I64LeU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
- FOR_UINT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_UINT64_INPUTS(j) { CHECK_EQ(i <= j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -468,7 +468,7 @@ WASM_EXEC_TEST(I64GtS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i > j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -476,7 +476,7 @@ WASM_EXEC_TEST(I64GeS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i >= j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -484,7 +484,7 @@ WASM_EXEC_TEST(I64GtU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
- FOR_UINT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_UINT64_INPUTS(j) { CHECK_EQ(i > j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -492,28 +492,28 @@ WASM_EXEC_TEST(I64GeU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
- FOR_UINT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_UINT64_INPUTS(j) { CHECK_EQ(i >= j ? 1 : 0, r.Call(i, j)); }
}
}
WASM_EXEC_TEST(I32ConvertI64) {
FOR_INT64_INPUTS(i) {
WasmRunner<int32_t> r(execution_tier);
- BUILD(r, WASM_I32_CONVERT_I64(WASM_I64V(*i)));
- CHECK_EQ(static_cast<int32_t>(*i), r.Call());
+ BUILD(r, WASM_I32_CONVERT_I64(WASM_I64V(i)));
+ CHECK_EQ(static_cast<int32_t>(i), r.Call());
}
}
WASM_EXEC_TEST(I64SConvertI32) {
WasmRunner<int64_t, int32_t> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(i), r.Call(i)); }
}
WASM_EXEC_TEST(I64UConvertI32) {
WasmRunner<int64_t, uint32_t> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0)));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(i), r.Call(i)); }
}
WASM_EXEC_TEST(I64Popcnt) {
@@ -536,7 +536,7 @@ WASM_EXEC_TEST(I64Popcnt) {
WASM_EXEC_TEST(F32SConvertI64) {
WasmRunner<float, int64_t> r(execution_tier);
BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0)));
- FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(*i), r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(i), r.Call(i)); }
}
WASM_EXEC_TEST(F32UConvertI64) {
@@ -629,7 +629,7 @@ WASM_EXEC_TEST(F32UConvertI64) {
WASM_EXEC_TEST(F64SConvertI64) {
WasmRunner<double, int64_t> r(execution_tier);
BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0)));
- FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(i), r.Call(i)); }
}
WASM_EXEC_TEST(F64UConvertI64) {
@@ -723,11 +723,11 @@ WASM_EXEC_TEST(I64SConvertF32) {
BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- if (*i < static_cast<float>(std::numeric_limits<int64_t>::max()) &&
- *i >= static_cast<float>(std::numeric_limits<int64_t>::min())) {
- CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i));
+ if (i < static_cast<float>(std::numeric_limits<int64_t>::max()) &&
+ i >= static_cast<float>(std::numeric_limits<int64_t>::min())) {
+ CHECK_EQ(static_cast<int64_t>(i), r.Call(i));
} else {
- CHECK_TRAP64(r.Call(*i));
+ CHECK_TRAP64(r.Call(i));
}
}
}
@@ -738,17 +738,17 @@ WASM_EXEC_TEST(I64SConvertSatF32) {
BUILD(r, WASM_I64_SCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
int64_t expected;
- if (*i < static_cast<float>(std::numeric_limits<int64_t>::max()) &&
- *i >= static_cast<float>(std::numeric_limits<int64_t>::min())) {
- expected = static_cast<int64_t>(*i);
- } else if (std::isnan(*i)) {
+ if (i < static_cast<float>(std::numeric_limits<int64_t>::max()) &&
+ i >= static_cast<float>(std::numeric_limits<int64_t>::min())) {
+ expected = static_cast<int64_t>(i);
+ } else if (std::isnan(i)) {
expected = static_cast<int64_t>(0);
- } else if (*i < 0.0) {
+ } else if (i < 0.0) {
expected = std::numeric_limits<int64_t>::min();
} else {
expected = std::numeric_limits<int64_t>::max();
}
- int64_t found = r.Call(*i);
+ int64_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -758,11 +758,11 @@ WASM_EXEC_TEST(I64SConvertF64) {
BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- if (*i < static_cast<double>(std::numeric_limits<int64_t>::max()) &&
- *i >= static_cast<double>(std::numeric_limits<int64_t>::min())) {
- CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i));
+ if (i < static_cast<double>(std::numeric_limits<int64_t>::max()) &&
+ i >= static_cast<double>(std::numeric_limits<int64_t>::min())) {
+ CHECK_EQ(static_cast<int64_t>(i), r.Call(i));
} else {
- CHECK_TRAP64(r.Call(*i));
+ CHECK_TRAP64(r.Call(i));
}
}
}
@@ -773,17 +773,17 @@ WASM_EXEC_TEST(I64SConvertSatF64) {
BUILD(r, WASM_I64_SCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int64_t expected;
- if (*i < static_cast<double>(std::numeric_limits<int64_t>::max()) &&
- *i >= static_cast<double>(std::numeric_limits<int64_t>::min())) {
- expected = static_cast<int64_t>(*i);
- } else if (std::isnan(*i)) {
+ if (i < static_cast<double>(std::numeric_limits<int64_t>::max()) &&
+ i >= static_cast<double>(std::numeric_limits<int64_t>::min())) {
+ expected = static_cast<int64_t>(i);
+ } else if (std::isnan(i)) {
expected = static_cast<int64_t>(0);
- } else if (*i < 0.0) {
+ } else if (i < 0.0) {
expected = std::numeric_limits<int64_t>::min();
} else {
expected = std::numeric_limits<int64_t>::max();
}
- int64_t found = r.Call(*i);
+ int64_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -793,11 +793,11 @@ WASM_EXEC_TEST(I64UConvertF32) {
BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
- *i > -1) {
- CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i));
+ if (i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
+ i > -1) {
+ CHECK_EQ(static_cast<uint64_t>(i), r.Call(i));
} else {
- CHECK_TRAP64(r.Call(*i));
+ CHECK_TRAP64(r.Call(i));
}
}
}
@@ -808,17 +808,17 @@ WASM_EXEC_TEST(I64UConvertSatF32) {
BUILD(r, WASM_I64_UCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
uint64_t expected;
- if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
- *i > -1) {
- expected = static_cast<uint64_t>(*i);
- } else if (std::isnan(*i)) {
+ if (i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
+ i > -1) {
+ expected = static_cast<uint64_t>(i);
+ } else if (std::isnan(i)) {
expected = static_cast<uint64_t>(0);
- } else if (*i < 0.0) {
+ } else if (i < 0.0) {
expected = std::numeric_limits<uint64_t>::min();
} else {
expected = std::numeric_limits<uint64_t>::max();
}
- uint64_t found = r.Call(*i);
+ uint64_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -828,11 +828,11 @@ WASM_EXEC_TEST(I64UConvertF64) {
BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
- *i > -1) {
- CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i));
+ if (i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
+ i > -1) {
+ CHECK_EQ(static_cast<uint64_t>(i), r.Call(i));
} else {
- CHECK_TRAP64(r.Call(*i));
+ CHECK_TRAP64(r.Call(i));
}
}
}
@@ -843,17 +843,17 @@ WASM_EXEC_TEST(I64UConvertSatF64) {
BUILD(r, WASM_I64_UCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int64_t expected;
- if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
- *i > -1) {
- expected = static_cast<uint64_t>(*i);
- } else if (std::isnan(*i)) {
+ if (i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
+ i > -1) {
+ expected = static_cast<uint64_t>(i);
+ } else if (std::isnan(i)) {
expected = static_cast<uint64_t>(0);
- } else if (*i < 0.0) {
+ } else if (i < 0.0) {
expected = std::numeric_limits<uint64_t>::min();
} else {
expected = std::numeric_limits<uint64_t>::max();
}
- int64_t found = r.Call(*i);
+ int64_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -1115,50 +1115,50 @@ WASM_EXEC_TEST(I64Popcnt2) {
// Test the WasmRunner with an Int64 return value and different numbers of
// Int64 parameters.
WASM_EXEC_TEST(I64WasmRunner) {
- {FOR_INT64_INPUTS(i){WasmRunner<int64_t> r(execution_tier);
- BUILD(r, WASM_I64V(*i));
- CHECK_EQ(*i, r.Call());
-}
-}
-{
- WasmRunner<int64_t, int64_t> r(execution_tier);
- BUILD(r, WASM_GET_LOCAL(0));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
-}
-{
- WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
- BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i ^ *j, r.Call(*i, *j)); }
+ WasmRunner<int64_t> r(execution_tier);
+ BUILD(r, WASM_I64V(i));
+ CHECK_EQ(i, r.Call());
}
-}
-{
- WasmRunner<int64_t, int64_t, int64_t, int64_t> r(execution_tier);
- BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
- WASM_I64_XOR(WASM_GET_LOCAL(1), WASM_GET_LOCAL(2))));
- FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) {
- CHECK_EQ(*i ^ *j ^ *j, r.Call(*i, *j, *j));
- CHECK_EQ(*j ^ *i ^ *j, r.Call(*j, *i, *j));
- CHECK_EQ(*j ^ *j ^ *i, r.Call(*j, *j, *i));
+ {
+ WasmRunner<int64_t, int64_t> r(execution_tier);
+ BUILD(r, WASM_GET_LOCAL(0));
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
+ }
+ {
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
+ BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i ^ j, r.Call(i, j)); }
}
}
-}
-{
- WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_tier);
- BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
- WASM_I64_XOR(WASM_GET_LOCAL(1),
- WASM_I64_XOR(WASM_GET_LOCAL(2),
- WASM_GET_LOCAL(3)))));
- FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) {
- CHECK_EQ(*i ^ *j ^ *j ^ *j, r.Call(*i, *j, *j, *j));
- CHECK_EQ(*j ^ *i ^ *j ^ *j, r.Call(*j, *i, *j, *j));
- CHECK_EQ(*j ^ *j ^ *i ^ *j, r.Call(*j, *j, *i, *j));
- CHECK_EQ(*j ^ *j ^ *j ^ *i, r.Call(*j, *j, *j, *i));
+ {
+ WasmRunner<int64_t, int64_t, int64_t, int64_t> r(execution_tier);
+ BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
+ WASM_I64_XOR(WASM_GET_LOCAL(1), WASM_GET_LOCAL(2))));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ CHECK_EQ(i ^ j ^ j, r.Call(i, j, j));
+ CHECK_EQ(j ^ i ^ j, r.Call(j, i, j));
+ CHECK_EQ(j ^ j ^ i, r.Call(j, j, i));
+ }
+ }
+ }
+ {
+ WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_tier);
+ BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
+ WASM_I64_XOR(WASM_GET_LOCAL(1),
+ WASM_I64_XOR(WASM_GET_LOCAL(2),
+ WASM_GET_LOCAL(3)))));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ CHECK_EQ(i ^ j ^ j ^ j, r.Call(i, j, j, j));
+ CHECK_EQ(j ^ i ^ j ^ j, r.Call(j, i, j, j));
+ CHECK_EQ(j ^ j ^ i ^ j, r.Call(j, j, i, j));
+ CHECK_EQ(j ^ j ^ j ^ i, r.Call(j, j, j, i));
+ }
}
}
-}
}
WASM_EXEC_TEST(Call_Int64Sub) {
@@ -1172,16 +1172,9 @@ WASM_EXEC_TEST(Call_Int64Sub) {
BUILD(r, WASM_CALL_FUNCTION(t.function_index(), WASM_GET_LOCAL(0),
WASM_GET_LOCAL(1)));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int64_t a = static_cast<int64_t>(*i) << 32 |
- (static_cast<int64_t>(*j) | 0xFFFFFFFF);
- int64_t b = static_cast<int64_t>(*j) << 32 |
- (static_cast<int64_t>(*i) | 0xFFFFFFFF);
-
- int64_t expected = static_cast<int64_t>(static_cast<uint64_t>(a) -
- static_cast<uint64_t>(b));
- CHECK_EQ(expected, r.Call(a, b));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ CHECK_EQ(base::SubWithWraparound(i, j), r.Call(i, j));
}
}
}
@@ -1217,7 +1210,8 @@ WASM_EXEC_TEST(LoadStoreI64_sx) {
r.builder().BlankMemory();
memory[size - 1] = static_cast<byte>(i); // set the high order byte.
- int64_t expected = static_cast<int64_t>(i) << ((size - 1) * 8);
+ int64_t expected = static_cast<uint64_t>(static_cast<int64_t>(i))
+ << ((size - 1) * 8);
CHECK_EQ(expected, r.Call());
CHECK_EQ(static_cast<byte>(i), memory[8 + size - 1]);
@@ -1238,8 +1232,8 @@ WASM_EXEC_TEST(I64ReinterpretF64) {
WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)));
FOR_INT32_INPUTS(i) {
- int64_t expected = base::MulWithWraparound(static_cast<int64_t>(*i),
- int64_t{0x300010001L});
+ int64_t expected =
+ base::MulWithWraparound(static_cast<int64_t>(i), int64_t{0x300010001L});
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -1264,8 +1258,8 @@ WASM_EXEC_TEST(F64ReinterpretI64) {
WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) {
- int64_t expected = base::MulWithWraparound(static_cast<int64_t>(*i),
- int64_t{0x300010001L});
+ int64_t expected =
+ base::MulWithWraparound(static_cast<int64_t>(i), int64_t{0x300010001L});
CHECK_EQ(expected, r.Call(expected));
CHECK_EQ(expected, r.builder().ReadMemory<int64_t>(&memory[0]));
}
@@ -1380,8 +1374,8 @@ WASM_EXEC_TEST(I64Eqz) {
BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0)));
FOR_INT64_INPUTS(i) {
- int32_t result = *i == 0 ? 1 : 0;
- CHECK_EQ(result, r.Call(*i));
+ int32_t result = i == 0 ? 1 : 0;
+ CHECK_EQ(result, r.Call(i));
}
}
@@ -1391,8 +1385,8 @@ WASM_EXEC_TEST(I64Ror) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- int64_t expected = base::bits::RotateRight64(*i, *j & 0x3F);
- CHECK_EQ(expected, r.Call(*i, *j));
+ int64_t expected = base::bits::RotateRight64(i, j & 0x3F);
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -1403,8 +1397,8 @@ WASM_EXEC_TEST(I64Rol) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- int64_t expected = base::bits::RotateLeft64(*i, *j & 0x3F);
- CHECK_EQ(expected, r.Call(*i, *j));
+ int64_t expected = base::bits::RotateLeft64(i, j & 0x3F);
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc b/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc
index fc9e395d44..ea45762a7c 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc
@@ -73,8 +73,8 @@ WASM_EXEC_TEST(I32AsmjsSConvertF32) {
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- int32_t expected = DoubleToInt32(*i);
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = DoubleToInt32(i);
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -84,8 +84,8 @@ WASM_EXEC_TEST(I32AsmjsSConvertF64) {
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- int32_t expected = DoubleToInt32(*i);
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = DoubleToInt32(i);
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -95,8 +95,8 @@ WASM_EXEC_TEST(I32AsmjsUConvertF32) {
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- uint32_t expected = DoubleToUint32(*i);
- CHECK_EQ(expected, r.Call(*i));
+ uint32_t expected = DoubleToUint32(i);
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -106,8 +106,8 @@ WASM_EXEC_TEST(I32AsmjsUConvertF64) {
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- uint32_t expected = DoubleToUint32(*i);
- CHECK_EQ(expected, r.Call(*i));
+ uint32_t expected = DoubleToUint32(i);
+ CHECK_EQ(expected, r.Call(i));
}
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc b/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc
index 8eddaa0224..7895b192f8 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc
@@ -22,11 +22,11 @@ void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t initial = *i;
+ uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint32_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint32_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -51,11 +51,11 @@ void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op,
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t initial = *i;
+ uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint16_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint16_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -79,11 +79,11 @@ void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t initial = *i;
+ uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint8_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint8_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -107,11 +107,11 @@ WASM_EXEC_TEST(I32AtomicCompareExchange) {
WASM_GET_LOCAL(1), MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t initial = *i;
+ uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint32_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint32_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -129,11 +129,11 @@ WASM_EXEC_TEST(I32AtomicCompareExchange16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t initial = *i;
+ uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint16_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint16_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -150,16 +150,38 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t initial = *i;
+ uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint8_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint8_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
}
+WASM_EXEC_TEST(I32AtomicCompareExchange_fail) {
+ EXPERIMENTAL_FLAG_SCOPE(threads);
+ WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
+ r.builder().SetHasSharedMemory();
+ uint32_t* memory =
+ r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
+ BUILD(r, WASM_ATOMICS_TERNARY_OP(
+ kExprI32AtomicCompareExchange, WASM_I32V_1(0), WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1), MachineRepresentation::kWord32));
+
+ // The original value at the memory location.
+ uint32_t old_val = 4;
+ // The value we use as the expected value for the compare-exchange so that it
+ // fails.
+ uint32_t expected = 6;
+ // The new value for the compare-exchange.
+ uint32_t new_val = 5;
+
+ r.builder().WriteMemory(&memory[0], old_val);
+ CHECK_EQ(old_val, r.Call(expected, new_val));
+}
+
WASM_EXEC_TEST(I32AtomicLoad) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t> r(execution_tier);
@@ -170,7 +192,7 @@ WASM_EXEC_TEST(I32AtomicLoad) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = *i;
+ uint32_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -186,7 +208,7 @@ WASM_EXEC_TEST(I32AtomicLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t expected = *i;
+ uint16_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -201,7 +223,7 @@ WASM_EXEC_TEST(I32AtomicLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t expected = *i;
+ uint8_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -221,8 +243,8 @@ WASM_EXEC_TEST(I32AtomicStoreLoad) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
+ uint32_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -242,8 +264,8 @@ WASM_EXEC_TEST(I32AtomicStoreLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
+ uint16_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -261,9 +283,9 @@ WASM_EXEC_TEST(I32AtomicStoreLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
- CHECK_EQ(*i, r.builder().ReadMemory(&memory[0]));
+ uint8_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
+ CHECK_EQ(i, r.builder().ReadMemory(&memory[0]));
}
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc b/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc
index 624982a117..bbeafc9151 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc
@@ -22,11 +22,11 @@ void RunU64BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
- uint64_t initial = *i;
+ uint64_t initial = i;
FOR_UINT64_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint64_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint64_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -51,11 +51,11 @@ void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t initial = *i;
+ uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint32_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint32_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -80,11 +80,11 @@ void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op,
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t initial = *i;
+ uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint16_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint16_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -108,11 +108,11 @@ void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t initial = *i;
+ uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint8_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint8_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -136,11 +136,11 @@ WASM_EXEC_TEST(I64AtomicCompareExchange) {
WASM_GET_LOCAL(1), MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
- uint64_t initial = *i;
+ uint64_t initial = i;
FOR_UINT64_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint64_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint64_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -158,11 +158,11 @@ WASM_EXEC_TEST(I64AtomicCompareExchange32U) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t initial = *i;
+ uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint32_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint32_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -180,11 +180,11 @@ WASM_EXEC_TEST(I64AtomicCompareExchange16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t initial = *i;
+ uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint16_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint16_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -200,11 +200,11 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t initial = *i;
+ uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint8_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint8_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -220,7 +220,7 @@ WASM_EXEC_TEST(I64AtomicLoad) {
MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
- uint64_t expected = *i;
+ uint64_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -236,7 +236,7 @@ WASM_EXEC_TEST(I64AtomicLoad32U) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = *i;
+ uint32_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -252,7 +252,7 @@ WASM_EXEC_TEST(I64AtomicLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t expected = *i;
+ uint16_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -267,7 +267,7 @@ WASM_EXEC_TEST(I64AtomicLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t expected = *i;
+ uint8_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -287,8 +287,8 @@ WASM_EXEC_TEST(I64AtomicStoreLoad) {
MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
- uint64_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
+ uint64_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -308,8 +308,8 @@ WASM_EXEC_TEST(I64AtomicStoreLoad32U) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
+ uint32_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -329,8 +329,8 @@ WASM_EXEC_TEST(I64AtomicStoreLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
+ uint16_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -348,9 +348,9 @@ WASM_EXEC_TEST(I64AtomicStoreLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
- CHECK_EQ(*i, r.builder().ReadMemory(&memory[0]));
+ uint8_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
+ CHECK_EQ(i, r.builder().ReadMemory(&memory[0]));
}
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc b/deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc
new file mode 100644
index 0000000000..eefaa678d1
--- /dev/null
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc
@@ -0,0 +1,220 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/api-inl.h"
+#include "test/cctest/wasm/wasm-atomics-utils.h"
+#include "test/common/wasm/test-signatures.h"
+#include "test/common/wasm/wasm-macro-gen.h"
+
+namespace v8 {
+namespace internal {
+namespace wasm {
+namespace test_run_wasm_exceptions {
+
+WASM_EXEC_TEST(TryCatchThrow) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
+ uint32_t except = r.builder().AddException(sigs.v_v());
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(kWasmI32,
+ WASM_STMTS(WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_THROW(except))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+WASM_EXEC_TEST(TryCatchCallDirect) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
+ uint32_t except = r.builder().AddException(sigs.v_v());
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+
+ // Build a throwing helper function.
+ WasmFunctionCompiler& throw_func = r.NewFunction(sigs.i_ii());
+ BUILD(throw_func, WASM_THROW(except));
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(
+ kWasmI32,
+ WASM_STMTS(WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_STMTS(WASM_CALL_FUNCTION(
+ throw_func.function_index(),
+ WASM_I32V(7), WASM_I32V(9)),
+ WASM_DROP))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+WASM_EXEC_TEST(TryCatchCallIndirect) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
+ uint32_t except = r.builder().AddException(sigs.v_v());
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+
+ // Build a throwing helper function.
+ WasmFunctionCompiler& throw_func = r.NewFunction(sigs.i_ii());
+ BUILD(throw_func, WASM_THROW(except));
+ r.builder().AddSignature(sigs.i_ii());
+ throw_func.SetSigIndex(0);
+
+ // Add an indirect function table.
+ uint16_t indirect_function_table[] = {
+ static_cast<uint16_t>(throw_func.function_index())};
+ r.builder().AddIndirectFunctionTable(indirect_function_table,
+ arraysize(indirect_function_table));
+ r.builder().PopulateIndirectFunctionTable();
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(
+ kWasmI32,
+ WASM_STMTS(WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_STMTS(WASM_CALL_INDIRECT2(
+ 0, WASM_GET_LOCAL(0),
+ WASM_I32V(7), WASM_I32V(9)),
+ WASM_DROP))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+WASM_EXEC_TEST(TryCatchCallExternal) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ HandleScope scope(CcTest::InitIsolateOnce());
+ const char* source = "(function() { throw 'ball'; })";
+ Handle<JSFunction> js_function =
+ Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(source))));
+ ManuallyImportedJSFunction import = {sigs.i_ii(), js_function};
+ WasmRunner<uint32_t, uint32_t> r(execution_tier, &import);
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+ constexpr uint32_t kJSFunc = 0;
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(
+ kWasmI32,
+ WASM_STMTS(
+ WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_STMTS(WASM_CALL_FUNCTION(kJSFunc, WASM_I32V(7),
+ WASM_I32V(9)),
+ WASM_DROP))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+WASM_EXEC_TEST(TryCatchTrapTypeError) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ HandleScope scope(CcTest::InitIsolateOnce());
+ const char* source = "(function() { return 0; })";
+ Handle<JSFunction> js_function =
+ Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(source))));
+ // Make sure to use a signature incompatible with JS below.
+ ManuallyImportedJSFunction import = {sigs.i_ll(), js_function};
+ WasmRunner<uint32_t, uint32_t> r(execution_tier, &import);
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+ constexpr uint32_t kJSFunc = 0;
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(
+ kWasmI32,
+ WASM_STMTS(
+ WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_STMTS(WASM_CALL_FUNCTION(kJSFunc, WASM_I64V(7),
+ WASM_I64V(9)),
+ WASM_DROP))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+namespace {
+
+// TODO(8729): The semantics of this are not yet specified and might change,
+// this test aims at keeping semantics of various execution tiers consistent.
+void TestTryCatchTrap(byte* code, size_t code_size,
+ ExecutionTier execution_tier) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier, nullptr, "main",
+ kRuntimeExceptionSupport);
+ r.builder().AddMemory(kWasmPageSize);
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+
+ // Build a trapping helper function.
+ WasmFunctionCompiler& trap_func = r.NewFunction(sigs.i_ii());
+ trap_func.Build(code, code + code_size);
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(
+ kWasmI32,
+ WASM_STMTS(WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_STMTS(WASM_CALL_FUNCTION(
+ trap_func.function_index(),
+ WASM_I32V(7), WASM_I32V(9)),
+ WASM_DROP))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+} // namespace
+
+WASM_EXEC_TEST(TryCatchTrapUnreachable) {
+ byte code[] = {WASM_UNREACHABLE};
+ TestTryCatchTrap(code, arraysize(code), execution_tier);
+}
+
+WASM_EXEC_TEST(TryCatchTrapMemOutOfBounds) {
+ byte code[] = {WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V_1(-1))};
+ TestTryCatchTrap(code, arraysize(code), execution_tier);
+}
+
+WASM_EXEC_TEST(TryCatchTrapDivByZero) {
+ byte code[] = {WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(0))};
+ TestTryCatchTrap(code, arraysize(code), execution_tier);
+}
+
+WASM_EXEC_TEST(TryCatchTrapRemByZero) {
+ byte code[] = {WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(0))};
+ TestTryCatchTrap(code, arraysize(code), execution_tier);
+}
+
+} // namespace test_run_wasm_exceptions
+} // namespace wasm
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc
index c5d0d84e63..1a8c15be31 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc
@@ -143,6 +143,109 @@ TEST(Run_Wasm_nested_ifs_i) {
CHECK_EQ(14, r.Call(0, 0));
}
+// Repeated from test-run-wasm.cc to avoid poluting header files.
+template <typename T>
+static T factorial(T v) {
+ T expected = 1;
+ for (T i = v; i > 1; i--) {
+ expected *= i;
+ }
+ return expected;
+}
+
+// Basic test of return call in interpreter. Good old factorial.
+TEST(Run_Wasm_returnCallFactorial) {
+ EXPERIMENTAL_FLAG_SCOPE(return_call);
+ // Run in bounded amount of stack - 8kb.
+ FlagScope<int32_t> stack_size(&v8::internal::FLAG_stack_size, 8);
+
+ WasmRunner<uint32_t, int32_t> r(ExecutionTier::kInterpreter);
+
+ WasmFunctionCompiler& fact_aux_fn =
+ r.NewFunction<int32_t, int32_t, int32_t>("fact_aux");
+
+ BUILD(r, WASM_RETURN_CALL_FUNCTION(fact_aux_fn.function_index(),
+ WASM_GET_LOCAL(0), WASM_I32V(1)));
+
+ BUILD(fact_aux_fn,
+ WASM_IF_ELSE_I(
+ WASM_I32_EQ(WASM_I32V(1), WASM_GET_LOCAL(0)), WASM_GET_LOCAL(1),
+ WASM_RETURN_CALL_FUNCTION(
+ fact_aux_fn.function_index(),
+ WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V(1)),
+ WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))));
+
+ // Runs out of stack space without using return call.
+ uint32_t test_values[] = {1, 2, 5, 10, 20, 20000};
+
+ for (uint32_t v : test_values) {
+ uint32_t found = r.Call(v);
+ CHECK_EQ(factorial(v), found);
+ }
+}
+
+TEST(Run_Wasm_returnCallFactorial64) {
+ EXPERIMENTAL_FLAG_SCOPE(return_call);
+
+ int32_t test_values[] = {1, 2, 5, 10, 20};
+ WasmRunner<int64_t, int32_t> r(ExecutionTier::kInterpreter);
+
+ WasmFunctionCompiler& fact_aux_fn =
+ r.NewFunction<int64_t, int32_t, int64_t>("fact_aux");
+
+ BUILD(r, WASM_RETURN_CALL_FUNCTION(fact_aux_fn.function_index(),
+ WASM_GET_LOCAL(0), WASM_I64V(1)));
+
+ BUILD(fact_aux_fn,
+ WASM_IF_ELSE_L(
+ WASM_I32_EQ(WASM_I32V(1), WASM_GET_LOCAL(0)), WASM_GET_LOCAL(1),
+ WASM_RETURN_CALL_FUNCTION(
+ fact_aux_fn.function_index(),
+ WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V(1)),
+ WASM_I64_MUL(WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)),
+ WASM_GET_LOCAL(1)))));
+
+ for (int32_t v : test_values) {
+ CHECK_EQ(factorial<int64_t>(v), r.Call(v));
+ }
+}
+
+TEST(Run_Wasm_returnCallIndirectFactorial) {
+ EXPERIMENTAL_FLAG_SCOPE(return_call);
+
+ TestSignatures sigs;
+
+ WasmRunner<uint32_t, uint32_t> r(ExecutionTier::kInterpreter);
+
+ WasmFunctionCompiler& fact_aux_fn = r.NewFunction(sigs.i_ii(), "fact_aux");
+ fact_aux_fn.SetSigIndex(0);
+
+ r.builder().AddSignature(sigs.i_ii());
+
+ // Function table.
+ uint16_t indirect_function_table[] = {
+ static_cast<uint16_t>(fact_aux_fn.function_index())};
+
+ r.builder().AddIndirectFunctionTable(indirect_function_table,
+ arraysize(indirect_function_table));
+ r.builder().PopulateIndirectFunctionTable();
+
+ BUILD(r, WASM_RETURN_CALL_INDIRECT(0, WASM_I32V(0), WASM_GET_LOCAL(0),
+ WASM_I32V(1)));
+
+ BUILD(fact_aux_fn,
+ WASM_IF_ELSE_I(
+ WASM_I32_EQ(WASM_I32V(1), WASM_GET_LOCAL(0)), WASM_GET_LOCAL(1),
+ WASM_RETURN_CALL_INDIRECT(
+ 0, WASM_I32V(0), WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V(1)),
+ WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))));
+
+ uint32_t test_values[] = {1, 2, 5, 10, 20};
+
+ for (uint32_t v : test_values) {
+ CHECK_EQ(factorial(v), r.Call(v));
+ }
+}
// Make tests more robust by not hard-coding offsets of various operations.
// The {Find} method finds the offsets for the given bytecodes, returning
// the offsets in an array.
@@ -192,7 +295,7 @@ TEST(Breakpoint_I32Add) {
FOR_UINT32_INPUTS(a) {
for (uint32_t b = 11; b < 3000000000u; b += 1000000000u) {
thread->Reset();
- WasmValue args[] = {WasmValue(*a), WasmValue(b)};
+ WasmValue args[] = {WasmValue(a), WasmValue(b)};
thread->InitFrame(r.function(), args);
for (int i = 0; i < kNumBreakpoints; i++) {
@@ -207,7 +310,7 @@ TEST(Breakpoint_I32Add) {
// Check the thread finished with the right value.
CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
- uint32_t expected = (*a) + (b);
+ uint32_t expected = (a) + (b);
CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
@@ -227,7 +330,7 @@ TEST(Step_I32Mul) {
FOR_UINT32_INPUTS(a) {
for (uint32_t b = 33; b < 3000000000u; b += 1000000000u) {
thread->Reset();
- WasmValue args[] = {WasmValue(*a), WasmValue(b)};
+ WasmValue args[] = {WasmValue(a), WasmValue(b)};
thread->InitFrame(r.function(), args);
// Run instructions one by one.
@@ -242,7 +345,7 @@ TEST(Step_I32Mul) {
// Check the thread finished with the right value.
CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
- uint32_t expected = (*a) * (b);
+ uint32_t expected = (a) * (b);
CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
@@ -269,7 +372,7 @@ TEST(Breakpoint_I32And_disable) {
interpreter->SetBreakpoint(r.function(), kLocalsDeclSize + offsets[0],
do_break);
thread->Reset();
- WasmValue args[] = {WasmValue(*a), WasmValue(b)};
+ WasmValue args[] = {WasmValue(a), WasmValue(b)};
thread->InitFrame(r.function(), args);
if (do_break) {
@@ -284,7 +387,7 @@ TEST(Breakpoint_I32And_disable) {
// Check the thread finished with the right value.
CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
- uint32_t expected = (*a) & (b);
+ uint32_t expected = (a) & (b);
CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
@@ -438,7 +541,7 @@ TEST(TestPossibleNondeterminism) {
TEST(WasmInterpreterActivations) {
WasmRunner<void> r(ExecutionTier::kInterpreter);
Isolate* isolate = r.main_isolate();
- BUILD(r, WASM_NOP);
+ BUILD(r, WASM_UNREACHABLE);
WasmInterpreter* interpreter = r.interpreter();
WasmInterpreter::Thread* thread = interpreter->GetThread(0);
@@ -451,17 +554,20 @@ TEST(WasmInterpreterActivations) {
thread->InitFrame(r.function(), nullptr);
CHECK_EQ(2, thread->NumActivations());
CHECK_EQ(2, thread->GetFrameCount());
- isolate->set_pending_exception(Smi::kZero);
- thread->HandleException(isolate);
+ CHECK_EQ(WasmInterpreter::TRAPPED, thread->Run());
+ thread->RaiseException(isolate, handle(Smi::kZero, isolate));
CHECK_EQ(1, thread->GetFrameCount());
CHECK_EQ(2, thread->NumActivations());
thread->FinishActivation(act1);
+ isolate->clear_pending_exception();
CHECK_EQ(1, thread->GetFrameCount());
CHECK_EQ(1, thread->NumActivations());
- thread->HandleException(isolate);
+ CHECK_EQ(WasmInterpreter::TRAPPED, thread->Run());
+ thread->RaiseException(isolate, handle(Smi::kZero, isolate));
CHECK_EQ(0, thread->GetFrameCount());
CHECK_EQ(1, thread->NumActivations());
thread->FinishActivation(act0);
+ isolate->clear_pending_exception();
CHECK_EQ(0, thread->NumActivations());
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-js.cc b/deps/v8/test/cctest/wasm/test-run-wasm-js.cc
index 499942464e..47ed644673 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-js.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-js.cc
@@ -69,68 +69,39 @@ ManuallyImportedJSFunction CreateJSSelector(FunctionSig* sig, int which) {
return import;
}
-
-void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc,
- Handle<Object>* buffer, int count) {
- Isolate* isolate = jsfunc->GetIsolate();
- Handle<Object> global(isolate->context()->global_object(), isolate);
- MaybeHandle<Object> retval =
- Execution::Call(isolate, jsfunc, global, count, buffer);
-
- CHECK(!retval.is_null());
- Handle<Object> result = retval.ToHandleChecked();
- if (result->IsSmi()) {
- CHECK_EQ(expected, Smi::ToInt(*result));
- } else {
- CHECK(result->IsHeapNumber());
- CHECK_FLOAT_EQ(expected, HeapNumber::cast(*result)->value());
- }
-}
-
-void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, double a,
- double b) {
- Isolate* isolate = jsfunc->GetIsolate();
- Handle<Object> buffer[] = {isolate->factory()->NewNumber(a),
- isolate->factory()->NewNumber(b)};
- EXPECT_CALL(expected, jsfunc, buffer, 2);
-}
} // namespace
WASM_EXEC_TEST(Run_Int32Sub_jswrapped) {
WasmRunner<int, int, int> r(execution_tier);
BUILD(r, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
- EXPECT_CALL(33, jsfunc, 44, 11);
- EXPECT_CALL(-8723487, jsfunc, -8000000, 723487);
+ r.CheckCallViaJS(33, 44, 11);
+ r.CheckCallViaJS(-8723487, -8000000, 723487);
}
WASM_EXEC_TEST(Run_Float32Div_jswrapped) {
WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
- EXPECT_CALL(92, jsfunc, 46, 0.5);
- EXPECT_CALL(64, jsfunc, -16, -0.25);
+ r.CheckCallViaJS(92, 46, 0.5);
+ r.CheckCallViaJS(64, -16, -0.25);
}
WASM_EXEC_TEST(Run_Float64Add_jswrapped) {
WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
- EXPECT_CALL(3, jsfunc, 2, 1);
- EXPECT_CALL(-5.5, jsfunc, -5.25, -0.25);
+ r.CheckCallViaJS(3, 2, 1);
+ r.CheckCallViaJS(-5.5, -5.25, -0.25);
}
WASM_EXEC_TEST(Run_I32Popcount_jswrapped) {
WasmRunner<int, int> r(execution_tier);
BUILD(r, WASM_I32_POPCNT(WASM_GET_LOCAL(0)));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
- EXPECT_CALL(2, jsfunc, 9, 0);
- EXPECT_CALL(3, jsfunc, 11, 0);
- EXPECT_CALL(6, jsfunc, 0x3F, 0);
+ r.CheckCallViaJS(2, 9);
+ r.CheckCallViaJS(3, 11);
+ r.CheckCallViaJS(6, 0x3F);
}
WASM_EXEC_TEST(Run_CallJS_Add_jswrapped) {
@@ -143,15 +114,48 @@ WASM_EXEC_TEST(Run_CallJS_Add_jswrapped) {
ManuallyImportedJSFunction import = {sigs.i_i(), js_function};
WasmRunner<int, int> r(execution_tier, &import);
uint32_t js_index = 0;
+ BUILD(r, WASM_CALL_FUNCTION(js_index, WASM_GET_LOCAL(0)));
- WasmFunctionCompiler& t = r.NewFunction(sigs.i_i());
- BUILD(t, WASM_CALL_FUNCTION(js_index, WASM_GET_LOCAL(0)));
+ r.CheckCallViaJS(101, 2);
+ r.CheckCallViaJS(199, 100);
+ r.CheckCallViaJS(-666666801, -666666900);
+}
- Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
+WASM_EXEC_TEST(Run_IndirectCallJSFunction) {
+ Isolate* isolate = CcTest::InitIsolateOnce();
+ HandleScope scope(isolate);
+ TestSignatures sigs;
- EXPECT_CALL(101, jsfunc, 2, -8);
- EXPECT_CALL(199, jsfunc, 100, -1);
- EXPECT_CALL(-666666801, jsfunc, -666666900, -1);
+ const char* source = "(function(a, b, c) { if(c) return a; return b; })";
+ Handle<JSFunction> js_function =
+ Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(source))));
+
+ ManuallyImportedJSFunction import = {sigs.i_iii(), js_function};
+
+ WasmRunner<int32_t, int32_t> r(execution_tier, &import);
+
+ const uint32_t js_index = 0;
+ const int32_t left = -2;
+ const int32_t right = 3;
+
+ WasmFunctionCompiler& rc_fn = r.NewFunction(sigs.i_i(), "rc");
+
+ r.builder().AddSignature(sigs.i_iii());
+ uint16_t indirect_function_table[] = {static_cast<uint16_t>(js_index)};
+
+ r.builder().AddIndirectFunctionTable(indirect_function_table,
+ arraysize(indirect_function_table));
+ r.builder().PopulateIndirectFunctionTable();
+
+ BUILD(rc_fn, WASM_CALL_INDIRECT3(0, WASM_I32V(js_index), WASM_I32V(left),
+ WASM_I32V(right), WASM_GET_LOCAL(0)));
+
+ Handle<Object> args_left[] = {isolate->factory()->NewNumber(1)};
+ r.CheckCallViaJS(left, rc_fn.function_index(), args_left, 1);
+
+ Handle<Object> args_right[] = {isolate->factory()->NewNumber(0)};
+ r.CheckCallViaJS(right, rc_fn.function_index(), args_right, 1);
}
void RunJSSelectTest(ExecutionTier tier, int which) {
@@ -184,9 +188,8 @@ void RunJSSelectTest(ExecutionTier tier, int which) {
t.Build(&code[0], &code[end]);
}
- Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
double expected = inputs.arg_d(which);
- EXPECT_CALL(expected, jsfunc, 0.0, 0.0);
+ r.CheckCallViaJS(expected, t.function_index(), nullptr, 0);
}
}
@@ -243,7 +246,6 @@ void RunWASMSelectTest(ExecutionTier tier, int which) {
WasmRunner<void> r(tier);
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(which));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
Handle<Object> args[] = {
isolate->factory()->NewNumber(inputs.arg_d(0)),
@@ -257,7 +259,7 @@ void RunWASMSelectTest(ExecutionTier tier, int which) {
};
double expected = inputs.arg_d(which);
- EXPECT_CALL(expected, jsfunc, args, kMaxParams);
+ r.CheckCallViaJS(expected, t.function_index(), args, kMaxParams);
}
}
@@ -315,7 +317,6 @@ void RunWASMSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
WasmRunner<void> r(tier);
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(which));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
Handle<Object> args[] = {isolate->factory()->NewNumber(inputs.arg_d(0)),
isolate->factory()->NewNumber(inputs.arg_d(1)),
@@ -330,7 +331,7 @@ void RunWASMSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
double nan = std::numeric_limits<double>::quiet_NaN();
double expected = which < num_args ? inputs.arg_d(which) : nan;
- EXPECT_CALL(expected, jsfunc, args, num_args);
+ r.CheckCallViaJS(expected, t.function_index(), args, num_args);
}
}
@@ -430,8 +431,6 @@ void RunJSSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
WasmFunctionCompiler& t = r.NewFunction(&sig);
t.Build(&code[0], &code[end]);
- Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
-
Handle<Object> args[] = {
factory->NewNumber(inputs.arg_d(0)),
factory->NewNumber(inputs.arg_d(1)),
@@ -447,7 +446,7 @@ void RunJSSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
double nan = std::numeric_limits<double>::quiet_NaN();
double expected = which < num_args ? inputs.arg_d(which) : nan;
- EXPECT_CALL(expected, jsfunc, args, num_args);
+ r.CheckCallViaJS(expected, t.function_index(), args, num_args);
}
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc
index 2503ec57fd..d23bdc133f 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc
@@ -854,8 +854,7 @@ TEST(Run_WasmModule_Reclaim_Memory) {
Handle<JSArrayBuffer> buffer;
for (int i = 0; i < 256; ++i) {
HandleScope scope(isolate);
- CHECK(NewArrayBuffer(isolate, kWasmPageSize, SharedFlag::kNotShared)
- .ToHandle(&buffer));
+ CHECK(NewArrayBuffer(isolate, kWasmPageSize).ToHandle(&buffer));
}
}
#endif
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc
index ed8bdf7281..fa27e983af 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc
@@ -158,7 +158,8 @@ int UnsignedGreaterEqual(T a, T b) {
template <typename T>
T LogicalShiftLeft(T a, int shift) {
- return a << shift;
+ using UnsignedT = typename std::make_unsigned<T>::type;
+ return static_cast<UnsignedT>(a) << shift;
}
template <typename T>
@@ -407,8 +408,8 @@ WASM_SIMD_TEST(F32x4Splat) {
WASM_SIMD_CHECK_SPLAT_F32x4(simd, lane_val), WASM_RETURN1(WASM_ONE));
FOR_FLOAT32_INPUTS(i) {
- if (SkipFPExpectedValue(*i)) continue;
- CHECK_EQ(1, r.Call(*i));
+ if (SkipFPExpectedValue(i)) continue;
+ CHECK_EQ(1, r.Call(i));
}
}
@@ -485,8 +486,8 @@ WASM_SIMD_COMPILED_TEST(F32x4ConvertI32x4) {
WASM_RETURN1(WASM_ONE));
FOR_INT32_INPUTS(i) {
- CHECK_EQ(1, r.Call(*i, static_cast<float>(*i),
- static_cast<float>(static_cast<uint32_t>(*i))));
+ CHECK_EQ(1, r.Call(i, static_cast<float>(i),
+ static_cast<float>(static_cast<uint32_t>(i))));
}
}
@@ -504,11 +505,11 @@ void RunF32x4UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_RETURN1(WASM_ONE));
FOR_FLOAT32_INPUTS(i) {
- if (SkipFPValue(*i)) continue;
- float expected = expected_op(*i);
+ if (SkipFPValue(i)) continue;
+ float expected = expected_op(i);
if (SkipFPExpectedValue(expected)) continue;
float abs_error = std::abs(expected) * error;
- CHECK_EQ(1, r.Call(*i, expected - abs_error, expected + abs_error));
+ CHECK_EQ(1, r.Call(i, expected - abs_error, expected + abs_error));
}
}
@@ -546,12 +547,12 @@ void RunF32x4BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT_F32x4(simd1, expected), WASM_RETURN1(WASM_ONE));
FOR_FLOAT32_INPUTS(i) {
- if (SkipFPValue(*i)) continue;
+ if (SkipFPValue(i)) continue;
FOR_FLOAT32_INPUTS(j) {
- if (SkipFPValue(*j)) continue;
- float expected = expected_op(*i, *j);
+ if (SkipFPValue(j)) continue;
+ float expected = expected_op(i, j);
if (SkipFPExpectedValue(expected)) continue;
- CHECK_EQ(1, r.Call(*i, *j, expected));
+ CHECK_EQ(1, r.Call(i, j, expected));
}
}
}
@@ -587,12 +588,12 @@ void RunF32x4CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE);
FOR_FLOAT32_INPUTS(i) {
- if (SkipFPValue(*i)) continue;
+ if (SkipFPValue(i)) continue;
FOR_FLOAT32_INPUTS(j) {
- if (SkipFPValue(*j)) continue;
- float diff = *i - *j;
+ if (SkipFPValue(j)) continue;
+ float diff = i - j;
if (SkipFPExpectedValue(diff)) continue;
- CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j)));
+ CHECK_EQ(1, r.Call(i, j, expected_op(i, j)));
}
}
}
@@ -639,7 +640,7 @@ WASM_SIMD_TEST(I32x4Splat) {
WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(lane_val))),
WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, lane_val), WASM_ONE);
- FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(i)); }
}
WASM_SIMD_TEST(I32x4ReplaceLane) {
@@ -676,7 +677,7 @@ WASM_SIMD_TEST(I16x8Splat) {
WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(lane_val))),
WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, lane_val), WASM_ONE);
- FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
+ FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(i)); }
}
WASM_SIMD_TEST(I16x8ReplaceLane) {
@@ -736,7 +737,7 @@ WASM_SIMD_TEST(I8x16Splat) {
WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(lane_val))),
WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), WASM_ONE);
- FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
+ FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(i)); }
}
WASM_SIMD_TEST(I8x16ReplaceLane) {
@@ -874,10 +875,10 @@ WASM_SIMD_TEST(I32x4ConvertF32x4) {
WASM_SIMD_CHECK_SPLAT4(I32x4, simd2, I32, expected_unsigned), WASM_ONE);
FOR_FLOAT32_INPUTS(i) {
- if (SkipFPValue(*i)) continue;
- int32_t signed_value = ConvertToInt(*i, false);
- int32_t unsigned_value = ConvertToInt(*i, true);
- CHECK_EQ(1, r.Call(*i, signed_value, unsigned_value));
+ if (SkipFPValue(i)) continue;
+ int32_t signed_value = ConvertToInt(i, false);
+ int32_t unsigned_value = ConvertToInt(i, true);
+ CHECK_EQ(1, r.Call(i, signed_value, unsigned_value));
}
}
@@ -915,10 +916,9 @@ WASM_SIMD_TEST(I32x4ConvertI16x8) {
WASM_ONE);
FOR_INT16_INPUTS(i) {
- int32_t unpacked_signed = static_cast<int32_t>(Widen<int16_t>(*i));
- int32_t unpacked_unsigned =
- static_cast<int32_t>(UnsignedWiden<int16_t>(*i));
- CHECK_EQ(1, r.Call(*i, unpacked_signed, unpacked_unsigned, 0));
+ int32_t unpacked_signed = static_cast<int32_t>(Widen<int16_t>(i));
+ int32_t unpacked_unsigned = static_cast<int32_t>(UnsignedWiden<int16_t>(i));
+ CHECK_EQ(1, r.Call(i, unpacked_signed, unpacked_unsigned, 0));
}
}
@@ -932,7 +932,7 @@ void RunI32x4UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, expected), WASM_ONE);
- FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i))); }
}
WASM_SIMD_TEST(I32x4Neg) {
@@ -959,7 +959,7 @@ void RunI32x4BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE);
FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1023,7 +1023,7 @@ void RunI32x4CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE);
FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1084,7 +1084,7 @@ void RunI32x4ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, expected), WASM_ONE);
- FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i, shift))); }
}
}
@@ -1140,9 +1140,9 @@ WASM_SIMD_TEST(I16x8ConvertI8x16) {
WASM_ONE);
FOR_INT8_INPUTS(i) {
- int32_t unpacked_signed = static_cast<int32_t>(Widen<int8_t>(*i));
- int32_t unpacked_unsigned = static_cast<int32_t>(UnsignedWiden<int8_t>(*i));
- CHECK_EQ(1, r.Call(*i, unpacked_signed, unpacked_unsigned, 0));
+ int32_t unpacked_signed = static_cast<int32_t>(Widen<int8_t>(i));
+ int32_t unpacked_unsigned = static_cast<int32_t>(UnsignedWiden<int8_t>(i));
+ CHECK_EQ(1, r.Call(i, unpacked_signed, unpacked_unsigned, 0));
}
}
@@ -1156,7 +1156,7 @@ void RunI16x8UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, expected), WASM_ONE);
- FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); }
+ FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i))); }
}
WASM_SIMD_TEST(I16x8Neg) {
@@ -1196,15 +1196,15 @@ WASM_SIMD_TEST(I16x8ConvertI32x4) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
// packed signed values
- int32_t ps_a = Narrow<int16_t>(*i);
- int32_t ps_b = Narrow<int16_t>(*j);
+ int32_t ps_a = Narrow<int16_t>(i);
+ int32_t ps_b = Narrow<int16_t>(j);
// packed unsigned values
- int32_t pu_a = UnsignedNarrow<int16_t>(*i);
- int32_t pu_b = UnsignedNarrow<int16_t>(*j);
+ int32_t pu_a = UnsignedNarrow<int16_t>(i);
+ int32_t pu_b = UnsignedNarrow<int16_t>(j);
// Sign-extend here, since ExtractLane sign extends.
if (pu_a & 0x8000) pu_a |= 0xFFFF0000;
if (pu_b & 0x8000) pu_b |= 0xFFFF0000;
- CHECK_EQ(1, r.Call(*i, *j, ps_a, ps_b, pu_a, pu_b));
+ CHECK_EQ(1, r.Call(i, j, ps_a, ps_b, pu_a, pu_b));
}
}
}
@@ -1224,7 +1224,7 @@ void RunI16x8BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT8(I16x8, simd1, I32, expected), WASM_ONE);
FOR_INT16_INPUTS(i) {
- FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1296,7 +1296,7 @@ void RunI16x8CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT8(I16x8, simd1, I32, expected), WASM_ONE);
FOR_INT16_INPUTS(i) {
- FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1357,7 +1357,7 @@ void RunI16x8ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, expected), WASM_ONE);
- FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); }
+ FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i, shift))); }
}
}
@@ -1386,7 +1386,7 @@ void RunI8x16UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE);
- FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); }
+ FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i))); }
}
WASM_SIMD_TEST(I8x16Neg) {
@@ -1428,15 +1428,15 @@ WASM_SIMD_TEST(I8x16ConvertI16x8) {
FOR_INT16_INPUTS(i) {
FOR_INT16_INPUTS(j) {
// packed signed values
- int32_t ps_a = Narrow<int8_t>(*i);
- int32_t ps_b = Narrow<int8_t>(*j);
+ int32_t ps_a = Narrow<int8_t>(i);
+ int32_t ps_b = Narrow<int8_t>(j);
// packed unsigned values
- int32_t pu_a = UnsignedNarrow<int8_t>(*i);
- int32_t pu_b = UnsignedNarrow<int8_t>(*j);
+ int32_t pu_a = UnsignedNarrow<int8_t>(i);
+ int32_t pu_b = UnsignedNarrow<int8_t>(j);
// Sign-extend here, since ExtractLane sign extends.
if (pu_a & 0x80) pu_a |= 0xFFFFFF00;
if (pu_b & 0x80) pu_b |= 0xFFFFFF00;
- CHECK_EQ(1, r.Call(*i, *j, ps_a, ps_b, pu_a, pu_b));
+ CHECK_EQ(1, r.Call(i, j, ps_a, ps_b, pu_a, pu_b));
}
}
}
@@ -1456,7 +1456,7 @@ void RunI8x16BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT16(I8x16, simd1, I32, expected), WASM_ONE);
FOR_INT8_INPUTS(i) {
- FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1523,7 +1523,7 @@ void RunI8x16CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT16(I8x16, simd1, I32, expected), WASM_ONE);
FOR_INT8_INPUTS(i) {
- FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1589,7 +1589,7 @@ void RunI8x16ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE);
- FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); }
+ FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i, shift))); }
}
}
@@ -2334,7 +2334,7 @@ WASM_SIMD_COMPILED_TEST(SimdLoadStoreLoad) {
WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_LOAD_MEM(WASM_I32V(4))));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i;
+ int32_t expected = i;
r.builder().WriteMemory(&memory[1], expected);
CHECK_EQ(expected, r.Call());
}
@@ -2356,9 +2356,9 @@ WASM_SIMD_COMPILED_TEST(SimdLoadStoreLoad) {
DCHECK_EQ(1, r.Call(5)); \
DCHECK_EQ(0, r.Call(0)); \
}
-WASM_SIMD_ANYTRUE_TEST(32x4, 4, 0xffffffff);
-WASM_SIMD_ANYTRUE_TEST(16x8, 8, 0xffff);
-WASM_SIMD_ANYTRUE_TEST(8x16, 16, 0xff);
+WASM_SIMD_ANYTRUE_TEST(32x4, 4, 0xffffffff)
+WASM_SIMD_ANYTRUE_TEST(16x8, 8, 0xffff)
+WASM_SIMD_ANYTRUE_TEST(8x16, 16, 0xff)
#define WASM_SIMD_ALLTRUE_TEST(format, lanes, max) \
WASM_SIMD_TEST_TURBOFAN(S##format##AllTrue) { \
@@ -2372,9 +2372,9 @@ WASM_SIMD_ANYTRUE_TEST(8x16, 16, 0xff);
DCHECK_EQ(0, r.Call(21)); \
DCHECK_EQ(0, r.Call(0)); \
}
-WASM_SIMD_ALLTRUE_TEST(32x4, 4, 0xffffffff);
-WASM_SIMD_ALLTRUE_TEST(16x8, 8, 0xffff);
-WASM_SIMD_ALLTRUE_TEST(8x16, 16, 0xff);
+WASM_SIMD_ALLTRUE_TEST(32x4, 4, 0xffffffff)
+WASM_SIMD_ALLTRUE_TEST(16x8, 8, 0xffff)
+WASM_SIMD_ALLTRUE_TEST(8x16, 16, 0xff)
#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST_TURBOFAN(BitSelect) {
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc
index 7e6ba47448..ef481bc929 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc
@@ -38,7 +38,7 @@ WASM_EXEC_TEST(Int32Const) {
WASM_EXEC_TEST(Int32Const_many) {
FOR_INT32_INPUTS(i) {
WasmRunner<int32_t> r(execution_tier);
- const int32_t kExpectedValue = *i;
+ const int32_t kExpectedValue = i;
// return(kExpectedValue)
BUILD(r, WASM_I32V(kExpectedValue));
CHECK_EQ(kExpectedValue, r.Call());
@@ -57,21 +57,21 @@ WASM_EXEC_TEST(Int32Param0) {
WasmRunner<int32_t, int32_t> r(execution_tier);
// return(local[0])
BUILD(r, WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Int32Param0_fallthru) {
WasmRunner<int32_t, int32_t> r(execution_tier);
// local[0]
BUILD(r, WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Int32Param1) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
// local[1]
BUILD(r, WASM_GET_LOCAL(1));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(-111, *i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(-111, i)); }
}
WASM_EXEC_TEST(Int32Add) {
@@ -85,14 +85,14 @@ WASM_EXEC_TEST(Int32Add_P) {
WasmRunner<int32_t, int32_t> r(execution_tier);
// p0 + 13
BUILD(r, WASM_I32_ADD(WASM_I32V_1(13), WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(base::AddWithWraparound(*i, 13), r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(base::AddWithWraparound(i, 13), r.Call(i)); }
}
WASM_EXEC_TEST(Int32Add_P_fallthru) {
WasmRunner<int32_t, int32_t> r(execution_tier);
// p0 + 13
BUILD(r, WASM_I32_ADD(WASM_I32V_1(13), WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(base::AddWithWraparound(*i, 13), r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(base::AddWithWraparound(i, 13), r.Call(i)); }
}
static void RunInt32AddTest(ExecutionTier execution_tier, const byte* code,
@@ -104,9 +104,9 @@ static void RunInt32AddTest(ExecutionTier execution_tier, const byte* code,
r.Build(code, code + size);
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*i) +
- static_cast<uint32_t>(*j));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(i) +
+ static_cast<uint32_t>(j));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -168,8 +168,8 @@ static void TestInt32Binop(ExecutionTier execution_tier, WasmOpcode opcode,
FOR_INT32_INPUTS(j) {
WasmRunner<ctype> r(execution_tier);
// Apply {opcode} on two constants.
- BUILD(r, WASM_BINOP(opcode, WASM_I32V(*i), WASM_I32V(*j)));
- CHECK_EQ(expected(*i, *j), r.Call());
+ BUILD(r, WASM_BINOP(opcode, WASM_I32V(i), WASM_I32V(j)));
+ CHECK_EQ(expected(i, j), r.Call());
}
}
{
@@ -178,7 +178,7 @@ static void TestInt32Binop(ExecutionTier execution_tier, WasmOpcode opcode,
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- CHECK_EQ(expected(*i, *j), r.Call(*i, *j));
+ CHECK_EQ(expected(i, j), r.Call(i, j));
}
}
}
@@ -204,7 +204,7 @@ WASM_I32_BINOP_TEST(RemU, uint32_t, b == 0 ? 0xDEADBEEF : a % b)
WASM_I32_BINOP_TEST(And, int32_t, a& b)
WASM_I32_BINOP_TEST(Ior, int32_t, a | b)
WASM_I32_BINOP_TEST(Xor, int32_t, a ^ b)
-WASM_I32_BINOP_TEST(Shl, int32_t, a << (b & 0x1F))
+WASM_I32_BINOP_TEST(Shl, int32_t, base::ShlWithWraparound(a, b))
WASM_I32_BINOP_TEST(ShrU, uint32_t, a >> (b & 0x1F))
WASM_I32_BINOP_TEST(ShrS, int32_t, a >> (b & 0x1F))
WASM_I32_BINOP_TEST(Ror, uint32_t, (a >> (b & 0x1F)) | (a << ((32 - b) & 0x1F)))
@@ -392,11 +392,11 @@ WASM_EXEC_TEST(Int32AsmjsDivS_byzero_const) {
BUILD(r, WASM_I32_ASMJS_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
FOR_INT32_INPUTS(i) {
if (denom == 0) {
- CHECK_EQ(0, r.Call(*i));
- } else if (denom == -1 && *i == std::numeric_limits<int32_t>::min()) {
- CHECK_EQ(std::numeric_limits<int32_t>::min(), r.Call(*i));
+ CHECK_EQ(0, r.Call(i));
+ } else if (denom == -1 && i == std::numeric_limits<int32_t>::min()) {
+ CHECK_EQ(std::numeric_limits<int32_t>::min(), r.Call(i));
} else {
- CHECK_EQ(*i / denom, r.Call(*i));
+ CHECK_EQ(i / denom, r.Call(i));
}
}
}
@@ -409,11 +409,11 @@ WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) {
BUILD(r, WASM_I32_ASMJS_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
FOR_INT32_INPUTS(i) {
if (denom == 0) {
- CHECK_EQ(0, r.Call(*i));
- } else if (denom == -1 && *i == std::numeric_limits<int32_t>::min()) {
- CHECK_EQ(0, r.Call(*i));
+ CHECK_EQ(0, r.Call(i));
+ } else if (denom == -1 && i == std::numeric_limits<int32_t>::min()) {
+ CHECK_EQ(0, r.Call(i));
} else {
- CHECK_EQ(*i % denom, r.Call(*i));
+ CHECK_EQ(i % denom, r.Call(i));
}
}
}
@@ -605,8 +605,7 @@ WASM_EXEC_TEST(Float32Neg) {
BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- CHECK_EQ(0x80000000,
- bit_cast<uint32_t>(*i) ^ bit_cast<uint32_t>(r.Call(*i)));
+ CHECK_EQ(0x80000000, bit_cast<uint32_t>(i) ^ bit_cast<uint32_t>(r.Call(i)));
}
}
@@ -616,7 +615,7 @@ WASM_EXEC_TEST(Float64Neg) {
FOR_FLOAT64_INPUTS(i) {
CHECK_EQ(0x8000000000000000,
- bit_cast<uint64_t>(*i) ^ bit_cast<uint64_t>(r.Call(*i)));
+ bit_cast<uint64_t>(i) ^ bit_cast<uint64_t>(r.Call(i)));
}
}
@@ -627,36 +626,36 @@ WASM_EXEC_TEST(IfElse_P) {
WASM_I32V_1(11), // --
WASM_I32V_1(22))); // --
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 11 : 22;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 11 : 22;
+ CHECK_EQ(expected, r.Call(i));
}
}
WASM_EXEC_TEST(If_empty1) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprEnd, WASM_GET_LOCAL(1));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 9, *i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i - 9, i)); }
}
WASM_EXEC_TEST(IfElse_empty1) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprElse, kExprEnd,
WASM_GET_LOCAL(1));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 8, *i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i - 8, i)); }
}
WASM_EXEC_TEST(IfElse_empty2) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, WASM_NOP, kExprElse,
kExprEnd, WASM_GET_LOCAL(1));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 7, *i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i - 7, i)); }
}
WASM_EXEC_TEST(IfElse_empty3) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprElse, WASM_NOP,
kExprEnd, WASM_GET_LOCAL(1));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 6, *i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i - 6, i)); }
}
WASM_EXEC_TEST(If_chain1) {
@@ -664,7 +663,7 @@ WASM_EXEC_TEST(If_chain1) {
// if (p0) 13; if (p0) 14; 15
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_NOP),
WASM_IF(WASM_GET_LOCAL(0), WASM_NOP), WASM_I32V_1(15));
- FOR_INT32_INPUTS(i) { CHECK_EQ(15, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(15, r.Call(i)); }
}
WASM_EXEC_TEST(If_chain_set) {
@@ -674,8 +673,8 @@ WASM_EXEC_TEST(If_chain_set) {
WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I32V_2(74))),
WASM_GET_LOCAL(1));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 74 : *i;
- CHECK_EQ(expected, r.Call(*i, *i));
+ int32_t expected = i ? 74 : i;
+ CHECK_EQ(expected, r.Call(i, i));
}
}
@@ -716,7 +715,7 @@ WASM_EXEC_TEST(Return_I32) {
BUILD(r, RET(WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Return_F32) {
@@ -725,7 +724,7 @@ WASM_EXEC_TEST(Return_F32) {
BUILD(r, RET(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- float expect = *i;
+ float expect = i;
float result = r.Call(expect);
if (std::isnan(expect)) {
CHECK(std::isnan(result));
@@ -741,7 +740,7 @@ WASM_EXEC_TEST(Return_F64) {
BUILD(r, RET(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- double expect = *i;
+ double expect = i;
double result = r.Call(expect);
if (std::isnan(expect)) {
CHECK(std::isnan(result));
@@ -764,8 +763,8 @@ WASM_EXEC_TEST(Select) {
// return select(11, 22, a);
BUILD(r, WASM_SELECT(WASM_I32V_1(11), WASM_I32V_1(22), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 11 : 22;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 11 : 22;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -776,7 +775,7 @@ WASM_EXEC_TEST(Select_strict1) {
WASM_TEE_LOCAL(0, WASM_I32V_1(1)),
WASM_TEE_LOCAL(0, WASM_I32V_1(2))),
WASM_DROP, WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(i)); }
}
WASM_EXEC_TEST(Select_strict2) {
@@ -787,8 +786,8 @@ WASM_EXEC_TEST(Select_strict2) {
BUILD(r, WASM_SELECT(WASM_TEE_LOCAL(1, WASM_I32V_1(5)),
WASM_TEE_LOCAL(2, WASM_I32V_1(6)), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 5 : 6;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 5 : 6;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -802,7 +801,7 @@ WASM_EXEC_TEST(Select_strict3) {
WASM_TEE_LOCAL(0, WASM_GET_LOCAL(1))));
FOR_INT32_INPUTS(i) {
int32_t expected = 5;
- CHECK_EQ(expected, r.Call(*i));
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -811,7 +810,7 @@ WASM_EXEC_TEST(BrIf_strict) {
BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_GET_LOCAL(0),
WASM_TEE_LOCAL(0, WASM_I32V_2(99)))));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Br_height) {
@@ -839,7 +838,7 @@ WASM_EXEC_TEST(BrTable0a) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0)))),
WASM_I32V_2(91));
- FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(i)); }
}
WASM_EXEC_TEST(BrTable0b) {
@@ -847,7 +846,7 @@ WASM_EXEC_TEST(BrTable0b) {
BUILD(r,
B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(0)))),
WASM_I32V_2(92));
- FOR_INT32_INPUTS(i) { CHECK_EQ(92, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(92, r.Call(i)); }
}
WASM_EXEC_TEST(BrTable0c) {
@@ -858,15 +857,15 @@ WASM_EXEC_TEST(BrTable0c) {
RET_I8(76))),
WASM_I32V_2(77));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i == 0 ? 76 : 77;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i == 0 ? 76 : 77;
+ CHECK_EQ(expected, r.Call(i));
}
}
WASM_EXEC_TEST(BrTable1) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), RET_I8(93));
- FOR_INT32_INPUTS(i) { CHECK_EQ(93, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(93, r.Call(i)); }
}
WASM_EXEC_TEST(BrTable_loop) {
@@ -1021,7 +1020,7 @@ WASM_EXEC_TEST(F32ReinterpretI32) {
WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i;
+ int32_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -1037,7 +1036,7 @@ WASM_EXEC_TEST(I32ReinterpretF32) {
WASM_I32V_2(107));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i;
+ int32_t expected = i;
CHECK_EQ(107, r.Call(expected));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
@@ -1079,7 +1078,7 @@ WASM_EXEC_TEST(LoadStoreLoad) {
WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i;
+ int32_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -1170,61 +1169,61 @@ WASM_EXEC_TEST(VoidReturn2) {
WASM_EXEC_TEST(BrEmpty) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BRV(0, WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(BrIfEmpty) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BRV_IF(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_empty) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, kExprBlock, kLocalVoid, kExprEnd, WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_empty_br1) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_BR(0)), WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_empty_brif1) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_ZERO)), WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_empty_brif2) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i, i + 1)); }
}
WASM_EXEC_TEST(Block_i) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_f) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_BLOCK_F(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_d) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_BLOCK_D(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_br2) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0))));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, static_cast<uint32_t>(r.Call(*i))); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, static_cast<uint32_t>(r.Call(i))); }
}
WASM_EXEC_TEST(Block_If_P) {
@@ -1235,51 +1234,51 @@ WASM_EXEC_TEST(Block_If_P) {
WASM_BRV(1, WASM_I32V_1(51))), // --
WASM_I32V_1(52))); // --
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 51 : 52;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 51 : 52;
+ CHECK_EQ(expected, r.Call(i));
}
}
WASM_EXEC_TEST(Loop_empty) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, kExprLoop, kLocalVoid, kExprEnd, WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_i) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_LOOP_I(WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_f) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_LOOP_F(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_d) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_LOOP_D(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_empty_br1) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_LOOP(WASM_BR(1))), WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_empty_brif1) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_LOOP(WASM_BR_IF(1, WASM_ZERO))), WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_empty_brif2) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_LOOP_I(WASM_BRV_IF(1, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i, i + 1)); }
}
WASM_EXEC_TEST(Loop_empty_brif3) {
@@ -1288,8 +1287,8 @@ WASM_EXEC_TEST(Loop_empty_brif3) {
WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- CHECK_EQ(*i, r.Call(0, *i, *j));
- CHECK_EQ(*j, r.Call(1, *i, *j));
+ CHECK_EQ(i, r.Call(0, i, j));
+ CHECK_EQ(j, r.Call(1, i, j));
}
}
}
@@ -1299,8 +1298,8 @@ WASM_EXEC_TEST(Block_BrIf_P) {
BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I32V_1(51), WASM_GET_LOCAL(0)),
WASM_I32V_1(52)));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 51 : 52;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 51 : 52;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -1313,8 +1312,8 @@ WASM_EXEC_TEST(Block_IfElse_P_assign) {
WASM_SET_LOCAL(0, WASM_I32V_2(72))), // --
WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 71 : 72;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 71 : 72;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -1327,8 +1326,8 @@ WASM_EXEC_TEST(Block_IfElse_P_return) {
RET_I8(82)), // --
WASM_ZERO); // --
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 81 : 82;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 81 : 82;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -1338,8 +1337,8 @@ WASM_EXEC_TEST(Block_If_P_assign) {
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I32V_1(61))),
WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 61 : *i;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 61 : i;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -1357,8 +1356,8 @@ WASM_EXEC_TEST(ExprIf_P) {
WASM_I32V_1(11), // --
WASM_I32V_1(22))); // --
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 11 : 22;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 11 : 22;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -2039,7 +2038,7 @@ WASM_EXEC_TEST(Int32LoadInt16_signext) {
BUILD(r, WASM_LOAD_MEM(MachineType::Int16(), WASM_GET_LOCAL(0)));
for (int i = 0; i < kNumBytes; i += 2) {
- int32_t expected = memory[i] | (static_cast<int8_t>(memory[i + 1]) << 8);
+ int32_t expected = static_cast<int16_t>(memory[i] | (memory[i + 1] << 8));
CHECK_EQ(expected, r.Call(i));
}
}
@@ -2275,9 +2274,9 @@ WASM_EXEC_TEST(Call_Int32Add) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*i) +
- static_cast<uint32_t>(*j));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(i) +
+ static_cast<uint32_t>(j));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -2294,7 +2293,7 @@ WASM_EXEC_TEST(Call_Float32Sub) {
WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, r.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(i - j, r.Call(i, j)); }
}
}
@@ -2312,9 +2311,9 @@ WASM_EXEC_TEST(Call_Float64Sub) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- r.builder().WriteMemory(&memory[0], *i);
- r.builder().WriteMemory(&memory[1], *j);
- double expected = *i - *j;
+ r.builder().WriteMemory(&memory[0], i);
+ r.builder().WriteMemory(&memory[1], j);
+ double expected = i - j;
CHECK_EQ(107, r.Call());
if (expected != expected) {
@@ -2445,9 +2444,9 @@ WASM_EXEC_TEST(MultiReturnSub) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*j) -
- static_cast<uint32_t>(*i));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(j) -
+ static_cast<uint32_t>(i));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -2779,56 +2778,56 @@ WASM_EXEC_TEST(F32Floor) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_FLOOR(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(*i), r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(i), r.Call(i)); }
}
WASM_EXEC_TEST(F32Ceil) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_CEIL(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(*i), r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(i), r.Call(i)); }
}
WASM_EXEC_TEST(F32Trunc) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(*i), r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(i), r.Call(i)); }
}
WASM_EXEC_TEST(F32NearestInt) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_NEARESTINT(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyintf(*i), r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyintf(i), r.Call(i)); }
}
WASM_EXEC_TEST(F64Floor) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_FLOOR(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(*i), r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(i), r.Call(i)); }
}
WASM_EXEC_TEST(F64Ceil) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_CEIL(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(*i), r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(i), r.Call(i)); }
}
WASM_EXEC_TEST(F64Trunc) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_TRUNC(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(trunc(*i), r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(trunc(i), r.Call(i)); }
}
WASM_EXEC_TEST(F64NearestInt) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_NEARESTINT(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(*i), r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(i), r.Call(i)); }
}
WASM_EXEC_TEST(F32Min) {
@@ -2836,7 +2835,7 @@ WASM_EXEC_TEST(F32Min) {
BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_DOUBLE_EQ(JSMin(*i, *j), r.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_DOUBLE_EQ(JSMin(i, j), r.Call(i, j)); }
}
}
@@ -2852,7 +2851,7 @@ WASM_EXEC_TEST(F64Min) {
BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(JSMin(*i, *j), r.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(JSMin(i, j), r.Call(i, j)); }
}
}
@@ -2868,7 +2867,7 @@ WASM_EXEC_TEST(F32Max) {
BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(JSMax(*i, *j), r.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(JSMax(i, j), r.Call(i, j)); }
}
}
@@ -2885,8 +2884,8 @@ WASM_EXEC_TEST(F64Max) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- double result = r.Call(*i, *j);
- CHECK_DOUBLE_EQ(JSMax(*i, *j), result);
+ double result = r.Call(i, j);
+ CHECK_DOUBLE_EQ(JSMax(i, j), result);
}
}
}
@@ -2903,10 +2902,10 @@ WASM_EXEC_TEST(I32SConvertF32) {
BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- if (is_inbounds<int32_t>(*i)) {
- CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i));
+ if (is_inbounds<int32_t>(i)) {
+ CHECK_EQ(static_cast<int32_t>(i), r.Call(i));
} else {
- CHECK_TRAP32(r.Call(*i));
+ CHECK_TRAP32(r.Call(i));
}
}
}
@@ -2918,12 +2917,12 @@ WASM_EXEC_TEST(I32SConvertSatF32) {
FOR_FLOAT32_INPUTS(i) {
int32_t expected =
- is_inbounds<int32_t>(*i)
- ? static_cast<int32_t>(*i)
- : std::isnan(*i) ? 0
- : *i < 0.0 ? std::numeric_limits<int32_t>::min()
- : std::numeric_limits<int32_t>::max();
- int32_t found = r.Call(*i);
+ is_inbounds<int32_t>(i)
+ ? static_cast<int32_t>(i)
+ : std::isnan(i) ? 0
+ : i < 0.0 ? std::numeric_limits<int32_t>::min()
+ : std::numeric_limits<int32_t>::max();
+ int32_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -2933,10 +2932,10 @@ WASM_EXEC_TEST(I32SConvertF64) {
BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- if (is_inbounds<int32_t>(*i)) {
- CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i));
+ if (is_inbounds<int32_t>(i)) {
+ CHECK_EQ(static_cast<int32_t>(i), r.Call(i));
} else {
- CHECK_TRAP32(r.Call(*i));
+ CHECK_TRAP32(r.Call(i));
}
}
}
@@ -2947,12 +2946,12 @@ WASM_EXEC_TEST(I32SConvertSatF64) {
BUILD(r, WASM_I32_SCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int32_t expected =
- is_inbounds<int32_t>(*i)
- ? static_cast<int32_t>(*i)
- : std::isnan(*i) ? 0
- : *i < 0.0 ? std::numeric_limits<int32_t>::min()
- : std::numeric_limits<int32_t>::max();
- int32_t found = r.Call(*i);
+ is_inbounds<int32_t>(i)
+ ? static_cast<int32_t>(i)
+ : std::isnan(i) ? 0
+ : i < 0.0 ? std::numeric_limits<int32_t>::min()
+ : std::numeric_limits<int32_t>::max();
+ int32_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -2961,10 +2960,10 @@ WASM_EXEC_TEST(I32UConvertF32) {
WasmRunner<uint32_t, float> r(execution_tier);
BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- if (is_inbounds<uint32_t>(*i)) {
- CHECK_EQ(static_cast<uint32_t>(*i), r.Call(*i));
+ if (is_inbounds<uint32_t>(i)) {
+ CHECK_EQ(static_cast<uint32_t>(i), r.Call(i));
} else {
- CHECK_TRAP32(r.Call(*i));
+ CHECK_TRAP32(r.Call(i));
}
}
}
@@ -2975,12 +2974,12 @@ WASM_EXEC_TEST(I32UConvertSatF32) {
BUILD(r, WASM_I32_UCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
int32_t expected =
- is_inbounds<uint32_t>(*i)
- ? static_cast<uint32_t>(*i)
- : std::isnan(*i) ? 0
- : *i < 0.0 ? std::numeric_limits<uint32_t>::min()
- : std::numeric_limits<uint32_t>::max();
- int32_t found = r.Call(*i);
+ is_inbounds<uint32_t>(i)
+ ? static_cast<uint32_t>(i)
+ : std::isnan(i) ? 0
+ : i < 0.0 ? std::numeric_limits<uint32_t>::min()
+ : std::numeric_limits<uint32_t>::max();
+ int32_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -2989,10 +2988,10 @@ WASM_EXEC_TEST(I32UConvertF64) {
WasmRunner<uint32_t, double> r(execution_tier);
BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- if (is_inbounds<uint32_t>(*i)) {
- CHECK_EQ(static_cast<uint32_t>(*i), r.Call(*i));
+ if (is_inbounds<uint32_t>(i)) {
+ CHECK_EQ(static_cast<uint32_t>(i), r.Call(i));
} else {
- CHECK_TRAP32(r.Call(*i));
+ CHECK_TRAP32(r.Call(i));
}
}
}
@@ -3003,12 +3002,12 @@ WASM_EXEC_TEST(I32UConvertSatF64) {
BUILD(r, WASM_I32_UCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int32_t expected =
- is_inbounds<uint32_t>(*i)
- ? static_cast<uint32_t>(*i)
- : std::isnan(*i) ? 0
- : *i < 0.0 ? std::numeric_limits<uint32_t>::min()
- : std::numeric_limits<uint32_t>::max();
- int32_t found = r.Call(*i);
+ is_inbounds<uint32_t>(i)
+ ? static_cast<uint32_t>(i)
+ : std::isnan(i) ? 0
+ : i < 0.0 ? std::numeric_limits<uint32_t>::min()
+ : std::numeric_limits<uint32_t>::max();
+ int32_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -3018,7 +3017,7 @@ WASM_EXEC_TEST(F64CopySign) {
BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(copysign(*i, *j), r.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(copysign(i, j), r.Call(i, j)); }
}
}
@@ -3027,7 +3026,7 @@ WASM_EXEC_TEST(F32CopySign) {
BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(copysignf(*i, *j), r.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(copysignf(i, j), r.Call(i, j)); }
}
}
@@ -3307,9 +3306,11 @@ WASM_EXEC_TEST(I32MulOnDifferentRegisters) {
}
WASM_EXEC_TEST(I32ShlOnDifferentRegisters) {
- BinOpOnDifferentRegisters<int32_t>(
- execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Shl,
- [](int32_t lhs, int32_t rhs, bool* trap) { return lhs << (rhs & 31); });
+ BinOpOnDifferentRegisters<int32_t>(execution_tier, kWasmI32,
+ ArrayVector(kSome32BitInputs), kExprI32Shl,
+ [](int32_t lhs, int32_t rhs, bool* trap) {
+ return base::ShlWithWraparound(lhs, rhs);
+ });
}
WASM_EXEC_TEST(I32ShrSOnDifferentRegisters) {
@@ -3383,9 +3384,11 @@ WASM_EXEC_TEST(I64MulOnDifferentRegisters) {
}
WASM_EXEC_TEST(I64ShlOnDifferentRegisters) {
- BinOpOnDifferentRegisters<int64_t>(
- execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Shl,
- [](int64_t lhs, int64_t rhs, bool* trap) { return lhs << (rhs & 63); });
+ BinOpOnDifferentRegisters<int64_t>(execution_tier, kWasmI64,
+ ArrayVector(kSome64BitInputs), kExprI64Shl,
+ [](int64_t lhs, int64_t rhs, bool* trap) {
+ return base::ShlWithWraparound(lhs, rhs);
+ });
}
WASM_EXEC_TEST(I64ShrSOnDifferentRegisters) {
@@ -3470,10 +3473,9 @@ TEST(Liftoff_tier_up) {
memcpy(buffer.get(), sub_code->instructions().start(), sub_size);
desc.buffer = buffer.get();
desc.instr_size = static_cast<int>(sub_size);
- WasmCode* code = native_module->AddCode(
- add.function_index(), desc, 0, 0, 0, {}, OwnedVector<byte>(),
- WasmCode::kFunction, WasmCode::kOther);
- native_module->PublishCode(code);
+ native_module->AddCode(add.function_index(), desc, 0, 0, {},
+ OwnedVector<byte>(), WasmCode::kFunction,
+ WasmCode::kOther);
// Second run should now execute {sub}.
CHECK_EQ(4, r.Call(11, 7));
diff --git a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc
index 43ba7dfea1..3ef62d869f 100644
--- a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc
+++ b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc
@@ -59,14 +59,14 @@ class MockPlatform final : public TestPlatform {
void PostDelayedTask(std::unique_ptr<Task> task,
double delay_in_seconds) override {
- UNREACHABLE();
- };
+ tasks_.push(std::move(task));
+ }
void PostIdleTask(std::unique_ptr<IdleTask> task) override {
UNREACHABLE();
}
- bool IdleTasksEnabled() override { return false; };
+ bool IdleTasksEnabled() override { return false; }
void ExecuteTasks() {
while (!tasks_.empty()) {
diff --git a/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc b/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc
index ba189a57ca..68366dc2df 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc
@@ -18,11 +18,10 @@ namespace wasm {
namespace test_wasm_import_wrapper_cache {
std::unique_ptr<NativeModule> NewModule(Isolate* isolate) {
- WasmCodeManager* manager = isolate->wasm_engine()->code_manager();
std::shared_ptr<WasmModule> module(new WasmModule);
bool can_request_more = false;
size_t size = 16384;
- auto native_module = manager->NewNativeModule(
+ auto native_module = isolate->wasm_engine()->NewNativeModule(
isolate, kAllWasmFeatures, size, can_request_more, std::move(module));
native_module->SetRuntimeStubs(isolate);
return native_module;
diff --git a/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc
index 1349ce2d17..211a79978e 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc
@@ -48,7 +48,7 @@ class ArgPassingHelper {
runner.Build(outer_code.data(), outer_code.data() + outer_code.size());
int funcs_to_redict[] = {static_cast<int>(inner_compiler.function_index())};
- runner.builder().Link();
+ runner.builder().SetExecutable();
WasmDebugInfo::RedirectToInterpreter(debug_info_,
ArrayVector(funcs_to_redict));
main_fun_wrapper_ = runner.builder().WrapCode(runner.function_index());
@@ -105,7 +105,7 @@ TEST(TestArgumentPassing_int32) {
return base::AddWithWraparound(base::MulWithWraparound(2, a), 1);
});
- FOR_INT32_INPUTS(v) { helper.CheckCall(*v); }
+ FOR_INT32_INPUTS(v) { helper.CheckCall(v); }
}
// Pass int64_t, return double.
@@ -124,17 +124,17 @@ TEST(TestArgumentPassing_double_int64) {
WASM_CALL_FUNCTION0(f2.function_index())},
[](int32_t a, int32_t b) {
int64_t a64 = static_cast<int64_t>(a) & 0xFFFFFFFF;
- int64_t b64 = static_cast<int64_t>(b) << 32;
+ int64_t b64 = static_cast<uint64_t>(static_cast<int64_t>(b)) << 32;
return static_cast<double>(a64 | b64);
});
FOR_INT32_INPUTS(v1) {
- FOR_INT32_INPUTS(v2) { helper.CheckCall(*v1, *v2); }
+ FOR_INT32_INPUTS(v2) { helper.CheckCall(v1, v2); }
}
FOR_INT64_INPUTS(v) {
- int32_t v1 = static_cast<int32_t>(*v);
- int32_t v2 = static_cast<int32_t>(*v >> 32);
+ int32_t v1 = static_cast<int32_t>(v);
+ int32_t v2 = static_cast<int32_t>(v >> 32);
helper.CheckCall(v1, v2);
helper.CheckCall(v2, v1);
}
@@ -175,7 +175,7 @@ TEST(TestArgumentPassing_float_double) {
WASM_GET_LOCAL(0), WASM_CALL_FUNCTION0(f2.function_index())},
[](float f) { return 2. * static_cast<double>(f) + 1.; });
- FOR_FLOAT32_INPUTS(f) { helper.CheckCall(*f); }
+ FOR_FLOAT32_INPUTS(f) { helper.CheckCall(f); }
}
// Pass two doubles, return double.
@@ -192,7 +192,7 @@ TEST(TestArgumentPassing_double_double) {
[](double a, double b) { return a + b; });
FOR_FLOAT64_INPUTS(d1) {
- FOR_FLOAT64_INPUTS(d2) { helper.CheckCall(*d1, *d2); }
+ FOR_FLOAT64_INPUTS(d2) { helper.CheckCall(d1, d2); }
}
}
diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.cc b/deps/v8/test/cctest/wasm/wasm-run-utils.cc
index f95760569f..ad57b458c6 100644
--- a/deps/v8/test/cctest/wasm/wasm-run-utils.cc
+++ b/deps/v8/test/cctest/wasm/wasm-run-utils.cc
@@ -6,6 +6,7 @@
#include "src/assembler-inl.h"
#include "src/code-tracer.h"
+#include "src/heap/heap-inl.h"
#include "src/wasm/graph-builder-interface.h"
#include "src/wasm/wasm-import-wrapper-cache-inl.h"
#include "src/wasm/wasm-memory.h"
@@ -57,7 +58,7 @@ TestingModuleBuilder::TestingModuleBuilder(
}
}
-byte* TestingModuleBuilder::AddMemory(uint32_t size) {
+byte* TestingModuleBuilder::AddMemory(uint32_t size, SharedFlag shared) {
CHECK(!test_module_->has_memory);
CHECK_NULL(mem_start_);
CHECK_EQ(0, mem_size_);
@@ -65,9 +66,16 @@ byte* TestingModuleBuilder::AddMemory(uint32_t size) {
DCHECK_IMPLIES(test_module_->origin == kWasmOrigin,
size % kWasmPageSize == 0);
test_module_->has_memory = true;
+ uint32_t max_size =
+ (test_module_->maximum_pages != 0) ? test_module_->maximum_pages : size;
uint32_t alloc_size = RoundUp(size, kWasmPageSize);
Handle<JSArrayBuffer> new_buffer;
- CHECK(NewArrayBuffer(isolate_, alloc_size).ToHandle(&new_buffer));
+ if (shared == SharedFlag::kShared) {
+ CHECK(NewSharedArrayBuffer(isolate_, alloc_size, max_size)
+ .ToHandle(&new_buffer));
+ } else {
+ CHECK(NewArrayBuffer(isolate_, alloc_size).ToHandle(&new_buffer));
+ }
CHECK(!new_buffer.is_null());
mem_start_ = reinterpret_cast<byte*>(new_buffer->backing_store());
mem_size_ = size;
@@ -75,9 +83,8 @@ byte* TestingModuleBuilder::AddMemory(uint32_t size) {
memset(mem_start_, 0, size);
// Create the WasmMemoryObject.
- Handle<WasmMemoryObject> memory_object = WasmMemoryObject::New(
- isolate_, new_buffer,
- (test_module_->maximum_pages != 0) ? test_module_->maximum_pages : -1);
+ Handle<WasmMemoryObject> memory_object =
+ WasmMemoryObject::New(isolate_, new_buffer, max_size);
instance_object_->set_memory_object(*memory_object);
WasmMemoryObject::AddInstance(isolate_, memory_object, instance_object_);
// TODO(wasm): Delete the following two lines when test-run-wasm will use a
@@ -119,8 +126,7 @@ uint32_t TestingModuleBuilder::AddFunction(FunctionSig* sig, const char* name,
}
Handle<JSFunction> TestingModuleBuilder::WrapCode(uint32_t index) {
- // Wrap the code so it can be called as a JS function.
- Link();
+ SetExecutable();
FunctionSig* sig = test_module_->functions[index].sig;
MaybeHandle<Code> maybe_ret_code =
compiler::CompileJSToWasmWrapper(isolate_, sig, false);
@@ -140,6 +146,14 @@ Handle<JSFunction> TestingModuleBuilder::WrapCode(uint32_t index) {
new_arr->set(old_arr->length(), *ret_code);
module_object->set_export_wrappers(*new_arr);
+ if (interpreter_) {
+ // Patch the jump table to call the interpreter for this function. This is
+ // only needed for functions with a wrapper. Other functions never get
+ // called through the jump table.
+ wasm::WasmCode* wasm_new_code = compiler::CompileWasmInterpreterEntry(
+ isolate_->wasm_engine(), native_module_, index, sig);
+ native_module_->PublishInterpreterEntry(wasm_new_code, index);
+ }
return ret;
}
@@ -181,12 +195,26 @@ uint32_t TestingModuleBuilder::AddBytes(Vector<const byte> bytes) {
uint32_t bytes_offset = old_size ? old_size : 1;
size_t new_size = bytes_offset + bytes.size();
OwnedVector<uint8_t> new_bytes = OwnedVector<uint8_t>::New(new_size);
- memcpy(new_bytes.start(), old_bytes.start(), old_size);
+ if (old_size > 0) {
+ memcpy(new_bytes.start(), old_bytes.start(), old_size);
+ }
memcpy(new_bytes.start() + bytes_offset, bytes.start(), bytes.length());
native_module_->SetWireBytes(std::move(new_bytes));
return bytes_offset;
}
+uint32_t TestingModuleBuilder::AddException(FunctionSig* sig) {
+ DCHECK_EQ(0, sig->return_count());
+ uint32_t index = static_cast<uint32_t>(test_module_->exceptions.size());
+ test_module_->exceptions.push_back(WasmException{sig});
+ Handle<WasmExceptionTag> tag = WasmExceptionTag::New(isolate_, index);
+ Handle<FixedArray> table(instance_object_->exceptions_table(), isolate_);
+ table = isolate_->factory()->CopyFixedArrayAndGrow(table, 1);
+ instance_object_->set_exceptions_table(*table);
+ table->set(index, *tag);
+ return index;
+}
+
CompilationEnv TestingModuleBuilder::CreateCompilationEnv() {
return {
test_module_ptr_,
@@ -219,6 +247,7 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() {
native_module_->ReserveCodeTableForTesting(kMaxFunctions);
auto instance = WasmInstanceObject::New(isolate_, module_object);
+ instance->set_exceptions_table(*isolate_->factory()->empty_fixed_array());
instance->set_globals_start(globals_data_);
return instance;
}
@@ -393,15 +422,9 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
static_cast<uint32_t>(len)};
if (interpreter_) {
- // Add the code to the interpreter.
+ // Add the code to the interpreter; do not generate compiled code.
interpreter_->SetFunctionCodeForTesting(function_, start, end);
- }
-
- // TODO(wasm): tests that go through JS depend on having a compiled version
- // of each function, even if the execution tier is the interpreter. Fix.
- auto tier = builder_->execution_tier();
- if (tier == ExecutionTier::kInterpreter) {
- tier = ExecutionTier::kOptimized;
+ return;
}
Vector<const uint8_t> wire_bytes = builder_->instance_object()
@@ -419,7 +442,7 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
NativeModule* native_module =
builder_->instance_object()->module_object()->native_module();
WasmCompilationUnit unit(isolate()->wasm_engine(), function_->func_index,
- tier);
+ builder_->execution_tier());
WasmFeatures unused_detected_features;
WasmCompilationResult result = unit.ExecuteCompilation(
&env, native_module->compilation_state()->GetWireBytesStorage(),
diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h
index af575fff77..d52d7bac76 100644
--- a/deps/v8/test/cctest/wasm/wasm-run-utils.h
+++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h
@@ -39,6 +39,7 @@
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/call-tester.h"
#include "test/cctest/compiler/graph-builder-tester.h"
+#include "test/cctest/compiler/value-helper.h"
#include "test/common/wasm/flag-utils.h"
namespace v8 {
@@ -87,7 +88,7 @@ class TestingModuleBuilder {
void ChangeOriginToAsmjs() { test_module_->origin = kAsmJsOrigin; }
- byte* AddMemory(uint32_t size);
+ byte* AddMemory(uint32_t size, SharedFlag shared = SharedFlag::kNotShared);
size_t CodeTableLength() const { return native_module_->num_functions(); }
@@ -175,6 +176,7 @@ class TestingModuleBuilder {
enum FunctionType { kImport, kWasm };
uint32_t AddFunction(FunctionSig* sig, const char* name, FunctionType type);
+ // Wrap the code so it can be called as a JS function.
Handle<JSFunction> WrapCode(uint32_t index);
void AddIndirectFunctionTable(const uint16_t* function_indexes,
@@ -184,6 +186,8 @@ class TestingModuleBuilder {
uint32_t AddBytes(Vector<const byte> bytes);
+ uint32_t AddException(FunctionSig* sig);
+
WasmFunction* GetFunctionAt(int index) {
return &test_module_->functions[index];
}
@@ -201,11 +205,8 @@ class TestingModuleBuilder {
Address globals_start() const {
return reinterpret_cast<Address>(globals_data_);
}
- void Link() {
- if (linked_) return;
- linked_ = true;
- native_module_->SetExecutable(true);
- }
+
+ void SetExecutable() { native_module_->SetExecutable(true); }
CompilationEnv CreateCompilationEnv();
@@ -228,7 +229,6 @@ class TestingModuleBuilder {
ExecutionTier execution_tier_;
Handle<WasmInstanceObject> instance_object_;
NativeModule* native_module_ = nullptr;
- bool linked_ = false;
RuntimeExceptionSupport runtime_exception_support_;
LowerSimd lower_simd_;
@@ -450,7 +450,7 @@ class WasmRunner : public WasmRunnerBase {
wrapper_.SetInnerCode(builder_.GetFunctionCode(0));
wrapper_.SetInstance(builder_.instance_object());
- builder_.Link();
+ builder_.SetExecutable();
Handle<Code> wrapper_code = wrapper_.GetWrapperCode();
compiler::CodeRunner<int32_t> runner(CcTest::InitIsolateOnce(),
wrapper_code, wrapper_.signature());
@@ -474,7 +474,9 @@ class WasmRunner : public WasmRunnerBase {
thread->Reset();
std::array<WasmValue, sizeof...(p)> args{{WasmValue(p)...}};
thread->InitFrame(function(), args.data());
- if (thread->Run() == WasmInterpreter::FINISHED) {
+ thread->Run();
+ CHECK_GT(thread->NumInterpretedCalls(), 0);
+ if (thread->state() == WasmInterpreter::FINISHED) {
WasmValue val = thread->GetReturnValue();
possible_nondeterminism_ |= thread->PossibleNondeterminism();
return val.to<ReturnType>();
@@ -488,7 +490,45 @@ class WasmRunner : public WasmRunnerBase {
}
}
+ void CheckCallViaJS(double expected, uint32_t function_index,
+ Handle<Object>* buffer, int count) {
+ Isolate* isolate = builder_.isolate();
+ if (jsfuncs_.size() <= function_index) {
+ jsfuncs_.resize(function_index + 1);
+ }
+ if (jsfuncs_[function_index].is_null()) {
+ jsfuncs_[function_index] = builder_.WrapCode(function_index);
+ }
+ Handle<JSFunction> jsfunc = jsfuncs_[function_index];
+ Handle<Object> global(isolate->context()->global_object(), isolate);
+ MaybeHandle<Object> retval =
+ Execution::Call(isolate, jsfunc, global, count, buffer);
+
+ CHECK(!retval.is_null());
+ Handle<Object> result = retval.ToHandleChecked();
+ if (result->IsSmi()) {
+ CHECK_EQ(expected, Smi::ToInt(*result));
+ } else {
+ CHECK(result->IsHeapNumber());
+ CHECK_DOUBLE_EQ(expected, HeapNumber::cast(*result)->value());
+ }
+
+ if (builder_.interpret()) {
+ CHECK_GT(builder_.interpreter()->GetThread(0)->NumInterpretedCalls(), 0);
+ }
+ }
+
+ void CheckCallViaJS(double expected, ParamTypes... p) {
+ Isolate* isolate = builder_.isolate();
+ uint32_t function_index = function()->func_index;
+ Handle<Object> buffer[] = {isolate->factory()->NewNumber(p)...};
+ CheckCallViaJS(expected, function_index, buffer, sizeof...(p));
+ }
+
Handle<Code> GetWrapperCode() { return wrapper_.GetWrapperCode(); }
+
+ private:
+ std::vector<Handle<JSFunction>> jsfuncs_;
};
// A macro to define tests that run in different engine configurations.