Index: src/full-codegen.cc |
diff --git a/src/full-codegen.cc b/src/full-codegen.cc |
index 5c7a23d54de942a2f5122f64ef0da65b66ba23d8..55dccabfcf55a8610cfec11ab289a5071d2d8945 100644 |
--- a/src/full-codegen.cc |
+++ b/src/full-codegen.cc |
@@ -285,6 +285,7 @@ bool FullCodeGenerator::MakeCode(CompilationInfo* info) { |
Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); |
code->set_optimizable(info->IsOptimizable()); |
cgen.PopulateDeoptimizationData(code); |
+ cgen.PopulateTypeFeedbackCells(code); |
code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); |
code->set_handler_table(*cgen.handler_table()); |
#ifdef ENABLE_DEBUGGER_SUPPORT |
@@ -329,8 +330,7 @@ void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) { |
ASSERT(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty()); |
if (!info_->HasDeoptimizationSupport()) return; |
int length = bailout_entries_.length(); |
- Handle<DeoptimizationOutputData> data = |
- isolate()->factory()-> |
+ Handle<DeoptimizationOutputData> data = isolate()->factory()-> |
NewDeoptimizationOutputData(length, TENURED); |
for (int i = 0; i < length; i++) { |
data->SetAstId(i, Smi::FromInt(bailout_entries_[i].id)); |
@@ -340,6 +340,21 @@ void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) { |
} |
+void FullCodeGenerator::PopulateTypeFeedbackCells(Handle<Code> code) { |
+ if (type_feedback_cells_.is_empty()) return; |
+ int length = type_feedback_cells_.length(); |
+ int array_size = TypeFeedbackCells::LengthOfFixedArray(length); |
+ Handle<TypeFeedbackCells> cache = Handle<TypeFeedbackCells>::cast( |
+ isolate()->factory()->NewFixedArray(array_size, TENURED)); |
+ for (int i = 0; i < length; i++) { |
+ cache->SetAstId(i, Smi::FromInt(type_feedback_cells_[i].ast_id)); |
+ cache->SetCell(i, *type_feedback_cells_[i].cell); |
+ } |
+ code->set_type_feedback_cells(*cache); |
+} |
+ |
+ |
+ |
void FullCodeGenerator::PrepareForBailout(Expression* node, State state) { |
PrepareForBailoutForId(node->id(), state); |
} |
@@ -383,6 +398,13 @@ void FullCodeGenerator::PrepareForBailoutForId(unsigned id, State state) { |
} |
+void FullCodeGenerator::RecordTypeFeedbackCell( |
+ unsigned id, Handle<JSGlobalPropertyCell> cell) { |
+ TypeFeedbackCellEntry entry = { id, cell }; |
+ type_feedback_cells_.Add(entry); |
+} |
+ |
+ |
void FullCodeGenerator::RecordStackCheck(unsigned ast_id) { |
// The pc offset does not need to be encoded and packed together with a |
// state. |