Reviewers: titzer,

Description:
Move context specialization flag into CompilationInfo.

[email protected]

Please review this at https://codereview.chromium.org/507603003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+9, -11 lines):
  M src/compiler.h
  M src/compiler/pipeline.h
  M src/compiler/pipeline.cc
  M test/cctest/compiler/function-tester.h


Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index 2194bfed7a5432049e873caedb6cbb043430bcc3..608b4a537699fa6685d0367b63b65cecb3ba7732 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -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();
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index bd99944149ec4adab18c97b2f9f3f85242888131..ca10a8017c7cf57b95902ad8b755beffa85185a3 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -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.
Index: src/compiler/pipeline.h
diff --git a/src/compiler/pipeline.h b/src/compiler/pipeline.h
index fce0952c4170b9b213fe1154c0416fee1295a990..9f8241a63c4ee4984f2f261f333a6447ce849c09 100644
--- a/src/compiler/pipeline.h
+++ b/src/compiler/pipeline.h
@@ -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(); }
Index: test/cctest/compiler/function-tester.h
diff --git a/test/cctest/compiler/function-tester.h b/test/cctest/compiler/function-tester.h index 00adcf183b0b54a5a99cd73e8ab59295f58e72e8..4a416a42082d0f4a54fc4f99ae9aac8af7e1679b 100644
--- a/test/cctest/compiler/function-tester.h
+++ b/test/cctest/compiler/function-tester.h
@@ -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());


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to