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

Side by Side Diff: test/cctest/interpreter/test-interpreter.cc

Issue 1645763003: [Interpreter] TurboFan implementation of intrinsics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update Created 4 years, 9 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 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 .Return(); 1559 .Return();
1560 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); 1560 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
1561 1561
1562 InterpreterTester tester(handles.main_isolate(), bytecode_array); 1562 InterpreterTester tester(handles.main_isolate(), bytecode_array);
1563 auto callable = tester.GetCallable<>(); 1563 auto callable = tester.GetCallable<>();
1564 1564
1565 Handle<Object> return_val = callable().ToHandleChecked(); 1565 Handle<Object> return_val = callable().ToHandleChecked();
1566 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(55)); 1566 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(55));
1567 } 1567 }
1568 1568
1569 TEST(InterpreterInvokeIntrinsic) {
1570 HandleAndZoneScope handles;
1571
1572 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1,
1573 0, 2);
1574 builder.LoadLiteral(Smi::FromInt(15))
1575 .StoreAccumulatorInRegister(Register(0))
1576 .CallRuntime(Runtime::kInlineIsArray, Register(0), 1)
1577 .Return();
1578 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
1579
1580 InterpreterTester tester(handles.main_isolate(), bytecode_array);
1581 auto callable = tester.GetCallable<>();
1582
1583 Handle<Object> return_val = callable().ToHandleChecked();
1584 CHECK(return_val->IsBoolean());
1585 CHECK_EQ(return_val->BooleanValue(), false);
1586 }
1569 1587
1570 TEST(InterpreterFunctionLiteral) { 1588 TEST(InterpreterFunctionLiteral) {
1571 HandleAndZoneScope handles; 1589 HandleAndZoneScope handles;
1572 1590
1573 // Test calling a function literal. 1591 // Test calling a function literal.
1574 std::string source( 1592 std::string source(
1575 "function " + InterpreterTester::function_name() + "(a) {\n" 1593 "function " + InterpreterTester::function_name() + "(a) {\n"
1576 " return (function(x){ return x + 2; })(a);\n" 1594 " return (function(x){ return x + 2; })(a);\n"
1577 "}"); 1595 "}");
1578 InterpreterTester tester(handles.main_isolate(), source.c_str()); 1596 InterpreterTester tester(handles.main_isolate(), source.c_str());
(...skipping 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after
4158 Handle<i::Object> return_value = callable().ToHandleChecked(); 4176 Handle<i::Object> return_value = callable().ToHandleChecked();
4159 CHECK(return_value->SameValue(*const_decl[i].second)); 4177 CHECK(return_value->SameValue(*const_decl[i].second));
4160 } 4178 }
4161 4179
4162 FLAG_legacy_const = old_flag_legacy_const; 4180 FLAG_legacy_const = old_flag_legacy_const;
4163 } 4181 }
4164 4182
4165 } // namespace interpreter 4183 } // namespace interpreter
4166 } // namespace internal 4184 } // namespace internal
4167 } // namespace v8 4185 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698