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

Side by Side Diff: src/runtime.cc

Issue 10807024: Optimize functions on a second thread. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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/runtime.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "jsregexp.h" 47 #include "jsregexp.h"
48 #include "json-parser.h" 48 #include "json-parser.h"
49 #include "liveedit.h" 49 #include "liveedit.h"
50 #include "liveobjectlist-inl.h" 50 #include "liveobjectlist-inl.h"
51 #include "misc-intrinsics.h" 51 #include "misc-intrinsics.h"
52 #include "parser.h" 52 #include "parser.h"
53 #include "platform.h" 53 #include "platform.h"
54 #include "runtime-profiler.h" 54 #include "runtime-profiler.h"
55 #include "runtime.h" 55 #include "runtime.h"
56 #include "scopeinfo.h" 56 #include "scopeinfo.h"
57 #include "smart-array-pointer.h" 57 #include "smart-pointers.h"
58 #include "string-search.h" 58 #include "string-search.h"
59 #include "stub-cache.h" 59 #include "stub-cache.h"
60 #include "v8threads.h" 60 #include "v8threads.h"
61 #include "vm-state-inl.h" 61 #include "vm-state-inl.h"
62 62
63 namespace v8 { 63 namespace v8 {
64 namespace internal { 64 namespace internal {
65 65
66 66
67 #define RUNTIME_ASSERT(value) \ 67 #define RUNTIME_ASSERT(value) \
(...skipping 8217 matching lines...) Expand 10 before | Expand all | Expand 10 after
8285 if (FLAG_trace_opt) { 8285 if (FLAG_trace_opt) {
8286 PrintF("[failed to optimize "); 8286 PrintF("[failed to optimize ");
8287 function->PrintName(); 8287 function->PrintName();
8288 PrintF(": optimized compilation failed]\n"); 8288 PrintF(": optimized compilation failed]\n");
8289 } 8289 }
8290 function->ReplaceCode(function->shared()->code()); 8290 function->ReplaceCode(function->shared()->code());
8291 return function->code(); 8291 return function->code();
8292 } 8292 }
8293 8293
8294 8294
8295 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParallelRecompile) {
8296 HandleScope handle_scope(isolate);
8297 ASSERT(FLAG_parallel_recompilation);
8298 Compiler::RecompileParallel(args.at<JSFunction>(0));
8299 return *isolate->factory()->undefined_value();
8300 }
8301
8302
8295 class ActivationsFinder : public ThreadVisitor { 8303 class ActivationsFinder : public ThreadVisitor {
8296 public: 8304 public:
8297 explicit ActivationsFinder(JSFunction* function) 8305 explicit ActivationsFinder(JSFunction* function)
8298 : function_(function), has_activations_(false) {} 8306 : function_(function), has_activations_(false) {}
8299 8307
8300 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { 8308 void VisitThread(Isolate* isolate, ThreadLocalTop* top) {
8301 if (has_activations_) return; 8309 if (has_activations_) return;
8302 8310
8303 for (JavaScriptFrameIterator it(isolate, top); !it.done(); it.Advance()) { 8311 for (JavaScriptFrameIterator it(isolate, top); !it.done(); it.Advance()) {
8304 JavaScriptFrame* frame = it.frame(); 8312 JavaScriptFrame* frame = it.frame();
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
8479 8487
8480 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { 8488 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) {
8481 HandleScope scope(isolate); 8489 HandleScope scope(isolate);
8482 ASSERT(args.length() == 1); 8490 ASSERT(args.length() == 1);
8483 // The least significant bit (after untagging) indicates whether the 8491 // The least significant bit (after untagging) indicates whether the
8484 // function is currently optimized, regardless of reason. 8492 // function is currently optimized, regardless of reason.
8485 if (!V8::UseCrankshaft()) { 8493 if (!V8::UseCrankshaft()) {
8486 return Smi::FromInt(4); // 4 == "never". 8494 return Smi::FromInt(4); // 4 == "never".
8487 } 8495 }
8488 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8496 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8497 if (FLAG_parallel_recompilation) {
8498 if (function->IsMarkedForLazyRecompilation()) {
8499 return Smi::FromInt(5);
8500 }
8501 }
8489 if (FLAG_always_opt) { 8502 if (FLAG_always_opt) {
8490 // We may have always opt, but that is more best-effort than a real 8503 // We may have always opt, but that is more best-effort than a real
8491 // promise, so we still say "no" if it is not optimized. 8504 // promise, so we still say "no" if it is not optimized.
8492 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". 8505 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always".
8493 : Smi::FromInt(2); // 2 == "no". 8506 : Smi::FromInt(2); // 2 == "no".
8494 } 8507 }
8495 return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes". 8508 return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes".
8496 : Smi::FromInt(2); // 2 == "no". 8509 : Smi::FromInt(2); // 2 == "no".
8497 } 8510 }
8498 8511
(...skipping 5206 matching lines...) Expand 10 before | Expand all | Expand 10 after
13705 // Handle last resort GC and make sure to allow future allocations 13718 // Handle last resort GC and make sure to allow future allocations
13706 // to grow the heap without causing GCs (if possible). 13719 // to grow the heap without causing GCs (if possible).
13707 isolate->counters()->gc_last_resort_from_js()->Increment(); 13720 isolate->counters()->gc_last_resort_from_js()->Increment();
13708 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13721 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13709 "Runtime::PerformGC"); 13722 "Runtime::PerformGC");
13710 } 13723 }
13711 } 13724 }
13712 13725
13713 13726
13714 } } // namespace v8::internal 13727 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698