Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: src/arm/frames-arm.cc

Issue 3226014: Add functionality for finding code objects from a pc that points into... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/frames.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 19 matching lines...) Expand all
30 #if defined(V8_TARGET_ARCH_ARM) 30 #if defined(V8_TARGET_ARCH_ARM)
31 31
32 #include "frames-inl.h" 32 #include "frames-inl.h"
33 #include "arm/assembler-arm-inl.h" 33 #include "arm/assembler-arm-inl.h"
34 34
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 39
40 StackFrame::Type StackFrame::ComputeType(State* state) {
41 ASSERT(state->fp != NULL);
42 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) {
43 return ARGUMENTS_ADAPTOR;
44 }
45 // The marker and function offsets overlap. If the marker isn't a
46 // smi then the frame is a JavaScript frame -- and the marker is
47 // really the function.
48 const int offset = StandardFrameConstants::kMarkerOffset;
49 Object* marker = Memory::Object_at(state->fp + offset);
50 if (!marker->IsSmi()) return JAVA_SCRIPT;
51 return static_cast<StackFrame::Type>(Smi::cast(marker)->value());
52 }
53
54
55 StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) { 40 StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) {
56 if (fp == 0) return NONE; 41 if (fp == 0) return NONE;
57 // Compute frame type and stack pointer. 42 // Compute frame type and stack pointer.
58 Address sp = fp + ExitFrameConstants::kSPOffset; 43 Address sp = fp + ExitFrameConstants::kSPOffset;
59 44
60 // Fill in the state. 45 // Fill in the state.
61 state->sp = sp; 46 state->sp = sp;
62 state->fp = fp; 47 state->fp = fp;
63 state->pc_address = reinterpret_cast<Address*>(sp - 1 * kPointerSize); 48 state->pc_address = reinterpret_cast<Address*>(sp - 1 * kPointerSize);
64 ASSERT(*state->pc_address != NULL); 49 ASSERT(*state->pc_address != NULL);
65 return EXIT; 50 return EXIT;
66 } 51 }
67 52
68 53
69 void ExitFrame::Iterate(ObjectVisitor* v) const {
70 v->VisitPointer(&code_slot());
71 // The arguments are traversed as part of the expression stack of
72 // the calling frame.
73 }
74
75
76 int JavaScriptFrame::GetProvidedParametersCount() const {
77 return ComputeParametersCount();
78 }
79
80
81 Address JavaScriptFrame::GetCallerStackPointer() const {
82 int arguments;
83 if (Heap::gc_state() != Heap::NOT_IN_GC || disable_heap_access_) {
84 // The arguments for cooked frames are traversed as if they were
85 // expression stack elements of the calling frame. The reason for
86 // this rather strange decision is that we cannot access the
87 // function during mark-compact GCs when the stack is cooked.
88 // In fact accessing heap objects (like function->shared() below)
89 // at all during GC is problematic.
90 arguments = 0;
91 } else {
92 // Compute the number of arguments by getting the number of formal
93 // parameters of the function. We must remember to take the
94 // receiver into account (+1).
95 JSFunction* function = JSFunction::cast(this->function());
96 arguments = function->shared()->formal_parameter_count() + 1;
97 }
98 const int offset = StandardFrameConstants::kCallerSPOffset;
99 return fp() + offset + (arguments * kPointerSize);
100 }
101
102
103 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const {
104 const int arguments = Smi::cast(GetExpression(0))->value();
105 const int offset = StandardFrameConstants::kCallerSPOffset;
106 return fp() + offset + (arguments + 1) * kPointerSize;
107 }
108
109
110 Address InternalFrame::GetCallerStackPointer() const {
111 // Internal frames have no arguments. The stack pointer of the
112 // caller is at a fixed offset from the frame pointer.
113 return fp() + StandardFrameConstants::kCallerSPOffset;
114 }
115
116
117 } } // namespace v8::internal 54 } } // namespace v8::internal
118 55
119 #endif // V8_TARGET_ARCH_ARM 56 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698