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

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

Issue 2365633002: [wasm] Make sure the interpreter only executes preprocessed code. (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/wasm-interpreter.h" 5 #include "src/wasm/wasm-interpreter.h"
6 6
7 #include "src/utils.h" 7 #include "src/utils.h"
8 #include "src/wasm/ast-decoder.h" 8 #include "src/wasm/ast-decoder.h"
9 #include "src/wasm/decoder.h" 9 #include "src/wasm/decoder.h"
10 #include "src/wasm/wasm-external-refs.h" 10 #include "src/wasm/wasm-external-refs.h"
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 TRACE(" => PushFrame(#%u @%zu)\n", code->function->func_index, 1029 TRACE(" => PushFrame(#%u @%zu)\n", code->function->func_index,
1030 frames_.back().ret_pc); 1030 frames_.back().ret_pc);
1031 } 1031 }
1032 1032
1033 virtual WasmInterpreter::State Run() { 1033 virtual WasmInterpreter::State Run() {
1034 do { 1034 do {
1035 TRACE(" => Run()\n"); 1035 TRACE(" => Run()\n");
1036 if (state_ == WasmInterpreter::STOPPED || 1036 if (state_ == WasmInterpreter::STOPPED ||
1037 state_ == WasmInterpreter::PAUSED) { 1037 state_ == WasmInterpreter::PAUSED) {
1038 state_ = WasmInterpreter::RUNNING; 1038 state_ = WasmInterpreter::RUNNING;
1039 Execute(frames_.back().code, frames_.back().ret_pc, kRunSteps); 1039 Execute(codemap()->Preprocess(frames_.back().code),
titzer 2016/09/22 14:18:24 Maybe PushFrame should do this?
ahaas 2016/09/22 14:40:37 I moved Preprocess to FindCode in the CodeMap. I t
1040 frames_.back().ret_pc, kRunSteps);
1040 } 1041 }
1041 } while (state_ == WasmInterpreter::STOPPED); 1042 } while (state_ == WasmInterpreter::STOPPED);
1042 return state_; 1043 return state_;
1043 } 1044 }
1044 1045
1045 virtual WasmInterpreter::State Step() { 1046 virtual WasmInterpreter::State Step() {
1046 TRACE(" => Step()\n"); 1047 TRACE(" => Step()\n");
1047 if (state_ == WasmInterpreter::STOPPED || 1048 if (state_ == WasmInterpreter::STOPPED ||
1048 state_ == WasmInterpreter::PAUSED) { 1049 state_ == WasmInterpreter::PAUSED) {
1049 state_ = WasmInterpreter::RUNNING; 1050 state_ = WasmInterpreter::RUNNING;
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 1851
1851 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( 1852 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting(
1852 Zone* zone, const byte* start, const byte* end) { 1853 Zone* zone, const byte* start, const byte* end) {
1853 ControlTransfers targets(zone, 0, start, end); 1854 ControlTransfers targets(zone, 0, start, end);
1854 return targets.map_; 1855 return targets.map_;
1855 } 1856 }
1856 1857
1857 } // namespace wasm 1858 } // namespace wasm
1858 } // namespace internal 1859 } // namespace internal
1859 } // namespace v8 1860 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698