Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 9a5357a338db84f2a643c5980d3dc3dd028ca031..5be1c84de8d0b0eb530984ce77ad0fe75cb72336 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -6148,6 +6148,23 @@ void SharedFunctionInfo::CompleteInobjectSlackTracking() { |
} |
+Code* SharedFunctionInfo::SearchOptimizedCodeMap(Context* global_context) { |
+ ASSERT(global_context->IsGlobalContext()); |
+ Object* value = optimized_code_map(); |
+ if (!value->IsSmi()) { |
+ FixedArray* optimized_code_map = FixedArray::cast(value); |
+ int length = optimized_code_map->length(); |
+ for (int i = 0; i < length; i += 2) { |
+ if (optimized_code_map->get(i) == global_context) { |
+ return Code::cast(optimized_code_map->get(i + 1)); |
+ } |
+ } |
+ } |
+ |
+ return NULL; |
+} |
+ |
+ |
void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { |
ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
@@ -6354,22 +6371,29 @@ void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { |
ASSERT(Translation::FRAME == opcode); |
int ast_id = iterator.Next(); |
int function_id = iterator.Next(); |
- JSFunction* function = |
- JSFunction::cast(LiteralArray()->get(function_id)); |
unsigned height = iterator.Next(); |
if (FLAG_print_code_verbose) { |
PrintF(out, "%24s %s {ast_id=%d, function=", |
"", Translation::StringFor(opcode), ast_id); |
- function->PrintName(out); |
+ if (function_id != Translation::kSelfLiteralId) { |
+ Object* function = LiteralArray()->get(function_id); |
+ JSFunction::cast(function)->PrintName(out); |
+ } else { |
+ PrintF(out, "<self>"); |
+ } |
PrintF(out, ", height=%u}\n", height); |
} |
- // Size of translation is height plus all incoming arguments including |
- // receiver. |
- int size = height + function->shared()->formal_parameter_count() + 1; |
- command_count += size; |
- for (int j = 0; j < size; ++j) { |
+ while (iterator.HasNext()) { |
opcode = static_cast<Translation::Opcode>(iterator.Next()); |
+ if (opcode == Translation::FRAME |
+ || opcode == Translation::BEGIN) { |
+ iterator.Undo(); |
+ break; |
+ } |
+ |
+ command_count++; |
+ |
if (FLAG_print_code_verbose) { |
PrintF(out, "%24s %s ", "", Translation::StringFor(opcode)); |
} |
@@ -6379,7 +6403,6 @@ void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { |
if (FLAG_print_code_verbose) { |
PrintF(out, "%s ", Translation::StringFor(opcode)); |
} |
- --j; // Two commands share the same frame index. |
} |
switch (opcode) { |