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

Side by Side Diff: src/wasm/wasm-module.cc

Issue 2273303002: [WASM] Adding fuzzing binaries for wasm, and script to update them. (Closed)
Patch Set: Fix Created 4 years, 3 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
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/fuzzer/wasm.tar.gz.sha1 » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 5 #include <memory>
6 6
7 #include "src/base/atomic-utils.h" 7 #include "src/base/atomic-utils.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 9
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 MaybeHandle<FixedArray> compiled_module = 1657 MaybeHandle<FixedArray> compiled_module =
1658 module->CompileFunctions(isolate, &thrower); 1658 module->CompileFunctions(isolate, &thrower);
1659 1659
1660 if (compiled_module.is_null()) return -1; 1660 if (compiled_module.is_null()) return -1;
1661 Handle<JSObject> instance = 1661 Handle<JSObject> instance =
1662 WasmModule::Instantiate(isolate, compiled_module.ToHandleChecked(), 1662 WasmModule::Instantiate(isolate, compiled_module.ToHandleChecked(),
1663 Handle<JSReceiver>::null(), 1663 Handle<JSReceiver>::null(),
1664 Handle<JSArrayBuffer>::null()) 1664 Handle<JSArrayBuffer>::null())
1665 .ToHandleChecked(); 1665 .ToHandleChecked();
1666 1666
1667 return CallFunction(isolate, instance, &thrower, "main", 0, nullptr); 1667 return CallFunction(isolate, instance, &thrower, asm_js ? "caller" : "main",
1668 0, nullptr, asm_js);
1668 } 1669 }
1669 1670
1670 int32_t CallFunction(Isolate* isolate, Handle<JSObject> instance, 1671 int32_t CallFunction(Isolate* isolate, Handle<JSObject> instance,
1671 ErrorThrower* thrower, const char* name, int argc, 1672 ErrorThrower* thrower, const char* name, int argc,
1672 Handle<Object> argv[]) { 1673 Handle<Object> argv[], bool asm_js) {
1673 Handle<Name> exports = isolate->factory()->InternalizeUtf8String("exports"); 1674 Handle<JSObject> exports_object;
1674 Handle<JSObject> exports_object = Handle<JSObject>::cast( 1675 if (asm_js) {
1675 JSObject::GetProperty(instance, exports).ToHandleChecked()); 1676 exports_object = instance;
1677 } else {
1678 Handle<Name> exports = isolate->factory()->InternalizeUtf8String("exports");
1679 exports_object = Handle<JSObject>::cast(
1680 JSObject::GetProperty(instance, exports).ToHandleChecked());
1681 }
1676 Handle<Name> main_name = isolate->factory()->NewStringFromAsciiChecked(name); 1682 Handle<Name> main_name = isolate->factory()->NewStringFromAsciiChecked(name);
1677 PropertyDescriptor desc; 1683 PropertyDescriptor desc;
1678 Maybe<bool> property_found = JSReceiver::GetOwnPropertyDescriptor( 1684 Maybe<bool> property_found = JSReceiver::GetOwnPropertyDescriptor(
1679 isolate, exports_object, main_name, &desc); 1685 isolate, exports_object, main_name, &desc);
1680 if (!property_found.FromMaybe(false)) return -1; 1686 if (!property_found.FromMaybe(false)) return -1;
1681 1687
1682 Handle<JSFunction> main_export = Handle<JSFunction>::cast(desc.value()); 1688 Handle<JSFunction> main_export = Handle<JSFunction>::cast(desc.value());
1683 1689
1684 // Call the JS function. 1690 // Call the JS function.
1685 Handle<Object> undefined = isolate->factory()->undefined_value(); 1691 Handle<Object> undefined = isolate->factory()->undefined_value();
(...skipping 13 matching lines...) Expand all
1699 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); 1705 return static_cast<int32_t>(HeapNumber::cast(*result)->value());
1700 } 1706 }
1701 thrower->Error("WASM.compileRun() failed: Return value should be number"); 1707 thrower->Error("WASM.compileRun() failed: Return value should be number");
1702 return -1; 1708 return -1;
1703 } 1709 }
1704 1710
1705 } // namespace testing 1711 } // namespace testing
1706 } // namespace wasm 1712 } // namespace wasm
1707 } // namespace internal 1713 } // namespace internal
1708 } // namespace v8 1714 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/fuzzer/wasm.tar.gz.sha1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698