Rename Runtime_CompileUnoptimized to Runtime_CompileLazy, because that is what it does. Split Compiler::GetUnoptimizedCode into two variants, one for lazy compilation (which can return optimized code!) and the other that actually returns unoptimized code.
R=mstarzinger@chromium.org BUG= Review URL: https://codereview.chromium.org/547293004 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24012 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
b8dd74779c
commit
f6807d7897
@ -807,8 +807,8 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized);
|
||||
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileLazy);
|
||||
GenerateTailCallToReturnedCode(masm);
|
||||
}
|
||||
|
||||
|
@ -780,8 +780,8 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized);
|
||||
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileLazy);
|
||||
GenerateTailCallToReturnedCode(masm);
|
||||
}
|
||||
|
||||
|
163
src/builtins.h
163
src/builtins.h
@ -63,105 +63,68 @@ enum BuiltinExtraArguments {
|
||||
V(GeneratorPoisonPill, NO_EXTRA_ARGUMENTS)
|
||||
|
||||
// Define list of builtins implemented in assembly.
|
||||
#define BUILTIN_LIST_A(V) \
|
||||
V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(InOptimizationQueue, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(JSConstructStubApi, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(CompileUnoptimized, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(CompileOptimized, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(CompileOptimizedConcurrent, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(NotifySoftDeoptimized, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(NotifyStubFailure, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(NotifyStubFailureSaveDoubles, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
V(LoadIC_Miss, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(StoreIC_Miss, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_PreMonomorphic, KEYED_LOAD_IC, PREMONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_Generic, KEYED_LOAD_IC, GENERIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_String, KEYED_LOAD_IC, MEGAMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_SloppyArguments, KEYED_LOAD_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, \
|
||||
StoreIC::kStrictModeState) \
|
||||
\
|
||||
V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedStoreIC_PreMonomorphic, KEYED_STORE_IC, PREMONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedStoreIC_Generic, KEYED_STORE_IC, GENERIC, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_PreMonomorphic_Strict, KEYED_STORE_IC, PREMONOMORPHIC, \
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_Generic_Strict, KEYED_STORE_IC, GENERIC, \
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_SloppyArguments, KEYED_STORE_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
/* Uses KeyedLoadIC_Initialize; must be after in list. */ \
|
||||
V(FunctionCall, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(FunctionApply, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
V(InternalArrayCode, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(ArrayCode, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
V(StringConstructCode, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
V(OnStackReplacement, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(InterruptCheck, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(OsrAfterStackCheck, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(StackCheck, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
V(MarkCodeAsExecutedOnce, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
V(MarkCodeAsExecutedTwice, BUILTIN, UNINITIALIZED, \
|
||||
kNoExtraICState) \
|
||||
#define BUILTIN_LIST_A(V) \
|
||||
V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(InOptimizationQueue, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructStubApi, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(CompileLazy, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(CompileOptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(CompileOptimizedConcurrent, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifySoftDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyStubFailure, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyStubFailureSaveDoubles, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(LoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(StoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, kNoExtraICState) \
|
||||
V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedLoadIC_PreMonomorphic, KEYED_LOAD_IC, PREMONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_Generic, KEYED_LOAD_IC, GENERIC, kNoExtraICState) \
|
||||
V(KeyedLoadIC_String, KEYED_LOAD_IC, MEGAMORPHIC, kNoExtraICState) \
|
||||
V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_SloppyArguments, KEYED_LOAD_IC, MONOMORPHIC, kNoExtraICState) \
|
||||
\
|
||||
V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, StoreIC::kStrictModeState) \
|
||||
\
|
||||
V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedStoreIC_PreMonomorphic, KEYED_STORE_IC, PREMONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedStoreIC_Generic, KEYED_STORE_IC, GENERIC, kNoExtraICState) \
|
||||
\
|
||||
V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_PreMonomorphic_Strict, KEYED_STORE_IC, PREMONOMORPHIC, \
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_Generic_Strict, KEYED_STORE_IC, GENERIC, \
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_SloppyArguments, KEYED_STORE_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
/* Uses KeyedLoadIC_Initialize; must be after in list. */ \
|
||||
V(FunctionCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(FunctionApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(InternalArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(ArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(StringConstructCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(OnStackReplacement, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(InterruptCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(OsrAfterStackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(StackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(MarkCodeAsExecutedOnce, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(MarkCodeAsExecutedTwice, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V)
|
||||
|
||||
// Define list of builtin handlers implemented in assembly.
|
||||
@ -334,7 +297,7 @@ class Builtins {
|
||||
static void Generate_Adaptor(MacroAssembler* masm,
|
||||
CFunctionId id,
|
||||
BuiltinExtraArguments extra_args);
|
||||
static void Generate_CompileUnoptimized(MacroAssembler* masm);
|
||||
static void Generate_CompileLazy(MacroAssembler* masm);
|
||||
static void Generate_InOptimizationQueue(MacroAssembler* masm);
|
||||
static void Generate_CompileOptimized(MacroAssembler* masm);
|
||||
static void Generate_CompileOptimizedConcurrent(MacroAssembler* masm);
|
||||
|
@ -714,6 +714,21 @@ MaybeHandle<Code> Compiler::GetUnoptimizedCode(Handle<JSFunction> function) {
|
||||
ASSIGN_RETURN_ON_EXCEPTION(info.isolate(), result,
|
||||
GetUnoptimizedCodeCommon(&info),
|
||||
Code);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
MaybeHandle<Code> Compiler::GetLazyCode(Handle<JSFunction> function) {
|
||||
DCHECK(!function->GetIsolate()->has_pending_exception());
|
||||
DCHECK(!function->is_compiled());
|
||||
if (function->shared()->is_compiled()) {
|
||||
return Handle<Code>(function->shared()->code());
|
||||
}
|
||||
|
||||
CompilationInfoWithZone info(function);
|
||||
Handle<Code> result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(info.isolate(), result,
|
||||
GetUnoptimizedCodeCommon(&info), Code);
|
||||
|
||||
if (FLAG_always_opt &&
|
||||
info.isolate()->use_crankshaft() &&
|
||||
@ -744,7 +759,7 @@ MaybeHandle<Code> Compiler::GetUnoptimizedCode(
|
||||
bool Compiler::EnsureCompiled(Handle<JSFunction> function,
|
||||
ClearExceptionFlag flag) {
|
||||
if (function->is_compiled()) return true;
|
||||
MaybeHandle<Code> maybe_code = Compiler::GetUnoptimizedCode(function);
|
||||
MaybeHandle<Code> maybe_code = Compiler::GetLazyCode(function);
|
||||
Handle<Code> code;
|
||||
if (!maybe_code.ToHandle(&code)) {
|
||||
if (flag == CLEAR_EXCEPTION) {
|
||||
@ -767,7 +782,7 @@ bool Compiler::EnsureCompiled(Handle<JSFunction> function,
|
||||
// full code without debug break slots to full code with debug break slots
|
||||
// depends on the generated code is otherwise exactly the same.
|
||||
// If compilation fails, just keep the existing code.
|
||||
MaybeHandle<Code> Compiler::GetCodeForDebugging(Handle<JSFunction> function) {
|
||||
MaybeHandle<Code> Compiler::GetDebugCode(Handle<JSFunction> function) {
|
||||
CompilationInfoWithZone info(function);
|
||||
Isolate* isolate = info.isolate();
|
||||
VMState<COMPILER> state(isolate);
|
||||
@ -1100,7 +1115,7 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(
|
||||
// Generate code
|
||||
Handle<ScopeInfo> scope_info;
|
||||
if (FLAG_lazy && allow_lazy && !literal->is_parenthesized()) {
|
||||
Handle<Code> code = isolate->builtins()->CompileUnoptimized();
|
||||
Handle<Code> code = isolate->builtins()->CompileLazy();
|
||||
info.SetCode(code);
|
||||
scope_info = Handle<ScopeInfo>(ScopeInfo::Empty(isolate));
|
||||
} else if (FullCodeGenerator::MakeCode(&info)) {
|
||||
@ -1354,8 +1369,7 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
|
||||
info->isolate()->cpu_profiler()->is_profiling()) {
|
||||
Handle<Script> script = info->script();
|
||||
Handle<Code> code = info->code();
|
||||
if (code.is_identical_to(
|
||||
info->isolate()->builtins()->CompileUnoptimized())) {
|
||||
if (code.is_identical_to(info->isolate()->builtins()->CompileLazy())) {
|
||||
return;
|
||||
}
|
||||
int line_num = Script::GetLineNumber(script, shared->start_position()) + 1;
|
||||
|
@ -659,11 +659,13 @@ class Compiler : public AllStatic {
|
||||
public:
|
||||
MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode(
|
||||
Handle<JSFunction> function);
|
||||
MUST_USE_RESULT static MaybeHandle<Code> GetLazyCode(
|
||||
Handle<JSFunction> function);
|
||||
MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode(
|
||||
Handle<SharedFunctionInfo> shared);
|
||||
static bool EnsureCompiled(Handle<JSFunction> function,
|
||||
ClearExceptionFlag flag);
|
||||
MUST_USE_RESULT static MaybeHandle<Code> GetCodeForDebugging(
|
||||
MUST_USE_RESULT static MaybeHandle<Code> GetDebugCode(
|
||||
Handle<JSFunction> function);
|
||||
|
||||
static void CompileForLiveEdit(Handle<Script> script);
|
||||
|
@ -1880,7 +1880,7 @@ static void EnsureFunctionHasDebugBreakSlots(Handle<JSFunction> function) {
|
||||
// Make sure that the shared full code is compiled with debug
|
||||
// break slots.
|
||||
if (!function->shared()->code()->has_debug_break_slots()) {
|
||||
MaybeHandle<Code> code = Compiler::GetCodeForDebugging(function);
|
||||
MaybeHandle<Code> code = Compiler::GetDebugCode(function);
|
||||
// Recompilation can fail. In that case leave the code as it was.
|
||||
if (!code.is_null()) function->ReplaceCode(*code.ToHandleChecked());
|
||||
} else {
|
||||
@ -1914,7 +1914,7 @@ void Debug::PrepareForBreakPoints() {
|
||||
|
||||
Deoptimizer::DeoptimizeAll(isolate_);
|
||||
|
||||
Handle<Code> lazy_compile = isolate_->builtins()->CompileUnoptimized();
|
||||
Handle<Code> lazy_compile = isolate_->builtins()->CompileLazy();
|
||||
|
||||
// There will be at least one break point when we are done.
|
||||
has_break_points_ = true;
|
||||
|
@ -1024,8 +1024,7 @@ void MarkCompactCollector::Finish() {
|
||||
// objects have been marked.
|
||||
|
||||
void CodeFlusher::ProcessJSFunctionCandidates() {
|
||||
Code* lazy_compile =
|
||||
isolate_->builtins()->builtin(Builtins::kCompileUnoptimized);
|
||||
Code* lazy_compile = isolate_->builtins()->builtin(Builtins::kCompileLazy);
|
||||
Object* undefined = isolate_->heap()->undefined_value();
|
||||
|
||||
JSFunction* candidate = jsfunction_candidates_head_;
|
||||
@ -1070,8 +1069,7 @@ void CodeFlusher::ProcessJSFunctionCandidates() {
|
||||
|
||||
|
||||
void CodeFlusher::ProcessSharedFunctionInfoCandidates() {
|
||||
Code* lazy_compile =
|
||||
isolate_->builtins()->builtin(Builtins::kCompileUnoptimized);
|
||||
Code* lazy_compile = isolate_->builtins()->builtin(Builtins::kCompileLazy);
|
||||
|
||||
SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
|
||||
SharedFunctionInfo* next_candidate;
|
||||
|
@ -550,8 +550,8 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized);
|
||||
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileLazy);
|
||||
GenerateTailCallToReturnedCode(masm);
|
||||
}
|
||||
|
||||
|
@ -1221,8 +1221,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
|
||||
CALL_LISTENERS(CodeCreateEvent(tag, code, shared, info, name));
|
||||
|
||||
if (!FLAG_log_code || !log_->IsEnabled()) return;
|
||||
if (code == isolate_->builtins()->builtin(Builtins::kCompileUnoptimized))
|
||||
return;
|
||||
if (code == isolate_->builtins()->builtin(Builtins::kCompileLazy)) return;
|
||||
|
||||
Log::MessageBuilder msg(log_);
|
||||
AppendCodeCreateHeader(&msg, tag, code);
|
||||
@ -1755,8 +1754,7 @@ void Logger::LogCompiledFunctions() {
|
||||
// During iteration, there can be heap allocation due to
|
||||
// GetScriptLineNumber call.
|
||||
for (int i = 0; i < compiled_funcs_count; ++i) {
|
||||
if (code_objects[i].is_identical_to(
|
||||
isolate_->builtins()->CompileUnoptimized()))
|
||||
if (code_objects[i].is_identical_to(isolate_->builtins()->CompileLazy()))
|
||||
continue;
|
||||
LogExistingFunction(sfis[i], code_objects[i]);
|
||||
}
|
||||
|
@ -824,8 +824,8 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized);
|
||||
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileLazy);
|
||||
GenerateTailCallToReturnedCode(masm);
|
||||
}
|
||||
|
||||
|
@ -839,8 +839,8 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized);
|
||||
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileLazy);
|
||||
GenerateTailCallToReturnedCode(masm);
|
||||
}
|
||||
|
||||
|
@ -5667,8 +5667,7 @@ void SharedFunctionInfo::set_scope_info(ScopeInfo* value,
|
||||
|
||||
|
||||
bool SharedFunctionInfo::is_compiled() {
|
||||
return code() !=
|
||||
GetIsolate()->builtins()->builtin(Builtins::kCompileUnoptimized);
|
||||
return code() != GetIsolate()->builtins()->builtin(Builtins::kCompileLazy);
|
||||
}
|
||||
|
||||
|
||||
@ -5942,8 +5941,7 @@ bool JSFunction::should_have_prototype() {
|
||||
|
||||
|
||||
bool JSFunction::is_compiled() {
|
||||
return code() !=
|
||||
GetIsolate()->builtins()->builtin(Builtins::kCompileUnoptimized);
|
||||
return code() != GetIsolate()->builtins()->builtin(Builtins::kCompileLazy);
|
||||
}
|
||||
|
||||
|
||||
|
@ -8405,7 +8405,7 @@ RUNTIME_FUNCTION(Runtime_FinalizeInstanceSize) {
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_CompileUnoptimized) {
|
||||
RUNTIME_FUNCTION(Runtime_CompileLazy) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
@ -8422,7 +8422,7 @@ RUNTIME_FUNCTION(Runtime_CompileUnoptimized) {
|
||||
|
||||
Handle<Code> code;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, code,
|
||||
Compiler::GetUnoptimizedCode(function));
|
||||
Compiler::GetLazyCode(function));
|
||||
function->ReplaceCode(*code);
|
||||
|
||||
// All done. Return the compiled code.
|
||||
|
168
src/runtime.h
168
src/runtime.h
@ -419,90 +419,90 @@ namespace internal {
|
||||
F(ForInCacheArrayLength, 2, 1) /* TODO(turbofan): Only temporary */
|
||||
|
||||
|
||||
#define RUNTIME_FUNCTION_LIST_ALWAYS_3(F) \
|
||||
/* String and Regexp */ \
|
||||
F(NumberToStringRT, 1, 1) \
|
||||
F(RegExpConstructResult, 3, 1) \
|
||||
F(RegExpExecRT, 4, 1) \
|
||||
F(StringAdd, 2, 1) \
|
||||
F(SubString, 3, 1) \
|
||||
F(InternalizeString, 1, 1) \
|
||||
F(StringCompare, 2, 1) \
|
||||
F(StringCharCodeAtRT, 2, 1) \
|
||||
F(GetFromCache, 2, 1) \
|
||||
\
|
||||
/* Compilation */ \
|
||||
F(CompileUnoptimized, 1, 1) \
|
||||
F(CompileOptimized, 2, 1) \
|
||||
F(TryInstallOptimizedCode, 1, 1) \
|
||||
F(NotifyDeoptimized, 1, 1) \
|
||||
F(NotifyStubFailure, 0, 1) \
|
||||
\
|
||||
/* Utilities */ \
|
||||
F(AllocateInNewSpace, 1, 1) \
|
||||
F(AllocateInTargetSpace, 2, 1) \
|
||||
F(AllocateHeapNumber, 0, 1) \
|
||||
F(NumberToSmi, 1, 1) \
|
||||
F(NumberToStringSkipCache, 1, 1) \
|
||||
\
|
||||
F(NewArguments, 1, 1) /* TODO(turbofan): Only temporary */ \
|
||||
F(NewSloppyArguments, 3, 1) \
|
||||
F(NewStrictArguments, 3, 1) \
|
||||
\
|
||||
/* Harmony generators */ \
|
||||
F(CreateJSGeneratorObject, 0, 1) \
|
||||
F(SuspendJSGeneratorObject, 1, 1) \
|
||||
F(ResumeJSGeneratorObject, 3, 1) \
|
||||
F(ThrowGeneratorStateError, 1, 1) \
|
||||
\
|
||||
/* Arrays */ \
|
||||
F(ArrayConstructor, -1, 1) \
|
||||
F(InternalArrayConstructor, -1, 1) \
|
||||
\
|
||||
/* Literals */ \
|
||||
F(MaterializeRegExpLiteral, 4, 1) \
|
||||
F(CreateObjectLiteral, 4, 1) \
|
||||
F(CreateArrayLiteral, 4, 1) \
|
||||
F(CreateArrayLiteralStubBailout, 3, 1) \
|
||||
\
|
||||
/* Statements */ \
|
||||
F(NewClosure, 3, 1) \
|
||||
F(NewClosureFromStubFailure, 1, 1) \
|
||||
F(NewObject, 1, 1) \
|
||||
F(NewObjectWithAllocationSite, 2, 1) \
|
||||
F(FinalizeInstanceSize, 1, 1) \
|
||||
F(Throw, 1, 1) \
|
||||
F(ReThrow, 1, 1) \
|
||||
F(ThrowReferenceError, 1, 1) \
|
||||
F(ThrowNotDateError, 0, 1) \
|
||||
F(StackGuard, 0, 1) \
|
||||
F(Interrupt, 0, 1) \
|
||||
F(PromoteScheduledException, 0, 1) \
|
||||
\
|
||||
/* Contexts */ \
|
||||
F(NewGlobalContext, 2, 1) \
|
||||
F(NewFunctionContext, 1, 1) \
|
||||
F(PushWithContext, 2, 1) \
|
||||
F(PushCatchContext, 3, 1) \
|
||||
F(PushBlockContext, 2, 1) \
|
||||
F(PushModuleContext, 2, 1) \
|
||||
F(DeleteLookupSlot, 2, 1) \
|
||||
F(LoadLookupSlot, 2, 2) \
|
||||
F(LoadLookupSlotNoReferenceError, 2, 2) \
|
||||
F(StoreLookupSlot, 4, 1) \
|
||||
\
|
||||
/* Declarations and initialization */ \
|
||||
F(DeclareGlobals, 3, 1) \
|
||||
F(DeclareModules, 1, 1) \
|
||||
F(DeclareLookupSlot, 4, 1) \
|
||||
F(InitializeConstGlobal, 2, 1) \
|
||||
F(InitializeLegacyConstLookupSlot, 3, 1) \
|
||||
\
|
||||
/* Eval */ \
|
||||
F(ResolvePossiblyDirectEval, 5, 2) \
|
||||
\
|
||||
/* Maths */ \
|
||||
F(MathPowSlow, 2, 1) \
|
||||
#define RUNTIME_FUNCTION_LIST_ALWAYS_3(F) \
|
||||
/* String and Regexp */ \
|
||||
F(NumberToStringRT, 1, 1) \
|
||||
F(RegExpConstructResult, 3, 1) \
|
||||
F(RegExpExecRT, 4, 1) \
|
||||
F(StringAdd, 2, 1) \
|
||||
F(SubString, 3, 1) \
|
||||
F(InternalizeString, 1, 1) \
|
||||
F(StringCompare, 2, 1) \
|
||||
F(StringCharCodeAtRT, 2, 1) \
|
||||
F(GetFromCache, 2, 1) \
|
||||
\
|
||||
/* Compilation */ \
|
||||
F(CompileLazy, 1, 1) \
|
||||
F(CompileOptimized, 2, 1) \
|
||||
F(TryInstallOptimizedCode, 1, 1) \
|
||||
F(NotifyDeoptimized, 1, 1) \
|
||||
F(NotifyStubFailure, 0, 1) \
|
||||
\
|
||||
/* Utilities */ \
|
||||
F(AllocateInNewSpace, 1, 1) \
|
||||
F(AllocateInTargetSpace, 2, 1) \
|
||||
F(AllocateHeapNumber, 0, 1) \
|
||||
F(NumberToSmi, 1, 1) \
|
||||
F(NumberToStringSkipCache, 1, 1) \
|
||||
\
|
||||
F(NewArguments, 1, 1) /* TODO(turbofan): Only temporary */ \
|
||||
F(NewSloppyArguments, 3, 1) \
|
||||
F(NewStrictArguments, 3, 1) \
|
||||
\
|
||||
/* Harmony generators */ \
|
||||
F(CreateJSGeneratorObject, 0, 1) \
|
||||
F(SuspendJSGeneratorObject, 1, 1) \
|
||||
F(ResumeJSGeneratorObject, 3, 1) \
|
||||
F(ThrowGeneratorStateError, 1, 1) \
|
||||
\
|
||||
/* Arrays */ \
|
||||
F(ArrayConstructor, -1, 1) \
|
||||
F(InternalArrayConstructor, -1, 1) \
|
||||
\
|
||||
/* Literals */ \
|
||||
F(MaterializeRegExpLiteral, 4, 1) \
|
||||
F(CreateObjectLiteral, 4, 1) \
|
||||
F(CreateArrayLiteral, 4, 1) \
|
||||
F(CreateArrayLiteralStubBailout, 3, 1) \
|
||||
\
|
||||
/* Statements */ \
|
||||
F(NewClosure, 3, 1) \
|
||||
F(NewClosureFromStubFailure, 1, 1) \
|
||||
F(NewObject, 1, 1) \
|
||||
F(NewObjectWithAllocationSite, 2, 1) \
|
||||
F(FinalizeInstanceSize, 1, 1) \
|
||||
F(Throw, 1, 1) \
|
||||
F(ReThrow, 1, 1) \
|
||||
F(ThrowReferenceError, 1, 1) \
|
||||
F(ThrowNotDateError, 0, 1) \
|
||||
F(StackGuard, 0, 1) \
|
||||
F(Interrupt, 0, 1) \
|
||||
F(PromoteScheduledException, 0, 1) \
|
||||
\
|
||||
/* Contexts */ \
|
||||
F(NewGlobalContext, 2, 1) \
|
||||
F(NewFunctionContext, 1, 1) \
|
||||
F(PushWithContext, 2, 1) \
|
||||
F(PushCatchContext, 3, 1) \
|
||||
F(PushBlockContext, 2, 1) \
|
||||
F(PushModuleContext, 2, 1) \
|
||||
F(DeleteLookupSlot, 2, 1) \
|
||||
F(LoadLookupSlot, 2, 2) \
|
||||
F(LoadLookupSlotNoReferenceError, 2, 2) \
|
||||
F(StoreLookupSlot, 4, 1) \
|
||||
\
|
||||
/* Declarations and initialization */ \
|
||||
F(DeclareGlobals, 3, 1) \
|
||||
F(DeclareModules, 1, 1) \
|
||||
F(DeclareLookupSlot, 4, 1) \
|
||||
F(InitializeConstGlobal, 2, 1) \
|
||||
F(InitializeLegacyConstLookupSlot, 3, 1) \
|
||||
\
|
||||
/* Eval */ \
|
||||
F(ResolvePossiblyDirectEval, 5, 2) \
|
||||
\
|
||||
/* Maths */ \
|
||||
F(MathPowSlow, 2, 1) \
|
||||
F(MathPowRT, 2, 1)
|
||||
|
||||
|
||||
|
@ -609,8 +609,8 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized);
|
||||
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileLazy);
|
||||
GenerateTailCallToReturnedCode(masm);
|
||||
}
|
||||
|
||||
|
@ -550,8 +550,8 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized);
|
||||
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileLazy);
|
||||
GenerateTailCallToReturnedCode(masm);
|
||||
}
|
||||
|
||||
|
@ -2362,15 +2362,12 @@ TEST(CheckCodeNames) {
|
||||
node = GetNodeByPath(snapshot, builtin_path1, arraysize(builtin_path1));
|
||||
CHECK_NE(NULL, node);
|
||||
|
||||
const char* builtin_path2[] = {
|
||||
"::(GC roots)",
|
||||
"::(Builtins)",
|
||||
"::(CompileUnoptimized builtin)"
|
||||
};
|
||||
const char* builtin_path2[] = {"::(GC roots)", "::(Builtins)",
|
||||
"::(CompileLazy builtin)"};
|
||||
node = GetNodeByPath(snapshot, builtin_path2, arraysize(builtin_path2));
|
||||
CHECK_NE(NULL, node);
|
||||
v8::String::Utf8Value node_name(node->GetName());
|
||||
CHECK_EQ("(CompileUnoptimized builtin)", *node_name);
|
||||
CHECK_EQ("(CompileLazy builtin)", *node_name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
# TODO(danno): Fix these internal function that are only callable form stubs
|
||||
# and un-blacklist them!
|
||||
"CompileUnoptimized": [SKIP],
|
||||
"CompileLazy": [SKIP],
|
||||
"NotifyDeoptimized": [SKIP],
|
||||
"NotifyStubFailure": [SKIP],
|
||||
"NewSloppyArguments": [SKIP],
|
||||
|
Loading…
Reference in New Issue
Block a user