| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 friend class DeoptimizingCodeListNode; | 319 friend class DeoptimizingCodeListNode; |
| 320 }; | 320 }; |
| 321 | 321 |
| 322 | 322 |
| 323 class FrameDescription { | 323 class FrameDescription { |
| 324 public: | 324 public: |
| 325 FrameDescription(uint32_t frame_size, | 325 FrameDescription(uint32_t frame_size, |
| 326 JSFunction* function); | 326 JSFunction* function); |
| 327 | 327 |
| 328 void* operator new(size_t size, uint32_t frame_size) { | 328 void* operator new(size_t size, uint32_t frame_size) { |
| 329 return malloc(size + frame_size); | 329 // Subtracts kPointerSize, as the member frame_content_ already supplies |
| 330 // the first element of the area to store the frame. |
| 331 return malloc(size + frame_size - kPointerSize); |
| 330 } | 332 } |
| 331 | 333 |
| 332 void operator delete(void* description) { | 334 void operator delete(void* description) { |
| 333 free(description); | 335 free(description); |
| 334 } | 336 } |
| 335 | 337 |
| 336 intptr_t GetFrameSize() const { return frame_size_; } | 338 intptr_t GetFrameSize() const { return frame_size_; } |
| 337 | 339 |
| 338 JSFunction* GetFunction() const { return function_; } | 340 JSFunction* GetFunction() const { return function_; } |
| 339 | 341 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 405 |
| 404 static int state_offset() { | 406 static int state_offset() { |
| 405 return OFFSET_OF(FrameDescription, state_); | 407 return OFFSET_OF(FrameDescription, state_); |
| 406 } | 408 } |
| 407 | 409 |
| 408 static int continuation_offset() { | 410 static int continuation_offset() { |
| 409 return OFFSET_OF(FrameDescription, continuation_); | 411 return OFFSET_OF(FrameDescription, continuation_); |
| 410 } | 412 } |
| 411 | 413 |
| 412 static int frame_content_offset() { | 414 static int frame_content_offset() { |
| 413 return sizeof(FrameDescription); | 415 return OFFSET_OF(FrameDescription, frame_content_); |
| 414 } | 416 } |
| 415 | 417 |
| 416 private: | 418 private: |
| 417 static const uint32_t kZapUint32 = 0xbeeddead; | 419 static const uint32_t kZapUint32 = 0xbeeddead; |
| 418 | 420 |
| 419 uintptr_t frame_size_; // Number of bytes. | 421 uintptr_t frame_size_; // Number of bytes. |
| 420 JSFunction* function_; | 422 JSFunction* function_; |
| 421 intptr_t registers_[Register::kNumRegisters]; | 423 intptr_t registers_[Register::kNumRegisters]; |
| 422 double double_registers_[DoubleRegister::kNumAllocatableRegisters]; | 424 double double_registers_[DoubleRegister::kNumAllocatableRegisters]; |
| 423 intptr_t top_; | 425 intptr_t top_; |
| 424 intptr_t pc_; | 426 intptr_t pc_; |
| 425 intptr_t fp_; | 427 intptr_t fp_; |
| 426 Smi* state_; | 428 Smi* state_; |
| 427 | 429 |
| 428 // Continuation is the PC where the execution continues after | 430 // Continuation is the PC where the execution continues after |
| 429 // deoptimizing. | 431 // deoptimizing. |
| 430 intptr_t continuation_; | 432 intptr_t continuation_; |
| 431 | 433 |
| 434 // This must be at the end of the object as the object is allocated larger |
| 435 // than it's definition indicate to extend this array. |
| 436 intptr_t frame_content_[1]; |
| 437 |
| 432 intptr_t* GetFrameSlotPointer(unsigned offset) { | 438 intptr_t* GetFrameSlotPointer(unsigned offset) { |
| 433 ASSERT(offset < frame_size_); | 439 ASSERT(offset < frame_size_); |
| 434 return reinterpret_cast<intptr_t*>( | 440 return reinterpret_cast<intptr_t*>( |
| 435 reinterpret_cast<Address>(this) + frame_content_offset() + offset); | 441 reinterpret_cast<Address>(this) + frame_content_offset() + offset); |
| 436 } | 442 } |
| 437 }; | 443 }; |
| 438 | 444 |
| 439 | 445 |
| 440 class TranslationBuffer BASE_EMBEDDED { | 446 class TranslationBuffer BASE_EMBEDDED { |
| 441 public: | 447 public: |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 Handle<Code> code_; | 548 Handle<Code> code_; |
| 543 | 549 |
| 544 // Next pointer for linked list. | 550 // Next pointer for linked list. |
| 545 DeoptimizingCodeListNode* next_; | 551 DeoptimizingCodeListNode* next_; |
| 546 }; | 552 }; |
| 547 | 553 |
| 548 | 554 |
| 549 } } // namespace v8::internal | 555 } } // namespace v8::internal |
| 550 | 556 |
| 551 #endif // V8_DEOPTIMIZER_H_ | 557 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |