diff options
Diffstat (limited to 'deps/v8/src/deoptimizer.cc')
-rw-r--r-- | deps/v8/src/deoptimizer.cc | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/deps/v8/src/deoptimizer.cc b/deps/v8/src/deoptimizer.cc index 68b10d9612..18be014c14 100644 --- a/deps/v8/src/deoptimizer.cc +++ b/deps/v8/src/deoptimizer.cc @@ -731,12 +731,6 @@ void Deoptimizer::DoComputeOutputFrames() { LOG(isolate(), CodeDeoptEvent(compiled_code_)); } ElapsedTimer timer; - - // Determine basic deoptimization information. The optimized frame is - // described by the input data. - DeoptimizationInputData* input_data = - DeoptimizationInputData::cast(compiled_code_->deoptimization_data()); - if (trace_scope_ != NULL) { timer.Start(); PrintF(trace_scope_->file(), @@ -745,8 +739,7 @@ void Deoptimizer::DoComputeOutputFrames() { reinterpret_cast<intptr_t>(function_)); PrintFunctionName(); PrintF(trace_scope_->file(), - " (opt #%d) @%d, FP to SP delta: %d]\n", - input_data->OptimizationId()->value(), + " @%d, FP to SP delta: %d]\n", bailout_id_, fp_to_sp_delta_); if (bailout_type_ == EAGER || bailout_type_ == SOFT) { @@ -754,6 +747,10 @@ void Deoptimizer::DoComputeOutputFrames() { } } + // Determine basic deoptimization information. The optimized frame is + // described by the input data. + DeoptimizationInputData* input_data = + DeoptimizationInputData::cast(compiled_code_->deoptimization_data()); BailoutId node_id = input_data->AstId(bailout_id_); ByteArray* translations = input_data->TranslationByteArray(); unsigned translation_index = @@ -1753,7 +1750,11 @@ Handle<Object> Deoptimizer::MaterializeNextHeapObject() { Handle<JSObject> arguments = Handle<JSObject>::cast( Accessors::FunctionGetArguments(function)); materialized_objects_->Add(arguments); - materialization_value_index_ += length; + // To keep consistent object counters, we still materialize the + // nested values (but we throw them away). + for (int i = 0; i < length; ++i) { + MaterializeNextValue(); + } } else if (desc.is_arguments()) { // Construct an arguments object and copy the parameters to a newly // allocated arguments object backing store. @@ -2691,9 +2692,6 @@ FrameDescription::FrameDescription(uint32_t frame_size, constant_pool_(kZapUint32) { // Zap all the registers. for (int r = 0; r < Register::kNumRegisters; r++) { - // TODO(jbramley): It isn't safe to use kZapUint32 here. If the register - // isn't used before the next safepoint, the GC will try to scan it as a - // tagged value. kZapUint32 looks like a valid tagged pointer, but it isn't. SetRegister(r, kZapUint32); } @@ -2998,8 +2996,7 @@ SlotRef SlotRefValueBuilder::ComputeSlotForNextArgument( } case Translation::ARGUMENTS_OBJECT: - // This can be only emitted for local slots not for argument slots. - break; + return SlotRef::NewArgumentsObject(iterator->Next()); case Translation::CAPTURED_OBJECT: { return SlotRef::NewDeferredObject(iterator->Next()); @@ -3049,7 +3046,7 @@ SlotRef SlotRefValueBuilder::ComputeSlotForNextArgument( break; } - UNREACHABLE(); + FATAL("We should never get here - unexpected deopt info."); return SlotRef(); } @@ -3129,9 +3126,8 @@ SlotRefValueBuilder::SlotRefValueBuilder(JavaScriptFrame* frame, // the nested slots of captured objects number_of_slots--; SlotRef& slot = slot_refs_.last(); - if (slot.Representation() == SlotRef::DEFERRED_OBJECT) { - number_of_slots += slot.DeferredObjectLength(); - } + ASSERT(slot.Representation() != SlotRef::ARGUMENTS_OBJECT); + number_of_slots += slot.GetChildrenCount(); if (slot.Representation() == SlotRef::DEFERRED_OBJECT || slot.Representation() == SlotRef::DUPLICATE_OBJECT) { should_deopt = true; @@ -3185,7 +3181,7 @@ Handle<Object> SlotRef::GetValue(Isolate* isolate) { return literal_; default: - UNREACHABLE(); + FATAL("We should never get here - unexpected deopt info."); return Handle<Object>::null(); } } @@ -3215,19 +3211,18 @@ Handle<Object> SlotRefValueBuilder::GetPreviouslyMaterialized( previously_materialized_objects_->get(object_index), isolate); materialized_objects_.Add(return_value); - // Now need to skip all nested objects (and possibly read them from - // the materialization store, too) + // Now need to skip all the nested objects (and possibly read them from + // the materialization store, too). for (int i = 0; i < length; i++) { SlotRef& slot = slot_refs_[current_slot_]; current_slot_++; - // For nested deferred objects, we need to read its properties - if (slot.Representation() == SlotRef::DEFERRED_OBJECT) { - length += slot.DeferredObjectLength(); - } + // We need to read all the nested objects - add them to the + // number of objects we need to process. + length += slot.GetChildrenCount(); - // For nested deferred and duplicate objects, we need to put them into - // our materialization array + // Put the nested deferred/duplicate objects into our materialization + // array. if (slot.Representation() == SlotRef::DEFERRED_OBJECT || slot.Representation() == SlotRef::DUPLICATE_OBJECT) { int nested_object_index = materialized_objects_.length(); @@ -3253,8 +3248,20 @@ Handle<Object> SlotRefValueBuilder::GetNext(Isolate* isolate, int lvl) { case SlotRef::LITERAL: { return slot.GetValue(isolate); } + case SlotRef::ARGUMENTS_OBJECT: { + // We should never need to materialize an arguments object, + // but we still need to put something into the array + // so that the indexing is consistent. + materialized_objects_.Add(isolate->factory()->undefined_value()); + int length = slot.GetChildrenCount(); + for (int i = 0; i < length; ++i) { + // We don't need the argument, just ignore it + GetNext(isolate, lvl + 1); + } + return isolate->factory()->undefined_value(); + } case SlotRef::DEFERRED_OBJECT: { - int length = slot.DeferredObjectLength(); + int length = slot.GetChildrenCount(); ASSERT(slot_refs_[current_slot_].Representation() == SlotRef::LITERAL || slot_refs_[current_slot_].Representation() == SlotRef::TAGGED); @@ -3323,7 +3330,7 @@ Handle<Object> SlotRefValueBuilder::GetNext(Isolate* isolate, int lvl) { break; } - UNREACHABLE(); + FATAL("We should never get here - unexpected deopt slot kind."); return Handle<Object>::null(); } |