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

Unified Diff: test/cctest/interpreter/test-interpreter.cc

Issue 1362383002: [Interpreter] Add CallRuntime support to the interpreter. (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: test/cctest/interpreter/test-interpreter.cc
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc
index 701a369280b27870dae1443174beadbdb159dc59..a64f37fc5e9435695849438960bef19e813bb204 100644
--- a/test/cctest/interpreter/test-interpreter.cc
+++ b/test/cctest/interpreter/test-interpreter.cc
@@ -974,3 +974,25 @@ TEST(InterpreterConditionalJumps) {
Handle<Object> return_value = callable().ToHandleChecked();
CHECK_EQ(Smi::cast(*return_value)->value(), 7);
}
+
+
+TEST(InterpreterCallRuntime) {
+ HandleAndZoneScope handles;
+
+ BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone());
+ builder.set_locals_count(2);
+ builder.set_parameter_count(1);
+ builder.LoadLiteral(Smi::FromInt(15))
+ .StoreAccumulatorInRegister(Register(0))
+ .LoadLiteral(Smi::FromInt(40))
+ .StoreAccumulatorInRegister(Register(1))
+ .CallRuntime(Runtime::kAdd, Register(0), 2)
+ .Return();
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
+
+ InterpreterTester tester(handles.main_isolate(), bytecode_array);
+ auto callable = tester.GetCallable<>();
+
+ Handle<Object> return_val = callable().ToHandleChecked();
+ CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(55));
+}

Powered by Google App Engine
This is Rietveld 408576698