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

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

Issue 2622563002: [wasm] The exports property of a wasm instance should always exist (Closed)
Patch Set: Do a better undefined check. Created 3 years, 11 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 | « no previous file | test/mjsunit/regress/wasm/regression-663994.js » ('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/assembler-inl.h" 7 #include "src/assembler-inl.h"
8 #include "src/base/adapters.h" 8 #include "src/base/adapters.h"
9 #include "src/base/atomic-utils.h" 9 #include "src/base/atomic-utils.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 break; 1757 break;
1758 } 1758 }
1759 } 1759 }
1760 if (needs_wrappers) { 1760 if (needs_wrappers) {
1761 // Fill the table to cache the exported JSFunction wrappers. 1761 // Fill the table to cache the exported JSFunction wrappers.
1762 js_wrappers_.insert(js_wrappers_.begin(), module_->functions.size(), 1762 js_wrappers_.insert(js_wrappers_.begin(), module_->functions.size(),
1763 Handle<JSFunction>::null()); 1763 Handle<JSFunction>::null());
1764 } 1764 }
1765 1765
1766 Handle<JSObject> exports_object = instance; 1766 Handle<JSObject> exports_object = instance;
1767 if (module_->export_table.size() > 0 && module_->origin == kWasmOrigin) { 1767 if (module_->origin == kWasmOrigin) {
1768 // Create the "exports" object. 1768 // Create the "exports" object.
1769 Handle<JSFunction> object_function = Handle<JSFunction>( 1769 Handle<JSFunction> object_function = Handle<JSFunction>(
1770 isolate_->native_context()->object_function(), isolate_); 1770 isolate_->native_context()->object_function(), isolate_);
1771 exports_object = 1771 exports_object =
1772 isolate_->factory()->NewJSObject(object_function, TENURED); 1772 isolate_->factory()->NewJSObject(object_function, TENURED);
1773 Handle<String> exports_name = 1773 Handle<String> exports_name =
1774 isolate_->factory()->InternalizeUtf8String("exports"); 1774 isolate_->factory()->InternalizeUtf8String("exports");
1775 JSObject::AddProperty(instance, exports_name, exports_object, NONE); 1775 JSObject::AddProperty(instance, exports_name, exports_object, NONE);
1776 } 1776 }
1777 1777
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
2298 CHECK(!compiled_module->has_weak_owning_instance()); 2298 CHECK(!compiled_module->has_weak_owning_instance());
2299 } 2299 }
2300 2300
2301 void testing::ValidateOrphanedInstance(Isolate* isolate, 2301 void testing::ValidateOrphanedInstance(Isolate* isolate,
2302 Handle<WasmInstanceObject> instance) { 2302 Handle<WasmInstanceObject> instance) {
2303 DisallowHeapAllocation no_gc; 2303 DisallowHeapAllocation no_gc;
2304 WasmCompiledModule* compiled_module = instance->compiled_module(); 2304 WasmCompiledModule* compiled_module = instance->compiled_module();
2305 CHECK(compiled_module->has_weak_wasm_module()); 2305 CHECK(compiled_module->has_weak_wasm_module());
2306 CHECK(compiled_module->ptr_to_weak_wasm_module()->cleared()); 2306 CHECK(compiled_module->ptr_to_weak_wasm_module()->cleared());
2307 } 2307 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/wasm/regression-663994.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698