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

Side by Side 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, 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
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 "src/compiler/interpreter-assembler.h" 5 #include "src/compiler/interpreter-assembler.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 574
575 Node** args = zone()->NewArray<Node*>(4); 575 Node** args = zone()->NewArray<Node*>(4);
576 args[0] = arg_count; 576 args[0] = arg_count;
577 args[1] = first_arg; 577 args[1] = first_arg;
578 args[2] = function_entry; 578 args[2] = function_entry;
579 args[3] = GetContext(); 579 args[3] = GetContext();
580 580
581 return CallN(descriptor, code_target, args); 581 return CallN(descriptor, code_target, args);
582 } 582 }
583 583
584 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id) {
585 CallPrologue();
586 Node* return_val = raw_assembler_->CallRuntime0(function_id, GetContext());
587 return return_val;
588 }
584 589
585 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, 590 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id,
586 Node* arg1) { 591 Node* arg1) {
587 CallPrologue(); 592 CallPrologue();
588 Node* return_val = 593 Node* return_val =
589 raw_assembler_->CallRuntime1(function_id, arg1, GetContext()); 594 raw_assembler_->CallRuntime1(function_id, arg1, GetContext());
590 return return_val; 595 return return_val;
591 } 596 }
592 597
593 598
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter); 697 STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter);
693 Node* args[] = { GetAccumulator(), 698 Node* args[] = { GetAccumulator(),
694 RegisterFileRawPointer(), 699 RegisterFileRawPointer(),
695 new_bytecode_offset, 700 new_bytecode_offset,
696 BytecodeArrayTaggedPointer(), 701 BytecodeArrayTaggedPointer(),
697 DispatchTableRawPointer(), 702 DispatchTableRawPointer(),
698 GetContext() }; 703 GetContext() };
699 raw_assembler_->TailCallN(call_descriptor(), target_code_object, args); 704 raw_assembler_->TailCallN(call_descriptor(), target_code_object, args);
700 } 705 }
701 706
707 void InterpreterAssembler::StackCheck() {
708 RawMachineLabel ok, stack_guard;
709 Node* sp = raw_assembler_->LoadStackPointer();
710 Node* stack_limit = raw_assembler_->Load(
711 MachineType::Pointer(),
712 raw_assembler_->ExternalConstant(
713 ExternalReference::address_of_stack_limit(isolate())));
714 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.
715 raw_assembler_->Branch(condition, &ok, &stack_guard);
716 raw_assembler_->Bind(&stack_guard);
717 CallRuntime(Runtime::kStackGuard);
718 raw_assembler_->Goto(&ok);
719 raw_assembler_->Bind(&ok);
720 }
702 721
703 void InterpreterAssembler::Abort(BailoutReason bailout_reason) { 722 void InterpreterAssembler::Abort(BailoutReason bailout_reason) {
704 Node* abort_id = SmiTag(Int32Constant(bailout_reason)); 723 Node* abort_id = SmiTag(Int32Constant(bailout_reason));
705 Node* ret_value = CallRuntime(Runtime::kAbort, abort_id); 724 Node* ret_value = CallRuntime(Runtime::kAbort, abort_id);
706 // Unreached, but keeps turbofan happy. 725 // Unreached, but keeps turbofan happy.
707 raw_assembler_->Return(ret_value); 726 raw_assembler_->Return(ret_value);
708 } 727 }
709 728
710 729
711 void InterpreterAssembler::AbortIfWordNotEqual(Node* lhs, Node* rhs, 730 void InterpreterAssembler::AbortIfWordNotEqual(Node* lhs, Node* rhs,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 return raw_assembler_->call_descriptor(); 767 return raw_assembler_->call_descriptor();
749 } 768 }
750 769
751 770
752 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } 771 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); }
753 772
754 773
755 } // namespace compiler 774 } // namespace compiler
756 } // namespace internal 775 } // namespace internal
757 } // namespace v8 776 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698