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

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

Issue 1323463005: [Interpreter] Add support for JS calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 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 d8266974a28220eddcf6da997716068286bcb4b5..a2536257f860f38080fc8a940851281a389d7439 100644
--- a/src/compiler/interpreter-assembler.cc
+++ b/src/compiler/interpreter-assembler.cc
@@ -102,7 +102,12 @@ Node* InterpreterAssembler::DispatchTableRawPointer() {
Node* InterpreterAssembler::RegisterFrameOffset(Node* index) {
- return raw_assembler_->WordShl(index, Int32Constant(kPointerSizeLog2));
+ return WordShl(index, kPointerSizeLog2);
+}
+
+
+Node* InterpreterAssembler::RegisterLocation(Node* reg_index) {
+ return IntPtrAdd(RegisterFileRawPointer(), RegisterFrameOffset(reg_index));
}
@@ -122,8 +127,7 @@ Node* InterpreterAssembler::BytecodeOperand(int operand_index) {
DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_));
return raw_assembler_->Load(
kMachUint8, BytecodeArrayTaggedPointer(),
- raw_assembler_->IntPtrAdd(BytecodeOffset(),
- Int32Constant(1 + operand_index)));
+ IntPtrAdd(BytecodeOffset(), Int32Constant(1 + operand_index)));
}
@@ -131,8 +135,7 @@ Node* InterpreterAssembler::BytecodeOperandSignExtended(int operand_index) {
DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_));
Node* load = raw_assembler_->Load(
kMachInt8, BytecodeArrayTaggedPointer(),
- raw_assembler_->IntPtrAdd(BytecodeOffset(),
- Int32Constant(1 + operand_index)));
+ IntPtrAdd(BytecodeOffset(), Int32Constant(1 + operand_index)));
// Ensure that we sign extend to full pointer size
if (kPointerSize == 8) {
load = raw_assembler_->ChangeInt32ToInt64(load);
@@ -141,6 +144,13 @@ Node* InterpreterAssembler::BytecodeOperandSignExtended(int operand_index) {
}
+Node* InterpreterAssembler::BytecodeOperandCount(int operand_index) {
+ DCHECK_EQ(interpreter::OperandType::kCount,
+ interpreter::Bytecodes::GetOperandType(bytecode_, operand_index));
+ return BytecodeOperand(operand_index);
+}
+
+
Node* InterpreterAssembler::BytecodeOperandImm8(int operand_index) {
DCHECK_EQ(interpreter::OperandType::kImm8,
interpreter::Bytecodes::GetOperandType(bytecode_, operand_index));
@@ -197,12 +207,27 @@ Node* InterpreterAssembler::SmiUntag(Node* value) {
}
+Node* InterpreterAssembler::IntPtrAdd(Node* a, Node* b) {
+ return raw_assembler_->IntPtrAdd(a, b);
+}
+
+
+Node* InterpreterAssembler::IntPtrSub(Node* a, Node* b) {
+ return raw_assembler_->IntPtrSub(a, b);
+}
+
+
+Node* InterpreterAssembler::WordShl(Node* value, int shift) {
+ return raw_assembler_->WordShl(value, Int32Constant(shift));
+}
+
+
Node* InterpreterAssembler::LoadConstantPoolEntry(Node* index) {
Node* constant_pool = LoadObjectField(BytecodeArrayTaggedPointer(),
BytecodeArray::kConstantPoolOffset);
- Node* entry_offset = raw_assembler_->IntPtrAdd(
- IntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag),
- raw_assembler_->WordShl(index, Int32Constant(kPointerSizeLog2)));
+ Node* entry_offset =
+ IntPtrAdd(IntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag),
+ WordShl(index, kPointerSizeLog2));
return raw_assembler_->Load(kMachAnyTagged, constant_pool, entry_offset);
}
@@ -236,6 +261,16 @@ Node* InterpreterAssembler::LoadTypeFeedbackVector() {
}
+Node* InterpreterAssembler::CallJS(Node* function, Node* first_var_arg,
+ Node* last_var_arg) {
+ CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(
+ zone(), false, 0, CallDescriptor::kHasVarArgs);
+ Node* context = LoadObjectField(function, JSFunction::kContextOffset);
+ return raw_assembler_->CallVarArgs(descriptor, function, &context,
+ first_var_arg, last_var_arg);
+}
+
+
Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor,
Node* target, Node* arg1, Node* arg2,
Node* arg3, Node* arg4) {
@@ -310,7 +345,7 @@ void InterpreterAssembler::Return() {
Node* InterpreterAssembler::Advance(int delta) {
- return raw_assembler_->IntPtrAdd(BytecodeOffset(), Int32Constant(delta));
+ return IntPtrAdd(BytecodeOffset(), Int32Constant(delta));
}

Powered by Google App Engine
This is Rietveld 408576698