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

Side by Side Diff: src/frames-inl.h

Issue 7223: Introduce a special kind of frames for construct frames, e.g.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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 | « src/frames.cc ('k') | src/macro-assembler-arm.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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return fp + StandardFrameConstants::kCallerPCOffset; 138 return fp + StandardFrameConstants::kCallerPCOffset;
139 } 139 }
140 140
141 141
142 inline bool StandardFrame::IsArgumentsAdaptorFrame(Address fp) { 142 inline bool StandardFrame::IsArgumentsAdaptorFrame(Address fp) {
143 int context = Memory::int_at(fp + StandardFrameConstants::kContextOffset); 143 int context = Memory::int_at(fp + StandardFrameConstants::kContextOffset);
144 return context == ArgumentsAdaptorFrame::SENTINEL; 144 return context == ArgumentsAdaptorFrame::SENTINEL;
145 } 145 }
146 146
147 147
148 inline bool StandardFrame::IsConstructTrampolineFrame(Address pc) { 148 inline bool StandardFrame::IsConstructFrame(Address fp) {
149 return Builtins::builtin(Builtins::JSConstructCall)->contains(pc); 149 Object* marker =
150 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset);
151 return marker == Smi::FromInt(CONSTRUCT);
150 } 152 }
151 153
152 154
153 inline Object* JavaScriptFrame::receiver() const { 155 inline Object* JavaScriptFrame::receiver() const {
154 const int offset = JavaScriptFrameConstants::kReceiverOffset; 156 const int offset = JavaScriptFrameConstants::kReceiverOffset;
155 return Memory::Object_at(pp() + offset); 157 return Memory::Object_at(pp() + offset);
156 } 158 }
157 159
158 160
159 inline void JavaScriptFrame::set_receiver(Object* value) { 161 inline void JavaScriptFrame::set_receiver(Object* value) {
160 const int offset = JavaScriptFrameConstants::kReceiverOffset; 162 const int offset = JavaScriptFrameConstants::kReceiverOffset;
161 Memory::Object_at(pp() + offset) = value; 163 Memory::Object_at(pp() + offset) = value;
162 } 164 }
163 165
164 166
165 inline bool JavaScriptFrame::has_adapted_arguments() const { 167 inline bool JavaScriptFrame::has_adapted_arguments() const {
166 return IsArgumentsAdaptorFrame(caller_fp()); 168 return IsArgumentsAdaptorFrame(caller_fp());
167 } 169 }
168 170
169 171
170 inline bool InternalFrame::is_construct_trampoline() const {
171 // TODO(1233795): This doesn't work when the stack frames have been
172 // cooked. We need to find another way of identifying construct
173 // trampoline frames possibly by manipulating the context field like
174 // we do for argument adaptor frames.
175 return IsConstructTrampolineFrame(pc());
176 }
177
178
179 inline JavaScriptFrame* JavaScriptFrameIterator::frame() const { 172 inline JavaScriptFrame* JavaScriptFrameIterator::frame() const {
180 // TODO(1233797): The frame hierarchy needs to change. It's 173 // TODO(1233797): The frame hierarchy needs to change. It's
181 // problematic that we can't use the safe-cast operator to cast to 174 // problematic that we can't use the safe-cast operator to cast to
182 // the JavaScript frame type, because we may encounter arguments 175 // the JavaScript frame type, because we may encounter arguments
183 // adaptor frames. 176 // adaptor frames.
184 StackFrame* frame = iterator_.frame(); 177 StackFrame* frame = iterator_.frame();
185 ASSERT(frame->is_java_script() || frame->is_arguments_adaptor()); 178 ASSERT(frame->is_java_script() || frame->is_arguments_adaptor());
186 return static_cast<JavaScriptFrame*>(frame); 179 return static_cast<JavaScriptFrame*>(frame);
187 } 180 }
188 181
189 182
190 } } // namespace v8::internal 183 } } // namespace v8::internal
191 184
192 #endif // V8_FRAMES_INL_H_ 185 #endif // V8_FRAMES_INL_H_
OLDNEW
« no previous file with comments | « src/frames.cc ('k') | src/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698