Index: src/interpreter/interpreter.cc |
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
index 020c662dd5973b9669cca1deca32914d6d228508..261b911107bb60437bdaa6bbc1dab63327670199 100644 |
--- a/src/interpreter/interpreter.cc |
+++ b/src/interpreter/interpreter.cc |
@@ -866,6 +866,30 @@ void Interpreter::DoCallRuntime(compiler::InterpreterAssembler* assembler) { |
} |
+// CallJSRuntime <context_index> <receiver> <arg_count> |
+// |
+// Call the JS runtime function that has the |context_index| with the receiver |
+// in register |receiver| and |arg_count| arguments in subsequent registers. |
+void Interpreter::DoCallJSRuntime(compiler::InterpreterAssembler* assembler) { |
+ Node* context_index = __ BytecodeOperandIdx(0); |
+ Node* receiver_reg = __ BytecodeOperandReg(1); |
+ Node* first_arg = __ RegisterLocation(receiver_reg); |
+ Node* args_count = __ BytecodeOperandCount(2); |
+ |
+ // Get the function to call from the native context. |
+ Node* context = __ GetContext(); |
+ Node* global = __ LoadContextSlot(context, Context::GLOBAL_OBJECT_INDEX); |
+ Node* native_context = |
+ __ LoadObjectField(global, GlobalObject::kNativeContextOffset); |
+ Node* function = __ LoadContextSlot(native_context, context_index); |
+ |
+ // Call the function. |
+ Node* result = __ CallJS(function, first_arg, args_count); |
+ __ SetAccumulator(result); |
+ __ Dispatch(); |
+} |
+ |
+ |
// New <constructor> <arg_count> |
// |
// Call operator new with |constructor| and the first argument in |