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

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

Issue 2591753002: [wasm] Implement correct 2-level namespace for imports. (Closed)
Patch Set: Fix debug tests Created 4 years 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/module-decoder.cc ('k') | src/wasm/wasm-module-builder.cc » ('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 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 1402
1403 // Look up the module first. 1403 // Look up the module first.
1404 MaybeHandle<Object> result = 1404 MaybeHandle<Object> result =
1405 Object::GetPropertyOrElement(ffi_, module_name); 1405 Object::GetPropertyOrElement(ffi_, module_name);
1406 if (result.is_null()) { 1406 if (result.is_null()) {
1407 return ReportTypeError("module not found", index, module_name); 1407 return ReportTypeError("module not found", index, module_name);
1408 } 1408 }
1409 1409
1410 Handle<Object> module = result.ToHandleChecked(); 1410 Handle<Object> module = result.ToHandleChecked();
1411 1411
1412 // TODO(bradnelson): Making this conditional on non-empty names violates the 1412 // Look up the value in the module.
1413 // Wasm spec, but seems to be a hack intended for the asm-to-wasm pipeline. 1413 if (!module->IsJSReceiver()) {
1414 // We need to get rid of it. 1414 return ReportTypeError("module is not an object or function", index,
1415 if (import_name->length() != 0) { 1415 module_name);
1416 // Look up the value in the module. 1416 }
1417 if (!module->IsJSReceiver()) {
1418 return ReportTypeError("module is not an object or function", index,
1419 module_name);
1420 }
1421 1417
1422 result = Object::GetPropertyOrElement(module, import_name); 1418 result = Object::GetPropertyOrElement(module, import_name);
1423 if (result.is_null()) { 1419 if (result.is_null()) {
1424 ReportLinkError("import not found", index, module_name, import_name); 1420 ReportLinkError("import not found", index, module_name, import_name);
1425 return MaybeHandle<JSFunction>(); 1421 return MaybeHandle<JSFunction>();
1426 }
1427 } 1422 }
1428 1423
1429 return result; 1424 return result;
1430 } 1425 }
1431 1426
1432 uint32_t EvalUint32InitExpr(const WasmInitExpr& expr) { 1427 uint32_t EvalUint32InitExpr(const WasmInitExpr& expr) {
1433 switch (expr.kind) { 1428 switch (expr.kind) {
1434 case WasmInitExpr::kI32Const: 1429 case WasmInitExpr::kI32Const:
1435 return expr.val.i32_const; 1430 return expr.val.i32_const;
1436 case WasmInitExpr::kGlobalIndex: { 1431 case WasmInitExpr::kGlobalIndex: {
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 CHECK(!compiled_module->has_weak_owning_instance()); 2310 CHECK(!compiled_module->has_weak_owning_instance());
2316 } 2311 }
2317 2312
2318 void testing::ValidateOrphanedInstance(Isolate* isolate, 2313 void testing::ValidateOrphanedInstance(Isolate* isolate,
2319 Handle<WasmInstanceObject> instance) { 2314 Handle<WasmInstanceObject> instance) {
2320 DisallowHeapAllocation no_gc; 2315 DisallowHeapAllocation no_gc;
2321 WasmCompiledModule* compiled_module = instance->get_compiled_module(); 2316 WasmCompiledModule* compiled_module = instance->get_compiled_module();
2322 CHECK(compiled_module->has_weak_wasm_module()); 2317 CHECK(compiled_module->has_weak_wasm_module());
2323 CHECK(compiled_module->ptr_to_weak_wasm_module()->cleared()); 2318 CHECK(compiled_module->ptr_to_weak_wasm_module()->cleared());
2324 } 2319 }
OLDNEW
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | src/wasm/wasm-module-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698