| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 | 7 |
| 8 #include "src/wasm/encoder.h" | 8 #include "src/wasm/encoder.h" |
| 9 #include "src/wasm/wasm-js.h" | 9 #include "src/wasm/wasm-js.h" |
| 10 #include "src/wasm/wasm-macro-gen.h" | 10 #include "src/wasm/wasm-macro-gen.h" |
| 11 #include "src/wasm/wasm-module.h" | 11 #include "src/wasm/wasm-module.h" |
| 12 #include "src/wasm/wasm-opcodes.h" | 12 #include "src/wasm/wasm-opcodes.h" |
| 13 | 13 |
| 14 #include "test/cctest/cctest.h" | 14 #include "test/cctest/cctest.h" |
| 15 | 15 |
| 16 using namespace v8::base; | 16 using namespace v8::base; |
| 17 using namespace v8::internal; | 17 using namespace v8::internal; |
| 18 using namespace v8::internal::compiler; | 18 using namespace v8::internal::compiler; |
| 19 using namespace v8::internal::wasm; | 19 using namespace v8::internal::wasm; |
| 20 | 20 |
| 21 | 21 |
| 22 #if !V8_TARGET_ARCH_ARM64 | |
| 23 // TODO(titzer): fix arm64 frame alignment. | 22 // TODO(titzer): fix arm64 frame alignment. |
| 24 namespace { | 23 namespace { |
| 25 void TestModule(WasmModuleIndex* module, int32_t expected_result) { | 24 void TestModule(WasmModuleIndex* module, int32_t expected_result) { |
| 26 Isolate* isolate = CcTest::InitIsolateOnce(); | 25 Isolate* isolate = CcTest::InitIsolateOnce(); |
| 27 HandleScope scope(isolate); | 26 HandleScope scope(isolate); |
| 28 WasmJs::InstallWasmFunctionMap(isolate, isolate->native_context()); | 27 WasmJs::InstallWasmFunctionMap(isolate, isolate->native_context()); |
| 29 int32_t result = | 28 int32_t result = |
| 30 CompileAndRunWasmModule(isolate, module->Begin(), module->End()); | 29 CompileAndRunWasmModule(isolate, module->Begin(), module->End()); |
| 31 CHECK_EQ(expected_result, result); | 30 CHECK_EQ(expected_result, result); |
| 32 } | 31 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 f->ReturnType(kAstI32); | 199 f->ReturnType(kAstI32); |
| 201 f->Exported(1); | 200 f->Exported(1); |
| 202 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), | 201 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), |
| 203 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), | 202 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), |
| 204 WASM_RETURN(WASM_CALL_FUNCTION0(f1_index))}; | 203 WASM_RETURN(WASM_CALL_FUNCTION0(f1_index))}; |
| 205 f->EmitCode(code2, sizeof(code2)); | 204 f->EmitCode(code2, sizeof(code2)); |
| 206 WasmModuleWriter* writer = builder->Build(&zone); | 205 WasmModuleWriter* writer = builder->Build(&zone); |
| 207 TestModule(writer->WriteTo(&zone), 97); | 206 TestModule(writer->WriteTo(&zone), 97); |
| 208 } | 207 } |
| 209 #endif | 208 #endif |
| 210 | |
| 211 #endif // !V8_TARGET_ARCH_ARM64 | |
| OLD | NEW |