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

Side by Side Diff: src/deoptimizer.h

Issue 11498006: Revert 13157, 13145 and 13140: Crankshaft code stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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/compiler.cc ('k') | src/deoptimizer.cc » ('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 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 EAGER, 128 EAGER,
129 LAZY, 129 LAZY,
130 OSR, 130 OSR,
131 // This last bailout type is not really a bailout, but used by the 131 // This last bailout type is not really a bailout, but used by the
132 // debugger to deoptimize stack frames to allow inspection. 132 // debugger to deoptimize stack frames to allow inspection.
133 DEBUGGER 133 DEBUGGER
134 }; 134 };
135 135
136 int output_count() const { return output_count_; } 136 int output_count() const { return output_count_; }
137 137
138 Code::Kind compiled_code_kind() const { return compiled_code_->kind(); }
139
140 // Number of created JS frames. Not all created frames are necessarily JS. 138 // Number of created JS frames. Not all created frames are necessarily JS.
141 int jsframe_count() const { return jsframe_count_; } 139 int jsframe_count() const { return jsframe_count_; }
142 140
143 static Deoptimizer* New(JSFunction* function, 141 static Deoptimizer* New(JSFunction* function,
144 BailoutType type, 142 BailoutType type,
145 unsigned bailout_id, 143 unsigned bailout_id,
146 Address from, 144 Address from,
147 int fp_to_sp_delta, 145 int fp_to_sp_delta,
148 Isolate* isolate); 146 Isolate* isolate);
149 static Deoptimizer* Grab(Isolate* isolate); 147 static Deoptimizer* Grab(Isolate* isolate);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 private: 290 private:
293 int count() const { return count_; } 291 int count() const { return count_; }
294 292
295 int count_; 293 int count_;
296 }; 294 };
297 295
298 int ConvertJSFrameIndexToFrameIndex(int jsframe_index); 296 int ConvertJSFrameIndexToFrameIndex(int jsframe_index);
299 297
300 static size_t GetMaxDeoptTableSize(); 298 static size_t GetMaxDeoptTableSize();
301 299
302 static void EnsureCodeForDeoptimizationEntry(BailoutType type,
303 int max_entry_id);
304
305 private: 300 private:
306 static const int kMinNumberOfEntries = 64; 301 static const int kMinNumberOfEntries = 64;
307 static const int kMaxNumberOfEntries = 16384; 302 static const int kMaxNumberOfEntries = 16384;
308 303
309 Deoptimizer(Isolate* isolate, 304 Deoptimizer(Isolate* isolate,
310 JSFunction* function, 305 JSFunction* function,
311 BailoutType type, 306 BailoutType type,
312 unsigned bailout_id, 307 unsigned bailout_id,
313 Address from, 308 Address from,
314 int fp_to_sp_delta, 309 int fp_to_sp_delta,
315 Code* optimized_code); 310 Code* optimized_code);
316 void DeleteFrameDescriptions(); 311 void DeleteFrameDescriptions();
317 312
318 void DoComputeOutputFrames(); 313 void DoComputeOutputFrames();
319 void DoComputeOsrOutputFrame(); 314 void DoComputeOsrOutputFrame();
320 void DoComputeJSFrame(TranslationIterator* iterator, int frame_index); 315 void DoComputeJSFrame(TranslationIterator* iterator, int frame_index);
321 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, 316 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
322 int frame_index); 317 int frame_index);
323 void DoComputeConstructStubFrame(TranslationIterator* iterator, 318 void DoComputeConstructStubFrame(TranslationIterator* iterator,
324 int frame_index); 319 int frame_index);
325 void DoComputeAccessorStubFrame(TranslationIterator* iterator, 320 void DoComputeAccessorStubFrame(TranslationIterator* iterator,
326 int frame_index, 321 int frame_index,
327 bool is_setter_stub_frame); 322 bool is_setter_stub_frame);
328 void DoCompiledStubFrame(TranslationIterator* iterator,
329 int frame_index);
330 void DoTranslateCommand(TranslationIterator* iterator, 323 void DoTranslateCommand(TranslationIterator* iterator,
331 int frame_index, 324 int frame_index,
332 unsigned output_offset); 325 unsigned output_offset);
333 // Translate a command for OSR. Updates the input offset to be used for 326 // Translate a command for OSR. Updates the input offset to be used for
334 // the next command. Returns false if translation of the command failed 327 // the next command. Returns false if translation of the command failed
335 // (e.g., a number conversion failed) and may or may not have updated the 328 // (e.g., a number conversion failed) and may or may not have updated the
336 // input offset. 329 // input offset.
337 bool DoOsrTranslateCommand(TranslationIterator* iterator, 330 bool DoOsrTranslateCommand(TranslationIterator* iterator,
338 int* input_offset); 331 int* input_offset);
339 332
340 unsigned ComputeInputFrameSize() const; 333 unsigned ComputeInputFrameSize() const;
341 unsigned ComputeFixedSize(JSFunction* function) const; 334 unsigned ComputeFixedSize(JSFunction* function) const;
342 335
343 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; 336 unsigned ComputeIncomingArgumentSize(JSFunction* function) const;
344 unsigned ComputeOutgoingArgumentSize() const; 337 unsigned ComputeOutgoingArgumentSize() const;
345 338
346 Object* ComputeLiteral(int index) const; 339 Object* ComputeLiteral(int index) const;
347 340
348 void AddArgumentsObject(intptr_t slot_address, int argc); 341 void AddArgumentsObject(intptr_t slot_address, int argc);
349 void AddArgumentsObjectValue(intptr_t value); 342 void AddArgumentsObjectValue(intptr_t value);
350 void AddDoubleValue(intptr_t slot_address, double value); 343 void AddDoubleValue(intptr_t slot_address, double value);
351 344
345 static void EnsureCodeForDeoptimizationEntry(BailoutType type,
346 int max_entry_id);
352 static void GenerateDeoptimizationEntries( 347 static void GenerateDeoptimizationEntries(
353 MacroAssembler* masm, int count, BailoutType type); 348 MacroAssembler* masm, int count, BailoutType type);
354 349
355 // Weak handle callback for deoptimizing code objects. 350 // Weak handle callback for deoptimizing code objects.
356 static void HandleWeakDeoptimizedCode( 351 static void HandleWeakDeoptimizedCode(
357 v8::Persistent<v8::Value> obj, void* data); 352 v8::Persistent<v8::Value> obj, void* data);
358 static Code* FindDeoptimizingCodeFromAddress(Address addr); 353 static Code* FindDeoptimizingCodeFromAddress(Address addr);
359 static void RemoveDeoptimizingCode(Code* code); 354 static void RemoveDeoptimizingCode(Code* code);
360 355
361 // Fill the input from from a JavaScript frame. This is used when 356 // Fill the input from from a JavaScript frame. This is used when
362 // the debugger needs to inspect an optimized frame. For normal 357 // the debugger needs to inspect an optimized frame. For normal
363 // deoptimizations the input frame is filled in generated code. 358 // deoptimizations the input frame is filled in generated code.
364 void FillInputFrame(Address tos, JavaScriptFrame* frame); 359 void FillInputFrame(Address tos, JavaScriptFrame* frame);
365 360
366 Isolate* isolate_; 361 Isolate* isolate_;
367 JSFunction* function_; 362 JSFunction* function_;
368 Code* compiled_code_; 363 Code* optimized_code_;
369 unsigned bailout_id_; 364 unsigned bailout_id_;
370 BailoutType bailout_type_; 365 BailoutType bailout_type_;
371 Address from_; 366 Address from_;
372 int fp_to_sp_delta_; 367 int fp_to_sp_delta_;
373 int has_alignment_padding_; 368 int has_alignment_padding_;
374 369
375 // Input frame description. 370 // Input frame description.
376 FrameDescription* input_; 371 FrameDescription* input_;
377 // Number of output frames. 372 // Number of output frames.
378 int output_count_; 373 int output_count_;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 523
529 private: 524 private:
530 static const uint32_t kZapUint32 = 0xbeeddead; 525 static const uint32_t kZapUint32 = 0xbeeddead;
531 526
532 // Frame_size_ must hold a uint32_t value. It is only a uintptr_t to 527 // Frame_size_ must hold a uint32_t value. It is only a uintptr_t to
533 // keep the variable-size array frame_content_ of type intptr_t at 528 // keep the variable-size array frame_content_ of type intptr_t at
534 // the end of the structure aligned. 529 // the end of the structure aligned.
535 uintptr_t frame_size_; // Number of bytes. 530 uintptr_t frame_size_; // Number of bytes.
536 JSFunction* function_; 531 JSFunction* function_;
537 intptr_t registers_[Register::kNumRegisters]; 532 intptr_t registers_[Register::kNumRegisters];
538 double double_registers_[DoubleRegister::kMaxNumAllocatableRegisters]; 533 double double_registers_[DoubleRegister::kNumAllocatableRegisters];
539 intptr_t top_; 534 intptr_t top_;
540 intptr_t pc_; 535 intptr_t pc_;
541 intptr_t fp_; 536 intptr_t fp_;
542 intptr_t context_; 537 intptr_t context_;
543 StackFrame::Type type_; 538 StackFrame::Type type_;
544 Smi* state_; 539 Smi* state_;
545 540
546 // Continuation is the PC where the execution continues after 541 // Continuation is the PC where the execution continues after
547 // deoptimizing. 542 // deoptimizing.
548 intptr_t continuation_; 543 intptr_t continuation_;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 593
599 class Translation BASE_EMBEDDED { 594 class Translation BASE_EMBEDDED {
600 public: 595 public:
601 enum Opcode { 596 enum Opcode {
602 BEGIN, 597 BEGIN,
603 JS_FRAME, 598 JS_FRAME,
604 CONSTRUCT_STUB_FRAME, 599 CONSTRUCT_STUB_FRAME,
605 GETTER_STUB_FRAME, 600 GETTER_STUB_FRAME,
606 SETTER_STUB_FRAME, 601 SETTER_STUB_FRAME,
607 ARGUMENTS_ADAPTOR_FRAME, 602 ARGUMENTS_ADAPTOR_FRAME,
608 COMPILED_STUB_FRAME,
609 REGISTER, 603 REGISTER,
610 INT32_REGISTER, 604 INT32_REGISTER,
611 UINT32_REGISTER, 605 UINT32_REGISTER,
612 DOUBLE_REGISTER, 606 DOUBLE_REGISTER,
613 STACK_SLOT, 607 STACK_SLOT,
614 INT32_STACK_SLOT, 608 INT32_STACK_SLOT,
615 UINT32_STACK_SLOT, 609 UINT32_STACK_SLOT,
616 DOUBLE_STACK_SLOT, 610 DOUBLE_STACK_SLOT,
617 LITERAL, 611 LITERAL,
618 ARGUMENTS_OBJECT, 612 ARGUMENTS_OBJECT,
(...skipping 10 matching lines...) Expand all
629 zone_(zone) { 623 zone_(zone) {
630 buffer_->Add(BEGIN, zone); 624 buffer_->Add(BEGIN, zone);
631 buffer_->Add(frame_count, zone); 625 buffer_->Add(frame_count, zone);
632 buffer_->Add(jsframe_count, zone); 626 buffer_->Add(jsframe_count, zone);
633 } 627 }
634 628
635 int index() const { return index_; } 629 int index() const { return index_; }
636 630
637 // Commands. 631 // Commands.
638 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); 632 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height);
639 void BeginCompiledStubFrame();
640 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); 633 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height);
641 void BeginConstructStubFrame(int literal_id, unsigned height); 634 void BeginConstructStubFrame(int literal_id, unsigned height);
642 void BeginGetterStubFrame(int literal_id); 635 void BeginGetterStubFrame(int literal_id);
643 void BeginSetterStubFrame(int literal_id); 636 void BeginSetterStubFrame(int literal_id);
644 void StoreRegister(Register reg); 637 void StoreRegister(Register reg);
645 void StoreInt32Register(Register reg); 638 void StoreInt32Register(Register reg);
646 void StoreUint32Register(Register reg); 639 void StoreUint32Register(Register reg);
647 void StoreDoubleRegister(DoubleRegister reg); 640 void StoreDoubleRegister(DoubleRegister reg);
648 void StoreStackSlot(int index); 641 void StoreStackSlot(int index);
649 void StoreInt32StackSlot(int index); 642 void StoreInt32StackSlot(int index);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 Object** expression_stack_; 846 Object** expression_stack_;
854 int source_position_; 847 int source_position_;
855 848
856 friend class Deoptimizer; 849 friend class Deoptimizer;
857 }; 850 };
858 #endif 851 #endif
859 852
860 } } // namespace v8::internal 853 } } // namespace v8::internal
861 854
862 #endif // V8_DEOPTIMIZER_H_ 855 #endif // V8_DEOPTIMIZER_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698