Index: src/deoptimizer.h |
diff --git a/src/deoptimizer.h b/src/deoptimizer.h |
index 64e0cdf2e83f822e3e124ff4d3bea71f8b67383f..da9c2db1ca56b921ec8d6a1e2d8b0bb51b3ba49c 100644 |
--- a/src/deoptimizer.h |
+++ b/src/deoptimizer.h |
@@ -552,6 +552,78 @@ class DeoptimizingCodeListNode : public Malloced { |
}; |
+class SlotRef BASE_EMBEDDED { |
+ public: |
+ enum SlotRepresentation { |
+ UNKNOWN, |
+ TAGGED, |
+ INT32, |
+ DOUBLE, |
+ LITERAL |
+ }; |
+ |
+ SlotRef() |
+ : addr_(NULL), representation_(UNKNOWN) { } |
+ |
+ SlotRef(Address addr, SlotRepresentation representation) |
+ : addr_(addr), representation_(representation) { } |
+ |
+ explicit SlotRef(Object* literal) |
+ : literal_(literal), representation_(LITERAL) { } |
+ |
+ Handle<Object> GetValue() { |
+ switch (representation_) { |
+ case TAGGED: |
+ return Handle<Object>(Memory::Object_at(addr_)); |
+ |
+ case INT32: { |
+ int value = Memory::int32_at(addr_); |
+ if (Smi::IsValid(value)) { |
+ return Handle<Object>(Smi::FromInt(value)); |
+ } else { |
+ return Isolate::Current()->factory()->NewNumberFromInt(value); |
+ } |
+ } |
+ |
+ case DOUBLE: { |
+ double value = Memory::double_at(addr_); |
+ return Isolate::Current()->factory()->NewNumber(value); |
+ } |
+ |
+ case LITERAL: |
+ return literal_; |
+ |
+ default: |
+ UNREACHABLE(); |
+ return Handle<Object>::null(); |
+ } |
+ } |
+ |
+ static void ComputeSlotMappingForArguments(JavaScriptFrame* frame, |
+ int inlined_frame_index, |
+ Vector<SlotRef>* args_slots); |
+ |
+ private: |
+ Address addr_; |
+ Handle<Object> literal_; |
+ SlotRepresentation representation_; |
+ |
+ static Address SlotAddress(JavaScriptFrame* frame, int slot_index) { |
+ if (slot_index >= 0) { |
+ const int offset = JavaScriptFrameConstants::kLocal0Offset; |
+ return frame->fp() + offset - (slot_index * kPointerSize); |
+ } else { |
+ const int offset = JavaScriptFrameConstants::kSavedRegistersOffset; |
Kevin Millikin (Chromium)
2011/04/01 08:53:16
kSavedRegistersOffset is an archaic name. Maybe i
|
+ return frame->fp() + offset - ((slot_index + 1) * kPointerSize); |
+ } |
+ } |
+ |
+ static SlotRef ComputeSlotForNextArgument(TranslationIterator* iterator, |
+ DeoptimizationInputData* data, |
+ JavaScriptFrame* frame); |
+}; |
+ |
+ |
} } // namespace v8::internal |
#endif // V8_DEOPTIMIZER_H_ |