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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/interpreter/interpreter-tester.h ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/interpreter/interpreter-tester.cc
diff --git a/test/cctest/interpreter/interpreter-tester.cc b/test/cctest/interpreter/interpreter-tester.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b1c412f4e724993e27072fde4f913e93e0127719
--- /dev/null
+++ b/test/cctest/interpreter/interpreter-tester.cc
@@ -0,0 +1,79 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "test/cctest/interpreter/interpreter-tester.h"
+
+namespace v8 {
+namespace internal {
+namespace interpreter {
+
+MaybeHandle<Object> CallInterpreter(Isolate* isolate,
+ Handle<JSFunction> function) {
+ return Execution::Call(isolate, function,
+ isolate->factory()->undefined_value(), 0, nullptr);
+}
+
+InterpreterTester::InterpreterTester(
+ Isolate* isolate, const char* source, MaybeHandle<BytecodeArray> bytecode,
+ MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter)
+ : isolate_(isolate),
+ source_(source),
+ bytecode_(bytecode),
+ feedback_vector_(feedback_vector) {
+ i::FLAG_ignition = true;
+ i::FLAG_always_opt = false;
+ // Set ignition filter flag via SetFlagsFromString to avoid double-free
+ // (or potential leak with StrDup() based on ownership confusion).
+ ScopedVector<char> ignition_filter(64);
+ SNPrintF(ignition_filter, "--ignition-filter=%s", filter);
+ FlagList::SetFlagsFromString(ignition_filter.start(),
+ ignition_filter.length());
+ // Ensure handler table is generated.
+ isolate->interpreter()->Initialize();
+}
+
+InterpreterTester::InterpreterTester(
+ Isolate* isolate, Handle<BytecodeArray> bytecode,
+ MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter)
+ : InterpreterTester(isolate, nullptr, bytecode, feedback_vector, filter) {}
+
+InterpreterTester::InterpreterTester(Isolate* isolate, const char* source,
+ const char* filter)
+ : InterpreterTester(isolate, source, MaybeHandle<BytecodeArray>(),
+ MaybeHandle<TypeFeedbackVector>(), filter) {}
+
+InterpreterTester::~InterpreterTester() {}
+
+Local<Message> InterpreterTester::CheckThrowsReturnMessage() {
+ TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate_));
+ auto callable = GetCallable<>();
+ MaybeHandle<Object> no_result = callable();
+ CHECK(isolate_->has_pending_exception());
+ CHECK(try_catch.HasCaught());
+ CHECK(no_result.is_null());
+ isolate_->OptionalRescheduleException(true);
+ CHECK(!try_catch.Message().IsEmpty());
+ return try_catch.Message();
+}
+
+Handle<Object> InterpreterTester::NewObject(const char* script) {
+ return v8::Utils::OpenHandle(*CompileRun(script));
+}
+
+Handle<String> InterpreterTester::GetName(Isolate* isolate, const char* name) {
+ Handle<String> result = isolate->factory()->NewStringFromAsciiChecked(name);
+ return isolate->factory()->string_table()->LookupString(isolate, result);
+}
+
+std::string InterpreterTester::SourceForBody(const char* body) {
+ return "function " + function_name() + "() {\n" + std::string(body) + "\n}";
+}
+
+std::string InterpreterTester::function_name() {
+ return std::string(kFunctionName);
+}
+
+} // namespace interpreter
+} // namespace internal
+} // namespace v8
« 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