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

Unified Diff: src/compiler/interpreter-assembler.cc

Issue 1665853002: [Interpreter] Add explicit StackCheck bytecodes on function entry and back branches. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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
Index: src/compiler/interpreter-assembler.cc
diff --git a/src/compiler/interpreter-assembler.cc b/src/compiler/interpreter-assembler.cc
index 8ca460e8a189a575d1492b8429a95cc57dd42eb5..d377f497c344c20aa1dd7c26e1ac95e561cdccf2 100644
--- a/src/compiler/interpreter-assembler.cc
+++ b/src/compiler/interpreter-assembler.cc
@@ -581,6 +581,11 @@ Node* InterpreterAssembler::CallRuntime(Node* function_id, Node* first_arg,
return CallN(descriptor, code_target, args);
}
+Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id) {
+ CallPrologue();
+ Node* return_val = raw_assembler_->CallRuntime0(function_id, GetContext());
+ return return_val;
+}
Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id,
Node* arg1) {
@@ -699,6 +704,20 @@ void InterpreterAssembler::DispatchTo(Node* new_bytecode_offset) {
raw_assembler_->TailCallN(call_descriptor(), target_code_object, args);
}
+void InterpreterAssembler::StackCheck() {
+ RawMachineLabel ok, stack_guard;
+ Node* sp = raw_assembler_->LoadStackPointer();
+ Node* stack_limit = raw_assembler_->Load(
+ MachineType::Pointer(),
+ raw_assembler_->ExternalConstant(
+ ExternalReference::address_of_stack_limit(isolate())));
+ Node* condition = raw_assembler_->IntPtrGreaterThanOrEqual(sp, stack_limit);
Michael Starzinger 2016/02/03 16:13:18 Not entirely sure about what code is produced here
rmcilroy 2016/02/04 11:55:15 Good catch. Done.
+ raw_assembler_->Branch(condition, &ok, &stack_guard);
+ raw_assembler_->Bind(&stack_guard);
+ CallRuntime(Runtime::kStackGuard);
+ raw_assembler_->Goto(&ok);
+ raw_assembler_->Bind(&ok);
+}
void InterpreterAssembler::Abort(BailoutReason bailout_reason) {
Node* abort_id = SmiTag(Int32Constant(bailout_reason));

Powered by Google App Engine
This is Rietveld 408576698