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

Side by Side 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: Fix arm32 debug build check errors. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/execution.h" 7 #include "src/execution.h"
8 #include "src/handles.h" 8 #include "src/handles.h"
9 #include "src/interpreter/bytecode-array-builder.h" 9 #include "src/interpreter/bytecode-array-builder.h"
10 #include "src/interpreter/interpreter.h" 10 #include "src/interpreter/interpreter.h"
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 .Return(); 1282 .Return();
1283 1283
1284 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); 1284 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
1285 InterpreterTester tester(handles.main_isolate(), bytecode_array); 1285 InterpreterTester tester(handles.main_isolate(), bytecode_array);
1286 auto callable = tester.GetCallable<>(); 1286 auto callable = tester.GetCallable<>();
1287 Handle<Object> return_value = callable().ToHandleChecked(); 1287 Handle<Object> return_value = callable().ToHandleChecked();
1288 CHECK(return_value->IsBoolean()); 1288 CHECK(return_value->IsBoolean());
1289 CHECK_EQ(return_value->BooleanValue(), expected_value); 1289 CHECK_EQ(return_value->BooleanValue(), expected_value);
1290 } 1290 }
1291 } 1291 }
1292
1293
1294 TEST(InterpreterCallRuntime) {
1295 HandleAndZoneScope handles;
1296
1297 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone());
1298 builder.set_locals_count(2);
1299 builder.set_parameter_count(1);
1300 builder.LoadLiteral(Smi::FromInt(15))
1301 .StoreAccumulatorInRegister(Register(0))
1302 .LoadLiteral(Smi::FromInt(40))
1303 .StoreAccumulatorInRegister(Register(1))
1304 .CallRuntime(Runtime::kAdd, Register(0), 2)
1305 .Return();
1306 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
1307
1308 InterpreterTester tester(handles.main_isolate(), bytecode_array);
1309 auto callable = tester.GetCallable<>();
1310
1311 Handle<Object> return_val = callable().ToHandleChecked();
1312 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(55));
1313 }
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | test/unittests/compiler/interpreter-assembler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698