summaryrefslogtreecommitdiff
path: root/deps/v8/src/frames.cc
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2013-03-18 13:49:34 -0700
committerBen Noordhuis <info@bnoordhuis.nl>2013-03-20 01:11:01 +0100
commit83261e789eb903da39f279cb5a161611482e7df5 (patch)
tree4133b5ca9f53bed4365e1a94544a227d68a0cf12 /deps/v8/src/frames.cc
parenta05f973f82d2be8527aad4c371d40d3c7e4c564e (diff)
downloadnode-new-83261e789eb903da39f279cb5a161611482e7df5.tar.gz
deps: update v8 to 3.17.13
Diffstat (limited to 'deps/v8/src/frames.cc')
-rw-r--r--deps/v8/src/frames.cc125
1 files changed, 91 insertions, 34 deletions
diff --git a/deps/v8/src/frames.cc b/deps/v8/src/frames.cc
index 18dc54164a..ed407e796b 100644
--- a/deps/v8/src/frames.cc
+++ b/deps/v8/src/frames.cc
@@ -88,14 +88,6 @@ class StackHandlerIterator BASE_EMBEDDED {
#define INITIALIZE_SINGLETON(type, field) field##_(this),
-StackFrameIterator::StackFrameIterator()
- : isolate_(Isolate::Current()),
- STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
- frame_(NULL), handler_(NULL),
- thread_(isolate_->thread_local_top()),
- fp_(NULL), sp_(NULL), advance_(&StackFrameIterator::AdvanceWithHandler) {
- Reset();
-}
StackFrameIterator::StackFrameIterator(Isolate* isolate)
: isolate_(isolate),
STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
@@ -210,11 +202,6 @@ StackFrame* StackFrameIterator::SingletonFor(StackFrame::Type type) {
// -------------------------------------------------------------------------
-StackTraceFrameIterator::StackTraceFrameIterator() {
- if (!done() && !IsValidFrame()) Advance();
-}
-
-
StackTraceFrameIterator::StackTraceFrameIterator(Isolate* isolate)
: JavaScriptFrameIterator(isolate) {
if (!done() && !IsValidFrame()) Advance();
@@ -484,7 +471,7 @@ Address StackFrame::UnpaddedFP() const {
Code* EntryFrame::unchecked_code() const {
- return HEAP->raw_unchecked_js_entry_code();
+ return HEAP->js_entry_code();
}
@@ -507,7 +494,7 @@ StackFrame::Type EntryFrame::GetCallerState(State* state) const {
Code* EntryConstructFrame::unchecked_code() const {
- return HEAP->raw_unchecked_js_construct_entry_code();
+ return HEAP->js_construct_entry_code();
}
@@ -617,13 +604,7 @@ bool StandardFrame::IsExpressionInsideHandler(int n) const {
}
-void OptimizedFrame::Iterate(ObjectVisitor* v) const {
-#ifdef DEBUG
- // Make sure that optimized frames do not contain any stack handlers.
- StackHandlerIterator it(this, top_handler());
- ASSERT(it.done());
-#endif
-
+void StandardFrame::IterateCompiledFrame(ObjectVisitor* v) const {
// Make sure that we're not doing "safe" stack frame iteration. We cannot
// possibly find pointers in optimized frames in that state.
ASSERT(!SafeStackFrameIterator::is_active(isolate()));
@@ -649,7 +630,9 @@ void OptimizedFrame::Iterate(ObjectVisitor* v) const {
// Skip saved double registers.
if (safepoint_entry.has_doubles()) {
- parameters_base += DoubleRegister::kNumAllocatableRegisters *
+ // Number of doubles not known at snapshot time.
+ ASSERT(!Serializer::enabled());
+ parameters_base += DoubleRegister::NumAllocatableRegisters() *
kDoubleSize / kPointerSize;
}
@@ -681,14 +664,51 @@ void OptimizedFrame::Iterate(ObjectVisitor* v) const {
}
}
- // Visit the context and the function.
+ // Visit the return address in the callee and incoming arguments.
+ IteratePc(v, pc_address(), code);
+
+ // Visit the context in stub frame and JavaScript frame.
+ // Visit the function in JavaScript frame.
Object** fixed_base = &Memory::Object_at(
- fp() + JavaScriptFrameConstants::kFunctionOffset);
+ fp() + StandardFrameConstants::kMarkerOffset);
Object** fixed_limit = &Memory::Object_at(fp());
v->VisitPointers(fixed_base, fixed_limit);
+}
- // Visit the return address in the callee and incoming arguments.
- IteratePc(v, pc_address(), code);
+
+void StubFrame::Iterate(ObjectVisitor* v) const {
+ IterateCompiledFrame(v);
+}
+
+
+Code* StubFrame::unchecked_code() const {
+ return static_cast<Code*>(isolate()->heap()->FindCodeObject(pc()));
+}
+
+
+Address StubFrame::GetCallerStackPointer() const {
+ return fp() + ExitFrameConstants::kCallerSPDisplacement;
+}
+
+
+int StubFrame::GetNumberOfIncomingArguments() const {
+ return 0;
+}
+
+
+void OptimizedFrame::Iterate(ObjectVisitor* v) const {
+#ifdef DEBUG
+ // Make sure that optimized frames do not contain any stack handlers.
+ StackHandlerIterator it(this, top_handler());
+ ASSERT(it.done());
+#endif
+
+ IterateCompiledFrame(v);
+}
+
+
+void JavaScriptFrame::SetParameterValue(int index, Object* value) const {
+ Memory::Object_at(GetParameterSlot(index)) = value;
}
@@ -751,13 +771,14 @@ void JavaScriptFrame::Summarize(List<FrameSummary>* functions) {
}
-void JavaScriptFrame::PrintTop(FILE* file,
+void JavaScriptFrame::PrintTop(Isolate* isolate,
+ FILE* file,
bool print_args,
bool print_line_number) {
// constructor calls
- HandleScope scope;
+ HandleScope scope(isolate);
AssertNoAllocation no_allocation;
- JavaScriptFrameIterator it;
+ JavaScriptFrameIterator it(isolate);
while (!it.done()) {
if (it.frame()->is_java_script()) {
JavaScriptFrame* frame = it.frame();
@@ -1052,7 +1073,7 @@ void StackFrame::PrintIndex(StringStream* accumulator,
void JavaScriptFrame::Print(StringStream* accumulator,
PrintMode mode,
int index) const {
- HandleScope scope;
+ HandleScope scope(isolate());
Object* receiver = this->receiver();
Object* function = this->function();
@@ -1066,7 +1087,7 @@ void JavaScriptFrame::Print(StringStream* accumulator,
// doesn't contain scope info, scope_info will return 0 for the number of
// parameters, stack local variables, context local variables, stack slots,
// or context slots.
- Handle<ScopeInfo> scope_info(ScopeInfo::Empty());
+ Handle<ScopeInfo> scope_info(ScopeInfo::Empty(isolate()));
if (function->IsJSFunction()) {
Handle<SharedFunctionInfo> shared(JSFunction::cast(function)->shared());
@@ -1271,6 +1292,42 @@ void InternalFrame::Iterate(ObjectVisitor* v) const {
}
+void StubFailureTrampolineFrame::Iterate(ObjectVisitor* v) const {
+ Object** base = &Memory::Object_at(sp());
+ Object** limit = &Memory::Object_at(fp() +
+ kFirstRegisterParameterFrameOffset);
+ v->VisitPointers(base, limit);
+ base = &Memory::Object_at(fp() + StandardFrameConstants::kMarkerOffset);
+ const int offset = StandardFrameConstants::kContextOffset;
+ limit = &Memory::Object_at(fp() + offset) + 1;
+ v->VisitPointers(base, limit);
+ IteratePc(v, pc_address(), LookupCode());
+}
+
+
+Address StubFailureTrampolineFrame::GetCallerStackPointer() const {
+ return fp() + StandardFrameConstants::kCallerSPOffset;
+}
+
+
+Code* StubFailureTrampolineFrame::unchecked_code() const {
+ int i = 0;
+ for (; i <= StubFailureTrampolineStub::kMaxExtraExpressionStackCount; ++i) {
+ Code* trampoline;
+ StubFailureTrampolineStub(i).FindCodeInCache(&trampoline, isolate());
+ ASSERT(trampoline != NULL);
+ Address current_pc = pc();
+ Address code_start = trampoline->instruction_start();
+ Address code_end = code_start + trampoline->instruction_size();
+ if (code_start <= current_pc && current_pc < code_end) {
+ return trampoline;
+ }
+ }
+ UNREACHABLE();
+ return NULL;
+}
+
+
// -------------------------------------------------------------------------
@@ -1432,9 +1489,9 @@ static StackFrame* AllocateFrameCopy(StackFrame* frame, Zone* zone) {
return NULL;
}
-Vector<StackFrame*> CreateStackMap(Zone* zone) {
+Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone) {
ZoneList<StackFrame*> list(10, zone);
- for (StackFrameIterator it; !it.done(); it.Advance()) {
+ for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
list.Add(frame, zone);
}