diff options
author | Michaël Zasso <targos@protonmail.com> | 2016-09-06 22:49:51 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2016-09-22 09:51:19 +0200 |
commit | ec02b811a8a5c999bab4de312be2d732b7d9d50b (patch) | |
tree | ca3068017254f238cf413a451c57a803572983a4 /deps/v8/test/cctest/compiler/function-tester.h | |
parent | d2eb7ce0105369a9cad82787cb33a665e9bd00ad (diff) | |
download | node-new-ec02b811a8a5c999bab4de312be2d732b7d9d50b.tar.gz |
deps: update V8 to 5.4.500.27
Pick up latest commit from the 5.4-lkgr branch.
deps: edit V8 gitignore to allow trace event copy
deps: update V8 trace event to 315bf1e2d45be7d53346c31cfcc37424a32c30c8
deps: edit V8 gitignore to allow gtest_prod.h copy
deps: update V8 gtest to 6f8a66431cb592dad629028a50b3dd418a408c87
PR-URL: https://github.com/nodejs/node/pull/8317
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/test/cctest/compiler/function-tester.h')
-rw-r--r-- | deps/v8/test/cctest/compiler/function-tester.h | 95 |
1 files changed, 60 insertions, 35 deletions
diff --git a/deps/v8/test/cctest/compiler/function-tester.h b/deps/v8/test/cctest/compiler/function-tester.h index 631bdde5ce..c1473ac960 100644 --- a/deps/v8/test/cctest/compiler/function-tester.h +++ b/deps/v8/test/cctest/compiler/function-tester.h @@ -6,7 +6,6 @@ #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ #include "src/ast/ast-numbering.h" -#include "src/ast/scopes.h" #include "src/compiler.h" #include "src/compiler/linkage.h" #include "src/compiler/pipeline.h" @@ -14,6 +13,7 @@ #include "src/full-codegen/full-codegen.h" #include "src/handles.h" #include "src/objects-inl.h" +#include "src/parsing/parse-info.h" #include "src/parsing/parser.h" #include "src/parsing/rewriter.h" #include "test/cctest/cctest.h" @@ -30,8 +30,8 @@ class FunctionTester : public InitializedHandleScope { flags_(flags) { Compile(function); const uint32_t supported_flags = - CompilationInfo::kFunctionContextSpecializing | - CompilationInfo::kInliningEnabled | CompilationInfo::kTypingEnabled; + CompilationInfo::kNativeContextSpecializing | + CompilationInfo::kInliningEnabled; CHECK_EQ(0u, flags_ & ~supported_flags); } @@ -42,16 +42,18 @@ class FunctionTester : public InitializedHandleScope { CompileGraph(graph); } - FunctionTester(const CallInterfaceDescriptor& descriptor, Handle<Code> code) + FunctionTester(Handle<Code> code, int param_count) : isolate(main_isolate()), - function( - (FLAG_allow_natives_syntax = true, - NewFunction(BuildFunctionFromDescriptor(descriptor).c_str()))), + function((FLAG_allow_natives_syntax = true, + NewFunction(BuildFunction(param_count).c_str()))), flags_(0) { Compile(function); function->ReplaceCode(*code); } + FunctionTester(const CallInterfaceDescriptor& descriptor, Handle<Code> code) + : FunctionTester(code, descriptor.GetParameterCount()) {} + Isolate* isolate; Handle<JSFunction> function; @@ -59,11 +61,22 @@ class FunctionTester : public InitializedHandleScope { return Execution::Call(isolate, function, undefined(), 0, nullptr); } + MaybeHandle<Object> Call(Handle<Object> a) { + Handle<Object> args[] = {a}; + return Execution::Call(isolate, function, undefined(), 1, args); + } + MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b) { Handle<Object> args[] = {a, b}; return Execution::Call(isolate, function, undefined(), 2, args); } + MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, + Handle<Object> c) { + Handle<Object> args[] = {a, b, c}; + return Execution::Call(isolate, function, undefined(), 3, args); + } + MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, Handle<Object> c, Handle<Object> d) { Handle<Object> args[] = {a, b, c, d}; @@ -91,41 +104,56 @@ class FunctionTester : public InitializedHandleScope { return try_catch.Message(); } - void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b) { - Handle<Object> result = Call(a, b).ToHandleChecked(); + void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b, + Handle<Object> c, Handle<Object> d) { + Handle<Object> result = Call(a, b, c, d).ToHandleChecked(); CHECK(expected->SameValue(*result)); } + void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b, + Handle<Object> c) { + return CheckCall(expected, a, b, c, undefined()); + } + + void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b) { + return CheckCall(expected, a, b, undefined()); + } + void CheckCall(Handle<Object> expected, Handle<Object> a) { CheckCall(expected, a, undefined()); } - void CheckCall(Handle<Object> expected) { - CheckCall(expected, undefined(), undefined()); - } + void CheckCall(Handle<Object> expected) { CheckCall(expected, undefined()); } void CheckCall(double expected, double a, double b) { CheckCall(Val(expected), Val(a), Val(b)); } + void CheckTrue(Handle<Object> a) { CheckCall(true_value(), a); } + void CheckTrue(Handle<Object> a, Handle<Object> b) { CheckCall(true_value(), a, b); } - void CheckTrue(Handle<Object> a) { CheckCall(true_value(), a, undefined()); } + void CheckTrue(Handle<Object> a, Handle<Object> b, Handle<Object> c) { + CheckCall(true_value(), a, b, c); + } + + void CheckTrue(Handle<Object> a, Handle<Object> b, Handle<Object> c, + Handle<Object> d) { + CheckCall(true_value(), a, b, c, d); + } void CheckTrue(double a, double b) { CheckCall(true_value(), Val(a), Val(b)); } + void CheckFalse(Handle<Object> a) { CheckCall(false_value(), a); } + void CheckFalse(Handle<Object> a, Handle<Object> b) { CheckCall(false_value(), a, b); } - void CheckFalse(Handle<Object> a) { - CheckCall(false_value(), a, undefined()); - } - void CheckFalse(double a, double b) { CheckCall(false_value(), Val(a), Val(b)); } @@ -177,25 +205,29 @@ class FunctionTester : public InitializedHandleScope { Handle<JSFunction> Compile(Handle<JSFunction> function) { Zone zone(function->GetIsolate()->allocator()); ParseInfo parse_info(&zone, function); - CompilationInfo info(&parse_info); + CompilationInfo info(&parse_info, function); info.MarkAsDeoptimizationEnabled(); - CHECK(Parser::ParseStatic(info.parse_info())); + if (!FLAG_turbo_from_bytecode) { + CHECK(Parser::ParseStatic(info.parse_info())); + } info.SetOptimizing(); - if (flags_ & CompilationInfo::kFunctionContextSpecializing) { - info.MarkAsFunctionContextSpecializing(); + if (flags_ & CompilationInfo::kNativeContextSpecializing) { + info.MarkAsNativeContextSpecializing(); } if (flags_ & CompilationInfo::kInliningEnabled) { info.MarkAsInliningEnabled(); } - if (flags_ & CompilationInfo::kTypingEnabled) { - info.MarkAsTypingEnabled(); + if (FLAG_turbo_from_bytecode) { + CHECK(Compiler::EnsureBytecode(&info)); + info.MarkAsOptimizeFromBytecode(); + } else { + CHECK(Compiler::Analyze(info.parse_info())); + CHECK(Compiler::EnsureDeoptimizationSupport(&info)); } - CHECK(Compiler::Analyze(info.parse_info())); - CHECK(Compiler::EnsureDeoptimizationSupport(&info)); + JSFunction::EnsureLiterals(function); - Pipeline pipeline(&info); - Handle<Code> code = pipeline.GenerateCode(); + Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); CHECK(!code.is_null()); info.dependencies()->Commit(code); info.context()->native_context()->AddOptimizedCode(*code); @@ -216,22 +248,15 @@ class FunctionTester : public InitializedHandleScope { return function_string; } - std::string BuildFunctionFromDescriptor( - const CallInterfaceDescriptor& descriptor) { - return BuildFunction(descriptor.GetParameterCount()); - } - // Compile the given machine graph instead of the source of the function // and replace the JSFunction's code with the result. Handle<JSFunction> CompileGraph(Graph* graph) { Zone zone(function->GetIsolate()->allocator()); ParseInfo parse_info(&zone, function); - CompilationInfo info(&parse_info); + CompilationInfo info(&parse_info, function); CHECK(Parser::ParseStatic(info.parse_info())); info.SetOptimizing(); - CHECK(Compiler::Analyze(info.parse_info())); - CHECK(Compiler::EnsureDeoptimizationSupport(&info)); Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); CHECK(!code.is_null()); |