Skip to content

Commit 693c764

Browse files
author
sanjoy@chromium.org
committed
Optimize functions on a second thread.
BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10807024 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12148 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
1 parent 5b0d3a0 commit 693c764

49 files changed

Lines changed: 822 additions & 153 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/SConscript

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ SOURCES = {
106106
objects-visiting.cc
107107
objects.cc
108108
once.cc
109+
optimizing-compiler-thread.cc
109110
parser.cc
110111
preparse-data.cc
111112
preparser.cc

src/arm/builtins-arm.cc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,43 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
697697
}
698698

699699

700+
static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
701+
__ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
702+
__ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset));
703+
__ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
704+
__ mov(pc, r2);
705+
}
706+
707+
708+
void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) {
709+
GenerateTailCallToSharedCode(masm);
710+
}
711+
712+
713+
void Builtins::Generate_ParallelRecompile(MacroAssembler* masm) {
714+
{
715+
FrameScope scope(masm, StackFrame::INTERNAL);
716+
717+
// Push a copy of the function onto the stack.
718+
__ push(r1);
719+
// Push call kind information.
720+
__ push(r5);
721+
722+
__ push(r1); // Function is also the parameter to the runtime call.
723+
__ CallRuntime(Runtime::kParallelRecompile, 1);
724+
725+
// Restore call kind information.
726+
__ pop(r5);
727+
// Restore receiver.
728+
__ pop(r1);
729+
730+
// Tear down internal frame.
731+
}
732+
733+
GenerateTailCallToSharedCode(masm);
734+
}
735+
736+
700737
static void Generate_JSConstructStubHelper(MacroAssembler* masm,
701738
bool is_api_function,
702739
bool count_constructions) {

src/ast.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "list-inl.h"
3838
#include "runtime.h"
3939
#include "small-pointer-list.h"
40-
#include "smart-array-pointer.h"
40+
#include "smart-pointers.h"
4141
#include "token.h"
4242
#include "utils.h"
4343
#include "variables.h"

src/builtins.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ enum BuiltinExtraArguments {
6666
#define BUILTIN_LIST_A(V) \
6767
V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, \
6868
Code::kNoExtraICState) \
69+
V(InRecompileQueue, BUILTIN, UNINITIALIZED, \
70+
Code::kNoExtraICState) \
6971
V(JSConstructStubCountdown, BUILTIN, UNINITIALIZED, \
7072
Code::kNoExtraICState) \
7173
V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, \
@@ -80,6 +82,8 @@ enum BuiltinExtraArguments {
8082
Code::kNoExtraICState) \
8183
V(LazyRecompile, BUILTIN, UNINITIALIZED, \
8284
Code::kNoExtraICState) \
85+
V(ParallelRecompile, BUILTIN, UNINITIALIZED, \
86+
Code::kNoExtraICState) \
8387
V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, \
8488
Code::kNoExtraICState) \
8589
V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, \
@@ -347,6 +351,8 @@ class Builtins {
347351
static void Generate_Adaptor(MacroAssembler* masm,
348352
CFunctionId id,
349353
BuiltinExtraArguments extra_args);
354+
static void Generate_InRecompileQueue(MacroAssembler* masm);
355+
static void Generate_ParallelRecompile(MacroAssembler* masm);
350356
static void Generate_JSConstructStubCountdown(MacroAssembler* masm);
351357
static void Generate_JSConstructStubGeneric(MacroAssembler* masm);
352358
static void Generate_JSConstructStubApi(MacroAssembler* masm);

0 commit comments

Comments
 (0)