Revision: 7469
Author: [email protected]
Date: Fri Apr 1 03:52:18 2011
Log: Never use classic code generator.
Crankshaft is now the default on all platforms. This is the first
patch on the way to removing the classic code generator from the
system.
[email protected]
BUG=
TEST=
Review URL: http://codereview.chromium.org/6771045
http://code.google.com/p/v8/source/detail?r=7469
Modified:
/branches/bleeding_edge/src/arm/full-codegen-arm.cc
/branches/bleeding_edge/src/ast.h
/branches/bleeding_edge/src/compiler.cc
/branches/bleeding_edge/src/flag-definitions.h
/branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
/branches/bleeding_edge/src/objects-inl.h
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/v8.cc
/branches/bleeding_edge/src/x64/full-codegen-x64.cc
/branches/bleeding_edge/test/cctest/test-deoptimization.cc
/branches/bleeding_edge/test/cctest/test-heap.cc
/branches/bleeding_edge/test/cctest/test-log.cc
/branches/bleeding_edge/tools/test.py
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Fri Apr 1 01:02:12
2011
+++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Fri Apr 1 03:52:18
2011
@@ -2352,16 +2352,6 @@
}
}
} else {
- // Call to some other expression. If the expression is an anonymous
- // function literal not called in a loop, mark it as one that should
- // also use the fast code generator.
- FunctionLiteral* lit = fun->AsFunctionLiteral();
- if (lit != NULL &&
- lit->name()->Equals(isolate()->heap()->empty_string()) &&
- loop_depth() == 0) {
- lit->set_try_full_codegen(true);
- }
-
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(fun);
}
=======================================
--- /branches/bleeding_edge/src/ast.h Mon Mar 21 05:25:31 2011
+++ /branches/bleeding_edge/src/ast.h Fri Apr 1 03:52:18 2011
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -1743,7 +1743,6 @@
contains_loops_(contains_loops),
function_token_position_(RelocInfo::kNoPosition),
inferred_name_(HEAP->empty_string()),
- try_full_codegen_(false),
pretenure_(false) { }
DECLARE_NODE_TYPE(FunctionLiteral)
@@ -1780,9 +1779,6 @@
void set_inferred_name(Handle<String> inferred_name) {
inferred_name_ = inferred_name;
}
-
- bool try_full_codegen() { return try_full_codegen_; }
- void set_try_full_codegen(bool flag) { try_full_codegen_ = flag; }
bool pretenure() { return pretenure_; }
void set_pretenure(bool value) { pretenure_ = value; }
@@ -1803,7 +1799,6 @@
bool strict_mode_;
int function_token_position_;
Handle<String> inferred_name_;
- bool try_full_codegen_;
bool pretenure_;
};
=======================================
--- /branches/bleeding_edge/src/compiler.cc Sun Mar 27 22:57:27 2011
+++ /branches/bleeding_edge/src/compiler.cc Fri Apr 1 03:52:18 2011
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -326,30 +326,9 @@
if (Rewriter::Rewrite(info) && Scope::Analyze(info)) {
if (V8::UseCrankshaft()) return MakeCrankshaftCode(info);
-
- // Generate code and return it. Code generator selection is governed
by
- // which backends are enabled and whether the function is considered
- // run-once code or not.
- //
- // --full-compiler enables the dedicated backend for code we expect to
- // be run once
- //
- // The normal choice of backend can be overridden with the flags
- // --always-full-compiler.
- if (Rewriter::Analyze(info)) {
- Handle<SharedFunctionInfo> shared = info->shared_info();
- bool is_run_once = (shared.is_null())
- ? info->scope()->is_global_scope()
- : (shared->is_toplevel() || shared->try_full_codegen());
- bool can_use_full =
- FLAG_full_compiler && !info->function()->contains_loops();
- if (AlwaysFullCompiler() || (is_run_once && can_use_full)) {
- return FullCodeGenerator::MakeCode(info);
- } else {
- return AssignedVariablesAnalyzer::Analyze(info) &&
- CodeGenerator::MakeCode(info);
- }
- }
+ // If crankshaft is not supported fall back to full code generator
+ // for all compilation.
+ return FullCodeGenerator::MakeCode(info);
}
return false;
@@ -721,35 +700,12 @@
if (FLAG_lazy && allow_lazy) {
Handle<Code> code = info.isolate()->builtins()->LazyCompile();
info.SetCode(code);
- } else {
- if (V8::UseCrankshaft()) {
- if (!MakeCrankshaftCode(&info)) {
- return Handle<SharedFunctionInfo>::null();
- }
- } else {
- // The bodies of function literals have not yet been visited by the
- // AST optimizer/analyzer.
- if (!Rewriter::Analyze(&info)) return
Handle<SharedFunctionInfo>::null();
-
- bool is_run_once = literal->try_full_codegen();
- bool can_use_full = FLAG_full_compiler && !literal->contains_loops();
-
- if (AlwaysFullCompiler() || (is_run_once && can_use_full)) {
- if (!FullCodeGenerator::MakeCode(&info)) {
- return Handle<SharedFunctionInfo>::null();
- }
- } else {
- // We fall back to the classic V8 code generator.
- if (!AssignedVariablesAnalyzer::Analyze(&info) ||
- !CodeGenerator::MakeCode(&info)) {
- return Handle<SharedFunctionInfo>::null();
- }
- }
- }
+ } else if ((V8::UseCrankshaft() && MakeCrankshaftCode(&info)) ||
+ (!V8::UseCrankshaft() && FullCodeGenerator::MakeCode(&info)))
{
ASSERT(!info.code().is_null());
-
- // Function compilation complete.
scope_info = SerializedScopeInfo::Create(info.scope());
+ } else {
+ return Handle<SharedFunctionInfo>::null();
}
// Create a shared function info object.
@@ -791,7 +747,6 @@
function_info->SetThisPropertyAssignmentsInfo(
lit->has_only_simple_this_property_assignments(),
*lit->this_property_assignments());
- function_info->set_try_full_codegen(lit->try_full_codegen());
function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation());
function_info->set_strict_mode(lit->strict_mode());
}
=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Mon Mar 28 06:05:36 2011
+++ /branches/bleeding_edge/src/flag-definitions.h Fri Apr 1 03:52:18 2011
@@ -97,11 +97,6 @@
#define FLAG FLAG_FULL
// Flags for Crankshaft.
-#ifdef V8_TARGET_ARCH_MIPS
- DEFINE_bool(crankshaft, false, "use crankshaft")
-#else
- DEFINE_bool(crankshaft, true, "use crankshaft")
-#endif
DEFINE_string(hydrogen_filter, "", "hydrogen use/trace filter")
DEFINE_bool(use_hydrogen, true, "use generated hydrogen for compilation")
DEFINE_bool(build_lithium, true, "use lithium chunk builder")
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Fri Apr 1
01:02:12 2011
+++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Fri Apr 1
03:52:18 2011
@@ -2268,15 +2268,6 @@
}
}
} else {
- // Call to some other expression. If the expression is an anonymous
- // function literal not called in a loop, mark it as one that should
- // also use the full code generator.
- FunctionLiteral* lit = fun->AsFunctionLiteral();
- if (lit != NULL &&
- lit->name()->Equals(isolate()->heap()->empty_string()) &&
- loop_depth() == 0) {
- lit->set_try_full_codegen(true);
- }
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(fun);
}
=======================================
--- /branches/bleeding_edge/src/objects-inl.h Thu Mar 31 04:52:51 2011
+++ /branches/bleeding_edge/src/objects-inl.h Fri Apr 1 03:52:18 2011
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -3056,10 +3056,6 @@
kHasOnlySimpleThisPropertyAssignments)
BOOL_ACCESSORS(SharedFunctionInfo,
compiler_hints,
- try_full_codegen,
- kTryFullCodegen)
-BOOL_ACCESSORS(SharedFunctionInfo,
- compiler_hints,
allows_lazy_compilation,
kAllowLazyCompilation)
=======================================
--- /branches/bleeding_edge/src/objects.h Thu Mar 31 03:55:53 2011
+++ /branches/bleeding_edge/src/objects.h Fri Apr 1 03:52:18 2011
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -4259,9 +4259,6 @@
// this.x = y; where y is either a constant or refers to an argument.
inline bool has_only_simple_this_property_assignments();
- inline bool try_full_codegen();
- inline void set_try_full_codegen(bool flag);
-
// Indicates if this function can be lazy compiled.
// This is used to determine if we can safely flush code from a function
// when doing GC if we expect that the function will no longer be used.
@@ -4461,13 +4458,12 @@
// Bit positions in compiler_hints.
static const int kHasOnlySimpleThisPropertyAssignments = 0;
- static const int kTryFullCodegen = 1;
- static const int kAllowLazyCompilation = 2;
- static const int kLiveObjectsMayExist = 3;
- static const int kCodeAgeShift = 4;
+ static const int kAllowLazyCompilation = 1;
+ static const int kLiveObjectsMayExist = 2;
+ static const int kCodeAgeShift = 3;
static const int kCodeAgeMask = 0x7;
- static const int kOptimizationDisabled = 7;
- static const int kStrictModeFunction = 8;
+ static const int kOptimizationDisabled = 6;
+ static const int kStrictModeFunction = 7;
private:
#if V8_HOST_ARCH_32_BIT
=======================================
--- /branches/bleeding_edge/src/v8.cc Thu Mar 31 09:17:37 2011
+++ /branches/bleeding_edge/src/v8.cc Fri Apr 1 03:52:18 2011
@@ -1,4 +1,4 @@
-// Copyright 2006-2009 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -196,7 +196,7 @@
#if defined(V8_TARGET_ARCH_ARM) && !defined(USE_ARM_EABI)
use_crankshaft_ = false;
#else
- use_crankshaft_ = FLAG_crankshaft;
+ use_crankshaft_ = true;
#endif
if (Serializer::enabled()) {
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Fri Apr 1 01:02:12
2011
+++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Fri Apr 1 03:52:18
2011
@@ -2248,15 +2248,6 @@
}
}
} else {
- // Call to some other expression. If the expression is an anonymous
- // function literal not called in a loop, mark it as one that should
- // also use the full code generator.
- FunctionLiteral* lit = fun->AsFunctionLiteral();
- if (lit != NULL &&
- lit->name()->Equals(isolate()->heap()->empty_string()) &&
- loop_depth() == 0) {
- lit->set_try_full_codegen(true);
- }
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(fun);
}
=======================================
--- /branches/bleeding_edge/test/cctest/test-deoptimization.cc Fri Mar 18
13:35:07 2011
+++ /branches/bleeding_edge/test/cctest/test-deoptimization.cc Fri Apr 1
03:52:18 2011
@@ -1,4 +1,4 @@
-// Copyright 2007-2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -371,7 +371,7 @@
i::FLAG_always_opt = true;
CompileRun(f_source);
CompileRun("f('a+', new X());");
- CHECK(!i::V8::UseCrankshaft() ||
+ CHECK(i::FLAG_always_full_compiler ||
GetJSFunction(env->Global(), "f")->IsOptimized());
// Call f and force deoptimization while processing the binary
operation.
@@ -423,7 +423,7 @@
i::FLAG_always_opt = true;
CompileRun(f_source);
CompileRun("f(7, new X());");
- CHECK(!i::V8::UseCrankshaft() ||
+ CHECK(i::FLAG_always_full_compiler ||
GetJSFunction((*env)->Global(), "f")->IsOptimized());
// Call f and force deoptimization while processing the binary operation.
@@ -534,7 +534,7 @@
i::FLAG_always_opt = true;
CompileRun(f_source);
CompileRun("f('a', new X());");
- CHECK(!i::V8::UseCrankshaft() ||
+ CHECK(i::FLAG_always_full_compiler ||
GetJSFunction(env->Global(), "f")->IsOptimized());
// Call f and force deoptimization while processing the comparison.
@@ -606,7 +606,7 @@
CompileRun("g1(new X());");
CompileRun("f2(new X(), 'z');");
CompileRun("g2(new X(), 'z');");
- if (i::V8::UseCrankshaft()) {
+ if (!i::FLAG_always_full_compiler) {
CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized());
CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized());
CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized());
@@ -692,7 +692,7 @@
CompileRun("g1(new X());");
CompileRun("f2(new X(), 'z');");
CompileRun("g2(new X(), 'z');");
- if (i::V8::UseCrankshaft()) {
+ if (!i::FLAG_always_full_compiler) {
CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized());
CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized());
CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized());
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Thu Mar 31 09:17:37
2011
+++ /branches/bleeding_edge/test/cctest/test-heap.cc Fri Apr 1 03:52:18
2011
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
#include <stdlib.h>
@@ -1070,7 +1070,7 @@
for (int i = 0; i < kNumTestContexts; i++) {
ctx[i] = v8::Context::New();
- bool opt = (FLAG_always_opt && i::V8::UseCrankshaft());
+ bool opt = (FLAG_always_opt && !i::FLAG_always_full_compiler);
CHECK_EQ(i + 1, CountGlobalContexts());
@@ -1204,7 +1204,7 @@
CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1));
}
- bool opt = (FLAG_always_opt && i::V8::UseCrankshaft());
+ bool opt = (FLAG_always_opt && !i::FLAG_always_full_compiler);
// Compile a number of functions the length of the weak list of optimized
// functions both with and without GCs while iterating the list.
=======================================
--- /branches/bleeding_edge/test/cctest/test-log.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/test/cctest/test-log.cc Fri Apr 1 03:52:18 2011
@@ -1,4 +1,4 @@
-// Copyright 2006-2009 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
//
// Tests of logging functions from log.h
@@ -294,7 +294,7 @@
TEST(ProfLazyMode) {
ScopedLoggerInitializer initialize_logger(true);
- if (!i::V8::UseCrankshaft()) return;
+ if (i::FLAG_always_full_compiler) return;
// No sampling should happen prior to resuming profiler unless we
// are runtime profiling.
=======================================
--- /branches/bleeding_edge/tools/test.py Thu Mar 31 01:12:17 2011
+++ /branches/bleeding_edge/tools/test.py Fri Apr 1 03:52:18 2011
@@ -584,7 +584,9 @@
# Use this to run several variants of the tests, e.g.:
# VARIANT_FLAGS = [[], ['--always_compact', '--noflush_code']]
-VARIANT_FLAGS = [[], ['--stress-opt', '--always-opt'], ['--nocrankshaft']]
+VARIANT_FLAGS = [[],
+ ['--stress-opt', '--always-opt'],
+ ['--always-full-compiler']]
class TestRepository(TestSuite):
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev