X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fv8%2Fsrc%2Fdeoptimizer.h;h=a6e610a8e045082b8fb56d779740264353a8a158;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=aace2208673f74b7aeb697932dab5de6792704cf;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/v8/src/deoptimizer.h b/src/v8/src/deoptimizer.h index aace220..a6e610a 100644 --- a/src/v8/src/deoptimizer.h +++ b/src/v8/src/deoptimizer.h @@ -55,6 +55,9 @@ static inline double read_double_value(Address p) { #endif // V8_HOST_CAN_READ_UNALIGNED } +static inline simd128_value_t read_simd128_value(Address p) { + return *reinterpret_cast(p); +} class FrameDescription; class TranslationIterator; @@ -75,6 +78,21 @@ class HeapNumberMaterializationDescriptor BASE_EMBEDDED { }; +template +class SIMD128MaterializationDescriptor BASE_EMBEDDED { + public: + SIMD128MaterializationDescriptor(T destination, simd128_value_t value) + : destination_(destination), value_(value) { } + + T destination() const { return destination_; } + simd128_value_t value() const { return value_; } + + private: + T destination_; + simd128_value_t value_; +}; + + class ObjectMaterializationDescriptor BASE_EMBEDDED { public: ObjectMaterializationDescriptor( @@ -349,7 +367,10 @@ class Deoptimizer : public Malloced { void AddObjectDuplication(intptr_t slot, int object_index); void AddObjectTaggedValue(intptr_t value); void AddObjectDoubleValue(double value); + void AddObjectSIMD128Value(simd128_value_t value, int translation_opcode); void AddDoubleValue(intptr_t slot_address, double value); + void AddSIMD128Value(intptr_t slot_address, simd128_value_t value, + int translation_opcode); bool ArgumentsObjectIsAdapted(int object_index) { ObjectMaterializationDescriptor desc = deferred_objects_.at(object_index); @@ -398,9 +419,9 @@ class Deoptimizer : public Malloced { void SetPlatformCompiledStubRegisters(FrameDescription* output_frame, CodeStubInterfaceDescriptor* desc); - // Fill the given output frame's double registers with the original values - // from the input frame's double registers. - void CopyDoubleRegisters(FrameDescription* output_frame); + // Fill the given output frame's simd128 registers with the original values + // from the input frame's simd128 registers. + void CopySIMD128Registers(FrameDescription* output_frame); // Determines whether the input frame contains alignment padding by looking // at the dynamic alignment state slot inside the frame. @@ -432,8 +453,19 @@ class Deoptimizer : public Malloced { List deferred_objects_tagged_values_; List > deferred_objects_double_values_; + List > + deferred_objects_float32x4_values_; + List > + deferred_objects_int32x4_values_; List deferred_objects_; List > deferred_heap_numbers_; + List > deferred_float32x4s_; + List > deferred_int32x4s_; + + // Key for lookup of previously materialized objects + Address stack_fp_; + Handle previously_materialized_objects_; + int prev_materialized_count_; // Output frame information. Only used during heap object materialization. List > jsframe_functions_; @@ -495,6 +527,11 @@ class FrameDescription { return read_double_value(reinterpret_cast
(ptr)); } + simd128_value_t GetSIMD128FrameSlot(unsigned offset) { + intptr_t* ptr = GetFrameSlotPointer(offset); + return read_simd128_value(reinterpret_cast
(ptr)); + } + void SetFrameSlot(unsigned offset, intptr_t value) { *GetFrameSlotPointer(offset) = value; } @@ -516,9 +553,11 @@ class FrameDescription { return registers_[n]; } - double GetDoubleRegister(unsigned n) const { - ASSERT(n < ARRAY_SIZE(double_registers_)); - return double_registers_[n]; + double GetDoubleRegister(unsigned n) const; + + simd128_value_t GetSIMD128Register(unsigned n) const { + ASSERT(n < ARRAY_SIZE(simd128_registers_)); + return simd128_registers_[n]; } void SetRegister(unsigned n, intptr_t value) { @@ -526,9 +565,11 @@ class FrameDescription { registers_[n] = value; } - void SetDoubleRegister(unsigned n, double value) { - ASSERT(n < ARRAY_SIZE(double_registers_)); - double_registers_[n] = value; + void SetDoubleRegister(unsigned n, double value); + + void SetSIMD128Register(unsigned n, simd128_value_t value) { + ASSERT(n < ARRAY_SIZE(simd128_registers_)); + simd128_registers_[n] = value; } intptr_t GetTop() const { return top_; } @@ -572,8 +613,8 @@ class FrameDescription { return OFFSET_OF(FrameDescription, registers_); } - static int double_registers_offset() { - return OFFSET_OF(FrameDescription, double_registers_); + static int simd128_registers_offset() { + return OFFSET_OF(FrameDescription, simd128_registers_); } static int frame_size_offset() { @@ -605,7 +646,7 @@ class FrameDescription { uintptr_t frame_size_; // Number of bytes. JSFunction* function_; intptr_t registers_[Register::kNumRegisters]; - double double_registers_[DoubleRegister::kMaxNumRegisters]; + simd128_value_t simd128_registers_[SIMD128Register::kMaxNumRegisters]; intptr_t top_; intptr_t pc_; intptr_t fp_; @@ -708,10 +749,14 @@ class TranslationIterator BASE_EMBEDDED { V(INT32_REGISTER) \ V(UINT32_REGISTER) \ V(DOUBLE_REGISTER) \ + V(FLOAT32x4_REGISTER) \ + V(INT32x4_REGISTER) \ V(STACK_SLOT) \ V(INT32_STACK_SLOT) \ V(UINT32_STACK_SLOT) \ V(DOUBLE_STACK_SLOT) \ + V(FLOAT32x4_STACK_SLOT) \ + V(INT32x4_STACK_SLOT) \ V(LITERAL) @@ -750,10 +795,12 @@ class Translation BASE_EMBEDDED { void StoreInt32Register(Register reg); void StoreUint32Register(Register reg); void StoreDoubleRegister(DoubleRegister reg); + void StoreSIMD128Register(SIMD128Register reg, Opcode opcode); void StoreStackSlot(int index); void StoreInt32StackSlot(int index); void StoreUint32StackSlot(int index); void StoreDoubleStackSlot(int index); + void StoreSIMD128StackSlot(int index, Opcode opcode); void StoreLiteral(int literal_id); void StoreArgumentsObject(bool args_known, int args_index, int args_length); @@ -783,7 +830,17 @@ class SlotRef BASE_EMBEDDED { INT32, UINT32, DOUBLE, - LITERAL + FLOAT32x4, + INT32x4, + 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. + ARGUMENTS_OBJECT // Arguments object - only used to keep indexing + // in sync, it should not be materialized. }; SlotRef() @@ -795,52 +852,80 @@ class SlotRef BASE_EMBEDDED { SlotRef(Isolate* isolate, Object* literal) : literal_(literal, isolate), representation_(LITERAL) { } - Handle GetValue(Isolate* isolate) { - switch (representation_) { - case TAGGED: - return Handle(Memory::Object_at(addr_), isolate); - - case INT32: { - int value = Memory::int32_at(addr_); - if (Smi::IsValid(value)) { - return Handle(Smi::FromInt(value), isolate); - } else { - return isolate->factory()->NewNumberFromInt(value); - } - } - - case UINT32: { - uint32_t value = Memory::uint32_at(addr_); - if (value <= static_cast(Smi::kMaxValue)) { - return Handle(Smi::FromInt(static_cast(value)), isolate); - } else { - return isolate->factory()->NewNumber(static_cast(value)); - } - } - - case DOUBLE: { - double value = read_double_value(addr_); - return isolate->factory()->NewNumber(value); - } - - case LITERAL: - return literal_; - - default: - UNREACHABLE(); - return Handle::null(); + static SlotRef NewArgumentsObject(int length) { + SlotRef slot; + slot.representation_ = ARGUMENTS_OBJECT; + slot.deferred_object_length_ = length; + return slot; + } + + 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; + } + + int GetChildrenCount() { + if (representation_ == DEFERRED_OBJECT || + representation_ == ARGUMENTS_OBJECT) { + return deferred_object_length_; + } else { + return 0; } } - static Vector ComputeSlotMappingForArguments( - JavaScriptFrame* frame, - int inlined_frame_index, - int formal_parameter_count); + int DuplicateObjectId() { return duplicate_object_id_; } + + Handle GetValue(Isolate* isolate); private: Address addr_; Handle 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 GetNext(Isolate* isolate, int level); + void Finish(Isolate* isolate); + + int args_length() { return args_length_; } + + private: + List > materialized_objects_; + Handle previously_materialized_objects_; + int prev_materialized_count_; + Address stack_frame_id_; + List 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 GetPreviouslyMaterialized(Isolate* isolate, int length); static Address SlotAddress(JavaScriptFrame* frame, int slot_index) { if (slot_index >= 0) { @@ -852,15 +937,27 @@ class SlotRef BASE_EMBEDDED { } } - static SlotRef ComputeSlotForNextArgument(TranslationIterator* iterator, - DeoptimizationInputData* data, - JavaScriptFrame* frame); + Handle GetDeferredObject(Isolate* isolate); +}; - static void ComputeSlotsForArguments( - Vector* args_slots, - TranslationIterator* iterator, - DeoptimizationInputData* data, - JavaScriptFrame* frame); +class MaterializedObjectStore { + public: + explicit MaterializedObjectStore(Isolate* isolate) : isolate_(isolate) { + } + + Handle Get(Address fp); + void Set(Address fp, Handle materialized_objects); + void Remove(Address fp); + + private: + Isolate* isolate() { return isolate_; } + Handle GetStackEntries(); + Handle EnsureStackEntries(int size); + + int StackIdToIndex(Address fp); + + Isolate* isolate_; + List
frame_fps_; };