Revision: 16494
Author: [email protected]
Date: Tue Sep 3 08:49:44 2013 UTC
Log: Move global V8::UseCrankshaft() into the Isolate.
[email protected]
BUG=v8:2744
Review URL: https://codereview.chromium.org/23441029
http://code.google.com/p/v8/source/detail?r=16494
Modified:
/branches/bleeding_edge/src/compiler.cc
/branches/bleeding_edge/src/compiler.h
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/isolate.h
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/v8.cc
/branches/bleeding_edge/src/v8.h
/branches/bleeding_edge/test/cctest/test-deoptimization.cc
/branches/bleeding_edge/test/cctest/test-heap.cc
/branches/bleeding_edge/test/cctest/test-random.cc
=======================================
--- /branches/bleeding_edge/src/compiler.cc Tue Sep 3 06:57:16 2013 UTC
+++ /branches/bleeding_edge/src/compiler.cc Tue Sep 3 08:49:44 2013 UTC
@@ -119,7 +119,7 @@
mode_ = STUB;
return;
}
- mode_ = V8::UseCrankshaft() ? mode : NONOPT;
+ mode_ = isolate->use_crankshaft() ? mode : NONOPT;
abort_due_to_dependency_ = false;
if (script_->type()->value() == Script::TYPE_NATIVE) {
MarkAsNative();
@@ -242,7 +242,7 @@
// break points has actually been set.
static bool IsDebuggerActive(Isolate* isolate) {
#ifdef ENABLE_DEBUGGER_SUPPORT
- return V8::UseCrankshaft() ?
+ return isolate->use_crankshaft() ?
isolate->debug()->has_break_points() :
isolate->debugger()->IsDebuggerActive();
#else
@@ -310,7 +310,7 @@
OptimizingCompiler::Status OptimizingCompiler::CreateGraph() {
- ASSERT(V8::UseCrankshaft());
+ ASSERT(isolate()->use_crankshaft());
ASSERT(info()->IsOptimizing());
ASSERT(!info()->IsCompilingForDebugging());
@@ -499,7 +499,7 @@
static bool GenerateCode(CompilationInfo* info) {
- bool is_optimizing = V8::UseCrankshaft() &&
+ bool is_optimizing = info->isolate()->use_crankshaft() &&
!info->IsCompilingForDebugging() &&
info->IsOptimizing();
if (is_optimizing) {
@@ -838,7 +838,7 @@
shared->set_dont_inline(lit->flags()->Contains(kDontInline));
shared->set_ast_node_count(lit->ast_node_count());
- if (V8::UseCrankshaft() &&
+ if (info->isolate()->use_crankshaft() &&
!function.is_null() &&
!shared->optimization_disabled()) {
// If we're asked to always optimize, we compile the optimized
=======================================
--- /branches/bleeding_edge/src/compiler.h Thu Aug 29 09:15:13 2013 UTC
+++ /branches/bleeding_edge/src/compiler.h Tue Sep 3 08:49:44 2013 UTC
@@ -335,7 +335,7 @@
void Initialize(Isolate* isolate, Mode mode, Zone* zone);
void SetMode(Mode mode) {
- ASSERT(V8::UseCrankshaft());
+ ASSERT(isolate()->use_crankshaft());
mode_ = mode;
}
=======================================
--- /branches/bleeding_edge/src/factory.cc Tue Sep 3 06:59:01 2013 UTC
+++ /branches/bleeding_edge/src/factory.cc Tue Sep 3 08:49:44 2013 UTC
@@ -664,7 +664,7 @@
return result;
}
- if (V8::UseCrankshaft() &&
+ if (isolate()->use_crankshaft() &&
FLAG_always_opt &&
result->is_compiled() &&
!function_info->is_toplevel() &&
=======================================
--- /branches/bleeding_edge/src/isolate.cc Tue Sep 3 06:59:01 2013 UTC
+++ /branches/bleeding_edge/src/isolate.cc Tue Sep 3 08:49:44 2013 UTC
@@ -1793,6 +1793,7 @@
regexp_stack_(NULL),
date_cache_(NULL),
code_stub_interface_descriptors_(NULL),
+ use_crankshaft_(true),
initialized_from_snapshot_(false),
cpu_profiler_(NULL),
heap_profiler_(NULL),
@@ -2148,6 +2149,10 @@
stress_deopt_count_ = FLAG_deopt_every_n_times;
+ use_crankshaft_ = FLAG_crankshaft
+ && !Serializer::enabled()
+ && CPU::SupportsCrankshaft();
+
if (function_entry_hook() != NULL) {
// When function entry hooking is in effect, we have to create the code
// stubs from scratch to get entry hooks, rather than loading the
previously
=======================================
--- /branches/bleeding_edge/src/isolate.h Thu Aug 29 17:13:57 2013 UTC
+++ /branches/bleeding_edge/src/isolate.h Tue Sep 3 08:49:44 2013 UTC
@@ -1058,6 +1058,8 @@
void SetTopLookupResult(LookupResult* top) {
thread_local_top_.top_lookup_result_ = top;
}
+
+ bool use_crankshaft() const { return use_crankshaft_; }
bool initialized_from_snapshot() { return initialized_from_snapshot_; }
@@ -1300,6 +1302,9 @@
unibrow::Mapping<unibrow::Ecma262Canonicalize>
interp_canonicalize_mapping_;
CodeStubInterfaceDescriptor* code_stub_interface_descriptors_;
+ // True if we are using the Crankshaft optimizing compiler.
+ bool use_crankshaft_;
+
// True if this isolate was initialized from a snapshot.
bool initialized_from_snapshot_;
=======================================
--- /branches/bleeding_edge/src/runtime.cc Tue Sep 3 07:19:32 2013 UTC
+++ /branches/bleeding_edge/src/runtime.cc Tue Sep 3 08:49:44 2013 UTC
@@ -8352,7 +8352,7 @@
HandleScope handle_scope(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
- ASSERT(V8::UseCrankshaft() && FLAG_concurrent_recompilation);
+ ASSERT(isolate->use_crankshaft() && FLAG_concurrent_recompilation);
isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
return function->code();
}
@@ -8538,7 +8538,7 @@
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) {
HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 1 || args.length() == 2);
- if (!V8::UseCrankshaft()) {
+ if (!isolate->use_crankshaft()) {
return Smi::FromInt(4); // 4 == "never".
}
bool sync_with_compiler_thread = true;
=======================================
--- /branches/bleeding_edge/src/v8.cc Mon Sep 2 17:06:08 2013 UTC
+++ /branches/bleeding_edge/src/v8.cc Tue Sep 3 08:49:44 2013 UTC
@@ -53,7 +53,6 @@
bool V8::has_been_set_up_ = false;
bool V8::has_been_disposed_ = false;
bool V8::has_fatal_error_ = false;
-bool V8::use_crankshaft_ = true;
List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL;
v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL;
@@ -314,9 +313,6 @@
OS::SetUp();
Sampler::SetUp();
CPU::SetUp();
- use_crankshaft_ = FLAG_crankshaft
- && !Serializer::enabled()
- && CPU::SupportsCrankshaft();
OS::PostSetUp();
ElementsAccessor::InitializeOncePerProcess();
LOperand::SetUpCaches();
=======================================
--- /branches/bleeding_edge/src/v8.h Mon Sep 2 17:06:08 2013 UTC
+++ /branches/bleeding_edge/src/v8.h Tue Sep 3 08:49:44 2013 UTC
@@ -82,7 +82,6 @@
// empty heap.
static bool Initialize(Deserializer* des);
static void TearDown();
- static bool UseCrankshaft() { return use_crankshaft_; }
// To be dead you have to have lived
// TODO(isolates): move IsDead to Isolate.
static bool IsDead() { return has_fatal_error_ || has_been_disposed_; }
@@ -138,8 +137,6 @@
// True if engine has been shut down
// (reset if engine is restarted)
static bool has_been_disposed_;
- // True if we are using the crankshaft optimizing compiler.
- static bool use_crankshaft_;
// List of callbacks when a Call completes.
static List<CallCompletedCallback>* call_completed_callbacks_;
// Allocator for external array buffers.
=======================================
--- /branches/bleeding_edge/test/cctest/test-deoptimization.cc Thu Aug 22
16:14:37 2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-deoptimization.cc Tue Sep 3
08:49:44 2013 UTC
@@ -367,7 +367,7 @@
i::FLAG_always_opt = true;
CompileRun(f_source);
CompileRun("f('a+', new X());");
- CHECK(!i::V8::UseCrankshaft() ||
+ CHECK(!i::Isolate::Current()->use_crankshaft() ||
GetJSFunction(env->Global(), "f")->IsOptimized());
// Call f and force deoptimization while processing the binary
operation.
@@ -419,7 +419,7 @@
i::FLAG_always_opt = true;
CompileRun(f_source);
CompileRun("f(7, new X());");
- CHECK(!i::V8::UseCrankshaft() ||
+ CHECK(!i::Isolate::Current()->use_crankshaft() ||
GetJSFunction((*env)->Global(), "f")->IsOptimized());
// Call f and force deoptimization while processing the binary operation.
@@ -517,7 +517,7 @@
i::FLAG_always_opt = true;
CompileRun(f_source);
CompileRun("f('a', new X());");
- CHECK(!i::V8::UseCrankshaft() ||
+ CHECK(!i::Isolate::Current()->use_crankshaft() ||
GetJSFunction(env->Global(), "f")->IsOptimized());
// Call f and force deoptimization while processing the comparison.
@@ -587,7 +587,7 @@
CompileRun("g1(new X());");
CompileRun("f2(new X(), 'z');");
CompileRun("g2(new X(), 'z');");
- if (i::V8::UseCrankshaft()) {
+ if (i::Isolate::Current()->use_crankshaft()) {
CHECK(GetJSFunction(env->Global(), "f1")->IsOptimized());
CHECK(GetJSFunction(env->Global(), "g1")->IsOptimized());
CHECK(GetJSFunction(env->Global(), "f2")->IsOptimized());
@@ -671,7 +671,7 @@
CompileRun("g1(new X());");
CompileRun("f2(new X(), 'z');");
CompileRun("g2(new X(), 'z');");
- if (i::V8::UseCrankshaft()) {
+ if (i::Isolate::Current()->use_crankshaft()) {
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 Tue Sep 3 07:34:34
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-heap.cc Tue Sep 3 08:49:44
2013 UTC
@@ -1335,7 +1335,7 @@
isolate->compilation_cache()->Clear();
heap->CollectAllGarbage(Heap::kNoGCFlags);
- bool opt = (FLAG_always_opt && i::V8::UseCrankshaft());
+ bool opt = (FLAG_always_opt && isolate->use_crankshaft());
CHECK_EQ(i + 1, CountNativeContexts());
@@ -1479,7 +1479,7 @@
CHECK_EQ(i + 1, CountNativeContextsWithGC(isolate, i / 2 + 1));
}
- bool opt = (FLAG_always_opt && i::V8::UseCrankshaft());
+ bool opt = (FLAG_always_opt && isolate->use_crankshaft());
// Compile a number of functions the length of the weak list of optimized
// functions both with and without GCs while iterating the list.
@@ -1879,7 +1879,7 @@
#endif
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft()) return;
+ if (!i::Isolate::Current()->use_crankshaft()) return;
if (i::FLAG_force_marking_deque_overflows) return;
v8::HandleScope outer_scope(v8::Isolate::GetCurrent());
@@ -1996,7 +1996,7 @@
#endif
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft()) return;
+ if (!i::Isolate::Current()->use_crankshaft()) return;
v8::HandleScope outer_scope(v8::Isolate::GetCurrent());
{
@@ -2053,7 +2053,7 @@
#endif
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft()) return;
+ if (!i::Isolate::Current()->use_crankshaft()) return;
v8::HandleScope outer_scope(CcTest::isolate());
{
@@ -2092,7 +2092,7 @@
TEST(OptimizedAllocationAlwaysInNewSpace) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
@@ -2121,7 +2121,7 @@
TEST(OptimizedPretenuringAllocationFolding) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
HEAP->SetNewSpaceHighPromotionModeActive(true);
@@ -2157,7 +2157,7 @@
TEST(OptimizedPretenuringAllocationFoldingBlocks) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
HEAP->SetNewSpaceHighPromotionModeActive(true);
@@ -2193,7 +2193,7 @@
TEST(OptimizedPretenuringObjectArrayLiterals) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
HEAP->SetNewSpaceHighPromotionModeActive(true);
@@ -2218,7 +2218,7 @@
TEST(OptimizedPretenuringMixedInObjectProperties) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
HEAP->SetNewSpaceHighPromotionModeActive(true);
@@ -2249,7 +2249,7 @@
TEST(OptimizedPretenuringDoubleArrayProperties) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
HEAP->SetNewSpaceHighPromotionModeActive(true);
@@ -2274,7 +2274,7 @@
TEST(OptimizedPretenuringdoubleArrayLiterals) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
HEAP->SetNewSpaceHighPromotionModeActive(true);
@@ -2299,7 +2299,7 @@
TEST(OptimizedPretenuringNestedMixedArrayLiterals) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
HEAP->SetNewSpaceHighPromotionModeActive(true);
@@ -2333,7 +2333,7 @@
TEST(OptimizedPretenuringNestedObjectLiterals) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
HEAP->SetNewSpaceHighPromotionModeActive(true);
@@ -2367,7 +2367,7 @@
TEST(OptimizedPretenuringNestedDoubleLiterals) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
HEAP->SetNewSpaceHighPromotionModeActive(true);
@@ -2404,7 +2404,7 @@
TEST(OptimizedAllocationArrayLiterals) {
i::FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
@@ -2431,7 +2431,7 @@
i::FLAG_allow_natives_syntax = true;
i::FLAG_pretenuring_call_new = true;
CcTest::InitializeVM();
- if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
+ if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt)
return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
HEAP->SetNewSpaceHighPromotionModeActive(true);
=======================================
--- /branches/bleeding_edge/test/cctest/test-random.cc Tue Jun 4 10:30:05
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-random.cc Tue Sep 3 08:49:44
2013 UTC
@@ -69,7 +69,7 @@
TEST(CrankshaftRandom) {
v8::V8::Initialize();
// Skip test if crankshaft is disabled.
- if (!V8::UseCrankshaft()) return;
+ if (!Isolate::Current()->use_crankshaft()) return;
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
v8::Context::Scope context_scope(v8::Context::New(isolate));
--
--
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/groups/opt_out.