Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Side by Side Diff: test/unittests/value-serializer-unittest.cc

Issue 2748473004: [wasm] Transferrable modules (Closed)
Patch Set: test patch Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 } 68 }
69 69
70 const Local<Context>& serialization_context() { 70 const Local<Context>& serialization_context() {
71 return serialization_context_; 71 return serialization_context_;
72 } 72 }
73 const Local<Context>& deserialization_context() { 73 const Local<Context>& deserialization_context() {
74 return deserialization_context_; 74 return deserialization_context_;
75 } 75 }
76 76
77 bool ExpectInlineWasm() const { return expect_inline_wasm_; }
78 void SetExpectInlineWasm(bool value) { expect_inline_wasm_ = value; }
79
77 // Overridden in more specific fixtures. 80 // Overridden in more specific fixtures.
78 virtual ValueSerializer::Delegate* GetSerializerDelegate() { return nullptr; } 81 virtual ValueSerializer::Delegate* GetSerializerDelegate() { return nullptr; }
79 virtual void BeforeEncode(ValueSerializer*) {} 82 virtual void BeforeEncode(ValueSerializer*) {}
80 virtual void AfterEncode() {} 83 virtual void AfterEncode() {}
81 virtual ValueDeserializer::Delegate* GetDeserializerDelegate() { 84 virtual ValueDeserializer::Delegate* GetDeserializerDelegate() {
82 return nullptr; 85 return nullptr;
83 } 86 }
84 virtual void BeforeDecode(ValueDeserializer*) {} 87 virtual void BeforeDecode(ValueDeserializer*) {}
85 88
86 template <typename InputFunctor, typename OutputFunctor> 89 template <typename InputFunctor, typename OutputFunctor>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 template <typename OutputFunctor> 168 template <typename OutputFunctor>
166 void DecodeTest(const std::vector<uint8_t>& data, 169 void DecodeTest(const std::vector<uint8_t>& data,
167 const OutputFunctor& output_functor) { 170 const OutputFunctor& output_functor) {
168 Local<Context> context = deserialization_context(); 171 Local<Context> context = deserialization_context();
169 Context::Scope scope(context); 172 Context::Scope scope(context);
170 TryCatch try_catch(isolate()); 173 TryCatch try_catch(isolate());
171 ValueDeserializer deserializer(isolate(), &data[0], 174 ValueDeserializer deserializer(isolate(), &data[0],
172 static_cast<int>(data.size()), 175 static_cast<int>(data.size()),
173 GetDeserializerDelegate()); 176 GetDeserializerDelegate());
174 deserializer.SetSupportsLegacyWireFormat(true); 177 deserializer.SetSupportsLegacyWireFormat(true);
178 deserializer.SetExpectInlineWasm(ExpectInlineWasm());
175 BeforeDecode(&deserializer); 179 BeforeDecode(&deserializer);
176 ASSERT_TRUE(deserializer.ReadHeader(context).FromMaybe(false)); 180 ASSERT_TRUE(deserializer.ReadHeader(context).FromMaybe(false));
177 Local<Value> result; 181 Local<Value> result;
178 ASSERT_TRUE(deserializer.ReadValue(context).ToLocal(&result)); 182 ASSERT_TRUE(deserializer.ReadValue(context).ToLocal(&result));
179 ASSERT_FALSE(result.IsEmpty()); 183 ASSERT_FALSE(result.IsEmpty());
180 ASSERT_FALSE(try_catch.HasCaught()); 184 ASSERT_FALSE(try_catch.HasCaught());
181 ASSERT_TRUE( 185 ASSERT_TRUE(
182 context->Global() 186 context->Global()
183 ->CreateDataProperty(context, StringFromUtf8("result"), result) 187 ->CreateDataProperty(context, StringFromUtf8("result"), result)
184 .FromMaybe(false)); 188 .FromMaybe(false));
185 output_functor(result); 189 output_functor(result);
186 ASSERT_FALSE(try_catch.HasCaught()); 190 ASSERT_FALSE(try_catch.HasCaught());
187 } 191 }
188 192
189 template <typename OutputFunctor> 193 template <typename OutputFunctor>
190 void DecodeTestForVersion0(const std::vector<uint8_t>& data, 194 void DecodeTestForVersion0(const std::vector<uint8_t>& data,
191 const OutputFunctor& output_functor) { 195 const OutputFunctor& output_functor) {
192 Local<Context> context = deserialization_context(); 196 Local<Context> context = deserialization_context();
193 Context::Scope scope(context); 197 Context::Scope scope(context);
194 TryCatch try_catch(isolate()); 198 TryCatch try_catch(isolate());
195 ValueDeserializer deserializer(isolate(), &data[0], 199 ValueDeserializer deserializer(isolate(), &data[0],
196 static_cast<int>(data.size()), 200 static_cast<int>(data.size()),
197 GetDeserializerDelegate()); 201 GetDeserializerDelegate());
198 deserializer.SetSupportsLegacyWireFormat(true); 202 deserializer.SetSupportsLegacyWireFormat(true);
203 deserializer.SetExpectInlineWasm(ExpectInlineWasm());
199 BeforeDecode(&deserializer); 204 BeforeDecode(&deserializer);
200 ASSERT_TRUE(deserializer.ReadHeader(context).FromMaybe(false)); 205 ASSERT_TRUE(deserializer.ReadHeader(context).FromMaybe(false));
201 ASSERT_EQ(0u, deserializer.GetWireFormatVersion()); 206 ASSERT_EQ(0u, deserializer.GetWireFormatVersion());
202 Local<Value> result; 207 Local<Value> result;
203 ASSERT_TRUE(deserializer.ReadValue(context).ToLocal(&result)); 208 ASSERT_TRUE(deserializer.ReadValue(context).ToLocal(&result));
204 ASSERT_FALSE(result.IsEmpty()); 209 ASSERT_FALSE(result.IsEmpty());
205 ASSERT_FALSE(try_catch.HasCaught()); 210 ASSERT_FALSE(try_catch.HasCaught());
206 ASSERT_TRUE( 211 ASSERT_TRUE(
207 context->Global() 212 context->Global()
208 ->CreateDataProperty(context, StringFromUtf8("result"), result) 213 ->CreateDataProperty(context, StringFromUtf8("result"), result)
209 .FromMaybe(false)); 214 .FromMaybe(false));
210 output_functor(result); 215 output_functor(result);
211 ASSERT_FALSE(try_catch.HasCaught()); 216 ASSERT_FALSE(try_catch.HasCaught());
212 } 217 }
213 218
214 void InvalidDecodeTest(const std::vector<uint8_t>& data) { 219 void InvalidDecodeTest(const std::vector<uint8_t>& data) {
215 Local<Context> context = deserialization_context(); 220 Local<Context> context = deserialization_context();
216 Context::Scope scope(context); 221 Context::Scope scope(context);
217 TryCatch try_catch(isolate()); 222 TryCatch try_catch(isolate());
218 ValueDeserializer deserializer(isolate(), &data[0], 223 ValueDeserializer deserializer(isolate(), &data[0],
219 static_cast<int>(data.size()), 224 static_cast<int>(data.size()),
220 GetDeserializerDelegate()); 225 GetDeserializerDelegate());
221 deserializer.SetSupportsLegacyWireFormat(true); 226 deserializer.SetSupportsLegacyWireFormat(true);
227 deserializer.SetExpectInlineWasm(ExpectInlineWasm());
222 BeforeDecode(&deserializer); 228 BeforeDecode(&deserializer);
223 Maybe<bool> header_result = deserializer.ReadHeader(context); 229 Maybe<bool> header_result = deserializer.ReadHeader(context);
224 if (header_result.IsNothing()) { 230 if (header_result.IsNothing()) {
225 EXPECT_TRUE(try_catch.HasCaught()); 231 EXPECT_TRUE(try_catch.HasCaught());
226 return; 232 return;
227 } 233 }
228 ASSERT_TRUE(header_result.ToChecked()); 234 ASSERT_TRUE(header_result.ToChecked());
229 ASSERT_TRUE(deserializer.ReadValue(context).IsEmpty()); 235 ASSERT_TRUE(deserializer.ReadValue(context).IsEmpty());
230 EXPECT_TRUE(try_catch.HasCaught()); 236 EXPECT_TRUE(try_catch.HasCaught());
231 } 237 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 Local<ArrayBuffer> ab = 274 Local<ArrayBuffer> ab =
269 ArrayBuffer::New(isolate(), static_cast<void*>(data), sizeof(data)); 275 ArrayBuffer::New(isolate(), static_cast<void*>(data), sizeof(data));
270 return Uint8Array::New(ab, 0, sizeof(data)); 276 return Uint8Array::New(ab, 0, sizeof(data));
271 } 277 }
272 278
273 private: 279 private:
274 Local<Context> serialization_context_; 280 Local<Context> serialization_context_;
275 Local<Context> deserialization_context_; 281 Local<Context> deserialization_context_;
276 Local<FunctionTemplate> host_object_constructor_template_; 282 Local<FunctionTemplate> host_object_constructor_template_;
277 i::Isolate* isolate_; 283 i::Isolate* isolate_;
284 bool expect_inline_wasm_ = false;
278 285
279 DISALLOW_COPY_AND_ASSIGN(ValueSerializerTest); 286 DISALLOW_COPY_AND_ASSIGN(ValueSerializerTest);
280 }; 287 };
281 288
282 TEST_F(ValueSerializerTest, DecodeInvalid) { 289 TEST_F(ValueSerializerTest, DecodeInvalid) {
283 // Version tag but no content. 290 // Version tag but no content.
284 InvalidDecodeTest({0xff}); 291 InvalidDecodeTest({0xff});
285 // Version too large. 292 // Version too large.
286 InvalidDecodeTest({0xff, 0x7f, 0x5f}); 293 InvalidDecodeTest({0xff, 0x7f, 0x5f});
287 // Nonsense tag. 294 // Nonsense tag.
(...skipping 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 EXPECT_TRUE( 2594 EXPECT_TRUE(
2588 EvaluateScriptForResultBool("result.a.toString() === '4,5,6'")); 2595 EvaluateScriptForResultBool("result.a.toString() === '4,5,6'"));
2589 EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); 2596 EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b"));
2590 }); 2597 });
2591 } 2598 }
2592 2599
2593 // It's expected that WebAssembly has more exhaustive tests elsewhere; this 2600 // It's expected that WebAssembly has more exhaustive tests elsewhere; this
2594 // mostly checks that the logic to embed it in structured clone serialization 2601 // mostly checks that the logic to embed it in structured clone serialization
2595 // works correctly. 2602 // works correctly.
2596 2603
2604 // A simple module which exports an "increment" function.
2605 // Copied from test/mjsunit/wasm/incrementer.wasm.
2606 const unsigned char kIncrementerWasm[] = {
2607 0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 1, 127, 1, 127,
2608 3, 2, 1, 0, 7, 13, 1, 9, 105, 110, 99, 114, 101, 109, 101, 110,
2609 116, 0, 0, 10, 9, 1, 7, 0, 32, 0, 65, 1, 106, 11,
2610 };
2611
2597 class ValueSerializerTestWithWasm : public ValueSerializerTest { 2612 class ValueSerializerTestWithWasm : public ValueSerializerTest {
2613 public:
2614 ValueSerializerTestWithWasm()
2615 : serialize_delegate_(&transfer_modules_),
2616 deserialize_delegate_(&transfer_modules_) {}
2617
2618 void Reset() {
2619 current_serializer_delegate_ = nullptr;
2620 transfer_modules_.clear();
2621 SetExpectInlineWasm(false);
2622 }
2623
2624 void EnableTransferSerialization() {
2625 current_serializer_delegate_ = &serialize_delegate_;
2626 }
2627
2628 void EnableTransferDeserialization() {
2629 current_deserializer_delegate_ = &deserialize_delegate_;
2630 }
2631
2598 protected: 2632 protected:
2599 static void SetUpTestCase() { 2633 static void SetUpTestCase() {
2600 g_saved_flag = i::FLAG_expose_wasm; 2634 g_saved_flag = i::FLAG_expose_wasm;
2601 i::FLAG_expose_wasm = true; 2635 i::FLAG_expose_wasm = true;
2602 ValueSerializerTest::SetUpTestCase(); 2636 ValueSerializerTest::SetUpTestCase();
2603 } 2637 }
2604 2638
2605 static void TearDownTestCase() { 2639 static void TearDownTestCase() {
2606 ValueSerializerTest::TearDownTestCase(); 2640 ValueSerializerTest::TearDownTestCase();
2607 i::FLAG_expose_wasm = g_saved_flag; 2641 i::FLAG_expose_wasm = g_saved_flag;
2608 g_saved_flag = false; 2642 g_saved_flag = false;
2609 } 2643 }
2610 2644
2645 class SerializeToTransfer : public ValueSerializer::Delegate {
2646 public:
2647 SerializeToTransfer(
2648 std::vector<WasmCompiledModule::TransferrableModule>* modules)
2649 : modules_(modules) {}
2650 Maybe<uint32_t> GetWasmModuleTransferId(
2651 Isolate* isolate, Local<WasmCompiledModule> module) override {
2652 modules_->push_back(module->GetTransferrableModule());
2653 return Just(static_cast<uint32_t>(modules_->size()) - 1);
2654 }
2655
2656 void ThrowDataCloneError(Local<String> message) override { UNREACHABLE(); }
2657
2658 private:
2659 std::vector<WasmCompiledModule::TransferrableModule>* modules_;
2660 };
2661
2662 class DeserializeFromTransfer : public ValueDeserializer::Delegate {
2663 public:
2664 DeserializeFromTransfer(
2665 std::vector<WasmCompiledModule::TransferrableModule>* modules)
2666 : modules_(modules) {}
2667
2668 MaybeLocal<WasmCompiledModule> GetWasmModuleFromId(Isolate* isolate,
2669 uint32_t id) override {
2670 return WasmCompiledModule::FromTransferrableModule(isolate,
2671 modules_->at(id));
2672 }
2673
2674 private:
2675 std::vector<WasmCompiledModule::TransferrableModule>* modules_;
2676 };
2677
2678 ValueSerializer::Delegate* GetSerializerDelegate() override {
2679 return current_serializer_delegate_;
2680 }
2681
2682 ValueDeserializer::Delegate* GetDeserializerDelegate() override {
2683 return current_deserializer_delegate_;
2684 }
2685
2686 Local<WasmCompiledModule> MakeWasm() {
2687 return WasmCompiledModule::DeserializeOrCompile(
2688 isolate(), {nullptr, 0},
2689 {kIncrementerWasm, sizeof(kIncrementerWasm)})
2690 .ToLocalChecked();
2691 }
2692
2693 void ExpectPass() {
2694 RoundTripTest(
2695 [this]() { return MakeWasm(); },
2696 [this](Local<Value> value) {
2697 ASSERT_TRUE(value->IsWebAssemblyCompiledModule());
2698 EXPECT_TRUE(EvaluateScriptForResultBool(
2699 "new WebAssembly.Instance(result).exports.increment(8) === 9"));
2700 });
2701 }
2702
2703 void ExpectFail() {
2704 EncodeTest(
2705 [this]() { return MakeWasm(); },
2706 [this](const std::vector<uint8_t>& data) { InvalidDecodeTest(data); });
2707 }
2708
2709 Local<Value> GetComplexObjectWithDuplicate() {
2710 Local<Value> wasm_module = MakeWasm();
2711 serialization_context()
2712 ->Global()
2713 ->CreateDataProperty(serialization_context(),
2714 StringFromUtf8("wasm_module"), wasm_module)
2715 .FromMaybe(false);
2716 Local<Script> script =
2717 Script::Compile(
2718 serialization_context(),
2719 StringFromUtf8("({mod1: wasm_module, num: 2, mod2: wasm_module})"))
2720 .ToLocalChecked();
2721 return script->Run(serialization_context()).ToLocalChecked();
2722 }
2723
2724 void VerifyComplexObject(Local<Value> value) {
2725 ASSERT_TRUE(value->IsObject());
2726 EXPECT_TRUE(EvaluateScriptForResultBool(
2727 "result.mod1 instanceof WebAssembly.Module"));
2728 EXPECT_TRUE(EvaluateScriptForResultBool(
2729 "result.mod2 instanceof WebAssembly.Module"));
2730 EXPECT_TRUE(EvaluateScriptForResultBool("result.num === 2"));
2731 }
2732
2733 Local<Value> GetComplexObjectWithMany() {
2734 Local<Value> wasm_module1 = MakeWasm();
2735 Local<Value> wasm_module2 = MakeWasm();
2736 serialization_context()
2737 ->Global()
2738 ->CreateDataProperty(serialization_context(),
2739 StringFromUtf8("wasm_module1"), wasm_module1)
2740 .FromMaybe(false);
2741 serialization_context()
2742 ->Global()
2743 ->CreateDataProperty(serialization_context(),
2744 StringFromUtf8("wasm_module2"), wasm_module2)
2745 .FromMaybe(false);
2746 Local<Script> script =
2747 Script::Compile(
2748 serialization_context(),
2749 StringFromUtf8(
2750 "({mod1: wasm_module1, num: 2, mod2: wasm_module2})"))
2751 .ToLocalChecked();
2752 return script->Run(serialization_context()).ToLocalChecked();
2753 }
2754
2611 private: 2755 private:
2612 static bool g_saved_flag; 2756 static bool g_saved_flag;
2757 std::vector<WasmCompiledModule::TransferrableModule> transfer_modules_;
2758 SerializeToTransfer serialize_delegate_;
2759 DeserializeFromTransfer deserialize_delegate_;
2760 ValueSerializer::Delegate* current_serializer_delegate_ = nullptr;
2761 ValueDeserializer::Delegate* current_deserializer_delegate_ = nullptr;
2613 }; 2762 };
2614 2763
2615 bool ValueSerializerTestWithWasm::g_saved_flag = false; 2764 bool ValueSerializerTestWithWasm::g_saved_flag = false;
2616 2765
2617 // A simple module which exports an "increment" function. 2766 // We only want to allow deserialization through
2618 // Copied from test/mjsunit/wasm/incrementer.wasm. 2767 // transferred modules - which requres both serializer
2619 const unsigned char kIncrementerWasm[] = { 2768 // and deserializer to understand that - or through
2620 0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 1, 127, 1, 127, 2769 // explicitly allowing inlined data, which requires
2621 3, 2, 1, 0, 7, 13, 1, 9, 105, 110, 99, 114, 101, 109, 101, 110, 2770 // deserializer opt-in (we default the serializer to
2622 116, 0, 0, 10, 9, 1, 7, 0, 32, 0, 65, 1, 106, 11, 2771 // inlined data because we don't trust that data on the
2623 }; 2772 // receiving end anyway).
2624 2773
2625 TEST_F(ValueSerializerTestWithWasm, RoundTripWasmModule) { 2774 TEST_F(ValueSerializerTestWithWasm, RoundtripWasmTransfer) {
2775 EnableTransferSerialization();
2776 EnableTransferDeserialization();
2777 ExpectPass();
2778 }
2779
2780 TEST_F(ValueSerializerTestWithWasm, RountripWasmInline) {
2781 SetExpectInlineWasm(true);
2782 ExpectPass();
2783 }
2784
2785 TEST_F(ValueSerializerTestWithWasm, CannotDeserializeWasmInlineData) {
2786 ExpectFail();
2787 }
2788
2789 TEST_F(ValueSerializerTestWithWasm, CannotTransferWasmWhenExpectingInline) {
2790 EnableTransferSerialization();
2791 SetExpectInlineWasm(true);
2792 ExpectFail();
2793 }
2794
2795 TEST_F(ValueSerializerTestWithWasm, ComplexObjectDuplicateTransfer) {
2796 EnableTransferSerialization();
2797 EnableTransferDeserialization();
2626 RoundTripTest( 2798 RoundTripTest(
2627 [this]() { 2799 [this]() { return GetComplexObjectWithDuplicate(); },
2628 return WasmCompiledModule::DeserializeOrCompile(
2629 isolate(), {nullptr, 0},
2630 {kIncrementerWasm, sizeof(kIncrementerWasm)})
2631 .ToLocalChecked();
2632 },
2633 [this](Local<Value> value) { 2800 [this](Local<Value> value) {
2634 ASSERT_TRUE(value->IsWebAssemblyCompiledModule()); 2801 VerifyComplexObject(value);
2635 EXPECT_TRUE(EvaluateScriptForResultBool( 2802 EXPECT_TRUE(EvaluateScriptForResultBool("result.mod1 === result.mod2"));
2636 "new WebAssembly.Instance(result).exports.increment(8) === 9"));
2637 }); 2803 });
2638 } 2804 }
2639 2805
2806 TEST_F(ValueSerializerTestWithWasm, ComplexObjectDuplicateInline) {
2807 SetExpectInlineWasm(true);
2808 RoundTripTest(
2809 [this]() { return GetComplexObjectWithDuplicate(); },
2810 [this](Local<Value> value) {
2811 VerifyComplexObject(value);
2812 EXPECT_TRUE(EvaluateScriptForResultBool("result.mod1 === result.mod2"));
2813 });
2814 }
2815
2816 TEST_F(ValueSerializerTestWithWasm, ComplexObjectWithManyTransfer) {
2817 EnableTransferSerialization();
2818 EnableTransferDeserialization();
2819 RoundTripTest(
2820 [this]() { return GetComplexObjectWithMany(); },
2821 [this](Local<Value> value) {
2822 VerifyComplexObject(value);
2823 EXPECT_TRUE(EvaluateScriptForResultBool("result.mod1 != result.mod2"));
2824 });
2825 }
2826
2827 TEST_F(ValueSerializerTestWithWasm, ComplexObjectWithManyInline) {
2828 SetExpectInlineWasm(true);
2829 RoundTripTest(
2830 [this]() { return GetComplexObjectWithMany(); },
2831 [this](Local<Value> value) {
2832 VerifyComplexObject(value);
2833 EXPECT_TRUE(EvaluateScriptForResultBool("result.mod1 != result.mod2"));
2834 });
2835 }
2836
2640 // As produced around Chrome 56. 2837 // As produced around Chrome 56.
2641 const unsigned char kSerializedIncrementerWasm[] = { 2838 const unsigned char kSerializedIncrementerWasm[] = {
2642 0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x2d, 0x00, 0x61, 0x73, 0x6d, 0x0d, 2839 0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x2d, 0x00, 0x61, 0x73, 0x6d, 0x0d,
2643 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01, 0x7f, 0x01, 0x7f, 0x03, 2840 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01, 0x7f, 0x01, 0x7f, 0x03,
2644 0x02, 0x01, 0x00, 0x07, 0x0d, 0x01, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 2841 0x02, 0x01, 0x00, 0x07, 0x0d, 0x01, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65,
2645 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x0a, 0x08, 0x01, 0x06, 0x00, 0x20, 2842 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x0a, 0x08, 0x01, 0x06, 0x00, 0x20,
2646 0x00, 0x41, 0x01, 0x6a, 0xf8, 0x04, 0xa1, 0x06, 0xde, 0xc0, 0xc6, 0x44, 2843 0x00, 0x41, 0x01, 0x6a, 0xf8, 0x04, 0xa1, 0x06, 0xde, 0xc0, 0xc6, 0x44,
2647 0x3c, 0x29, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x02, 0x00, 0x00, 0x81, 0x4e, 2844 0x3c, 0x29, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x02, 0x00, 0x00, 0x81, 0x4e,
2648 0xce, 0x7c, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x30, 0x02, 2845 0xce, 0x7c, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x30, 0x02,
2649 0x00, 0x00, 0xb0, 0x25, 0x30, 0xe3, 0xf2, 0xdb, 0x2e, 0x48, 0x00, 0x00, 2846 0x00, 0x00, 0xb0, 0x25, 0x30, 0xe3, 0xf2, 0xdb, 0x2e, 0x48, 0x00, 0x00,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 InvalidDecodeTest(raw); 2941 InvalidDecodeTest(raw);
2745 } 2942 }
2746 2943
2747 TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidDataLength) { 2944 TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidDataLength) {
2748 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x7f, 0x00}); 2945 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x7f, 0x00});
2749 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x00, 0x7f}); 2946 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x00, 0x7f});
2750 } 2947 }
2751 2948
2752 } // namespace 2949 } // namespace
2753 } // namespace v8 2950 } // namespace v8
OLDNEW
« src/value-serializer.cc ('K') | « test/cctest/wasm/test-run-wasm-module.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698