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

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: Rebased Created 5 years, 1 month 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
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index bc4077a048febb6134da03b2a1e018f2c91ed591..e089a5d475e8c224af759d7fff98f2753e3b2bb1 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -914,6 +914,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, JSGlobalObject::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
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698