Commit a81bd4c0 authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[cleanup] Refactor code to use boolean literals instead of 0/1.

Fixing clang-tidy warning.

Bug: v8:8015
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: Ib48ead467519354715e3bc0e3f718cbdda28f989
Reviewed-on: https://chromium-review.googlesource.com/1225704
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55907}
parent ad72d195
...@@ -5951,7 +5951,7 @@ HeapStatistics::HeapStatistics() ...@@ -5951,7 +5951,7 @@ HeapStatistics::HeapStatistics()
malloced_memory_(0), malloced_memory_(0),
external_memory_(0), external_memory_(0),
peak_malloced_memory_(0), peak_malloced_memory_(0),
does_zap_garbage_(0), does_zap_garbage_(false),
number_of_native_contexts_(0), number_of_native_contexts_(0),
number_of_detached_contexts_(0) {} number_of_detached_contexts_(0) {}
......
...@@ -61,7 +61,7 @@ char* itoa_r(intptr_t i, char* buf, size_t sz, int base, size_t padding); ...@@ -61,7 +61,7 @@ char* itoa_r(intptr_t i, char* buf, size_t sz, int base, size_t padding);
namespace { namespace {
volatile sig_atomic_t in_signal_handler = 0; volatile sig_atomic_t in_signal_handler = 0;
bool dump_stack_in_signal_handler = 1; bool dump_stack_in_signal_handler = true;
// The prefix used for mangled symbols, per the Itanium C++ ABI: // The prefix used for mangled symbols, per the Itanium C++ ABI:
// http://www.codesourcery.com/cxx-abi/abi.html#mangling // http://www.codesourcery.com/cxx-abi/abi.html#mangling
......
...@@ -862,7 +862,7 @@ TNode<BoolT> RegExpBuiltinsAssembler::IsFastRegExpWithOriginalExec( ...@@ -862,7 +862,7 @@ TNode<BoolT> RegExpBuiltinsAssembler::IsFastRegExpWithOriginalExec(
TVARIABLE(BoolT, var_result); TVARIABLE(BoolT, var_result);
#ifdef V8_ENABLE_FORCE_SLOW_PATH #ifdef V8_ENABLE_FORCE_SLOW_PATH
var_result = BoolConstant(0); var_result = BoolConstant(false);
GotoIfForceSlowPath(&out); GotoIfForceSlowPath(&out);
#endif #endif
......
...@@ -223,7 +223,7 @@ Object* FutexEmulation::Wait(Isolate* isolate, ...@@ -223,7 +223,7 @@ Object* FutexEmulation::Wait(Isolate* isolate,
} }
wait_list_.Pointer()->RemoveNode(node); wait_list_.Pointer()->RemoveNode(node);
} while (0); } while (false);
isolate->RunAtomicsWaitCallback(callback_result, array_buffer, addr, value, isolate->RunAtomicsWaitCallback(callback_result, array_buffer, addr, value,
rel_timeout_ms, nullptr); rel_timeout_ms, nullptr);
......
...@@ -95,7 +95,7 @@ ICInfo::ICInfo() ...@@ -95,7 +95,7 @@ ICInfo::ICInfo()
is_constructor(false), is_constructor(false),
is_optimized(false), is_optimized(false),
map(nullptr), map(nullptr),
is_dictionary_map(0), is_dictionary_map(false),
number_of_own_descriptors(0) {} number_of_own_descriptors(0) {}
void ICInfo::Reset() { void ICInfo::Reset() {
......
...@@ -3560,272 +3560,276 @@ TEST(MaybeAssignedInsideLoop) { ...@@ -3560,272 +3560,276 @@ TEST(MaybeAssignedInsideLoop) {
std::vector<unsigned> top; // Can't use {} in initializers below. std::vector<unsigned> top; // Can't use {} in initializers below.
Input module_and_script_tests[] = { Input module_and_script_tests[] = {
{1, "for (j=x; j<10; ++j) { foo = j }", top}, {true, "for (j=x; j<10; ++j) { foo = j }", top},
{1, "for (j=x; j<10; ++j) { [foo] = [j] }", top}, {true, "for (j=x; j<10; ++j) { [foo] = [j] }", top},
{1, "for (j=x; j<10; ++j) { var foo = j }", top}, {true, "for (j=x; j<10; ++j) { var foo = j }", top},
{1, "for (j=x; j<10; ++j) { var [foo] = [j] }", top}, {true, "for (j=x; j<10; ++j) { var [foo] = [j] }", top},
{0, "for (j=x; j<10; ++j) { let foo = j }", {0}}, {false, "for (j=x; j<10; ++j) { let foo = j }", {0}},
{0, "for (j=x; j<10; ++j) { let [foo] = [j] }", {0}}, {false, "for (j=x; j<10; ++j) { let [foo] = [j] }", {0}},
{0, "for (j=x; j<10; ++j) { const foo = j }", {0}}, {false, "for (j=x; j<10; ++j) { const foo = j }", {0}},
{0, "for (j=x; j<10; ++j) { const [foo] = [j] }", {0}}, {false, "for (j=x; j<10; ++j) { const [foo] = [j] }", {0}},
{0, "for (j=x; j<10; ++j) { function foo() {return j} }", {0}}, {false, "for (j=x; j<10; ++j) { function foo() {return j} }", {0}},
{1, "for ({j}=x; j<10; ++j) { foo = j }", top}, {true, "for ({j}=x; j<10; ++j) { foo = j }", top},
{1, "for ({j}=x; j<10; ++j) { [foo] = [j] }", top}, {true, "for ({j}=x; j<10; ++j) { [foo] = [j] }", top},
{1, "for ({j}=x; j<10; ++j) { var foo = j }", top}, {true, "for ({j}=x; j<10; ++j) { var foo = j }", top},
{1, "for ({j}=x; j<10; ++j) { var [foo] = [j] }", top}, {true, "for ({j}=x; j<10; ++j) { var [foo] = [j] }", top},
{0, "for ({j}=x; j<10; ++j) { let foo = j }", {0}}, {false, "for ({j}=x; j<10; ++j) { let foo = j }", {0}},
{0, "for ({j}=x; j<10; ++j) { let [foo] = [j] }", {0}}, {false, "for ({j}=x; j<10; ++j) { let [foo] = [j] }", {0}},
{0, "for ({j}=x; j<10; ++j) { const foo = j }", {0}}, {false, "for ({j}=x; j<10; ++j) { const foo = j }", {0}},
{0, "for ({j}=x; j<10; ++j) { const [foo] = [j] }", {0}}, {false, "for ({j}=x; j<10; ++j) { const [foo] = [j] }", {0}},
{0, "for ({j}=x; j<10; ++j) { function foo() {return j} }", {0}}, {false, "for ({j}=x; j<10; ++j) { function foo() {return j} }", {0}},
{1, "for (var j=x; j<10; ++j) { foo = j }", top}, {true, "for (var j=x; j<10; ++j) { foo = j }", top},
{1, "for (var j=x; j<10; ++j) { [foo] = [j] }", top}, {true, "for (var j=x; j<10; ++j) { [foo] = [j] }", top},
{1, "for (var j=x; j<10; ++j) { var foo = j }", top}, {true, "for (var j=x; j<10; ++j) { var foo = j }", top},
{1, "for (var j=x; j<10; ++j) { var [foo] = [j] }", top}, {true, "for (var j=x; j<10; ++j) { var [foo] = [j] }", top},
{0, "for (var j=x; j<10; ++j) { let foo = j }", {0}}, {false, "for (var j=x; j<10; ++j) { let foo = j }", {0}},
{0, "for (var j=x; j<10; ++j) { let [foo] = [j] }", {0}}, {false, "for (var j=x; j<10; ++j) { let [foo] = [j] }", {0}},
{0, "for (var j=x; j<10; ++j) { const foo = j }", {0}}, {false, "for (var j=x; j<10; ++j) { const foo = j }", {0}},
{0, "for (var j=x; j<10; ++j) { const [foo] = [j] }", {0}}, {false, "for (var j=x; j<10; ++j) { const [foo] = [j] }", {0}},
{0, "for (var j=x; j<10; ++j) { function foo() {return j} }", {0}}, {false, "for (var j=x; j<10; ++j) { function foo() {return j} }", {0}},
{1, "for (var {j}=x; j<10; ++j) { foo = j }", top}, {true, "for (var {j}=x; j<10; ++j) { foo = j }", top},
{1, "for (var {j}=x; j<10; ++j) { [foo] = [j] }", top}, {true, "for (var {j}=x; j<10; ++j) { [foo] = [j] }", top},
{1, "for (var {j}=x; j<10; ++j) { var foo = j }", top}, {true, "for (var {j}=x; j<10; ++j) { var foo = j }", top},
{1, "for (var {j}=x; j<10; ++j) { var [foo] = [j] }", top}, {true, "for (var {j}=x; j<10; ++j) { var [foo] = [j] }", top},
{0, "for (var {j}=x; j<10; ++j) { let foo = j }", {0}}, {false, "for (var {j}=x; j<10; ++j) { let foo = j }", {0}},
{0, "for (var {j}=x; j<10; ++j) { let [foo] = [j] }", {0}}, {false, "for (var {j}=x; j<10; ++j) { let [foo] = [j] }", {0}},
{0, "for (var {j}=x; j<10; ++j) { const foo = j }", {0}}, {false, "for (var {j}=x; j<10; ++j) { const foo = j }", {0}},
{0, "for (var {j}=x; j<10; ++j) { const [foo] = [j] }", {0}}, {false, "for (var {j}=x; j<10; ++j) { const [foo] = [j] }", {0}},
{0, "for (var {j}=x; j<10; ++j) { function foo() {return j} }", {0}}, {false, "for (var {j}=x; j<10; ++j) { function foo() {return j} }", {0}},
{1, "for (let j=x; j<10; ++j) { foo = j }", top}, {true, "for (let j=x; j<10; ++j) { foo = j }", top},
{1, "for (let j=x; j<10; ++j) { [foo] = [j] }", top}, {true, "for (let j=x; j<10; ++j) { [foo] = [j] }", top},
{1, "for (let j=x; j<10; ++j) { var foo = j }", top}, {true, "for (let j=x; j<10; ++j) { var foo = j }", top},
{1, "for (let j=x; j<10; ++j) { var [foo] = [j] }", top}, {true, "for (let j=x; j<10; ++j) { var [foo] = [j] }", top},
{0, "for (let j=x; j<10; ++j) { let foo = j }", {0, 0}}, {false, "for (let j=x; j<10; ++j) { let foo = j }", {0, 0}},
{0, "for (let j=x; j<10; ++j) { let [foo] = [j] }", {0, 0, 0}}, {false, "for (let j=x; j<10; ++j) { let [foo] = [j] }", {0, 0, 0}},
{0, "for (let j=x; j<10; ++j) { const foo = j }", {0, 0}}, {false, "for (let j=x; j<10; ++j) { const foo = j }", {0, 0}},
{0, "for (let j=x; j<10; ++j) { const [foo] = [j] }", {0, 0, 0}}, {false, "for (let j=x; j<10; ++j) { const [foo] = [j] }", {0, 0, 0}},
{0, "for (let j=x; j<10; ++j) { function foo() {return j} }", {0, 0, 0}}, {false,
"for (let j=x; j<10; ++j) { function foo() {return j} }",
{1, "for (let {j}=x; j<10; ++j) { foo = j }", top}, {0, 0, 0}},
{1, "for (let {j}=x; j<10; ++j) { [foo] = [j] }", top},
{1, "for (let {j}=x; j<10; ++j) { var foo = j }", top}, {true, "for (let {j}=x; j<10; ++j) { foo = j }", top},
{1, "for (let {j}=x; j<10; ++j) { var [foo] = [j] }", top}, {true, "for (let {j}=x; j<10; ++j) { [foo] = [j] }", top},
{0, "for (let {j}=x; j<10; ++j) { let foo = j }", {0, 0}}, {true, "for (let {j}=x; j<10; ++j) { var foo = j }", top},
{0, "for (let {j}=x; j<10; ++j) { let [foo] = [j] }", {0, 0, 0}}, {true, "for (let {j}=x; j<10; ++j) { var [foo] = [j] }", top},
{0, "for (let {j}=x; j<10; ++j) { const foo = j }", {0, 0}}, {false, "for (let {j}=x; j<10; ++j) { let foo = j }", {0, 0}},
{0, "for (let {j}=x; j<10; ++j) { const [foo] = [j] }", {0, 0, 0}}, {false, "for (let {j}=x; j<10; ++j) { let [foo] = [j] }", {0, 0, 0}},
{0, "for (let {j}=x; j<10; ++j) { function foo(){return j} }", {0, 0, 0}}, {false, "for (let {j}=x; j<10; ++j) { const foo = j }", {0, 0}},
{false, "for (let {j}=x; j<10; ++j) { const [foo] = [j] }", {0, 0, 0}},
{1, "for (j of x) { foo = j }", top}, {false,
{1, "for (j of x) { [foo] = [j] }", top}, "for (let {j}=x; j<10; ++j) { function foo(){return j} }",
{1, "for (j of x) { var foo = j }", top}, {0, 0, 0}},
{1, "for (j of x) { var [foo] = [j] }", top},
{0, "for (j of x) { let foo = j }", {1}}, {true, "for (j of x) { foo = j }", top},
{0, "for (j of x) { let [foo] = [j] }", {1}}, {true, "for (j of x) { [foo] = [j] }", top},
{0, "for (j of x) { const foo = j }", {1}}, {true, "for (j of x) { var foo = j }", top},
{0, "for (j of x) { const [foo] = [j] }", {1}}, {true, "for (j of x) { var [foo] = [j] }", top},
{0, "for (j of x) { function foo() {return j} }", {1}}, {false, "for (j of x) { let foo = j }", {1}},
{false, "for (j of x) { let [foo] = [j] }", {1}},
{1, "for ({j} of x) { foo = j }", top}, {false, "for (j of x) { const foo = j }", {1}},
{1, "for ({j} of x) { [foo] = [j] }", top}, {false, "for (j of x) { const [foo] = [j] }", {1}},
{1, "for ({j} of x) { var foo = j }", top}, {false, "for (j of x) { function foo() {return j} }", {1}},
{1, "for ({j} of x) { var [foo] = [j] }", top},
{0, "for ({j} of x) { let foo = j }", {1}}, {true, "for ({j} of x) { foo = j }", top},
{0, "for ({j} of x) { let [foo] = [j] }", {1}}, {true, "for ({j} of x) { [foo] = [j] }", top},
{0, "for ({j} of x) { const foo = j }", {1}}, {true, "for ({j} of x) { var foo = j }", top},
{0, "for ({j} of x) { const [foo] = [j] }", {1}}, {true, "for ({j} of x) { var [foo] = [j] }", top},
{0, "for ({j} of x) { function foo() {return j} }", {1}}, {false, "for ({j} of x) { let foo = j }", {1}},
{false, "for ({j} of x) { let [foo] = [j] }", {1}},
{1, "for (var j of x) { foo = j }", top}, {false, "for ({j} of x) { const foo = j }", {1}},
{1, "for (var j of x) { [foo] = [j] }", top}, {false, "for ({j} of x) { const [foo] = [j] }", {1}},
{1, "for (var j of x) { var foo = j }", top}, {false, "for ({j} of x) { function foo() {return j} }", {1}},
{1, "for (var j of x) { var [foo] = [j] }", top},
{0, "for (var j of x) { let foo = j }", {1}}, {true, "for (var j of x) { foo = j }", top},
{0, "for (var j of x) { let [foo] = [j] }", {1}}, {true, "for (var j of x) { [foo] = [j] }", top},
{0, "for (var j of x) { const foo = j }", {1}}, {true, "for (var j of x) { var foo = j }", top},
{0, "for (var j of x) { const [foo] = [j] }", {1}}, {true, "for (var j of x) { var [foo] = [j] }", top},
{0, "for (var j of x) { function foo() {return j} }", {1}}, {false, "for (var j of x) { let foo = j }", {1}},
{false, "for (var j of x) { let [foo] = [j] }", {1}},
{1, "for (var {j} of x) { foo = j }", top}, {false, "for (var j of x) { const foo = j }", {1}},
{1, "for (var {j} of x) { [foo] = [j] }", top}, {false, "for (var j of x) { const [foo] = [j] }", {1}},
{1, "for (var {j} of x) { var foo = j }", top}, {false, "for (var j of x) { function foo() {return j} }", {1}},
{1, "for (var {j} of x) { var [foo] = [j] }", top},
{0, "for (var {j} of x) { let foo = j }", {1}}, {true, "for (var {j} of x) { foo = j }", top},
{0, "for (var {j} of x) { let [foo] = [j] }", {1}}, {true, "for (var {j} of x) { [foo] = [j] }", top},
{0, "for (var {j} of x) { const foo = j }", {1}}, {true, "for (var {j} of x) { var foo = j }", top},
{0, "for (var {j} of x) { const [foo] = [j] }", {1}}, {true, "for (var {j} of x) { var [foo] = [j] }", top},
{0, "for (var {j} of x) { function foo() {return j} }", {1}}, {false, "for (var {j} of x) { let foo = j }", {1}},
{false, "for (var {j} of x) { let [foo] = [j] }", {1}},
{1, "for (let j of x) { foo = j }", top}, {false, "for (var {j} of x) { const foo = j }", {1}},
{1, "for (let j of x) { [foo] = [j] }", top}, {false, "for (var {j} of x) { const [foo] = [j] }", {1}},
{1, "for (let j of x) { var foo = j }", top}, {false, "for (var {j} of x) { function foo() {return j} }", {1}},
{1, "for (let j of x) { var [foo] = [j] }", top},
{0, "for (let j of x) { let foo = j }", {0, 1, 0}}, {true, "for (let j of x) { foo = j }", top},
{0, "for (let j of x) { let [foo] = [j] }", {0, 1, 0}}, {true, "for (let j of x) { [foo] = [j] }", top},
{0, "for (let j of x) { const foo = j }", {0, 1, 0}}, {true, "for (let j of x) { var foo = j }", top},
{0, "for (let j of x) { const [foo] = [j] }", {0, 1, 0}}, {true, "for (let j of x) { var [foo] = [j] }", top},
{0, "for (let j of x) { function foo() {return j} }", {0, 1, 0}}, {false, "for (let j of x) { let foo = j }", {0, 1, 0}},
{false, "for (let j of x) { let [foo] = [j] }", {0, 1, 0}},
{1, "for (let {j} of x) { foo = j }", top}, {false, "for (let j of x) { const foo = j }", {0, 1, 0}},
{1, "for (let {j} of x) { [foo] = [j] }", top}, {false, "for (let j of x) { const [foo] = [j] }", {0, 1, 0}},
{1, "for (let {j} of x) { var foo = j }", top}, {false, "for (let j of x) { function foo() {return j} }", {0, 1, 0}},
{1, "for (let {j} of x) { var [foo] = [j] }", top},
{0, "for (let {j} of x) { let foo = j }", {0, 1, 0}}, {true, "for (let {j} of x) { foo = j }", top},
{0, "for (let {j} of x) { let [foo] = [j] }", {0, 1, 0}}, {true, "for (let {j} of x) { [foo] = [j] }", top},
{0, "for (let {j} of x) { const foo = j }", {0, 1, 0}}, {true, "for (let {j} of x) { var foo = j }", top},
{0, "for (let {j} of x) { const [foo] = [j] }", {0, 1, 0}}, {true, "for (let {j} of x) { var [foo] = [j] }", top},
{0, "for (let {j} of x) { function foo() {return j} }", {0, 1, 0}}, {false, "for (let {j} of x) { let foo = j }", {0, 1, 0}},
{false, "for (let {j} of x) { let [foo] = [j] }", {0, 1, 0}},
{1, "for (const j of x) { foo = j }", top}, {false, "for (let {j} of x) { const foo = j }", {0, 1, 0}},
{1, "for (const j of x) { [foo] = [j] }", top}, {false, "for (let {j} of x) { const [foo] = [j] }", {0, 1, 0}},
{1, "for (const j of x) { var foo = j }", top}, {false, "for (let {j} of x) { function foo() {return j} }", {0, 1, 0}},
{1, "for (const j of x) { var [foo] = [j] }", top},
{0, "for (const j of x) { let foo = j }", {0, 1, 0}}, {true, "for (const j of x) { foo = j }", top},
{0, "for (const j of x) { let [foo] = [j] }", {0, 1, 0}}, {true, "for (const j of x) { [foo] = [j] }", top},
{0, "for (const j of x) { const foo = j }", {0, 1, 0}}, {true, "for (const j of x) { var foo = j }", top},
{0, "for (const j of x) { const [foo] = [j] }", {0, 1, 0}}, {true, "for (const j of x) { var [foo] = [j] }", top},
{0, "for (const j of x) { function foo() {return j} }", {0, 1, 0}}, {false, "for (const j of x) { let foo = j }", {0, 1, 0}},
{false, "for (const j of x) { let [foo] = [j] }", {0, 1, 0}},
{1, "for (const {j} of x) { foo = j }", top}, {false, "for (const j of x) { const foo = j }", {0, 1, 0}},
{1, "for (const {j} of x) { [foo] = [j] }", top}, {false, "for (const j of x) { const [foo] = [j] }", {0, 1, 0}},
{1, "for (const {j} of x) { var foo = j }", top}, {false, "for (const j of x) { function foo() {return j} }", {0, 1, 0}},
{1, "for (const {j} of x) { var [foo] = [j] }", top},
{0, "for (const {j} of x) { let foo = j }", {0, 1, 0}}, {true, "for (const {j} of x) { foo = j }", top},
{0, "for (const {j} of x) { let [foo] = [j] }", {0, 1, 0}}, {true, "for (const {j} of x) { [foo] = [j] }", top},
{0, "for (const {j} of x) { const foo = j }", {0, 1, 0}}, {true, "for (const {j} of x) { var foo = j }", top},
{0, "for (const {j} of x) { const [foo] = [j] }", {0, 1, 0}}, {true, "for (const {j} of x) { var [foo] = [j] }", top},
{0, "for (const {j} of x) { function foo() {return j} }", {0, 1, 0}}, {false, "for (const {j} of x) { let foo = j }", {0, 1, 0}},
{false, "for (const {j} of x) { let [foo] = [j] }", {0, 1, 0}},
{1, "for (j in x) { foo = j }", top}, {false, "for (const {j} of x) { const foo = j }", {0, 1, 0}},
{1, "for (j in x) { [foo] = [j] }", top}, {false, "for (const {j} of x) { const [foo] = [j] }", {0, 1, 0}},
{1, "for (j in x) { var foo = j }", top}, {false, "for (const {j} of x) { function foo() {return j} }", {0, 1, 0}},
{1, "for (j in x) { var [foo] = [j] }", top},
{0, "for (j in x) { let foo = j }", {0}}, {true, "for (j in x) { foo = j }", top},
{0, "for (j in x) { let [foo] = [j] }", {0}}, {true, "for (j in x) { [foo] = [j] }", top},
{0, "for (j in x) { const foo = j }", {0}}, {true, "for (j in x) { var foo = j }", top},
{0, "for (j in x) { const [foo] = [j] }", {0}}, {true, "for (j in x) { var [foo] = [j] }", top},
{0, "for (j in x) { function foo() {return j} }", {0}}, {false, "for (j in x) { let foo = j }", {0}},
{false, "for (j in x) { let [foo] = [j] }", {0}},
{1, "for ({j} in x) { foo = j }", top}, {false, "for (j in x) { const foo = j }", {0}},
{1, "for ({j} in x) { [foo] = [j] }", top}, {false, "for (j in x) { const [foo] = [j] }", {0}},
{1, "for ({j} in x) { var foo = j }", top}, {false, "for (j in x) { function foo() {return j} }", {0}},
{1, "for ({j} in x) { var [foo] = [j] }", top},
{0, "for ({j} in x) { let foo = j }", {0}}, {true, "for ({j} in x) { foo = j }", top},
{0, "for ({j} in x) { let [foo] = [j] }", {0}}, {true, "for ({j} in x) { [foo] = [j] }", top},
{0, "for ({j} in x) { const foo = j }", {0}}, {true, "for ({j} in x) { var foo = j }", top},
{0, "for ({j} in x) { const [foo] = [j] }", {0}}, {true, "for ({j} in x) { var [foo] = [j] }", top},
{0, "for ({j} in x) { function foo() {return j} }", {0}}, {false, "for ({j} in x) { let foo = j }", {0}},
{false, "for ({j} in x) { let [foo] = [j] }", {0}},
{1, "for (var j in x) { foo = j }", top}, {false, "for ({j} in x) { const foo = j }", {0}},
{1, "for (var j in x) { [foo] = [j] }", top}, {false, "for ({j} in x) { const [foo] = [j] }", {0}},
{1, "for (var j in x) { var foo = j }", top}, {false, "for ({j} in x) { function foo() {return j} }", {0}},
{1, "for (var j in x) { var [foo] = [j] }", top},
{0, "for (var j in x) { let foo = j }", {0}}, {true, "for (var j in x) { foo = j }", top},
{0, "for (var j in x) { let [foo] = [j] }", {0}}, {true, "for (var j in x) { [foo] = [j] }", top},
{0, "for (var j in x) { const foo = j }", {0}}, {true, "for (var j in x) { var foo = j }", top},
{0, "for (var j in x) { const [foo] = [j] }", {0}}, {true, "for (var j in x) { var [foo] = [j] }", top},
{0, "for (var j in x) { function foo() {return j} }", {0}}, {false, "for (var j in x) { let foo = j }", {0}},
{false, "for (var j in x) { let [foo] = [j] }", {0}},
{1, "for (var {j} in x) { foo = j }", top}, {false, "for (var j in x) { const foo = j }", {0}},
{1, "for (var {j} in x) { [foo] = [j] }", top}, {false, "for (var j in x) { const [foo] = [j] }", {0}},
{1, "for (var {j} in x) { var foo = j }", top}, {false, "for (var j in x) { function foo() {return j} }", {0}},
{1, "for (var {j} in x) { var [foo] = [j] }", top},
{0, "for (var {j} in x) { let foo = j }", {0}}, {true, "for (var {j} in x) { foo = j }", top},
{0, "for (var {j} in x) { let [foo] = [j] }", {0}}, {true, "for (var {j} in x) { [foo] = [j] }", top},
{0, "for (var {j} in x) { const foo = j }", {0}}, {true, "for (var {j} in x) { var foo = j }", top},
{0, "for (var {j} in x) { const [foo] = [j] }", {0}}, {true, "for (var {j} in x) { var [foo] = [j] }", top},
{0, "for (var {j} in x) { function foo() {return j} }", {0}}, {false, "for (var {j} in x) { let foo = j }", {0}},
{false, "for (var {j} in x) { let [foo] = [j] }", {0}},
{1, "for (let j in x) { foo = j }", top}, {false, "for (var {j} in x) { const foo = j }", {0}},
{1, "for (let j in x) { [foo] = [j] }", top}, {false, "for (var {j} in x) { const [foo] = [j] }", {0}},
{1, "for (let j in x) { var foo = j }", top}, {false, "for (var {j} in x) { function foo() {return j} }", {0}},
{1, "for (let j in x) { var [foo] = [j] }", top},
{0, "for (let j in x) { let foo = j }", {0, 0, 0}}, {true, "for (let j in x) { foo = j }", top},
{0, "for (let j in x) { let [foo] = [j] }", {0, 0, 0}}, {true, "for (let j in x) { [foo] = [j] }", top},
{0, "for (let j in x) { const foo = j }", {0, 0, 0}}, {true, "for (let j in x) { var foo = j }", top},
{0, "for (let j in x) { const [foo] = [j] }", {0, 0, 0}}, {true, "for (let j in x) { var [foo] = [j] }", top},
{0, "for (let j in x) { function foo() {return j} }", {0, 0, 0}}, {false, "for (let j in x) { let foo = j }", {0, 0, 0}},
{false, "for (let j in x) { let [foo] = [j] }", {0, 0, 0}},
{1, "for (let {j} in x) { foo = j }", top}, {false, "for (let j in x) { const foo = j }", {0, 0, 0}},
{1, "for (let {j} in x) { [foo] = [j] }", top}, {false, "for (let j in x) { const [foo] = [j] }", {0, 0, 0}},
{1, "for (let {j} in x) { var foo = j }", top}, {false, "for (let j in x) { function foo() {return j} }", {0, 0, 0}},
{1, "for (let {j} in x) { var [foo] = [j] }", top},
{0, "for (let {j} in x) { let foo = j }", {0, 0, 0}}, {true, "for (let {j} in x) { foo = j }", top},
{0, "for (let {j} in x) { let [foo] = [j] }", {0, 0, 0}}, {true, "for (let {j} in x) { [foo] = [j] }", top},
{0, "for (let {j} in x) { const foo = j }", {0, 0, 0}}, {true, "for (let {j} in x) { var foo = j }", top},
{0, "for (let {j} in x) { const [foo] = [j] }", {0, 0, 0}}, {true, "for (let {j} in x) { var [foo] = [j] }", top},
{0, "for (let {j} in x) { function foo() {return j} }", {0, 0, 0}}, {false, "for (let {j} in x) { let foo = j }", {0, 0, 0}},
{false, "for (let {j} in x) { let [foo] = [j] }", {0, 0, 0}},
{1, "for (const j in x) { foo = j }", top}, {false, "for (let {j} in x) { const foo = j }", {0, 0, 0}},
{1, "for (const j in x) { [foo] = [j] }", top}, {false, "for (let {j} in x) { const [foo] = [j] }", {0, 0, 0}},
{1, "for (const j in x) { var foo = j }", top}, {false, "for (let {j} in x) { function foo() {return j} }", {0, 0, 0}},
{1, "for (const j in x) { var [foo] = [j] }", top},
{0, "for (const j in x) { let foo = j }", {0, 0, 0}}, {true, "for (const j in x) { foo = j }", top},
{0, "for (const j in x) { let [foo] = [j] }", {0, 0, 0}}, {true, "for (const j in x) { [foo] = [j] }", top},
{0, "for (const j in x) { const foo = j }", {0, 0, 0}}, {true, "for (const j in x) { var foo = j }", top},
{0, "for (const j in x) { const [foo] = [j] }", {0, 0, 0}}, {true, "for (const j in x) { var [foo] = [j] }", top},
{0, "for (const j in x) { function foo() {return j} }", {0, 0, 0}}, {false, "for (const j in x) { let foo = j }", {0, 0, 0}},
{false, "for (const j in x) { let [foo] = [j] }", {0, 0, 0}},
{1, "for (const {j} in x) { foo = j }", top}, {false, "for (const j in x) { const foo = j }", {0, 0, 0}},
{1, "for (const {j} in x) { [foo] = [j] }", top}, {false, "for (const j in x) { const [foo] = [j] }", {0, 0, 0}},
{1, "for (const {j} in x) { var foo = j }", top}, {false, "for (const j in x) { function foo() {return j} }", {0, 0, 0}},
{1, "for (const {j} in x) { var [foo] = [j] }", top},
{0, "for (const {j} in x) { let foo = j }", {0, 0, 0}}, {true, "for (const {j} in x) { foo = j }", top},
{0, "for (const {j} in x) { let [foo] = [j] }", {0, 0, 0}}, {true, "for (const {j} in x) { [foo] = [j] }", top},
{0, "for (const {j} in x) { const foo = j }", {0, 0, 0}}, {true, "for (const {j} in x) { var foo = j }", top},
{0, "for (const {j} in x) { const [foo] = [j] }", {0, 0, 0}}, {true, "for (const {j} in x) { var [foo] = [j] }", top},
{0, "for (const {j} in x) { function foo() {return j} }", {0, 0, 0}}, {false, "for (const {j} in x) { let foo = j }", {0, 0, 0}},
{false, "for (const {j} in x) { let [foo] = [j] }", {0, 0, 0}},
{1, "while (j) { foo = j }", top}, {false, "for (const {j} in x) { const foo = j }", {0, 0, 0}},
{1, "while (j) { [foo] = [j] }", top}, {false, "for (const {j} in x) { const [foo] = [j] }", {0, 0, 0}},
{1, "while (j) { var foo = j }", top}, {false, "for (const {j} in x) { function foo() {return j} }", {0, 0, 0}},
{1, "while (j) { var [foo] = [j] }", top},
{0, "while (j) { let foo = j }", {0}}, {true, "while (j) { foo = j }", top},
{0, "while (j) { let [foo] = [j] }", {0}}, {true, "while (j) { [foo] = [j] }", top},
{0, "while (j) { const foo = j }", {0}}, {true, "while (j) { var foo = j }", top},
{0, "while (j) { const [foo] = [j] }", {0}}, {true, "while (j) { var [foo] = [j] }", top},
{0, "while (j) { function foo() {return j} }", {0}}, {false, "while (j) { let foo = j }", {0}},
{false, "while (j) { let [foo] = [j] }", {0}},
{1, "do { foo = j } while (j)", top}, {false, "while (j) { const foo = j }", {0}},
{1, "do { [foo] = [j] } while (j)", top}, {false, "while (j) { const [foo] = [j] }", {0}},
{1, "do { var foo = j } while (j)", top}, {false, "while (j) { function foo() {return j} }", {0}},
{1, "do { var [foo] = [j] } while (j)", top},
{0, "do { let foo = j } while (j)", {0}}, {true, "do { foo = j } while (j)", top},
{0, "do { let [foo] = [j] } while (j)", {0}}, {true, "do { [foo] = [j] } while (j)", top},
{0, "do { const foo = j } while (j)", {0}}, {true, "do { var foo = j } while (j)", top},
{0, "do { const [foo] = [j] } while (j)", {0}}, {true, "do { var [foo] = [j] } while (j)", top},
{0, "do { function foo() {return j} } while (j)", {0}}, {false, "do { let foo = j } while (j)", {0}},
{false, "do { let [foo] = [j] } while (j)", {0}},
{false, "do { const foo = j } while (j)", {0}},
{false, "do { const [foo] = [j] } while (j)", {0}},
{false, "do { function foo() {return j} } while (j)", {0}},
}; };
Input script_only_tests[] = { Input script_only_tests[] = {
{1, "for (j=x; j<10; ++j) { function foo() {return j} }", top}, {true, "for (j=x; j<10; ++j) { function foo() {return j} }", top},
{1, "for ({j}=x; j<10; ++j) { function foo() {return j} }", top}, {true, "for ({j}=x; j<10; ++j) { function foo() {return j} }", top},
{1, "for (var j=x; j<10; ++j) { function foo() {return j} }", top}, {true, "for (var j=x; j<10; ++j) { function foo() {return j} }", top},
{1, "for (var {j}=x; j<10; ++j) { function foo() {return j} }", top}, {true, "for (var {j}=x; j<10; ++j) { function foo() {return j} }", top},
{1, "for (let j=x; j<10; ++j) { function foo() {return j} }", top}, {true, "for (let j=x; j<10; ++j) { function foo() {return j} }", top},
{1, "for (let {j}=x; j<10; ++j) { function foo() {return j} }", top}, {true, "for (let {j}=x; j<10; ++j) { function foo() {return j} }", top},
{1, "for (j of x) { function foo() {return j} }", top}, {true, "for (j of x) { function foo() {return j} }", top},
{1, "for ({j} of x) { function foo() {return j} }", top}, {true, "for ({j} of x) { function foo() {return j} }", top},
{1, "for (var j of x) { function foo() {return j} }", top}, {true, "for (var j of x) { function foo() {return j} }", top},
{1, "for (var {j} of x) { function foo() {return j} }", top}, {true, "for (var {j} of x) { function foo() {return j} }", top},
{1, "for (let j of x) { function foo() {return j} }", top}, {true, "for (let j of x) { function foo() {return j} }", top},
{1, "for (let {j} of x) { function foo() {return j} }", top}, {true, "for (let {j} of x) { function foo() {return j} }", top},
{1, "for (const j of x) { function foo() {return j} }", top}, {true, "for (const j of x) { function foo() {return j} }", top},
{1, "for (const {j} of x) { function foo() {return j} }", top}, {true, "for (const {j} of x) { function foo() {return j} }", top},
{1, "for (j in x) { function foo() {return j} }", top}, {true, "for (j in x) { function foo() {return j} }", top},
{1, "for ({j} in x) { function foo() {return j} }", top}, {true, "for ({j} in x) { function foo() {return j} }", top},
{1, "for (var j in x) { function foo() {return j} }", top}, {true, "for (var j in x) { function foo() {return j} }", top},
{1, "for (var {j} in x) { function foo() {return j} }", top}, {true, "for (var {j} in x) { function foo() {return j} }", top},
{1, "for (let j in x) { function foo() {return j} }", top}, {true, "for (let j in x) { function foo() {return j} }", top},
{1, "for (let {j} in x) { function foo() {return j} }", top}, {true, "for (let {j} in x) { function foo() {return j} }", top},
{1, "for (const j in x) { function foo() {return j} }", top}, {true, "for (const j in x) { function foo() {return j} }", top},
{1, "for (const {j} in x) { function foo() {return j} }", top}, {true, "for (const {j} in x) { function foo() {return j} }", top},
{1, "while (j) { function foo() {return j} }", top}, {true, "while (j) { function foo() {return j} }", top},
{1, "do { function foo() {return j} } while (j)", top}, {true, "do { function foo() {return j} } while (j)", top},
}; };
for (unsigned i = 0; i < arraysize(module_and_script_tests); ++i) { for (unsigned i = 0; i < arraysize(module_and_script_tests); ++i) {
......
...@@ -198,8 +198,8 @@ TEST(Run_WasmModule_Global) { ...@@ -198,8 +198,8 @@ TEST(Run_WasmModule_Global) {
TestSignatures sigs; TestSignatures sigs;
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint32_t global1 = builder->AddGlobal(kWasmI32, 0); uint32_t global1 = builder->AddGlobal(kWasmI32, false);
uint32_t global2 = builder->AddGlobal(kWasmI32, 0); uint32_t global2 = builder->AddGlobal(kWasmI32, false);
WasmFunctionBuilder* f1 = builder->AddFunction(sigs.i_v()); WasmFunctionBuilder* f1 = builder->AddFunction(sigs.i_v());
byte code1[] = { byte code1[] = {
WASM_I32_ADD(WASM_GET_GLOBAL(global1), WASM_GET_GLOBAL(global2))}; WASM_I32_ADD(WASM_GET_GLOBAL(global1), WASM_GET_GLOBAL(global2))};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment