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

Unified Diff: src/interpreter/interpreter.cc

Issue 1410003003: [Interpreter] Add support for JS runtime calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_api_builtin
Patch Set: Fix unittests Created 5 years, 2 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/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

Powered by Google App Engine
This is Rietveld 408576698