| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 NO_ID = 0 | 218 NO_ID = 0 |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 // Used to mark the outermost JS entry frame. | 221 // Used to mark the outermost JS entry frame. |
| 222 enum JsFrameMarker { | 222 enum JsFrameMarker { |
| 223 INNER_JSENTRY_FRAME = 0, | 223 INNER_JSENTRY_FRAME = 0, |
| 224 OUTERMOST_JSENTRY_FRAME = 1 | 224 OUTERMOST_JSENTRY_FRAME = 1 |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 struct State { | 227 struct State { |
| 228 State() : sp(NULL), fp(NULL), pc_address(NULL) { } | 228 State() : sp(NULL), fp(NULL), pc_address(NULL), |
| 229 constant_pool_address(NULL) { } |
| 229 Address sp; | 230 Address sp; |
| 230 Address fp; | 231 Address fp; |
| 231 Address* pc_address; | 232 Address* pc_address; |
| 233 Address* constant_pool_address; |
| 232 }; | 234 }; |
| 233 | 235 |
| 234 // Copy constructor; it breaks the connection to host iterator | 236 // Copy constructor; it breaks the connection to host iterator |
| 235 // (as an iterator usually lives on stack). | 237 // (as an iterator usually lives on stack). |
| 236 StackFrame(const StackFrame& original) { | 238 StackFrame(const StackFrame& original) { |
| 237 this->state_ = original.state_; | 239 this->state_ = original.state_; |
| 238 this->iterator_ = NULL; | 240 this->iterator_ = NULL; |
| 239 this->isolate_ = original.isolate_; | 241 this->isolate_ = original.isolate_; |
| 240 } | 242 } |
| 241 | 243 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 263 Address caller_sp() const { return GetCallerStackPointer(); } | 265 Address caller_sp() const { return GetCallerStackPointer(); } |
| 264 | 266 |
| 265 // If this frame is optimized and was dynamically aligned return its old | 267 // If this frame is optimized and was dynamically aligned return its old |
| 266 // unaligned frame pointer. When the frame is deoptimized its FP will shift | 268 // unaligned frame pointer. When the frame is deoptimized its FP will shift |
| 267 // up one word and become unaligned. | 269 // up one word and become unaligned. |
| 268 Address UnpaddedFP() const; | 270 Address UnpaddedFP() const; |
| 269 | 271 |
| 270 Address pc() const { return *pc_address(); } | 272 Address pc() const { return *pc_address(); } |
| 271 void set_pc(Address pc) { *pc_address() = pc; } | 273 void set_pc(Address pc) { *pc_address() = pc; } |
| 272 | 274 |
| 275 Address constant_pool() const { return *constant_pool_address(); } |
| 276 void set_constant_pool(ConstantPoolArray* constant_pool) { |
| 277 *constant_pool_address() = reinterpret_cast<Address>(constant_pool); |
| 278 } |
| 279 |
| 273 virtual void SetCallerFp(Address caller_fp) = 0; | 280 virtual void SetCallerFp(Address caller_fp) = 0; |
| 274 | 281 |
| 275 // Manually changes value of fp in this object. | 282 // Manually changes value of fp in this object. |
| 276 void UpdateFp(Address fp) { state_.fp = fp; } | 283 void UpdateFp(Address fp) { state_.fp = fp; } |
| 277 | 284 |
| 278 Address* pc_address() const { return state_.pc_address; } | 285 Address* pc_address() const { return state_.pc_address; } |
| 279 | 286 |
| 287 Address* constant_pool_address() const { |
| 288 return state_.constant_pool_address; |
| 289 } |
| 290 |
| 280 // Get the id of this stack frame. | 291 // Get the id of this stack frame. |
| 281 Id id() const { return static_cast<Id>(OffsetFrom(caller_sp())); } | 292 Id id() const { return static_cast<Id>(OffsetFrom(caller_sp())); } |
| 282 | 293 |
| 283 // Checks if this frame includes any stack handlers. | 294 // Checks if this frame includes any stack handlers. |
| 284 bool HasHandler() const; | 295 bool HasHandler() const; |
| 285 | 296 |
| 286 // Get the type of this frame. | 297 // Get the type of this frame. |
| 287 virtual Type type() const = 0; | 298 virtual Type type() const = 0; |
| 288 | 299 |
| 289 // Get the code associated with this frame. | 300 // Get the code associated with this frame. |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 virtual void ComputeCallerState(State* state) const; | 500 virtual void ComputeCallerState(State* state) const; |
| 490 | 501 |
| 491 // Accessors. | 502 // Accessors. |
| 492 inline Address caller_fp() const; | 503 inline Address caller_fp() const; |
| 493 inline Address caller_pc() const; | 504 inline Address caller_pc() const; |
| 494 | 505 |
| 495 // Computes the address of the PC field in the standard frame given | 506 // Computes the address of the PC field in the standard frame given |
| 496 // by the provided frame pointer. | 507 // by the provided frame pointer. |
| 497 static inline Address ComputePCAddress(Address fp); | 508 static inline Address ComputePCAddress(Address fp); |
| 498 | 509 |
| 510 // Computes the address of the constant pool field in the standard |
| 511 // frame given by the provided frame pointer. |
| 512 static inline Address ComputeConstantPoolAddress(Address fp); |
| 513 |
| 499 // Iterate over expression stack including stack handlers, locals, | 514 // Iterate over expression stack including stack handlers, locals, |
| 500 // and parts of the fixed part including context and code fields. | 515 // and parts of the fixed part including context and code fields. |
| 501 void IterateExpressions(ObjectVisitor* v) const; | 516 void IterateExpressions(ObjectVisitor* v) const; |
| 502 | 517 |
| 503 // Returns the address of the n'th expression stack element. | 518 // Returns the address of the n'th expression stack element. |
| 504 Address GetExpressionAddress(int n) const; | 519 Address GetExpressionAddress(int n) const; |
| 505 static Address GetExpressionAddress(Address fp, int n); | 520 static Address GetExpressionAddress(Address fp, int n); |
| 506 | 521 |
| 507 // Determines if the n'th expression stack element is in a stack | 522 // Determines if the n'th expression stack element is in a stack |
| 508 // handler or not. Requires traversing all handlers in this frame. | 523 // handler or not. Requires traversing all handlers in this frame. |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 }; | 960 }; |
| 946 | 961 |
| 947 | 962 |
| 948 // Reads all frames on the current stack and copies them into the current | 963 // Reads all frames on the current stack and copies them into the current |
| 949 // zone memory. | 964 // zone memory. |
| 950 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 965 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 951 | 966 |
| 952 } } // namespace v8::internal | 967 } } // namespace v8::internal |
| 953 | 968 |
| 954 #endif // V8_FRAMES_H_ | 969 #endif // V8_FRAMES_H_ |
| OLD | NEW |