isolate()->counters()->code_stubs()->Increment();
if (FLAG_trace_hydrogen_stubs) {
- const char* name = CodeStub::MajorName(stub()->MajorKey(), false);
+ const char* name = CodeStub::MajorName(stub()->MajorKey());
PrintF("-----------------------------------------------------------\n");
PrintF("Compiling stub %s using hydrogen\n", name);
isolate()->GetHTracer()->TraceCompilation(info());
}
-const char* CodeStub::MajorName(CodeStub::Major major_key,
- bool allow_unknown_keys) {
+const char* CodeStub::MajorName(CodeStub::Major major_key) {
switch (major_key) {
#define DEF_CASE(name) case name: return #name "Stub";
CODE_STUB_LIST(DEF_CASE)
void CodeStub::PrintBaseName(std::ostream& os) const { // NOLINT
- os << MajorName(MajorKey(), false);
+ os << MajorName(MajorKey());
}
Handle<Code> TurboFanCodeStub::GenerateCode() {
// Get the outer ("stub generator") function.
- const char* name = CodeStub::MajorName(MajorKey(), false);
+ const char* name = CodeStub::MajorName(MajorKey());
Handle<JSFunction> outer = GetFunction(isolate(), name);
DCHECK_EQ(2, outer->shared()->length());
static uint32_t NoCacheKey() { return MajorKeyBits::encode(NoCache); }
- static const char* MajorName(Major major_key, bool allow_unknown_keys);
+ static const char* MajorName(Major major_key);
explicit CodeStub(Isolate* isolate) : minor_key_(0), isolate_(isolate) {}
virtual ~CodeStub() {}
};
-// TODO(svenpanne) This class is only used to construct a more or less sensible
-// CompilationInfo for testing purposes, basically pretending that we are
-// currently compiling some kind of code stub. Remove this when the pipeline and
-// testing machinery is restructured in such a way that we don't have to come up
-// with a CompilationInfo out of thin air, although we only need a few parts of
-// it.
-struct FakeStubForTesting : public CodeStub {
- explicit FakeStubForTesting(Isolate* isolate) : CodeStub(isolate) {}
-
- // Only used by pipeline.cc's GetDebugName in DEBUG mode.
- Major MajorKey() const override { return CodeStub::NoCache; }
-
- CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
- return ContextOnlyDescriptor(isolate());
- }
-
- Handle<Code> GenerateCode() override {
- UNREACHABLE();
- return Handle<Code>();
- }
-};
-
-
#define DEFINE_CODE_STUB_BASE(NAME, SUPER) \
public: \
NAME(uint32_t key, Isolate* isolate) : SUPER(key, isolate) {} \
}
if (FLAG_trace_codegen || print_source || print_ast) {
- PrintF("[generating %s code for %s function: ", kind, ftype);
- if (info->IsStub()) {
- const char* name =
- CodeStub::MajorName(info->code_stub()->MajorKey(), true);
- PrintF("%s", name == NULL ? "<unknown>" : name);
- } else {
- AllowDeferredHandleDereference allow_deference_for_trace;
- PrintF("%s", info->literal()->debug_name()->ToCString().get());
- }
- PrintF("]\n");
+ base::SmartArrayPointer<char> name = info->GetDebugName();
+ PrintF("[generating %s code for %s function: %s]", kind, ftype, name.get());
}
#ifdef DEBUG
Isolate* isolate = info->isolate();
Code::Flags flags =
- info->code_stub() != nullptr
- ? Code::ComputeFlags(info->code_stub()->GetCodeKind(),
- info->code_stub()->GetICState(),
- info->code_stub()->GetExtraICState(),
- info->code_stub()->GetStubType())
+ info->IsStub()
+ ? info->code_stub()
+ ? Code::ComputeFlags(info->code_stub()->GetCodeKind(),
+ info->code_stub()->GetICState(),
+ info->code_stub()->GetExtraICState(),
+ info->code_stub()->GetStubType())
+ : Code::ComputeFlags(Code::STUB)
: Code::ComputeFlags(info->IsOptimizing() ? Code::OPTIMIZED_FUNCTION
: Code::FUNCTION);
(info->IsStub() && FLAG_print_code_stubs) ||
(info->IsOptimizing() && FLAG_print_opt_code));
if (print_code) {
- const char* debug_name;
- base::SmartArrayPointer<char> debug_name_holder;
- if (info->IsStub()) {
- CodeStub::Major major_key = info->code_stub()->MajorKey();
- debug_name = CodeStub::MajorName(major_key, false);
- } else {
- debug_name_holder = info->literal()->debug_name()->ToCString();
- debug_name = debug_name_holder.get();
- }
-
+ base::SmartArrayPointer<char> debug_name = info->GetDebugName();
CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer());
OFStream os(tracing_scope.file());
if (info->IsOptimizing()) {
if (FLAG_print_unopt_code && info->parse_info()) {
os << "--- Unoptimized code ---\n";
- info->closure()->shared()->code()->Disassemble(debug_name, os);
+ info->closure()->shared()->code()->Disassemble(debug_name.get(), os);
}
os << "--- Optimized code ---\n"
<< "optimization_id = " << info->optimization_id() << "\n";
FunctionLiteral* literal = info->literal();
os << "source_position = " << literal->start_position() << "\n";
}
- code->Disassemble(debug_name, os);
+ code->Disassemble(debug_name.get(), os);
os << "--- End code ---\n";
}
#endif // ENABLE_DISASSEMBLER
CompilationInfo::CompilationInfo(ParseInfo* parse_info)
- : CompilationInfo(parse_info, nullptr, BASE, parse_info->isolate(),
+ : CompilationInfo(parse_info, nullptr, nullptr, BASE, parse_info->isolate(),
parse_info->zone()) {
// Compiling for the snapshot typically results in different code than
// compiling later on. This means that code recompiled with deoptimization
CompilationInfo::CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone)
- : CompilationInfo(nullptr, stub, STUB, isolate, zone) {}
+ : CompilationInfo(nullptr, stub, CodeStub::MajorName(stub->MajorKey()),
+ STUB, isolate, zone) {}
+CompilationInfo::CompilationInfo(const char* debug_name, Isolate* isolate,
+ Zone* zone)
+ : CompilationInfo(nullptr, nullptr, debug_name, STUB, isolate, zone) {}
CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub,
- Mode mode, Isolate* isolate, Zone* zone)
+ const char* code_stub_debug_name, Mode mode,
+ Isolate* isolate, Zone* zone)
: parse_info_(parse_info),
isolate_(isolate),
flags_(0),
parameter_count_(0),
optimization_id_(-1),
osr_expr_stack_height_(0),
- function_type_(nullptr) {
+ function_type_(nullptr),
+ code_stub_debug_name_(code_stub_debug_name) {
// Parameter count is number of stack parameters.
if (code_stub_ != NULL) {
CodeStubDescriptor descriptor(code_stub_);
}
+void CompilationInfo::SetStub(CodeStub* code_stub) {
+ SetMode(STUB);
+ code_stub_ = code_stub;
+ code_stub_debug_name_ = CodeStub::MajorName(code_stub->MajorKey());
+}
+
+
int CompilationInfo::num_parameters() const {
return has_scope() ? scope()->num_parameters() : parameter_count_;
}
}
+base::SmartArrayPointer<char> CompilationInfo::GetDebugName() const {
+ if (IsStub()) {
+ size_t len = strlen(code_stub_debug_name_) + 1;
+ base::SmartArrayPointer<char> name(new char[len]);
+ memcpy(name.get(), code_stub_debug_name_, len);
+ return name;
+ } else {
+ AllowHandleDereference allow_deref;
+ return literal()->debug_name()->ToCString();
+ }
+}
+
+
class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder {
public:
explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info)
explicit CompilationInfo(ParseInfo* parse_info);
CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone);
+ CompilationInfo(const char* code_stub_debug_name, Isolate* isolate,
+ Zone* zone);
virtual ~CompilationInfo();
ParseInfo* parse_info() const { return parse_info_; }
}
Type::FunctionType* function_type() const { return function_type_; }
- void SetStub(CodeStub* code_stub) {
- SetMode(STUB);
- code_stub_ = code_stub;
- }
+ void SetStub(CodeStub* code_stub);
// Deoptimization support.
bool HasDeoptimizationSupport() const {
DCHECK_EQ(BASE, mode_);
SetFlag(kDeoptimizationSupport);
}
+ bool ShouldEnsureSpaceForLazyDeopt() { return !IsStub(); }
// Determines whether or not to insert a self-optimization header.
bool ShouldSelfOptimize();
inlined_functions_.push_back(inlined_function);
}
+ base::SmartArrayPointer<char> GetDebugName() const;
+
protected:
ParseInfo* parse_info_;
STUB
};
- CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub, Mode mode,
- Isolate* isolate, Zone* zone);
+ CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub,
+ const char* code_stub_debug_name, Mode mode, Isolate* isolate,
+ Zone* zone);
Isolate* isolate_;
Type::FunctionType* function_type_;
+ const char* code_stub_debug_name_;
+
DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
};
void CodeGenerator::EnsureSpaceForLazyDeopt() {
+ if (!info()->ShouldEnsureSpaceForLazyDeopt()) {
+ return;
+ }
+
int space_needed = Deoptimizer::patch_size();
- if (!info()->IsStub()) {
- // Ensure that we have enough space after the previous lazy-bailout
- // instruction for patching the code here.
- int current_pc = masm()->pc_offset();
- if (current_pc < last_lazy_deopt_pc_ + space_needed) {
- // Block literal pool emission for duration of padding.
- v8::internal::Assembler::BlockConstPoolScope block_const_pool(masm());
- int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
- DCHECK_EQ(0, padding_size % v8::internal::Assembler::kInstrSize);
- while (padding_size > 0) {
- __ nop();
- padding_size -= v8::internal::Assembler::kInstrSize;
- }
+ // Ensure that we have enough space after the previous lazy-bailout
+ // instruction for patching the code here.
+ int current_pc = masm()->pc_offset();
+ if (current_pc < last_lazy_deopt_pc_ + space_needed) {
+ // Block literal pool emission for duration of padding.
+ v8::internal::Assembler::BlockConstPoolScope block_const_pool(masm());
+ int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
+ DCHECK_EQ(0, padding_size % v8::internal::Assembler::kInstrSize);
+ while (padding_size > 0) {
+ __ nop();
+ padding_size -= v8::internal::Assembler::kInstrSize;
}
}
}
void CodeGenerator::EnsureSpaceForLazyDeopt() {
+ if (!info()->ShouldEnsureSpaceForLazyDeopt()) {
+ return;
+ }
+
int space_needed = Deoptimizer::patch_size();
- if (!info()->IsStub()) {
- // Ensure that we have enough space after the previous lazy-bailout
- // instruction for patching the code here.
- intptr_t current_pc = masm()->pc_offset();
-
- if (current_pc < (last_lazy_deopt_pc_ + space_needed)) {
- intptr_t padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
- DCHECK((padding_size % kInstructionSize) == 0);
- InstructionAccurateScope instruction_accurate(
- masm(), padding_size / kInstructionSize);
-
- while (padding_size > 0) {
- __ nop();
- padding_size -= kInstructionSize;
- }
+ // Ensure that we have enough space after the previous lazy-bailout
+ // instruction for patching the code here.
+ intptr_t current_pc = masm()->pc_offset();
+
+ if (current_pc < (last_lazy_deopt_pc_ + space_needed)) {
+ intptr_t padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
+ DCHECK((padding_size % kInstructionSize) == 0);
+ InstructionAccurateScope instruction_accurate(
+ masm(), padding_size / kInstructionSize);
+
+ while (padding_size > 0) {
+ __ nop();
+ padding_size -= kInstructionSize;
}
}
}
}
// Ensure there is space for lazy deoptimization in the code.
- if (!info->IsStub()) {
+ if (info->ShouldEnsureSpaceForLazyDeopt()) {
int target_offset = masm()->pc_offset() + Deoptimizer::patch_size();
while (masm()->pc_offset() < target_offset) {
masm()->nop();
PopulateDeoptimizationData(result);
// Ensure there is space for lazy deoptimization in the relocation info.
- if (!info->IsStub()) {
+ if (!info->ShouldEnsureSpaceForLazyDeopt()) {
Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(result);
}
#include "src/compiler/register-allocator.h"
#include "src/compiler/schedule.h"
#include "src/compiler/scheduler.h"
+#include "src/interpreter/bytecodes.h"
#include "src/ostreams.h"
namespace v8 {
FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase,
const char* suffix, const char* mode) {
EmbeddedVector<char, 256> filename(0);
- base::SmartArrayPointer<char> function_name;
- if (info->has_shared_info()) {
- function_name = info->shared_info()->DebugName()->ToCString();
- if (strlen(function_name.get()) > 0) {
- SNPrintF(filename, "turbo-%s", function_name.get());
- } else {
- SNPrintF(filename, "turbo-%p", static_cast<void*>(info));
- }
+ base::SmartArrayPointer<char> debug_name = info->GetDebugName();
+ if (strlen(debug_name.get()) > 0) {
+ SNPrintF(filename, "turbo-%s", debug_name.get());
+ } else if (info->has_shared_info()) {
+ SNPrintF(filename, "turbo-%p", static_cast<void*>(info));
} else {
SNPrintF(filename, "turbo-none-%s", phase);
}
void GraphC1Visualizer::PrintCompilation(const CompilationInfo* info) {
Tag tag(this, "compilation");
+ base::SmartArrayPointer<char> name = info->GetDebugName();
if (info->IsOptimizing()) {
- Handle<String> name = info->literal()->debug_name();
- PrintStringProperty("name", name->ToCString().get());
+ PrintStringProperty("name", name.get());
PrintIndent();
- os_ << "method \"" << name->ToCString().get() << ":"
- << info->optimization_id() << "\"\n";
+ os_ << "method \"" << name.get() << ":" << info->optimization_id()
+ << "\"\n";
} else {
- CodeStub::Major major_key = info->code_stub()->MajorKey();
- PrintStringProperty("name", CodeStub::MajorName(major_key, false));
+ PrintStringProperty("name", name.get());
PrintStringProperty("method", "stub");
}
PrintLongProperty("date",
void CodeGenerator::EnsureSpaceForLazyDeopt() {
+ if (!info()->ShouldEnsureSpaceForLazyDeopt()) {
+ return;
+ }
+
int space_needed = Deoptimizer::patch_size();
- if (!info()->IsStub()) {
- // Ensure that we have enough space after the previous lazy-bailout
- // instruction for patching the code here.
- int current_pc = masm()->pc_offset();
- if (current_pc < last_lazy_deopt_pc_ + space_needed) {
- int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
- __ Nop(padding_size);
- }
+ // Ensure that we have enough space after the previous lazy-bailout
+ // instruction for patching the code here.
+ int current_pc = masm()->pc_offset();
+ if (current_pc < last_lazy_deopt_pc_ + space_needed) {
+ int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
+ __ Nop(padding_size);
}
}
void CodeGenerator::EnsureSpaceForLazyDeopt() {
+ if (!info()->ShouldEnsureSpaceForLazyDeopt()) {
+ return;
+ }
+
int space_needed = Deoptimizer::patch_size();
- if (!info()->IsStub()) {
- // Ensure that we have enough space after the previous lazy-bailout
- // instruction for patching the code here.
- int current_pc = masm()->pc_offset();
- if (current_pc < last_lazy_deopt_pc_ + space_needed) {
- // Block tramoline pool emission for duration of padding.
- v8::internal::Assembler::BlockTrampolinePoolScope block_trampoline_pool(
- masm());
- int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
- DCHECK_EQ(0, padding_size % v8::internal::Assembler::kInstrSize);
- while (padding_size > 0) {
- __ nop();
- padding_size -= v8::internal::Assembler::kInstrSize;
- }
+ // Ensure that we have enough space after the previous lazy-bailout
+ // instruction for patching the code here.
+ int current_pc = masm()->pc_offset();
+ if (current_pc < last_lazy_deopt_pc_ + space_needed) {
+ // Block tramoline pool emission for duration of padding.
+ v8::internal::Assembler::BlockTrampolinePoolScope block_trampoline_pool(
+ masm());
+ int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
+ DCHECK_EQ(0, padding_size % v8::internal::Assembler::kInstrSize);
+ while (padding_size > 0) {
+ __ nop();
+ padding_size -= v8::internal::Assembler::kInstrSize;
}
}
}
void CodeGenerator::EnsureSpaceForLazyDeopt() {
+ if (!info()->ShouldEnsureSpaceForLazyDeopt()) {
+ return;
+ }
+
int space_needed = Deoptimizer::patch_size();
- if (!info()->IsStub()) {
- // Ensure that we have enough space after the previous lazy-bailout
- // instruction for patching the code here.
- int current_pc = masm()->pc_offset();
- if (current_pc < last_lazy_deopt_pc_ + space_needed) {
- // Block tramoline pool emission for duration of padding.
- v8::internal::Assembler::BlockTrampolinePoolScope block_trampoline_pool(
- masm());
- int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
- DCHECK_EQ(0, padding_size % v8::internal::Assembler::kInstrSize);
- while (padding_size > 0) {
- __ nop();
- padding_size -= v8::internal::Assembler::kInstrSize;
- }
+ // Ensure that we have enough space after the previous lazy-bailout
+ // instruction for patching the code here.
+ int current_pc = masm()->pc_offset();
+ if (current_pc < last_lazy_deopt_pc_ + space_needed) {
+ // Block tramoline pool emission for duration of padding.
+ v8::internal::Assembler::BlockTrampolinePoolScope block_trampoline_pool(
+ masm());
+ int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
+ DCHECK_EQ(0, padding_size % v8::internal::Assembler::kInstrSize);
+ while (padding_size > 0) {
+ __ nop();
+ padding_size -= v8::internal::Assembler::kInstrSize;
}
}
}
}
-base::SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
- if (info->code_stub() != NULL) {
- CodeStub::Major major_key = info->code_stub()->MajorKey();
- const char* major_name = CodeStub::MajorName(major_key, false);
- size_t len = strlen(major_name) + 1;
- base::SmartArrayPointer<char> name(new char[len]);
- memcpy(name.get(), major_name, len);
- return name;
- } else {
- AllowHandleDereference allow_deref;
- return info->literal()->debug_name()->ToCString();
- }
-}
-
-
class AstGraphBuilderWithPositions final : public AstGraphBuilder {
public:
AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info,
OFStream json_of(json_file);
Handle<Script> script = info()->script();
FunctionLiteral* function = info()->literal();
- base::SmartArrayPointer<char> function_name =
- info()->shared_info()->DebugName()->ToCString();
+ base::SmartArrayPointer<char> function_name = info()->GetDebugName();
int pos = info()->shared_info()->start_position();
json_of << "{\"function\":\"" << function_name.get()
<< "\", \"sourcePosition\":" << pos << ", \"source\":\"";
if (FLAG_trace_turbo) {
OFStream os(stdout);
os << "---------------------------------------------------\n"
- << "Begin compiling method " << GetDebugName(info()).get()
+ << "Begin compiling method " << info()->GetDebugName().get()
<< " using Turbofan" << std::endl;
TurboCfgFile tcf(isolate());
tcf << AsC1VCompilation(info());
CallDescriptor* call_descriptor,
Graph* graph,
Schedule* schedule) {
- FakeStubForTesting stub(isolate);
- CompilationInfo info(&stub, isolate, graph->zone());
+ CompilationInfo info("testing", isolate, graph->zone());
return GenerateCodeForTesting(&info, call_descriptor, graph, schedule);
}
bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config,
InstructionSequence* sequence,
bool run_verifier) {
- FakeStubForTesting stub(sequence->isolate());
- CompilationInfo info(&stub, sequence->isolate(), sequence->zone());
+ CompilationInfo info("testing", sequence->isolate(), sequence->zone());
ZonePool zone_pool;
PipelineData data(&zone_pool, &info, sequence);
Pipeline pipeline(&info);
}
OFStream os(stdout);
os << "---------------------------------------------------\n"
- << "Finished compiling method " << GetDebugName(info()).get()
+ << "Finished compiling method " << info()->GetDebugName().get()
<< " using Turbofan" << std::endl;
}
base::SmartArrayPointer<char> debug_name;
#ifdef DEBUG
- debug_name = GetDebugName(data->info());
+ debug_name = info()->GetDebugName();
#endif
data->InitializeRegisterAllocationData(config, descriptor, debug_name.get());
void CodeGenerator::EnsureSpaceForLazyDeopt() {
+ if (!info()->ShouldEnsureSpaceForLazyDeopt()) {
+ return;
+ }
+
int space_needed = Deoptimizer::patch_size();
- if (!info()->IsStub()) {
- // Ensure that we have enough space after the previous lazy-bailout
- // instruction for patching the code here.
- int current_pc = masm()->pc_offset();
- if (current_pc < last_lazy_deopt_pc_ + space_needed) {
- int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
- DCHECK_EQ(0, padding_size % v8::internal::Assembler::kInstrSize);
- while (padding_size > 0) {
- __ nop();
- padding_size -= v8::internal::Assembler::kInstrSize;
- }
+ // Ensure that we have enough space after the previous lazy-bailout
+ // instruction for patching the code here.
+ int current_pc = masm()->pc_offset();
+ if (current_pc < last_lazy_deopt_pc_ + space_needed) {
+ int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
+ DCHECK_EQ(0, padding_size % v8::internal::Assembler::kInstrSize);
+ while (padding_size > 0) {
+ __ nop();
+ padding_size -= v8::internal::Assembler::kInstrSize;
}
}
}
void CodeGenerator::EnsureSpaceForLazyDeopt() {
+ if (!info()->ShouldEnsureSpaceForLazyDeopt()) {
+ return;
+ }
+
int space_needed = Deoptimizer::patch_size();
- if (!info()->IsStub()) {
- // Ensure that we have enough space after the previous lazy-bailout
- // instruction for patching the code here.
- int current_pc = masm()->pc_offset();
- if (current_pc < last_lazy_deopt_pc_ + space_needed) {
- int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
- __ Nop(padding_size);
- }
+ // Ensure that we have enough space after the previous lazy-bailout
+ // instruction for patching the code here.
+ int current_pc = masm()->pc_offset();
+ if (current_pc < last_lazy_deopt_pc_ + space_needed) {
+ int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
+ __ Nop(padding_size);
}
}
void CodeGenerator::EnsureSpaceForLazyDeopt() {
+ if (!info()->ShouldEnsureSpaceForLazyDeopt()) {
+ return;
+ }
+
int space_needed = Deoptimizer::patch_size();
- if (!info()->IsStub()) {
- // Ensure that we have enough space after the previous lazy-bailout
- // instruction for patching the code here.
- int current_pc = masm()->pc_offset();
- if (current_pc < last_lazy_deopt_pc_ + space_needed) {
- int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
- __ Nop(padding_size);
- }
+ // Ensure that we have enough space after the previous lazy-bailout
+ // instruction for patching the code here.
+ int current_pc = masm()->pc_offset();
+ if (current_pc < last_lazy_deopt_pc_ + space_needed) {
+ int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
+ __ Nop(padding_size);
}
}
if (trace_scope_ != NULL) {
PrintF(trace_scope_->file(),
" translating %s => StubFailureTrampolineStub, height=%d\n",
- CodeStub::MajorName(static_cast<CodeStub::Major>(major_key), false),
+ CodeStub::MajorName(static_cast<CodeStub::Major>(major_key)),
height_in_bytes);
}
CodeStub::Major major_key = CodeStub::GetMajorKey(code);
DCHECK(major_key == CodeStub::MajorKeyFromKey(key));
out.AddFormatted(" %s, %s, ", Code::Kind2String(kind),
- CodeStub::MajorName(major_key, false));
+ CodeStub::MajorName(major_key));
out.AddFormatted("minor: %d", minor_key);
} else {
out.AddFormatted(" %s", Code::Kind2String(kind));
void V8HeapExplorer::TagCodeObject(Code* code) {
if (code->kind() == Code::STUB) {
TagObject(code, names_->GetFormatted(
- "(%s code)", CodeStub::MajorName(
- CodeStub::GetMajorKey(code), true)));
+ "(%s code)",
+ CodeStub::MajorName(CodeStub::GetMajorKey(code))));
}
}
std::ostream& HCallStub::PrintDataTo(std::ostream& os) const { // NOLINT
- os << CodeStub::MajorName(major_key_, false) << " ";
+ os << CodeStub::MajorName(major_key_) << " ";
return HUnaryCall::PrintDataTo(os);
}
void HTracer::TraceCompilation(CompilationInfo* info) {
Tag tag(this, "compilation");
+ base::SmartArrayPointer<char> name = info->GetDebugName();
if (info->IsOptimizing()) {
- Handle<String> name = info->literal()->debug_name();
- PrintStringProperty("name", name->ToCString().get());
+ PrintStringProperty("name", name.get());
PrintIndent();
- trace_.Add("method \"%s:%d\"\n",
- name->ToCString().get(),
- info->optimization_id());
+ trace_.Add("method \"%s:%d\"\n", name.get(), info->optimization_id());
} else {
- CodeStub::Major major_key = info->code_stub()->MajorKey();
- PrintStringProperty("name", CodeStub::MajorName(major_key, false));
+ PrintStringProperty("name", name.get());
PrintStringProperty("method", "stub");
}
PrintLongProperty("date",
while (!iterator.Done()) {
found = true;
int operand_index = iterator.Current();
- if (chunk_->info()->IsStub()) {
- CodeStub::Major major_key = chunk_->info()->code_stub()->MajorKey();
- PrintF("Function: %s\n", CodeStub::MajorName(major_key, false));
- } else {
- DCHECK(chunk_->info()->IsOptimizing());
+ {
AllowHandleDereference allow_deref;
- PrintF("Function: %s\n",
- chunk_->info()->literal()->debug_name()->ToCString().get());
+ PrintF("Function: %s\n", chunk_->info()->GetDebugName().get());
}
PrintF("Value %d used before first definition!\n", operand_index);
LiveRange* range = LiveRangeFor(operand_index);
case Code::COMPARE_NIL_IC: // fall through
case Code::TO_BOOLEAN_IC: // fall through
case Code::STUB:
- description =
- CodeStub::MajorName(CodeStub::GetMajorKey(code_object), true);
+ description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object));
if (description == NULL)
description = "A stub from the snapshot";
tag = Logger::STUB_TAG;
void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT
os << "kind = " << Kind2String(kind()) << "\n";
if (IsCodeStubOrIC()) {
- const char* n = CodeStub::MajorName(CodeStub::GetMajorKey(this), true);
+ const char* n = CodeStub::MajorName(CodeStub::GetMajorKey(this));
os << "major_key = " << (n == NULL ? "null" : n) << "\n";
}
if (is_inline_cache_stub()) {
if (FLAG_trace_serializer) {
PrintF(" Encoding code stub %s as %d\n",
- CodeStub::MajorName(CodeStub::MajorKeyFromKey(stub_key), false),
- index);
+ CodeStub::MajorName(CodeStub::MajorKeyFromKey(stub_key)), index);
}
sink_->Put(kAttachedReference + how_to_code + where_to_point, "CodeStub");
#include "src/v8.h"
-#include "src/code-stubs.h"
#include "src/compilation-cache.h"
#include "src/execution.h"
#include "src/factory.h"
CHECK(expectations.Check(*map));
Zone zone;
- FakeStubForTesting stub(isolate);
if (is_detached_map) {
detach_point_map = Map::ReconfigureProperty(
// Create new maps by generalizing representation of propX field.
Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate);
- CompilationInfo info(&stub, isolate, &zone);
+ CompilationInfo info("testing", isolate, &zone);
CHECK(!info.dependencies()->HasAborted());
info.dependencies()->AssumeFieldType(field_owner);
CHECK(expectations2.Check(*map2));
Zone zone;
- FakeStubForTesting stub(isolate);
Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate);
- CompilationInfo info(&stub, isolate, &zone);
+ CompilationInfo info("testing", isolate, &zone);
CHECK(!info.dependencies()->HasAborted());
info.dependencies()->AssumeFieldType(field_owner);
CHECK(expectations2.Check(*map2));
Zone zone;
- FakeStubForTesting stub(isolate);
Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate);
- CompilationInfo info(&stub, isolate, &zone);
+ CompilationInfo info("testing", isolate, &zone);
CHECK(!info.dependencies()->HasAborted());
info.dependencies()->AssumeFieldType(field_owner);