Make it possible to Crankshaft all kinds of stubs.
Review URL: https://codereview.chromium.org/14307006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14323 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
55324693aa
commit
244fa50a80
@ -130,7 +130,7 @@ class UnaryOpStub: public PlatformCodeStub {
|
||||
void GenerateGenericStubBitNot(MacroAssembler* masm);
|
||||
void GenerateGenericCodeFallback(MacroAssembler* masm);
|
||||
|
||||
virtual int GetCodeKind() { return Code::UNARY_OP_IC; }
|
||||
virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }
|
||||
|
||||
virtual InlineCacheState GetICState() {
|
||||
return UnaryOpIC::ToState(operand_type_);
|
||||
|
@ -185,7 +185,7 @@ template <class Stub>
|
||||
static Handle<Code> DoGenerateCode(Stub* stub) {
|
||||
CodeStubGraphBuilder<Stub> builder(stub);
|
||||
LChunk* chunk = OptimizeGraph(builder.CreateGraph());
|
||||
return chunk->Codegen(Code::COMPILED_STUB);
|
||||
return chunk->Codegen();
|
||||
}
|
||||
|
||||
|
||||
@ -249,7 +249,7 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
|
||||
Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
|
||||
CodeStubGraphBuilder<FastCloneShallowArrayStub> builder(this);
|
||||
LChunk* chunk = OptimizeGraph(builder.CreateGraph());
|
||||
return chunk->Codegen(Code::COMPILED_STUB);
|
||||
return chunk->Codegen();
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ void CodeStub::RecordCodeGeneration(Code* code, Isolate* isolate) {
|
||||
}
|
||||
|
||||
|
||||
int CodeStub::GetCodeKind() {
|
||||
Code::Kind CodeStub::GetCodeKind() const {
|
||||
return Code::STUB;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ Handle<Code> PlatformCodeStub::GenerateCode() {
|
||||
|
||||
// Copy the generated code into a heap object.
|
||||
Code::Flags flags = Code::ComputeFlags(
|
||||
static_cast<Code::Kind>(GetCodeKind()),
|
||||
GetCodeKind(),
|
||||
GetICState(),
|
||||
GetExtraICState(),
|
||||
GetStubType(),
|
||||
@ -308,7 +308,7 @@ void ICCompareStub::AddToSpecialCache(Handle<Code> new_object) {
|
||||
bool ICCompareStub::FindCodeInSpecialCache(Code** code_out, Isolate* isolate) {
|
||||
Factory* factory = isolate->factory();
|
||||
Code::Flags flags = Code::ComputeFlags(
|
||||
static_cast<Code::Kind>(GetCodeKind()),
|
||||
GetCodeKind(),
|
||||
UNINITIALIZED);
|
||||
ASSERT(op_ == Token::EQ || op_ == Token::EQ_STRICT);
|
||||
Handle<Object> probe(
|
||||
|
@ -176,19 +176,19 @@ class CodeStub BASE_EMBEDDED {
|
||||
virtual Major MajorKey() = 0;
|
||||
virtual int MinorKey() = 0;
|
||||
|
||||
protected:
|
||||
static bool CanUseFPRegisters();
|
||||
|
||||
// Generates the assembler code for the stub.
|
||||
virtual Handle<Code> GenerateCode() = 0;
|
||||
|
||||
// BinaryOpStub needs to override this.
|
||||
virtual InlineCacheState GetICState() {
|
||||
return UNINITIALIZED;
|
||||
}
|
||||
virtual Code::ExtraICState GetExtraICState() {
|
||||
return Code::kNoExtraICState;
|
||||
}
|
||||
|
||||
protected:
|
||||
static bool CanUseFPRegisters();
|
||||
|
||||
// Generates the assembler code for the stub.
|
||||
virtual Handle<Code> GenerateCode() = 0;
|
||||
|
||||
virtual Code::StubType GetStubType() {
|
||||
return Code::NORMAL;
|
||||
}
|
||||
@ -210,7 +210,7 @@ class CodeStub BASE_EMBEDDED {
|
||||
virtual void Activate(Code* code) { }
|
||||
|
||||
// BinaryOpStub needs to override this.
|
||||
virtual int GetCodeKind();
|
||||
virtual Code::Kind GetCodeKind() const;
|
||||
|
||||
// Add the code to a specialized cache, specific to an individual
|
||||
// stub type. Please note, this method must add the code object to a
|
||||
@ -249,7 +249,7 @@ class PlatformCodeStub : public CodeStub {
|
||||
// Retrieve the code for the stub. Generate the code if needed.
|
||||
virtual Handle<Code> GenerateCode();
|
||||
|
||||
virtual int GetCodeKind() { return Code::STUB; }
|
||||
virtual Code::Kind GetCodeKind() const { return Code::STUB; }
|
||||
virtual int GetStubFlags() { return -1; }
|
||||
|
||||
protected:
|
||||
@ -286,7 +286,7 @@ class HydrogenCodeStub : public CodeStub {
|
||||
// Retrieve the code for the stub. Generate the code if needed.
|
||||
virtual Handle<Code> GenerateCode() = 0;
|
||||
|
||||
virtual int GetCodeKind() { return Code::COMPILED_STUB; }
|
||||
virtual Code::Kind GetCodeKind() const { return Code::STUB; }
|
||||
|
||||
CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate) {
|
||||
return isolate->code_stub_interface_descriptor(MajorKey());
|
||||
@ -606,7 +606,7 @@ class MathPowStub: public PlatformCodeStub {
|
||||
class ICStub: public PlatformCodeStub {
|
||||
public:
|
||||
explicit ICStub(Code::Kind kind) : kind_(kind) { }
|
||||
virtual int GetCodeKind() { return kind_; }
|
||||
virtual Code::Kind GetCodeKind() const { return kind_; }
|
||||
virtual InlineCacheState GetICState() { return MONOMORPHIC; }
|
||||
|
||||
bool Describes(Code* code) {
|
||||
@ -692,7 +692,7 @@ class StoreArrayLengthStub: public StoreICStub {
|
||||
class HandlerStub: public ICStub {
|
||||
public:
|
||||
explicit HandlerStub(Code::Kind kind) : ICStub(kind) { }
|
||||
virtual int GetCodeKind() { return Code::STUB; }
|
||||
virtual Code::Kind GetCodeKind() const { return Code::STUB; }
|
||||
virtual int GetStubFlags() { return kind(); }
|
||||
};
|
||||
|
||||
@ -830,7 +830,7 @@ class BinaryOpStub: public PlatformCodeStub {
|
||||
// Entirely platform-specific methods are defined as static helper
|
||||
// functions in the <arch>/code-stubs-<arch>.cc files.
|
||||
|
||||
virtual int GetCodeKind() { return Code::BINARY_OP_IC; }
|
||||
virtual Code::Kind GetCodeKind() const { return Code::BINARY_OP_IC; }
|
||||
|
||||
virtual InlineCacheState GetICState() {
|
||||
return BinaryOpIC::ToState(Max(left_type_, right_type_));
|
||||
@ -884,7 +884,7 @@ class ICCompareStub: public PlatformCodeStub {
|
||||
virtual CodeStub::Major MajorKey() { return CompareIC; }
|
||||
virtual int MinorKey();
|
||||
|
||||
virtual int GetCodeKind() { return Code::COMPARE_IC; }
|
||||
virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; }
|
||||
|
||||
void GenerateSmis(MacroAssembler* masm);
|
||||
void GenerateNumbers(MacroAssembler* masm);
|
||||
@ -1548,7 +1548,7 @@ class ToBooleanStub: public PlatformCodeStub {
|
||||
: tos_(tos), types_(types) { }
|
||||
|
||||
void Generate(MacroAssembler* masm);
|
||||
virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; }
|
||||
virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
|
||||
virtual void PrintName(StringStream* stream);
|
||||
|
||||
virtual bool SometimesSetsUpAFrame() { return false; }
|
||||
|
@ -106,10 +106,13 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
|
||||
|
||||
// Allocate and install the code.
|
||||
CodeDesc desc;
|
||||
bool is_crankshafted =
|
||||
Code::ExtractKindFromFlags(flags) == Code::OPTIMIZED_FUNCTION ||
|
||||
info->IsStub();
|
||||
masm->GetCode(&desc);
|
||||
Handle<Code> code =
|
||||
isolate->factory()->NewCode(desc, flags, masm->CodeObject());
|
||||
|
||||
isolate->factory()->NewCode(desc, flags, masm->CodeObject(),
|
||||
false, is_crankshafted);
|
||||
if (!code.is_null()) {
|
||||
isolate->counters()->total_compiled_code_size()->Increment(
|
||||
code->instruction_size());
|
||||
@ -129,7 +132,7 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
|
||||
if (print_code) {
|
||||
// Print the source code if available.
|
||||
FunctionLiteral* function = info->function();
|
||||
if (code->kind() != Code::COMPILED_STUB) {
|
||||
if (code->kind() == Code::OPTIMIZED_FUNCTION) {
|
||||
Handle<Script> script = info->script();
|
||||
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
|
||||
PrintF("--- Raw source ---\n");
|
||||
|
@ -144,7 +144,11 @@ int CompilationInfo::num_heap_slots() const {
|
||||
|
||||
Code::Flags CompilationInfo::flags() const {
|
||||
if (IsStub()) {
|
||||
return Code::ComputeFlags(Code::COMPILED_STUB);
|
||||
return Code::ComputeFlags(code_stub()->GetCodeKind(),
|
||||
code_stub()->GetICState(),
|
||||
code_stub()->GetExtraICState(),
|
||||
Code::NORMAL,
|
||||
0);
|
||||
} else {
|
||||
return Code::ComputeFlags(Code::OPTIMIZED_FUNCTION);
|
||||
}
|
||||
@ -421,7 +425,7 @@ OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() {
|
||||
Timer timer(this, &time_taken_to_codegen_);
|
||||
ASSERT(chunk_ != NULL);
|
||||
ASSERT(graph_ != NULL);
|
||||
Handle<Code> optimized_code = chunk_->Codegen(Code::OPTIMIZED_FUNCTION);
|
||||
Handle<Code> optimized_code = chunk_->Codegen();
|
||||
if (optimized_code.is_null()) {
|
||||
info()->set_bailout_reason("code generation failed");
|
||||
return AbortOptimization();
|
||||
|
@ -79,7 +79,7 @@ class CompilationInfo {
|
||||
Handle<JSFunction> closure() const { return closure_; }
|
||||
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
|
||||
Handle<Script> script() const { return script_; }
|
||||
HydrogenCodeStub* code_stub() {return code_stub_; }
|
||||
HydrogenCodeStub* code_stub() const {return code_stub_; }
|
||||
v8::Extension* extension() const { return extension_; }
|
||||
ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; }
|
||||
Handle<Context> context() const { return context_; }
|
||||
|
@ -1195,7 +1195,8 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
|
||||
// reg = JSFunction context
|
||||
//
|
||||
|
||||
ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
|
||||
ASSERT(compiled_code_->is_crankshafted() &&
|
||||
compiled_code_->kind() != Code::OPTIMIZED_FUNCTION);
|
||||
int major_key = compiled_code_->major_key();
|
||||
CodeStubInterfaceDescriptor* descriptor =
|
||||
isolate_->code_stub_interface_descriptor(major_key);
|
||||
@ -2133,7 +2134,7 @@ unsigned Deoptimizer::ComputeInputFrameSize() const {
|
||||
// size matches with the stack height we can compute based on the
|
||||
// environment at the OSR entry. The code for that his built into
|
||||
// the DoComputeOsrOutputFrame function for now.
|
||||
} else if (compiled_code_->kind() != Code::COMPILED_STUB) {
|
||||
} else if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
|
||||
unsigned stack_slots = compiled_code_->stack_slots();
|
||||
unsigned outgoing_size = ComputeOutgoingArgumentSize();
|
||||
ASSERT(result == fixed_size + (stack_slots * kPointerSize) + outgoing_size);
|
||||
|
@ -332,8 +332,7 @@ int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) {
|
||||
// Called by Code::CodePrint.
|
||||
void Disassembler::Decode(FILE* f, Code* code) {
|
||||
Isolate* isolate = code->GetIsolate();
|
||||
int decode_size = (code->kind() == Code::OPTIMIZED_FUNCTION ||
|
||||
code->kind() == Code::COMPILED_STUB)
|
||||
int decode_size = code->is_crankshafted()
|
||||
? static_cast<int>(code->safepoint_table_offset())
|
||||
: code->instruction_size();
|
||||
// If there might be a back edge table, stop before reaching it.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 the V8 project authors. All rights reserved.
|
||||
// Copyright 2013 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
@ -916,10 +916,11 @@ Handle<JSObject> Factory::NewExternal(void* value) {
|
||||
Handle<Code> Factory::NewCode(const CodeDesc& desc,
|
||||
Code::Flags flags,
|
||||
Handle<Object> self_ref,
|
||||
bool immovable) {
|
||||
bool immovable,
|
||||
bool crankshafted) {
|
||||
CALL_HEAP_FUNCTION(isolate(),
|
||||
isolate()->heap()->CreateCode(
|
||||
desc, flags, self_ref, immovable),
|
||||
desc, flags, self_ref, immovable, crankshafted),
|
||||
Code);
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,8 @@ class Factory {
|
||||
Handle<Code> NewCode(const CodeDesc& desc,
|
||||
Code::Flags flags,
|
||||
Handle<Object> self_reference,
|
||||
bool immovable = false);
|
||||
bool immovable = false,
|
||||
bool crankshafted = false);
|
||||
|
||||
Handle<Code> CopyCode(Handle<Code> code);
|
||||
|
||||
|
@ -3752,7 +3752,8 @@ MaybeObject* Heap::AllocateExternalArray(int length,
|
||||
MaybeObject* Heap::CreateCode(const CodeDesc& desc,
|
||||
Code::Flags flags,
|
||||
Handle<Object> self_reference,
|
||||
bool immovable) {
|
||||
bool immovable,
|
||||
bool crankshafted) {
|
||||
// Allocate ByteArray before the Code object, so that we do not risk
|
||||
// leaving uninitialized Code object (and breaking the heap).
|
||||
ByteArray* reloc_info;
|
||||
@ -3796,6 +3797,7 @@ MaybeObject* Heap::CreateCode(const CodeDesc& desc,
|
||||
if (code->is_call_stub() || code->is_keyed_call_stub()) {
|
||||
code->set_check_type(RECEIVER_MAP_CHECK);
|
||||
}
|
||||
code->set_is_crankshafted(crankshafted);
|
||||
code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER);
|
||||
code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value());
|
||||
code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER);
|
||||
|
@ -1142,7 +1142,8 @@ class Heap {
|
||||
MUST_USE_RESULT MaybeObject* CreateCode(const CodeDesc& desc,
|
||||
Code::Flags flags,
|
||||
Handle<Object> self_reference,
|
||||
bool immovable = false);
|
||||
bool immovable = false,
|
||||
bool crankshafted = false);
|
||||
|
||||
MUST_USE_RESULT MaybeObject* CopyCode(Code* code);
|
||||
|
||||
|
@ -144,7 +144,7 @@ class UnaryOpStub: public PlatformCodeStub {
|
||||
void GenerateGenericStubBitNot(MacroAssembler* masm);
|
||||
void GenerateGenericCodeFallback(MacroAssembler* masm);
|
||||
|
||||
virtual int GetCodeKind() { return Code::UNARY_OP_IC; }
|
||||
virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }
|
||||
|
||||
virtual InlineCacheState GetICState() {
|
||||
return UnaryOpIC::ToState(operand_type_);
|
||||
|
@ -442,7 +442,7 @@ LChunk* LChunk::NewChunk(HGraph* graph) {
|
||||
}
|
||||
|
||||
|
||||
Handle<Code> LChunk::Codegen(Code::Kind kind) {
|
||||
Handle<Code> LChunk::Codegen() {
|
||||
MacroAssembler assembler(info()->isolate(), NULL, 0);
|
||||
LOG_CODE_EVENT(info()->isolate(),
|
||||
CodeStartLinePosInfoRecordEvent(
|
||||
@ -456,11 +456,11 @@ Handle<Code> LChunk::Codegen(Code::Kind kind) {
|
||||
PrintF("Crankshaft Compiler - ");
|
||||
}
|
||||
CodeGenerator::MakeCodePrologue(info());
|
||||
Code::Flags flags = Code::ComputeFlags(kind);
|
||||
Code::Flags flags = info()->flags();
|
||||
Handle<Code> code =
|
||||
CodeGenerator::MakeCodeEpilogue(&assembler, flags, info());
|
||||
generator.FinishCode(code);
|
||||
|
||||
code->set_is_crankshafted(true);
|
||||
if (!code.is_null()) {
|
||||
void* jit_handler_data =
|
||||
assembler.positions_recorder()->DetachJITHandlerData();
|
||||
|
@ -685,7 +685,7 @@ class LChunk: public ZoneObject {
|
||||
|
||||
Zone* zone() const { return info_->zone(); }
|
||||
|
||||
Handle<Code> Codegen(Code::Kind kind);
|
||||
Handle<Code> Codegen();
|
||||
|
||||
void set_allocated_double_registers(BitVector* allocated_registers);
|
||||
BitVector* allocated_double_registers() {
|
||||
|
@ -1590,7 +1590,6 @@ void Logger::LogCodeObject(Object* object) {
|
||||
case Code::BINARY_OP_IC: // fall through
|
||||
case Code::COMPARE_IC: // fall through
|
||||
case Code::TO_BOOLEAN_IC: // fall through
|
||||
case Code::COMPILED_STUB: // fall through
|
||||
case Code::STUB:
|
||||
description =
|
||||
CodeStub::MajorName(CodeStub::GetMajorKey(code_object), true);
|
||||
|
@ -131,7 +131,7 @@ class UnaryOpStub: public PlatformCodeStub {
|
||||
void GenerateGenericStubBitNot(MacroAssembler* masm);
|
||||
void GenerateGenericCodeFallback(MacroAssembler* masm);
|
||||
|
||||
virtual int GetCodeKind() { return Code::UNARY_OP_IC; }
|
||||
virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }
|
||||
|
||||
virtual InlineCacheState GetICState() {
|
||||
return UnaryOpIC::ToState(operand_type_);
|
||||
|
@ -3645,9 +3645,21 @@ int Code::arguments_count() {
|
||||
}
|
||||
|
||||
|
||||
inline bool Code::is_crankshafted() {
|
||||
return IsCrankshaftedField::decode(
|
||||
READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
|
||||
}
|
||||
|
||||
|
||||
inline void Code::set_is_crankshafted(bool value) {
|
||||
int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
|
||||
int updated = IsCrankshaftedField::update(previous, value);
|
||||
WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
|
||||
}
|
||||
|
||||
|
||||
int Code::major_key() {
|
||||
ASSERT(kind() == STUB ||
|
||||
kind() == COMPILED_STUB ||
|
||||
kind() == UNARY_OP_IC ||
|
||||
kind() == BINARY_OP_IC ||
|
||||
kind() == COMPARE_IC ||
|
||||
@ -3661,7 +3673,6 @@ int Code::major_key() {
|
||||
|
||||
void Code::set_major_key(int major) {
|
||||
ASSERT(kind() == STUB ||
|
||||
kind() == COMPILED_STUB ||
|
||||
kind() == UNARY_OP_IC ||
|
||||
kind() == BINARY_OP_IC ||
|
||||
kind() == COMPARE_IC ||
|
||||
@ -3774,7 +3785,7 @@ void Code::set_profiler_ticks(int ticks) {
|
||||
|
||||
|
||||
unsigned Code::stack_slots() {
|
||||
ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
|
||||
ASSERT(is_crankshafted());
|
||||
return StackSlotsField::decode(
|
||||
READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
|
||||
}
|
||||
@ -3782,7 +3793,7 @@ unsigned Code::stack_slots() {
|
||||
|
||||
void Code::set_stack_slots(unsigned slots) {
|
||||
CHECK(slots <= (1 << kStackSlotsBitCount));
|
||||
ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
|
||||
ASSERT(is_crankshafted());
|
||||
int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
|
||||
int updated = StackSlotsField::update(previous, slots);
|
||||
WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
|
||||
@ -3790,7 +3801,7 @@ void Code::set_stack_slots(unsigned slots) {
|
||||
|
||||
|
||||
unsigned Code::safepoint_table_offset() {
|
||||
ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
|
||||
ASSERT(is_crankshafted());
|
||||
return SafepointTableOffsetField::decode(
|
||||
READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
|
||||
}
|
||||
@ -3798,7 +3809,7 @@ unsigned Code::safepoint_table_offset() {
|
||||
|
||||
void Code::set_safepoint_table_offset(unsigned offset) {
|
||||
CHECK(offset <= (1 << kSafepointTableOffsetBitCount));
|
||||
ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
|
||||
ASSERT(is_crankshafted());
|
||||
ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize)));
|
||||
int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
|
||||
int updated = SafepointTableOffsetField::update(previous, offset);
|
||||
|
@ -9313,7 +9313,6 @@ const char* Code::Kind2String(Kind kind) {
|
||||
switch (kind) {
|
||||
case FUNCTION: return "FUNCTION";
|
||||
case OPTIMIZED_FUNCTION: return "OPTIMIZED_FUNCTION";
|
||||
case COMPILED_STUB: return "COMPILED_STUB";
|
||||
case STUB: return "STUB";
|
||||
case BUILTIN: return "BUILTIN";
|
||||
case LOAD_IC: return "LOAD_IC";
|
||||
@ -9613,7 +9612,7 @@ void Code::Disassemble(const char* name, FILE* out) {
|
||||
}
|
||||
PrintF("\n");
|
||||
|
||||
if (kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB) {
|
||||
if (is_crankshafted()) {
|
||||
SafepointTable table(this);
|
||||
PrintF(out, "Safepoints (size = %u)\n", table.size());
|
||||
for (unsigned i = 0; i < table.length(); i++) {
|
||||
|
@ -4327,7 +4327,6 @@ class Code: public HeapObject {
|
||||
V(FUNCTION) \
|
||||
V(OPTIMIZED_FUNCTION) \
|
||||
V(STUB) \
|
||||
V(COMPILED_STUB) \
|
||||
V(BUILTIN) \
|
||||
V(LOAD_IC) \
|
||||
V(KEYED_LOAD_IC) \
|
||||
@ -4470,6 +4469,11 @@ class Code: public HeapObject {
|
||||
inline int major_key();
|
||||
inline void set_major_key(int value);
|
||||
|
||||
// For kind STUB or ICs, tells whether or not a code object was generated by
|
||||
// the optimizing compiler (but it may not be an optimized function).
|
||||
bool is_crankshafted();
|
||||
inline void set_is_crankshafted(bool value);
|
||||
|
||||
// For stubs, tells whether they should always exist, so that they can be
|
||||
// called from other stubs.
|
||||
inline bool is_pregenerated();
|
||||
@ -4785,15 +4789,22 @@ class Code: public HeapObject {
|
||||
kMarkedForDeoptimizationFirstBit,
|
||||
kMarkedForDeoptimizationBitCount> {}; // NOLINT
|
||||
|
||||
// KindSpecificFlags2 layout (ALL)
|
||||
static const int kIsCrankshaftedBit = 0;
|
||||
class IsCrankshaftedField: public BitField<bool,
|
||||
kIsCrankshaftedBit, 1> {}; // NOLINT
|
||||
|
||||
// KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION)
|
||||
static const int kStubMajorKeyFirstBit = 0;
|
||||
static const int kStubMajorKeyFirstBit = kIsCrankshaftedBit + 1;
|
||||
static const int kSafepointTableOffsetFirstBit =
|
||||
kStubMajorKeyFirstBit + kStubMajorKeyBits;
|
||||
static const int kSafepointTableOffsetBitCount = 26;
|
||||
static const int kSafepointTableOffsetBitCount = 25;
|
||||
|
||||
STATIC_ASSERT(kStubMajorKeyFirstBit + kStubMajorKeyBits <= 32);
|
||||
STATIC_ASSERT(kSafepointTableOffsetFirstBit +
|
||||
kSafepointTableOffsetBitCount <= 32);
|
||||
STATIC_ASSERT(1 + kStubMajorKeyBits +
|
||||
kSafepointTableOffsetBitCount <= 32);
|
||||
|
||||
class SafepointTableOffsetField: public BitField<int,
|
||||
kSafepointTableOffsetFirstBit,
|
||||
@ -4802,8 +4813,10 @@ class Code: public HeapObject {
|
||||
kStubMajorKeyFirstBit, kStubMajorKeyBits> {}; // NOLINT
|
||||
|
||||
// KindSpecificFlags2 layout (FUNCTION)
|
||||
class BackEdgeTableOffsetField: public BitField<int, 0, 31> {};
|
||||
class BackEdgesPatchedForOSRField: public BitField<bool, 31, 1> {};
|
||||
class BackEdgeTableOffsetField: public BitField<int,
|
||||
kIsCrankshaftedBit + 1, 29> {}; // NOLINT
|
||||
class BackEdgesPatchedForOSRField: public BitField<bool,
|
||||
kIsCrankshaftedBit + 1 + 29, 1> {}; // NOLINT
|
||||
|
||||
// Signed field cannot be encoded using the BitField class.
|
||||
static const int kArgumentsCountShift = 17;
|
||||
|
@ -7653,7 +7653,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyStubFailure) {
|
||||
ASSERT(args.length() == 0);
|
||||
Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate);
|
||||
ASSERT(isolate->heap()->IsAllocationAllowed());
|
||||
ASSERT(deoptimizer->compiled_code_kind() == Code::COMPILED_STUB);
|
||||
delete deoptimizer;
|
||||
return isolate->heap()->undefined_value();
|
||||
}
|
||||
@ -7668,7 +7667,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) {
|
||||
Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate);
|
||||
ASSERT(isolate->heap()->IsAllocationAllowed());
|
||||
|
||||
ASSERT(deoptimizer->compiled_code_kind() != Code::COMPILED_STUB);
|
||||
ASSERT(deoptimizer->compiled_code_kind() == Code::OPTIMIZED_FUNCTION);
|
||||
|
||||
// Make sure to materialize objects before causing any allocation.
|
||||
JavaScriptFrameIterator it(isolate);
|
||||
|
@ -59,8 +59,7 @@ bool SafepointEntry::HasRegisterAt(int reg_index) const {
|
||||
|
||||
|
||||
SafepointTable::SafepointTable(Code* code) {
|
||||
ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION ||
|
||||
code->kind() == Code::COMPILED_STUB);
|
||||
ASSERT(code->is_crankshafted());
|
||||
code_ = code;
|
||||
Address header = code->instruction_start() + code->safepoint_table_offset();
|
||||
length_ = Memory::uint32_at(header + kLengthOffset);
|
||||
|
@ -1807,7 +1807,6 @@ static void ReportCodeKindStatistics() {
|
||||
CASE(FUNCTION);
|
||||
CASE(OPTIMIZED_FUNCTION);
|
||||
CASE(STUB);
|
||||
CASE(COMPILED_STUB);
|
||||
CASE(BUILTIN);
|
||||
CASE(LOAD_IC);
|
||||
CASE(KEYED_LOAD_IC);
|
||||
|
@ -138,7 +138,7 @@ class UnaryOpStub: public PlatformCodeStub {
|
||||
void GenerateGenericStubBitNot(MacroAssembler* masm);
|
||||
void GenerateGenericCodeFallback(MacroAssembler* masm);
|
||||
|
||||
virtual int GetCodeKind() { return Code::UNARY_OP_IC; }
|
||||
virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }
|
||||
|
||||
virtual InlineCacheState GetICState() {
|
||||
return UnaryOpIC::ToState(operand_type_);
|
||||
|
Loading…
Reference in New Issue
Block a user