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

Unified Diff: src/compiler/wasm-compiler.cc

Issue 2256603002: [wasm] Add stack checks at the beginning of each function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index b457efec4ec3e0e34ddd7305b16f1539a29fc631..93f7a78eed3183af122a040c18688a4d27e0fcb0 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -374,6 +374,19 @@ Node* WasmGraphBuilder::Int64Constant(int64_t value) {
return jsgraph()->Int64Constant(value);
}
+void WasmGraphBuilder::InitStackCheck(wasm::WasmCodePosition position) {
+ Node* limit = graph()->NewNode(
+ jsgraph()->machine()->Load(MachineType::Pointer()),
+ jsgraph()->ExternalConstant(
+ ExternalReference::address_of_stack_limit(jsgraph()->isolate())),
+ jsgraph()->IntPtrConstant(0), *effect_, *control_);
+ Node* pointer = graph()->NewNode(jsgraph()->machine()->LoadStackPointer());
+
+ Node* check =
+ graph()->NewNode(jsgraph()->machine()->UintLessThan(), limit, pointer);
+ trap_->AddTrapIfFalse(wasm::kTrapStackOverflow, check, position);
titzer 2016/08/17 08:23:28 We'll need to use the regular JS machinery here an
ahaas 2016/08/17 09:18:43 Done.
+}
+
Node* WasmGraphBuilder::Binop(wasm::WasmOpcode opcode, Node* left, Node* right,
wasm::WasmCodePosition position) {
const Operator* op;
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698