Index: src/deoptimizer.h |
diff --git a/src/deoptimizer.h b/src/deoptimizer.h |
index 806433c6f3f8d22e72e0bd545439a8b3ecccc6e3..aace2208673f74b7aeb697932dab5de6792704cf 100644 |
--- a/src/deoptimizer.h |
+++ b/src/deoptimizer.h |
@@ -435,11 +435,6 @@ 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_; |
@@ -788,13 +783,7 @@ class SlotRef BASE_EMBEDDED { |
INT32, |
UINT32, |
DOUBLE, |
- LITERAL, |
- DEFERRED_OBJECT, // Object captured by the escape analysis. |
- // The number of nested objects can be obtained |
- // with the DeferredObjectLength() method |
- // (the SlotRefs of the nested objects follow |
- // this SlotRef in the depth-first order.) |
- DUPLICATE_OBJECT // Duplicated object of a deferred object. |
+ LITERAL |
}; |
SlotRef() |
@@ -806,66 +795,52 @@ class SlotRef BASE_EMBEDDED { |
SlotRef(Isolate* isolate, Object* literal) |
: literal_(literal, isolate), representation_(LITERAL) { } |
- static SlotRef NewDeferredObject(int length) { |
- SlotRef slot; |
- slot.representation_ = DEFERRED_OBJECT; |
- slot.deferred_object_length_ = length; |
- return slot; |
- } |
- |
- SlotRepresentation Representation() { return representation_; } |
- |
- static SlotRef NewDuplicateObject(int id) { |
- SlotRef slot; |
- slot.representation_ = DUPLICATE_OBJECT; |
- slot.duplicate_object_id_ = id; |
- return slot; |
+ 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(); |
+ } |
} |
- 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( |
+ static Vector<SlotRef> ComputeSlotMappingForArguments( |
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); |
+ Address addr_; |
+ Handle<Object> literal_; |
+ SlotRepresentation representation_; |
static Address SlotAddress(JavaScriptFrame* frame, int slot_index) { |
if (slot_index >= 0) { |
@@ -877,27 +852,15 @@ class SlotRefValueBuilder BASE_EMBEDDED { |
} |
} |
- Handle<Object> GetDeferredObject(Isolate* isolate); |
-}; |
- |
-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); |
+ static SlotRef ComputeSlotForNextArgument(TranslationIterator* iterator, |
+ DeoptimizationInputData* data, |
+ JavaScriptFrame* frame); |
- Isolate* isolate_; |
- List<Address> frame_fps_; |
+ static void ComputeSlotsForArguments( |
+ Vector<SlotRef>* args_slots, |
+ TranslationIterator* iterator, |
+ DeoptimizationInputData* data, |
+ JavaScriptFrame* frame); |
}; |