Move context specialization flag into CompilationInfo.

R=titzer@chromium.org

Review URL: https://codereview.chromium.org/507603003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23410 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d8b48c0a
......@@ -79,7 +79,8 @@ class CompilationInfo {
kDebug = 1 << 12,
kCompilingForDebugging = 1 << 13,
kParseRestriction = 1 << 14,
kSerializing = 1 << 15
kSerializing = 1 << 15,
kContextSpecializing = 1 << 16
};
CompilationInfo(Handle<JSFunction> closure, Zone* zone);
......@@ -181,6 +182,10 @@ class CompilationInfo {
bool will_serialize() const { return GetFlag(kSerializing); }
void MarkAsContextSpecializing() { SetFlag(kContextSpecializing); }
bool is_context_specializing() const { return GetFlag(kContextSpecializing); }
bool IsCodePreAgingActive() const {
return FLAG_optimize_for_size && FLAG_age_code && !will_serialize() &&
!is_debug();
......
......@@ -186,7 +186,7 @@ Handle<Code> Pipeline::GenerateCode() {
VerifyAndPrintGraph(&graph, "Initial untyped");
if (context_specialization_) {
if (info()->is_context_specializing()) {
SourcePositionTable::Scope pos(&source_positions,
SourcePosition::Unknown());
// Specialize the code to the context as aggressively as possible.
......
......@@ -24,8 +24,7 @@ class Linkage;
class Pipeline {
public:
explicit Pipeline(CompilationInfo* info)
: info_(info), context_specialization_(FLAG_context_specialization) {}
explicit Pipeline(CompilationInfo* info) : info_(info) {}
// Run the entire pipeline and generate a handle to a code object.
Handle<Code> GenerateCode();
......@@ -40,14 +39,9 @@ class Pipeline {
static void SetUp();
static void TearDown();
bool context_specialization() { return context_specialization_; }
void set_context_specialization(bool context_specialization) {
context_specialization_ = context_specialization;
}
private:
CompilationInfo* info_;
bool context_specialization_;
CompilationInfo* info() const { return info_; }
Isolate* isolate() { return info_->isolate(); }
......
......@@ -32,7 +32,6 @@ class FunctionTester : public InitializedHandleScope {
function((FLAG_allow_natives_syntax = true, NewFunction(source))),
context_specialization_(context_specialization) {
Compile(function);
USE(context_specialization_);
}
Isolate* isolate;
......@@ -46,6 +45,7 @@ class FunctionTester : public InitializedHandleScope {
StrictMode strict_mode = info.function()->strict_mode();
info.SetStrictMode(strict_mode);
info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code()));
if (context_specialization_) info.MarkAsContextSpecializing();
CHECK(Rewriter::Rewrite(&info));
CHECK(Scope::Analyze(&info));
CHECK_NE(NULL, info.scope());
......@@ -55,7 +55,6 @@ class FunctionTester : public InitializedHandleScope {
EnsureDeoptimizationSupport(&info);
Pipeline pipeline(&info);
pipeline.set_context_specialization(context_specialization_);
Handle<Code> code = pipeline.GenerateCode();
CHECK(!code.is_null());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment