Chromium Code Reviews| Index: src/deoptimizer.h |
| diff --git a/src/deoptimizer.h b/src/deoptimizer.h |
| index aace2208673f74b7aeb697932dab5de6792704cf..a1bed4135301414f6a48c76e3bba5ec8964b0b48 100644 |
| --- a/src/deoptimizer.h |
| +++ b/src/deoptimizer.h |
| @@ -435,6 +435,11 @@ class Deoptimizer : public Malloced { |
| List<ObjectMaterializationDescriptor> deferred_objects_; |
| List<HeapNumberMaterializationDescriptor<Address> > deferred_heap_numbers_; |
| + // Key for lookup of previously materialized objects |
| + Address stack_fp_; |
| + Handle<FixedArray> previously_materialized_objects_; |
| + int prev_materialized_count_; |
| + |
| // Output frame information. Only used during heap object materialization. |
| List<Handle<JSFunction> > jsframe_functions_; |
| List<bool> jsframe_has_adapted_arguments_; |
| @@ -783,7 +788,9 @@ class SlotRef BASE_EMBEDDED { |
| INT32, |
| UINT32, |
| DOUBLE, |
| - LITERAL |
| + LITERAL, |
| + DEFERRED_OBJECT, |
|
danno
2014/01/28 15:44:34
Perhaps a short comment for these is warranted?
Jarin
2014/01/28 19:52:30
Done.
|
| + DUPLICATE_OBJECT |
| }; |
| SlotRef() |
| @@ -795,52 +802,66 @@ class SlotRef BASE_EMBEDDED { |
| SlotRef(Isolate* isolate, Object* literal) |
| : literal_(literal, isolate), representation_(LITERAL) { } |
| - Handle<Object> GetValue(Isolate* isolate) { |
| - switch (representation_) { |
| - case TAGGED: |
| - return Handle<Object>(Memory::Object_at(addr_), isolate); |
| - |
| - case INT32: { |
| - int value = Memory::int32_at(addr_); |
| - if (Smi::IsValid(value)) { |
| - return Handle<Object>(Smi::FromInt(value), isolate); |
| - } else { |
| - return isolate->factory()->NewNumberFromInt(value); |
| - } |
| - } |
| - |
| - case UINT32: { |
| - uint32_t value = Memory::uint32_at(addr_); |
| - if (value <= static_cast<uint32_t>(Smi::kMaxValue)) { |
| - return Handle<Object>(Smi::FromInt(static_cast<int>(value)), isolate); |
| - } else { |
| - return isolate->factory()->NewNumber(static_cast<double>(value)); |
| - } |
| - } |
| - |
| - case DOUBLE: { |
| - double value = read_double_value(addr_); |
| - return isolate->factory()->NewNumber(value); |
| - } |
| - |
| - case LITERAL: |
| - return literal_; |
| - |
| - default: |
| - UNREACHABLE(); |
| - return Handle<Object>::null(); |
| - } |
| + static SlotRef NewDeferredObject(int length) { |
| + SlotRef slot; |
| + slot.representation_ = DEFERRED_OBJECT; |
| + slot.deferred_object_length_ = length; |
| + return slot; |
| } |
| - static Vector<SlotRef> ComputeSlotMappingForArguments( |
| - JavaScriptFrame* frame, |
| - int inlined_frame_index, |
| - int formal_parameter_count); |
| + SlotRepresentation Representation() { return representation_; } |
| + |
| + static SlotRef NewDuplicateObject(int id) { |
| + SlotRef slot; |
| + slot.representation_ = DUPLICATE_OBJECT; |
| + slot.duplicate_object_id_ = id; |
| + return slot; |
| + } |
| + |
| + int DeferredObjectLength() { return deferred_object_length_; } |
| + |
| + int DuplicateObjectId() { return duplicate_object_id_; } |
| + |
| + Handle<Object> GetValue(Isolate* isolate); |
| private: |
| Address addr_; |
| Handle<Object> literal_; |
| SlotRepresentation representation_; |
| + int deferred_object_length_; |
| + int duplicate_object_id_; |
| +}; |
| + |
| +class SlotRefValueBuilder BASE_EMBEDDED { |
| + public: |
| + SlotRefValueBuilder( |
| + JavaScriptFrame* frame, |
| + int inlined_frame_index, |
| + int formal_parameter_count); |
| + |
| + void Prepare(Isolate* isolate); |
| + Handle<Object> GetNext(Isolate* isolate, int level); |
| + void Finish(Isolate* isolate); |
| + |
| + int args_length() { return args_length_; } |
| + |
| + private: |
| + List<Handle<Object> > materialized_objects_; |
| + Handle<FixedArray> previously_materialized_objects_; |
| + int prev_materialized_count_; |
| + Address stack_frame_id_; |
| + List<SlotRef> slot_refs_; |
| + int current_slot_; |
| + int args_length_; |
| + int first_slot_index_; |
| + |
| + static SlotRef ComputeSlotForNextArgument( |
| + Translation::Opcode opcode, |
| + TranslationIterator* iterator, |
| + DeoptimizationInputData* data, |
| + JavaScriptFrame* frame); |
| + |
| + Handle<Object> GetPreviouslyMaterialized(Isolate* isolate, int length); |
| static Address SlotAddress(JavaScriptFrame* frame, int slot_index) { |
| if (slot_index >= 0) { |
| @@ -852,15 +873,27 @@ class SlotRef BASE_EMBEDDED { |
| } |
| } |
| - static SlotRef ComputeSlotForNextArgument(TranslationIterator* iterator, |
| - DeoptimizationInputData* data, |
| - JavaScriptFrame* frame); |
| + Handle<Object> GetDeferredObject(Isolate* isolate); |
| +}; |
| - static void ComputeSlotsForArguments( |
| - Vector<SlotRef>* args_slots, |
| - TranslationIterator* iterator, |
| - DeoptimizationInputData* data, |
| - JavaScriptFrame* frame); |
| +class MaterializedObjectStore { |
| + public: |
| + explicit MaterializedObjectStore(Isolate* isolate) : isolate_(isolate) { |
| + } |
| + |
| + Handle<FixedArray> Get(Address fp); |
| + void Set(Address fp, Handle<FixedArray> materialized_objects); |
| + void Remove(Address fp); |
| + |
| + private: |
| + Isolate* isolate() { return isolate_; } |
| + Handle<FixedArray> GetStackEntries(); |
| + Handle<FixedArray> EnsureStackEntries(int size); |
| + |
| + int StackIdToIndex(Address fp); |
| + |
| + Isolate* isolate_; |
| + List<Address> frame_fps_; |
| }; |