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

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

Issue 1645763003: [Interpreter] TurboFan implementation of intrinsics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Merged with oth@'s changes. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "test/cctest/interpreter/interpreter-tester.h"
6
7 namespace v8 {
8 namespace internal {
9 namespace interpreter {
10
11 MaybeHandle<Object> CallInterpreter(Isolate* isolate,
12 Handle<JSFunction> function) {
13 return Execution::Call(isolate, function,
14 isolate->factory()->undefined_value(), 0, nullptr);
15 }
16
17 InterpreterTester::InterpreterTester(
18 Isolate* isolate, const char* source, MaybeHandle<BytecodeArray> bytecode,
19 MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter)
20 : isolate_(isolate),
21 source_(source),
22 bytecode_(bytecode),
23 feedback_vector_(feedback_vector) {
24 i::FLAG_ignition = true;
25 i::FLAG_always_opt = false;
26 // Set ignition filter flag via SetFlagsFromString to avoid double-free
27 // (or potential leak with StrDup() based on ownership confusion).
28 ScopedVector<char> ignition_filter(64);
29 SNPrintF(ignition_filter, "--ignition-filter=%s", filter);
30 FlagList::SetFlagsFromString(ignition_filter.start(),
31 ignition_filter.length());
32 // Ensure handler table is generated.
33 isolate->interpreter()->Initialize();
34 }
35
36 InterpreterTester::InterpreterTester(
37 Isolate* isolate, Handle<BytecodeArray> bytecode,
38 MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter)
39 : InterpreterTester(isolate, nullptr, bytecode, feedback_vector, filter) {}
40
41 InterpreterTester::InterpreterTester(Isolate* isolate, const char* source,
42 const char* filter)
43 : InterpreterTester(isolate, source, MaybeHandle<BytecodeArray>(),
44 MaybeHandle<TypeFeedbackVector>(), filter) {}
45
46 InterpreterTester::~InterpreterTester() {}
47
48 Local<Message> InterpreterTester::CheckThrowsReturnMessage() {
49 TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate_));
50 auto callable = GetCallable<>();
51 MaybeHandle<Object> no_result = callable();
52 CHECK(isolate_->has_pending_exception());
53 CHECK(try_catch.HasCaught());
54 CHECK(no_result.is_null());
55 isolate_->OptionalRescheduleException(true);
56 CHECK(!try_catch.Message().IsEmpty());
57 return try_catch.Message();
58 }
59
60 Handle<Object> InterpreterTester::NewObject(const char* script) {
61 return v8::Utils::OpenHandle(*CompileRun(script));
62 }
63
64 Handle<String> InterpreterTester::GetName(Isolate* isolate, const char* name) {
65 Handle<String> result = isolate->factory()->NewStringFromAsciiChecked(name);
66 return isolate->factory()->string_table()->LookupString(isolate, result);
67 }
68
69 std::string InterpreterTester::SourceForBody(const char* body) {
70 return "function " + function_name() + "() {\n" + std::string(body) + "\n}";
71 }
72
73 std::string InterpreterTester::function_name() {
74 return std::string(kFunctionName);
75 }
76
77 } // namespace interpreter
78 } // namespace internal
79 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/interpreter-tester.h ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698