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

Side by Side Diff: test/cctest/compiler/test-codegen-deopt.cc

Issue 974213002: Extract ParseInfo from CompilationInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 7
8 #include "src/compiler/code-generator.h" 8 #include "src/compiler/code-generator.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 26 matching lines...) Expand all
37 return v8::Utils::OpenHandle( 37 return v8::Utils::OpenHandle(
38 *v8::Handle<v8::Function>::Cast(CompileRun(source))); 38 *v8::Handle<v8::Function>::Cast(CompileRun(source)));
39 } 39 }
40 40
41 41
42 class DeoptCodegenTester { 42 class DeoptCodegenTester {
43 public: 43 public:
44 explicit DeoptCodegenTester(HandleAndZoneScope* scope, const char* src) 44 explicit DeoptCodegenTester(HandleAndZoneScope* scope, const char* src)
45 : scope_(scope), 45 : scope_(scope),
46 function(NewFunction(src)), 46 function(NewFunction(src)),
47 info(function, scope->main_zone()), 47 parse_info(scope->main_zone()),
48 info(parse_info.InitializeFromJSFunction(function)),
48 bailout_id(-1) { 49 bailout_id(-1) {
49 CHECK(Parser::ParseStatic(&info)); 50 CHECK(Parser::ParseStatic(&parse_info));
50 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); 51 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code()));
51 CHECK(Compiler::Analyze(&info)); 52 CHECK(Compiler::Analyze(&parse_info));
52 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); 53 CHECK(Compiler::EnsureDeoptimizationSupport(&info));
53 54
54 DCHECK(info.shared_info()->has_deoptimization_support()); 55 DCHECK(info.shared_info()->has_deoptimization_support());
55 56
56 graph = new (scope_->main_zone()) Graph(scope_->main_zone()); 57 graph = new (scope_->main_zone()) Graph(scope_->main_zone());
57 } 58 }
58 59
59 virtual ~DeoptCodegenTester() {} 60 virtual ~DeoptCodegenTester() {}
60 61
61 void GenerateCodeFromSchedule(Schedule* schedule) { 62 void GenerateCodeFromSchedule(Schedule* schedule) {
62 OFStream os(stdout); 63 OFStream os(stdout);
63 if (FLAG_trace_turbo) { 64 if (FLAG_trace_turbo) {
64 os << *schedule; 65 os << *schedule;
65 } 66 }
66 result_code = Pipeline::GenerateCodeForTesting(&info, graph, schedule); 67 result_code = Pipeline::GenerateCodeForTesting(&info, graph, schedule);
67 #ifdef OBJECT_PRINT 68 #ifdef OBJECT_PRINT
68 if (FLAG_print_opt_code || FLAG_trace_turbo) { 69 if (FLAG_print_opt_code || FLAG_trace_turbo) {
69 result_code->Print(); 70 result_code->Print();
70 } 71 }
71 #endif 72 #endif
72 } 73 }
73 74
74 Zone* zone() { return scope_->main_zone(); } 75 Zone* zone() { return scope_->main_zone(); }
75 Isolate* isolate() { return scope_->main_isolate(); } 76 Isolate* isolate() { return scope_->main_isolate(); }
76 77
77 HandleAndZoneScope* scope_; 78 HandleAndZoneScope* scope_;
78 Handle<JSFunction> function; 79 Handle<JSFunction> function;
80 ParseInfo parse_info;
79 CompilationInfo info; 81 CompilationInfo info;
80 BailoutId bailout_id; 82 BailoutId bailout_id;
81 Handle<Code> result_code; 83 Handle<Code> result_code;
82 TestInstrSeq* code; 84 TestInstrSeq* code;
83 Graph* graph; 85 Graph* graph;
84 }; 86 };
85 87
86 88
87 class TrivialDeoptCodegenTester : public DeoptCodegenTester { 89 class TrivialDeoptCodegenTester : public DeoptCodegenTester {
88 public: 90 public:
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 Handle<Object> result; 286 Handle<Object> result;
285 bool has_pending_exception = 287 bool has_pending_exception =
286 !Execution::Call(isolate, t.function, 288 !Execution::Call(isolate, t.function,
287 isolate->factory()->undefined_value(), 0, NULL, 289 isolate->factory()->undefined_value(), 0, NULL,
288 false).ToHandle(&result); 290 false).ToHandle(&result);
289 CHECK(!has_pending_exception); 291 CHECK(!has_pending_exception);
290 CHECK(result->SameValue(Smi::FromInt(42))); 292 CHECK(result->SameValue(Smi::FromInt(42)));
291 } 293 }
292 294
293 #endif 295 #endif
OLDNEW
« no previous file with comments | « test/cctest/compiler/function-tester.h ('k') | test/cctest/compiler/test-loop-assignment-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698