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

Side by Side Diff: test/cctest/compiler/function-tester.h

Issue 507603003: Move context specialization flag into CompilationInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/pipeline.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ 5 #ifndef V8_CCTEST_COMPILER_FUNCTION_TESTER_H_
6 #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ 6 #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 #include "test/cctest/cctest.h" 9 #include "test/cctest/cctest.h"
10 10
(...skipping 14 matching lines...) Expand all
25 namespace compiler { 25 namespace compiler {
26 26
27 class FunctionTester : public InitializedHandleScope { 27 class FunctionTester : public InitializedHandleScope {
28 public: 28 public:
29 explicit FunctionTester(const char* source, bool context_specialization = 29 explicit FunctionTester(const char* source, bool context_specialization =
30 FLAG_context_specialization) 30 FLAG_context_specialization)
31 : isolate(main_isolate()), 31 : isolate(main_isolate()),
32 function((FLAG_allow_natives_syntax = true, NewFunction(source))), 32 function((FLAG_allow_natives_syntax = true, NewFunction(source))),
33 context_specialization_(context_specialization) { 33 context_specialization_(context_specialization) {
34 Compile(function); 34 Compile(function);
35 USE(context_specialization_);
36 } 35 }
37 36
38 Isolate* isolate; 37 Isolate* isolate;
39 Handle<JSFunction> function; 38 Handle<JSFunction> function;
40 39
41 Handle<JSFunction> Compile(Handle<JSFunction> function) { 40 Handle<JSFunction> Compile(Handle<JSFunction> function) {
42 #if V8_TURBOFAN_TARGET 41 #if V8_TURBOFAN_TARGET
43 CompilationInfoWithZone info(function); 42 CompilationInfoWithZone info(function);
44 43
45 CHECK(Parser::Parse(&info)); 44 CHECK(Parser::Parse(&info));
46 StrictMode strict_mode = info.function()->strict_mode(); 45 StrictMode strict_mode = info.function()->strict_mode();
47 info.SetStrictMode(strict_mode); 46 info.SetStrictMode(strict_mode);
48 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); 47 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code()));
48 if (context_specialization_) info.MarkAsContextSpecializing();
49 CHECK(Rewriter::Rewrite(&info)); 49 CHECK(Rewriter::Rewrite(&info));
50 CHECK(Scope::Analyze(&info)); 50 CHECK(Scope::Analyze(&info));
51 CHECK_NE(NULL, info.scope()); 51 CHECK_NE(NULL, info.scope());
52 Handle<ScopeInfo> scope_info = ScopeInfo::Create(info.scope(), info.zone()); 52 Handle<ScopeInfo> scope_info = ScopeInfo::Create(info.scope(), info.zone());
53 info.shared_info()->set_scope_info(*scope_info); 53 info.shared_info()->set_scope_info(*scope_info);
54 54
55 EnsureDeoptimizationSupport(&info); 55 EnsureDeoptimizationSupport(&info);
56 56
57 Pipeline pipeline(&info); 57 Pipeline pipeline(&info);
58 pipeline.set_context_specialization(context_specialization_);
59 Handle<Code> code = pipeline.GenerateCode(); 58 Handle<Code> code = pipeline.GenerateCode();
60 59
61 CHECK(!code.is_null()); 60 CHECK(!code.is_null());
62 function->ReplaceCode(*code); 61 function->ReplaceCode(*code);
63 #elif USE_CRANKSHAFT 62 #elif USE_CRANKSHAFT
64 Handle<Code> unoptimized = Handle<Code>(function->code()); 63 Handle<Code> unoptimized = Handle<Code>(function->code());
65 Handle<Code> code = Compiler::GetOptimizedCode(function, unoptimized, 64 Handle<Code> code = Compiler::GetOptimizedCode(function, unoptimized,
66 Compiler::NOT_CONCURRENT); 65 Compiler::NOT_CONCURRENT);
67 CHECK(!code.is_null()); 66 CHECK(!code.is_null());
68 #if ENABLE_DISASSEMBLER 67 #if ENABLE_DISASSEMBLER
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 Handle<Object> false_value() { return isolate->factory()->false_value(); } 193 Handle<Object> false_value() { return isolate->factory()->false_value(); }
195 194
196 private: 195 private:
197 bool context_specialization_; 196 bool context_specialization_;
198 }; 197 };
199 } 198 }
200 } 199 }
201 } // namespace v8::internal::compiler 200 } // namespace v8::internal::compiler
202 201
203 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ 202 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_
OLDNEW
« no previous file with comments | « src/compiler/pipeline.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698