Upgrade V8 to 5.1.281.57  DO NOT MERGE

FPIIM-449

Change-Id: Id981b686b4d587ac31697662eb98bb34be42ad90
(cherry picked from commit 3b9bc31999c9787eb726ecdbfd5796bfdec32a18)
diff --git a/test/cctest/wasm/test-run-wasm-module.cc b/test/cctest/wasm/test-run-wasm-module.cc
index 905e8e4..118a91f 100644
--- a/test/cctest/wasm/test-run-wasm-module.cc
+++ b/test/cctest/wasm/test-run-wasm-module.cc
@@ -19,7 +19,6 @@
 using namespace v8::internal::wasm;
 
 
-#if !V8_TARGET_ARCH_ARM64
 // TODO(titzer): fix arm64 frame alignment.
 namespace {
 void TestModule(WasmModuleIndex* module, int32_t expected_result) {
@@ -36,19 +35,24 @@
 // A raw test that skips the WasmModuleBuilder.
 TEST(Run_WasmModule_CallAdd_rev) {
   static const byte data[] = {
+      WASM_MODULE_HEADER,
       // sig#0 ------------------------------------------
-      kDeclSignatures, 2, 0, kLocalI32,    // void -> int
-      2, kLocalI32, kLocalI32, kLocalI32,  // int,int -> int
+      WASM_SECTION_SIGNATURES_SIZE + 7,          // Section size.
+      WASM_SECTION_SIGNATURES, 2, 0, kLocalI32,  // void -> int
+      2, kLocalI32, kLocalI32, kLocalI32,        // int,int -> int
       // func#0 (main) ----------------------------------
-      kDeclFunctions, 2, kDeclFunctionExport, 0, 0,  // sig index
-      6, 0,                                          // body size
-      kExprCallFunction, 1,                          // --
-      kExprI8Const, 77,                              // --
-      kExprI8Const, 22,                              // --
+      WASM_SECTION_FUNCTIONS_SIZE + 24, WASM_SECTION_FUNCTIONS, 2,
+      kDeclFunctionExport, 0, 0,  // sig index
+      7, 0,                       // body size
+      0,                          // locals
+      kExprCallFunction, 1,       // --
+      kExprI8Const, 77,           // --
+      kExprI8Const, 22,           // --
       // func#1 -----------------------------------------
       0,                 // no name, not exported
       1, 0,              // sig index
-      5, 0,              // body size
+      6, 0,              // body size
+      0,                 // locals
       kExprI32Add,       // --
       kExprGetLocal, 0,  // --
       kExprGetLocal, 1,  // --
@@ -65,7 +69,8 @@
 
 TEST(Run_WasmModule_Return114) {
   static const int32_t kReturnValue = 114;
-  Zone zone;
+  v8::base::AccountingAllocator allocator;
+  Zone zone(&allocator);
   WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
   uint16_t f_index = builder->AddFunction();
   WasmFunctionBuilder* f = builder->FunctionAt(f_index);
@@ -79,7 +84,8 @@
 
 
 TEST(Run_WasmModule_CallAdd) {
-  Zone zone;
+  v8::base::AccountingAllocator allocator;
+  Zone zone(&allocator);
   WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
   uint16_t f1_index = builder->AddFunction();
   WasmFunctionBuilder* f = builder->FunctionAt(f1_index);
@@ -102,7 +108,8 @@
 
 TEST(Run_WasmModule_ReadLoadedDataSegment) {
   static const byte kDataSegmentDest0 = 12;
-  Zone zone;
+  v8::base::AccountingAllocator allocator;
+  Zone zone(&allocator);
   WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
   uint16_t f_index = builder->AddFunction();
   WasmFunctionBuilder* f = builder->FunctionAt(f_index);
@@ -118,19 +125,10 @@
   TestModule(writer->WriteTo(&zone), 0xddccbbaa);
 }
 
-
-#if defined(__has_feature)
-#if __has_feature(address_sanitizer)
-#define V8_WITH_ASAN 1
-#endif
-#endif
-
-
-#if !defined(V8_WITH_ASAN)
-// TODO(bradnelson): Figure out why this crashes under asan.
 TEST(Run_WasmModule_CheckMemoryIsZero) {
   static const int kCheckSize = 16 * 1024;
-  Zone zone;
+  v8::base::AccountingAllocator allocator;
+  Zone zone(&allocator);
   WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
   uint16_t f_index = builder->AddFunction();
   WasmFunctionBuilder* f = builder->FunctionAt(f_index);
@@ -140,23 +138,19 @@
   byte code[] = {WASM_BLOCK(
       2,
       WASM_WHILE(
-          WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I32(kCheckSize)),
+          WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I32V_3(kCheckSize)),
           WASM_IF_ELSE(
               WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(localIndex)),
               WASM_BRV(2, WASM_I8(-1)), WASM_INC_LOCAL_BY(localIndex, 4))),
       WASM_I8(11))};
-  uint32_t local_indices[] = {7, 19, 25, 28};
-  f->EmitCode(code, sizeof(code), local_indices, sizeof(local_indices) / 4);
+  f->EmitCode(code, sizeof(code), nullptr, 0);
   WasmModuleWriter* writer = builder->Build(&zone);
   TestModule(writer->WriteTo(&zone), 11);
 }
-#endif
 
-
-#if !defined(V8_WITH_ASAN)
-// TODO(bradnelson): Figure out why this crashes under asan.
 TEST(Run_WasmModule_CallMain_recursive) {
-  Zone zone;
+  v8::base::AccountingAllocator allocator;
+  Zone zone(&allocator);
   WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
   uint16_t f_index = builder->AddFunction();
   WasmFunctionBuilder* f = builder->FunctionAt(f_index);
@@ -171,18 +165,14 @@
                                                 WASM_INC_LOCAL(localIndex)),
                               WASM_BRV(1, WASM_CALL_FUNCTION0(0))),
                    WASM_BRV(0, WASM_I8(55))))};
-  uint32_t local_indices[] = {3, 11, 21, 24};
-  f->EmitCode(code, sizeof(code), local_indices, sizeof(local_indices) / 4);
+  f->EmitCode(code, sizeof(code), nullptr, 0);
   WasmModuleWriter* writer = builder->Build(&zone);
   TestModule(writer->WriteTo(&zone), 55);
 }
-#endif
 
-
-#if !defined(V8_WITH_ASAN)
-// TODO(bradnelson): Figure out why this crashes under asan.
 TEST(Run_WasmModule_Global) {
-  Zone zone;
+  v8::base::AccountingAllocator allocator;
+  Zone zone(&allocator);
   WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
   uint32_t global1 = builder->AddGlobal(MachineType::Int32(), 0);
   uint32_t global2 = builder->AddGlobal(MachineType::Int32(), 0);
@@ -196,13 +186,10 @@
   f = builder->FunctionAt(f2_index);
   f->ReturnType(kAstI32);
   f->Exported(1);
-  byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32(56)),
-                  WASM_STORE_GLOBAL(global2, WASM_I32(41)),
+  byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)),
+                  WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)),
                   WASM_RETURN(WASM_CALL_FUNCTION0(f1_index))};
   f->EmitCode(code2, sizeof(code2));
   WasmModuleWriter* writer = builder->Build(&zone);
   TestModule(writer->WriteTo(&zone), 97);
 }
-#endif
-
-#endif  // !V8_TARGET_ARCH_ARM64