Merge V8 at r7668: Initial merge by Git.
Change-Id: I1703c8b4f5c63052451a22cf3fb878abc9a0ec75
diff --git a/src/frames.h b/src/frames.h
index bee95cc..da9009b 100644
--- a/src/frames.h
+++ b/src/frames.h
@@ -158,10 +158,12 @@
Address* pc_address;
};
- // Copy constructor; it breaks the connection to host iterator.
+ // Copy constructor; it breaks the connection to host iterator
+ // (as an iterator usually lives on stack).
StackFrame(const StackFrame& original) {
this->state_ = original.state_;
this->iterator_ = NULL;
+ this->isolate_ = original.isolate_;
}
// Type testers.
@@ -205,8 +207,8 @@
virtual Code* unchecked_code() const = 0;
// Get the code associated with this frame.
- Code* LookupCode(Isolate* isolate) const {
- return GetContainingCode(isolate, pc());
+ Code* LookupCode() const {
+ return GetContainingCode(isolate(), pc());
}
// Get the code object that contains the given pc.
@@ -215,7 +217,8 @@
// Get the code object containing the given pc and fill in the
// safepoint entry and the number of stack slots. The pc must be at
// a safepoint.
- static Code* GetSafepointData(Address pc,
+ static Code* GetSafepointData(Isolate* isolate,
+ Address pc,
SafepointEntry* safepoint_entry,
unsigned* stack_slots);
@@ -230,9 +233,11 @@
int index) const { }
protected:
- explicit StackFrame(StackFrameIterator* iterator) : iterator_(iterator) { }
+ inline explicit StackFrame(StackFrameIterator* iterator);
virtual ~StackFrame() { }
+ Isolate* isolate() const { return isolate_; }
+
// Compute the stack pointer for the calling frame.
virtual Address GetCallerStackPointer() const = 0;
@@ -245,10 +250,11 @@
inline StackHandler* top_handler() const;
// Compute the stack frame type for the given state.
- static Type ComputeType(State* state);
+ static Type ComputeType(Isolate* isolate, State* state);
private:
const StackFrameIterator* iterator_;
+ Isolate* isolate_;
State state_;
// Fill in the state of the calling frame.
@@ -257,6 +263,8 @@
// Get the type and the state of the calling frame.
virtual Type GetCallerState(State* state) const;
+ static const intptr_t kIsolateTag = 1;
+
friend class StackFrameIterator;
friend class StackHandlerIterator;
friend class SafeStackFrameIterator;
@@ -430,7 +438,7 @@
Handle<Object> receiver() { return receiver_; }
Handle<JSFunction> function() { return function_; }
Handle<Code> code() { return code_; }
- Address pc() { return reinterpret_cast<Address>(*code_) + offset_; }
+ Address pc() { return code_->address() + offset_; }
int offset() { return offset_; }
bool is_constructor() { return is_constructor_; }
@@ -455,8 +463,11 @@
inline void set_receiver(Object* value);
// Access the parameters.
- Object* GetParameter(int index) const;
- int ComputeParametersCount() const;
+ inline Address GetParameterSlot(int index) const;
+ inline Object* GetParameter(int index) const;
+ inline int ComputeParametersCount() const {
+ return GetNumberOfIncomingArguments();
+ }
// Check if this frame is a constructor frame invoked through 'new'.
bool IsConstructor() const;
@@ -494,6 +505,8 @@
virtual Address GetCallerStackPointer() const;
+ virtual int GetNumberOfIncomingArguments() const;
+
// Garbage collection support. Iterates over incoming arguments,
// receiver, and any callee-saved registers.
void IterateArguments(ObjectVisitor* v) const;
@@ -554,6 +567,10 @@
explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator)
: JavaScriptFrame(iterator) { }
+ virtual int GetNumberOfIncomingArguments() const {
+ return Smi::cast(GetExpression(0))->value();
+ }
+
virtual Address GetCallerStackPointer() const;
private:
@@ -609,11 +626,15 @@
class StackFrameIterator BASE_EMBEDDED {
public:
- // An iterator that iterates over the current thread's stack.
+ // An iterator that iterates over the current thread's stack,
+ // and uses current isolate.
StackFrameIterator();
+ // An iterator that iterates over the isolate's current thread's stack,
+ explicit StackFrameIterator(Isolate* isolate);
+
// An iterator that iterates over a given thread's stack.
- explicit StackFrameIterator(ThreadLocalTop* thread);
+ StackFrameIterator(Isolate* isolate, ThreadLocalTop* t);
// An iterator that can start from a given FP address.
// If use_top, then work as usual, if fp isn't NULL, use it,
@@ -625,6 +646,8 @@
return frame_;
}
+ Isolate* isolate() const { return isolate_; }
+
bool done() const { return frame_ == NULL; }
void Advance() { (this->*advance_)(); }
@@ -632,6 +655,7 @@
void Reset();
private:
+ Isolate* isolate_;
#define DECLARE_SINGLETON(ignore, type) type type##_;
STACK_FRAME_TYPE_LIST(DECLARE_SINGLETON)
#undef DECLARE_SINGLETON
@@ -667,13 +691,12 @@
public:
JavaScriptFrameIteratorTemp() { if (!done()) Advance(); }
- explicit JavaScriptFrameIteratorTemp(ThreadLocalTop* thread) :
- iterator_(thread) {
- if (!done()) Advance();
- }
+ inline explicit JavaScriptFrameIteratorTemp(Isolate* isolate);
// Skip frames until the frame with the given id is reached.
- explicit JavaScriptFrameIteratorTemp(StackFrame::Id id);
+ explicit JavaScriptFrameIteratorTemp(StackFrame::Id id) { AdvanceToId(id); }
+
+ inline JavaScriptFrameIteratorTemp(Isolate* isolate, StackFrame::Id id);
JavaScriptFrameIteratorTemp(Address fp, Address sp,
Address low_bound, Address high_bound) :
@@ -702,6 +725,8 @@
void Reset();
private:
+ inline void AdvanceToId(StackFrame::Id id);
+
Iterator iterator_;
};
@@ -716,6 +741,7 @@
class StackTraceFrameIterator: public JavaScriptFrameIterator {
public:
StackTraceFrameIterator();
+ explicit StackTraceFrameIterator(Isolate* isolate);
void Advance();
private:
@@ -739,7 +765,7 @@
void Advance();
void Reset();
- static bool is_active() { return active_count_ > 0; }
+ static bool is_active(Isolate* isolate);
static bool IsWithinBounds(
Address low_bound, Address high_bound, Address addr) {
@@ -786,13 +812,13 @@
// heap objects.
class ActiveCountMaintainer BASE_EMBEDDED {
public:
- ActiveCountMaintainer() { active_count_++; }
- ~ActiveCountMaintainer() { active_count_--; }
+ explicit ActiveCountMaintainer(Isolate* isolate);
+ ~ActiveCountMaintainer();
+ private:
+ Isolate* isolate_;
};
ActiveCountMaintainer maintainer_;
- // TODO(isolates): this is dangerous.
- static int active_count_;
StackAddressValidator stack_validator_;
const bool is_valid_top_;
const bool is_valid_fp_;