Commit 8a77673b authored by titzer's avatar titzer Committed by Commit bot

Add CompilationInfo::output_code_kind to allow overriding the kind of code generated.

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1356363004

Cr-Commit-Position: refs/heads/master@{#30892}
parent 307cc458
...@@ -144,16 +144,15 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, ...@@ -144,16 +144,15 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
CompilationInfo* info) { CompilationInfo* info) {
Isolate* isolate = info->isolate(); Isolate* isolate = info->isolate();
Code::Flags flags = Code::Flags flags;
info->IsStub() if (info->IsStub() && info->code_stub()) {
? info->code_stub() DCHECK_EQ(info->output_code_kind(), info->code_stub()->GetCodeKind());
? Code::ComputeFlags(info->code_stub()->GetCodeKind(), flags = Code::ComputeFlags(
info->code_stub()->GetICState(), info->output_code_kind(), info->code_stub()->GetICState(),
info->code_stub()->GetExtraICState(), info->code_stub()->GetExtraICState(), info->code_stub()->GetStubType());
info->code_stub()->GetStubType()) } else {
: Code::ComputeFlags(Code::STUB) flags = Code::ComputeFlags(info->output_code_kind());
: Code::ComputeFlags(info->IsOptimizing() ? Code::OPTIMIZED_FUNCTION }
: Code::FUNCTION);
// Allocate and install the code. // Allocate and install the code.
CodeDesc desc; CodeDesc desc;
......
...@@ -154,7 +154,9 @@ CompilationInfo::CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone) ...@@ -154,7 +154,9 @@ CompilationInfo::CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone)
CompilationInfo::CompilationInfo(const char* debug_name, Isolate* isolate, CompilationInfo::CompilationInfo(const char* debug_name, Isolate* isolate,
Zone* zone) Zone* zone)
: CompilationInfo(nullptr, nullptr, debug_name, STUB, isolate, zone) {} : CompilationInfo(nullptr, nullptr, debug_name, STUB, isolate, zone) {
set_output_code_kind(Code::STUB);
}
CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub, CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub,
const char* debug_name, Mode mode, const char* debug_name, Mode mode,
...@@ -188,6 +190,9 @@ CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub, ...@@ -188,6 +190,9 @@ CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub,
if (descriptor.function_mode() == NOT_JS_FUNCTION_STUB_MODE) { if (descriptor.function_mode() == NOT_JS_FUNCTION_STUB_MODE) {
parameter_count_--; parameter_count_--;
} }
set_output_code_kind(code_stub->GetCodeKind());
} else {
set_output_code_kind(Code::FUNCTION);
} }
} }
...@@ -208,6 +213,7 @@ void CompilationInfo::SetStub(CodeStub* code_stub) { ...@@ -208,6 +213,7 @@ void CompilationInfo::SetStub(CodeStub* code_stub) {
SetMode(STUB); SetMode(STUB);
code_stub_ = code_stub; code_stub_ = code_stub;
debug_name_ = CodeStub::MajorName(code_stub->MajorKey()); debug_name_ = CodeStub::MajorName(code_stub->MajorKey());
set_output_code_kind(code_stub->GetCodeKind());
} }
......
...@@ -299,6 +299,7 @@ class CompilationInfo { ...@@ -299,6 +299,7 @@ class CompilationInfo {
osr_ast_id_ = osr_ast_id; osr_ast_id_ = osr_ast_id;
unoptimized_code_ = unoptimized; unoptimized_code_ = unoptimized;
optimization_id_ = isolate()->NextOptimizationId(); optimization_id_ = isolate()->NextOptimizationId();
set_output_code_kind(Code::OPTIMIZED_FUNCTION);
} }
void SetFunctionType(Type::FunctionType* function_type) { void SetFunctionType(Type::FunctionType* function_type) {
...@@ -412,6 +413,10 @@ class CompilationInfo { ...@@ -412,6 +413,10 @@ class CompilationInfo {
base::SmartArrayPointer<char> GetDebugName() const; base::SmartArrayPointer<char> GetDebugName() const;
Code::Kind output_code_kind() const { return output_code_kind_; }
void set_output_code_kind(Code::Kind kind) { output_code_kind_ = kind; }
protected: protected:
ParseInfo* parse_info_; ParseInfo* parse_info_;
...@@ -451,6 +456,8 @@ class CompilationInfo { ...@@ -451,6 +456,8 @@ class CompilationInfo {
unsigned flags_; unsigned flags_;
Code::Kind output_code_kind_;
// For compiled stubs, the stub object // For compiled stubs, the stub object
CodeStub* code_stub_; CodeStub* code_stub_;
// The compiled code. // The compiled code.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment