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

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

Issue 2649163004: [wasm] JSAPI conformance: instance.exports has null prototype. (Closed)
Patch Set: 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 | « src/factory.cc ('k') | test/mjsunit/wasm/js-api.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 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 Handle<WasmCompiledModule> compiled_module) { 1905 Handle<WasmCompiledModule> compiled_module) {
1906 if (NeedsWrappers()) { 1906 if (NeedsWrappers()) {
1907 // Fill the table to cache the exported JSFunction wrappers. 1907 // Fill the table to cache the exported JSFunction wrappers.
1908 js_wrappers_.insert(js_wrappers_.begin(), module_->functions.size(), 1908 js_wrappers_.insert(js_wrappers_.begin(), module_->functions.size(),
1909 Handle<JSFunction>::null()); 1909 Handle<JSFunction>::null());
1910 } 1910 }
1911 1911
1912 Handle<JSObject> exports_object = instance; 1912 Handle<JSObject> exports_object = instance;
1913 if (module_->origin == kWasmOrigin) { 1913 if (module_->origin == kWasmOrigin) {
1914 // Create the "exports" object. 1914 // Create the "exports" object.
1915 Handle<JSFunction> object_function = Handle<JSFunction>( 1915 exports_object = isolate_->factory()->NewJSObjectWithNullProto();
1916 isolate_->native_context()->object_function(), isolate_);
1917 exports_object =
1918 isolate_->factory()->NewJSObject(object_function, TENURED);
1919 Handle<String> exports_name = 1916 Handle<String> exports_name =
1920 isolate_->factory()->InternalizeUtf8String("exports"); 1917 isolate_->factory()->InternalizeUtf8String("exports");
1921 JSObject::AddProperty(instance, exports_name, exports_object, NONE); 1918 JSObject::AddProperty(instance, exports_name, exports_object, NONE);
1922 } 1919 }
1923 1920
1924 PropertyDescriptor desc; 1921 PropertyDescriptor desc;
1925 desc.set_writable(false); 1922 desc.set_writable(false);
1926 desc.set_enumerable(true); 1923 desc.set_enumerable(true);
1927 1924
1928 // Count up export indexes. 1925 // Count up export indexes.
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
2757 Handle<FixedArray> storage = factory->NewFixedArray(num_custom_sections); 2754 Handle<FixedArray> storage = factory->NewFixedArray(num_custom_sections);
2758 JSArray::SetContent(array_object, storage); 2755 JSArray::SetContent(array_object, storage);
2759 array_object->set_length(Smi::FromInt(num_custom_sections)); 2756 array_object->set_length(Smi::FromInt(num_custom_sections));
2760 2757
2761 for (int i = 0; i < num_custom_sections; i++) { 2758 for (int i = 0; i < num_custom_sections; i++) {
2762 storage->set(i, *matching_sections[i]); 2759 storage->set(i, *matching_sections[i]);
2763 } 2760 }
2764 2761
2765 return array_object; 2762 return array_object;
2766 } 2763 }
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | test/mjsunit/wasm/js-api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698