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

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

Issue 2971093003: [wasm] Remove the use of private symbols for branding. (Closed)
Patch Set: [wasm] Remove the use of private symbols for branding. Created 3 years, 5 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/contexts.h ('k') | src/wasm/wasm-js.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 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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/wasm/module-compiler.h> 5 #include <src/wasm/module-compiler.h>
6 6
7 #include <atomic> 7 #include <atomic>
8 8
9 #include "src/asmjs/asm-js.h" 9 #include "src/asmjs/asm-js.h"
10 #include "src/assembler-inl.h" 10 #include "src/assembler-inl.h"
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 ReportLinkError("imported function does not match the expected type", 1311 ReportLinkError("imported function does not match the expected type",
1312 index, module_name, import_name); 1312 index, module_name, import_name);
1313 return -1; 1313 return -1;
1314 } 1314 }
1315 code_table->set(num_imported_functions, *import_wrapper); 1315 code_table->set(num_imported_functions, *import_wrapper);
1316 RecordStats(*import_wrapper, counters()); 1316 RecordStats(*import_wrapper, counters());
1317 num_imported_functions++; 1317 num_imported_functions++;
1318 break; 1318 break;
1319 } 1319 }
1320 case kExternalTable: { 1320 case kExternalTable: {
1321 if (!WasmJs::IsWasmTableObject(isolate_, value)) { 1321 if (!value->IsWasmTableObject()) {
1322 ReportLinkError("table import requires a WebAssembly.Table", index, 1322 ReportLinkError("table import requires a WebAssembly.Table", index,
1323 module_name, import_name); 1323 module_name, import_name);
1324 return -1; 1324 return -1;
1325 } 1325 }
1326 WasmIndirectFunctionTable& table = 1326 WasmIndirectFunctionTable& table =
1327 module_->function_tables[num_imported_tables]; 1327 module_->function_tables[num_imported_tables];
1328 TableInstance& table_instance = table_instances_[num_imported_tables]; 1328 TableInstance& table_instance = table_instances_[num_imported_tables];
1329 table_instance.table_object = Handle<WasmTableObject>::cast(value); 1329 table_instance.table_object = Handle<WasmTableObject>::cast(value);
1330 table_instance.js_wrappers = Handle<FixedArray>( 1330 table_instance.js_wrappers = Handle<FixedArray>(
1331 table_instance.table_object->functions(), isolate_); 1331 table_instance.table_object->functions(), isolate_);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 table_instance.function_table->set(i, *UnwrapImportWrapper(val)); 1383 table_instance.function_table->set(i, *UnwrapImportWrapper(val));
1384 } 1384 }
1385 1385
1386 num_imported_tables++; 1386 num_imported_tables++;
1387 break; 1387 break;
1388 } 1388 }
1389 case kExternalMemory: { 1389 case kExternalMemory: {
1390 // Validation should have failed if more than one memory object was 1390 // Validation should have failed if more than one memory object was
1391 // provided. 1391 // provided.
1392 DCHECK(!instance->has_memory_object()); 1392 DCHECK(!instance->has_memory_object());
1393 if (!WasmJs::IsWasmMemoryObject(isolate_, value)) { 1393 if (!value->IsWasmMemoryObject()) {
1394 ReportLinkError("memory import must be a WebAssembly.Memory object", 1394 ReportLinkError("memory import must be a WebAssembly.Memory object",
1395 index, module_name, import_name); 1395 index, module_name, import_name);
1396 return -1; 1396 return -1;
1397 } 1397 }
1398 auto memory = Handle<WasmMemoryObject>::cast(value); 1398 auto memory = Handle<WasmMemoryObject>::cast(value);
1399 DCHECK(WasmJs::IsWasmMemoryObject(isolate_, memory));
1400 instance->set_memory_object(*memory); 1399 instance->set_memory_object(*memory);
1401 memory_ = Handle<JSArrayBuffer>(memory->array_buffer(), isolate_); 1400 memory_ = Handle<JSArrayBuffer>(memory->array_buffer(), isolate_);
1402 uint32_t imported_cur_pages = static_cast<uint32_t>( 1401 uint32_t imported_cur_pages = static_cast<uint32_t>(
1403 memory_->byte_length()->Number() / WasmModule::kPageSize); 1402 memory_->byte_length()->Number() / WasmModule::kPageSize);
1404 if (imported_cur_pages < module_->min_mem_pages) { 1403 if (imported_cur_pages < module_->min_mem_pages) {
1405 thrower_->LinkError( 1404 thrower_->LinkError(
1406 "memory import %d is smaller than maximum %u, got %u", index, 1405 "memory import %d is smaller than maximum %u, got %u", index,
1407 module_->min_mem_pages, imported_cur_pages); 1406 module_->min_mem_pages, imported_cur_pages);
1408 } 1407 }
1409 int32_t imported_max_pages = memory->maximum_pages(); 1408 int32_t imported_max_pages = memory->maximum_pages();
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 HandleScope scope(job_->isolate_); 2354 HandleScope scope(job_->isolate_);
2356 Handle<WasmModuleObject> result = 2355 Handle<WasmModuleObject> result =
2357 WasmModuleObject::New(job_->isolate_, job_->compiled_module_); 2356 WasmModuleObject::New(job_->isolate_, job_->compiled_module_);
2358 // {job_} is deleted in AsyncCompileSucceeded, therefore the {return}. 2357 // {job_} is deleted in AsyncCompileSucceeded, therefore the {return}.
2359 return job_->AsyncCompileSucceeded(result); 2358 return job_->AsyncCompileSucceeded(result);
2360 } 2359 }
2361 }; 2360 };
2362 } // namespace wasm 2361 } // namespace wasm
2363 } // namespace internal 2362 } // namespace internal
2364 } // namespace v8 2363 } // namespace v8
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/wasm/wasm-js.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698