| OLD | NEW | 
|     1 // Copyright 2016 the V8 project authors. All rights reserved. |     1 // Copyright 2016 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 "src/value-serializer.h" |     5 #include "src/value-serializer.h" | 
|     6  |     6  | 
|     7 #include <algorithm> |     7 #include <algorithm> | 
|     8 #include <string> |     8 #include <string> | 
|     9  |     9  | 
|    10 #include "include/v8.h" |    10 #include "include/v8.h" | 
| (...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2549  |  2549  | 
|  2550  private: |  2550  private: | 
|  2551   static bool g_saved_flag; |  2551   static bool g_saved_flag; | 
|  2552 }; |  2552 }; | 
|  2553  |  2553  | 
|  2554 bool ValueSerializerTestWithWasm::g_saved_flag = false; |  2554 bool ValueSerializerTestWithWasm::g_saved_flag = false; | 
|  2555  |  2555  | 
|  2556 // A simple module which exports an "increment" function. |  2556 // A simple module which exports an "increment" function. | 
|  2557 // Copied from test/mjsunit/wasm/incrementer.wasm. |  2557 // Copied from test/mjsunit/wasm/incrementer.wasm. | 
|  2558 const unsigned char kIncrementerWasm[] = { |  2558 const unsigned char kIncrementerWasm[] = { | 
|  2559     0,   97, 115, 109, 13, 0,  0, 0, 1,   6,   1,  96,  1,   127, 1,   127, |  2559     0,   97, 115, 109, 1, 0,  0, 0, 1,   6,   1,  96,  1,   127, 1,   127, | 
|  2560     3,   2,  1,   0,   7,  13, 1, 9, 105, 110, 99, 114, 101, 109, 101, 110, |  2560     3,   2,  1,   0,   7, 13, 1, 9, 105, 110, 99, 114, 101, 109, 101, 110, | 
|  2561     116, 0,  0,   10,  9,  1,  7, 0, 32,  0,   65, 1,   106, 11, |  2561     116, 0,  0,   10,  9, 1,  7, 0, 32,  0,   65, 1,   106, 11, | 
|  2562 }; |  2562 }; | 
|  2563  |  2563  | 
|  2564 TEST_F(ValueSerializerTestWithWasm, RoundTripWasmModule) { |  2564 TEST_F(ValueSerializerTestWithWasm, RoundTripWasmModule) { | 
|  2565   RoundTripTest( |  2565   RoundTripTest( | 
|  2566       [this]() { |  2566       [this]() { | 
|  2567         return WasmCompiledModule::DeserializeOrCompile( |  2567         return WasmCompiledModule::DeserializeOrCompile( | 
|  2568                    isolate(), {nullptr, 0}, |  2568                    isolate(), {nullptr, 0}, | 
|  2569                    {kIncrementerWasm, sizeof(kIncrementerWasm)}) |  2569                    {kIncrementerWasm, sizeof(kIncrementerWasm)}) | 
|  2570             .ToLocalChecked(); |  2570             .ToLocalChecked(); | 
|  2571       }, |  2571       }, | 
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2683   InvalidDecodeTest(raw); |  2683   InvalidDecodeTest(raw); | 
|  2684 } |  2684 } | 
|  2685  |  2685  | 
|  2686 TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidDataLength) { |  2686 TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidDataLength) { | 
|  2687   InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x7f, 0x00}); |  2687   InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x7f, 0x00}); | 
|  2688   InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x00, 0x7f}); |  2688   InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x00, 0x7f}); | 
|  2689 } |  2689 } | 
|  2690  |  2690  | 
|  2691 }  // namespace |  2691 }  // namespace | 
|  2692 }  // namespace v8 |  2692 }  // namespace v8 | 
| OLD | NEW |