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

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

Issue 2651833003: [wasm] Move protected instruction info to RelocInfo (Closed)
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/v8/v8 into trap-relocinfo Created 3 years, 10 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/trap-handler/trap-handler.h ('k') | src/x64/assembler-x64.h » ('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 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 1400
1401 // Patch new call sites and the context. 1401 // Patch new call sites and the context.
1402 PatchDirectCallsAndContext(code_table, compiled_module_, module_, 1402 PatchDirectCallsAndContext(code_table, compiled_module_, module_,
1403 num_imported_functions); 1403 num_imported_functions);
1404 1404
1405 FlushICache(isolate_, code_table); 1405 FlushICache(isolate_, code_table);
1406 1406
1407 //-------------------------------------------------------------------------- 1407 //--------------------------------------------------------------------------
1408 // Unpack and notify signal handler of protected instructions. 1408 // Unpack and notify signal handler of protected instructions.
1409 //-------------------------------------------------------------------------- 1409 //--------------------------------------------------------------------------
1410 { 1410 if (FLAG_wasm_trap_handler) {
1411 for (int i = 0; i < code_table->length(); ++i) { 1411 for (int i = 0; i < code_table->length(); ++i) {
1412 Handle<Code> code = code_table->GetValueChecked<Code>(isolate_, i); 1412 Handle<Code> code = code_table->GetValueChecked<Code>(isolate_, i);
1413 1413
1414 if (code->kind() != Code::WASM_FUNCTION) { 1414 if (code->kind() != Code::WASM_FUNCTION) {
1415 continue; 1415 continue;
1416 } 1416 }
1417 1417
1418 FixedArray* protected_instructions = code->protected_instructions(); 1418 const intptr_t base = reinterpret_cast<intptr_t>(code->entry());
1419 DCHECK(protected_instructions != nullptr); 1419
1420 Zone zone(isolate_->allocator(), "Wasm Module"); 1420 Zone zone(isolate_->allocator(), "Wasm Module");
1421 ZoneVector<trap_handler::ProtectedInstructionData> unpacked(&zone); 1421 ZoneVector<trap_handler::ProtectedInstructionData> unpacked(&zone);
1422 for (int i = 0; i < protected_instructions->length(); 1422 const int mode_mask =
1423 i += Code::kTrapDataSize) { 1423 RelocInfo::ModeMask(RelocInfo::WASM_PROTECTED_INSTRUCTION_LANDING);
1424 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
1424 trap_handler::ProtectedInstructionData data; 1425 trap_handler::ProtectedInstructionData data;
1425 data.instr_offset = 1426 data.instr_offset = it.rinfo()->data();
1426 protected_instructions
1427 ->GetValueChecked<Smi>(isolate_, i + Code::kTrapCodeOffset)
1428 ->value();
1429 data.landing_offset = 1427 data.landing_offset =
1430 protected_instructions 1428 reinterpret_cast<intptr_t>(it.rinfo()->pc()) - base;
1431 ->GetValueChecked<Smi>(isolate_, i + Code::kTrapLandingOffset)
1432 ->value();
1433 unpacked.emplace_back(data); 1429 unpacked.emplace_back(data);
1434 } 1430 }
1435 // TODO(eholk): Register the protected instruction information once the 1431 // TODO(eholk): Register the protected instruction information once the
1436 // trap handler is in place. 1432 // trap handler is in place.
1437 } 1433 }
1438 } 1434 }
1439 1435
1440 //-------------------------------------------------------------------------- 1436 //--------------------------------------------------------------------------
1441 // Set up and link the new instance. 1437 // Set up and link the new instance.
1442 //-------------------------------------------------------------------------- 1438 //--------------------------------------------------------------------------
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
2822 Handle<FixedArray> storage = factory->NewFixedArray(num_custom_sections); 2818 Handle<FixedArray> storage = factory->NewFixedArray(num_custom_sections);
2823 JSArray::SetContent(array_object, storage); 2819 JSArray::SetContent(array_object, storage);
2824 array_object->set_length(Smi::FromInt(num_custom_sections)); 2820 array_object->set_length(Smi::FromInt(num_custom_sections));
2825 2821
2826 for (int i = 0; i < num_custom_sections; i++) { 2822 for (int i = 0; i < num_custom_sections; i++) {
2827 storage->set(i, *matching_sections[i]); 2823 storage->set(i, *matching_sections[i]);
2828 } 2824 }
2829 2825
2830 return array_object; 2826 return array_object;
2831 } 2827 }
OLDNEW
« no previous file with comments | « src/trap-handler/trap-handler.h ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698