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

Side by Side Diff: src/deoptimizer.h

Issue 16779004: Allow the deoptimizer translation to track de-materialized objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Improved comments slightly. Created 7 years, 6 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/data-flow.h ('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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 Address slot_address() const { return slot_address_; } 69 Address slot_address() const { return slot_address_; }
70 double value() const { return val_; } 70 double value() const { return val_; }
71 71
72 private: 72 private:
73 Address slot_address_; 73 Address slot_address_;
74 double val_; 74 double val_;
75 }; 75 };
76 76
77 77
78 class ArgumentsObjectMaterializationDescriptor BASE_EMBEDDED { 78 class ObjectMaterializationDescriptor BASE_EMBEDDED {
79 public: 79 public:
80 ArgumentsObjectMaterializationDescriptor(Address slot_address, int argc) 80 ObjectMaterializationDescriptor(Address slot_address, int length)
81 : slot_address_(slot_address), arguments_length_(argc) { } 81 : slot_address_(slot_address), object_length_(length) { }
82 82
83 Address slot_address() const { return slot_address_; } 83 Address slot_address() const { return slot_address_; }
84 int arguments_length() const { return arguments_length_; } 84 int object_length() const { return object_length_; }
85 85
86 private: 86 private:
87 Address slot_address_; 87 Address slot_address_;
88 int arguments_length_; 88 int object_length_;
89 }; 89 };
90 90
91 91
92 class OptimizedFunctionVisitor BASE_EMBEDDED { 92 class OptimizedFunctionVisitor BASE_EMBEDDED {
93 public: 93 public:
94 virtual ~OptimizedFunctionVisitor() {} 94 virtual ~OptimizedFunctionVisitor() {}
95 95
96 // Function which is called before iteration of any optimized functions 96 // Function which is called before iteration of any optimized functions
97 // from given native context. 97 // from given native context.
98 virtual void EnterContext(Context* context) = 0; 98 virtual void EnterContext(Context* context) = 0;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, 362 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
363 int frame_index); 363 int frame_index);
364 void DoComputeConstructStubFrame(TranslationIterator* iterator, 364 void DoComputeConstructStubFrame(TranslationIterator* iterator,
365 int frame_index); 365 int frame_index);
366 void DoComputeAccessorStubFrame(TranslationIterator* iterator, 366 void DoComputeAccessorStubFrame(TranslationIterator* iterator,
367 int frame_index, 367 int frame_index,
368 bool is_setter_stub_frame); 368 bool is_setter_stub_frame);
369 void DoComputeCompiledStubFrame(TranslationIterator* iterator, 369 void DoComputeCompiledStubFrame(TranslationIterator* iterator,
370 int frame_index); 370 int frame_index);
371 371
372 void DoTranslateObject(TranslationIterator* iterator,
373 int object_opcode,
374 int field_index);
375
372 enum DeoptimizerTranslatedValueType { 376 enum DeoptimizerTranslatedValueType {
373 TRANSLATED_VALUE_IS_NATIVE, 377 TRANSLATED_VALUE_IS_NATIVE,
374 TRANSLATED_VALUE_IS_TAGGED 378 TRANSLATED_VALUE_IS_TAGGED
375 }; 379 };
376 380
377 void DoTranslateCommand(TranslationIterator* iterator, 381 void DoTranslateCommand(TranslationIterator* iterator,
378 int frame_index, 382 int frame_index,
379 unsigned output_offset, 383 unsigned output_offset,
380 DeoptimizerTranslatedValueType value_type = TRANSLATED_VALUE_IS_TAGGED); 384 DeoptimizerTranslatedValueType value_type = TRANSLATED_VALUE_IS_TAGGED);
381 385
382 // Translate a command for OSR. Updates the input offset to be used for 386 // Translate a command for OSR. Updates the input offset to be used for
383 // the next command. Returns false if translation of the command failed 387 // the next command. Returns false if translation of the command failed
384 // (e.g., a number conversion failed) and may or may not have updated the 388 // (e.g., a number conversion failed) and may or may not have updated the
385 // input offset. 389 // input offset.
386 bool DoOsrTranslateCommand(TranslationIterator* iterator, 390 bool DoOsrTranslateCommand(TranslationIterator* iterator,
387 int* input_offset); 391 int* input_offset);
388 392
389 unsigned ComputeInputFrameSize() const; 393 unsigned ComputeInputFrameSize() const;
390 unsigned ComputeFixedSize(JSFunction* function) const; 394 unsigned ComputeFixedSize(JSFunction* function) const;
391 395
392 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; 396 unsigned ComputeIncomingArgumentSize(JSFunction* function) const;
393 unsigned ComputeOutgoingArgumentSize() const; 397 unsigned ComputeOutgoingArgumentSize() const;
394 398
395 Object* ComputeLiteral(int index) const; 399 Object* ComputeLiteral(int index) const;
396 400
397 void AddArgumentsObject(intptr_t slot_address, int argc); 401 void AddObjectStart(intptr_t slot_address, int argc);
398 void AddArgumentsObjectValue(intptr_t value); 402 void AddObjectTaggedValue(intptr_t value);
403 void AddObjectDoubleValue(double value);
399 void AddDoubleValue(intptr_t slot_address, double value); 404 void AddDoubleValue(intptr_t slot_address, double value);
400 405
401 static void GenerateDeoptimizationEntries( 406 static void GenerateDeoptimizationEntries(
402 MacroAssembler* masm, int count, BailoutType type); 407 MacroAssembler* masm, int count, BailoutType type);
403 408
404 // Weak handle callback for deoptimizing code objects. 409 // Weak handle callback for deoptimizing code objects.
405 static void HandleWeakDeoptimizedCode(v8::Isolate* isolate, 410 static void HandleWeakDeoptimizedCode(v8::Isolate* isolate,
406 v8::Persistent<v8::Value>* obj, 411 v8::Persistent<v8::Value>* obj,
407 void* data); 412 void* data);
408 413
(...skipping 30 matching lines...) Expand all
439 444
440 // Input frame description. 445 // Input frame description.
441 FrameDescription* input_; 446 FrameDescription* input_;
442 // Number of output frames. 447 // Number of output frames.
443 int output_count_; 448 int output_count_;
444 // Number of output js frames. 449 // Number of output js frames.
445 int jsframe_count_; 450 int jsframe_count_;
446 // Array of output frame descriptions. 451 // Array of output frame descriptions.
447 FrameDescription** output_; 452 FrameDescription** output_;
448 453
449 List<Object*> deferred_arguments_objects_values_; 454 List<Object*> deferred_objects_tagged_values_;
450 List<ArgumentsObjectMaterializationDescriptor> deferred_arguments_objects_; 455 List<double> deferred_objects_double_values_;
456 List<ObjectMaterializationDescriptor> deferred_objects_;
451 List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_; 457 List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_;
452 #ifdef DEBUG 458 #ifdef DEBUG
453 DisallowHeapAllocation* disallow_heap_allocation_; 459 DisallowHeapAllocation* disallow_heap_allocation_;
454 #endif // DEBUG 460 #endif // DEBUG
455 461
456 bool trace_; 462 bool trace_;
457 463
458 static const int table_entry_size_; 464 static const int table_entry_size_;
459 465
460 friend class FrameDescription; 466 friend class FrameDescription;
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 class Translation BASE_EMBEDDED { 697 class Translation BASE_EMBEDDED {
692 public: 698 public:
693 enum Opcode { 699 enum Opcode {
694 BEGIN, 700 BEGIN,
695 JS_FRAME, 701 JS_FRAME,
696 CONSTRUCT_STUB_FRAME, 702 CONSTRUCT_STUB_FRAME,
697 GETTER_STUB_FRAME, 703 GETTER_STUB_FRAME,
698 SETTER_STUB_FRAME, 704 SETTER_STUB_FRAME,
699 ARGUMENTS_ADAPTOR_FRAME, 705 ARGUMENTS_ADAPTOR_FRAME,
700 COMPILED_STUB_FRAME, 706 COMPILED_STUB_FRAME,
707 ARGUMENTS_OBJECT,
701 REGISTER, 708 REGISTER,
702 INT32_REGISTER, 709 INT32_REGISTER,
703 UINT32_REGISTER, 710 UINT32_REGISTER,
704 DOUBLE_REGISTER, 711 DOUBLE_REGISTER,
705 STACK_SLOT, 712 STACK_SLOT,
706 INT32_STACK_SLOT, 713 INT32_STACK_SLOT,
707 UINT32_STACK_SLOT, 714 UINT32_STACK_SLOT,
708 DOUBLE_STACK_SLOT, 715 DOUBLE_STACK_SLOT,
709 LITERAL, 716 LITERAL,
710 ARGUMENTS_OBJECT,
711 717
712 // A prefix indicating that the next command is a duplicate of the one 718 // A prefix indicating that the next command is a duplicate of the one
713 // that follows it. 719 // that follows it.
714 DUPLICATE 720 DUPLICATE
715 }; 721 };
716 722
717 Translation(TranslationBuffer* buffer, int frame_count, int jsframe_count, 723 Translation(TranslationBuffer* buffer, int frame_count, int jsframe_count,
718 Zone* zone) 724 Zone* zone)
719 : buffer_(buffer), 725 : buffer_(buffer),
720 index_(buffer->CurrentIndex()), 726 index_(buffer->CurrentIndex()),
721 zone_(zone) { 727 zone_(zone) {
722 buffer_->Add(BEGIN, zone); 728 buffer_->Add(BEGIN, zone);
723 buffer_->Add(frame_count, zone); 729 buffer_->Add(frame_count, zone);
724 buffer_->Add(jsframe_count, zone); 730 buffer_->Add(jsframe_count, zone);
725 } 731 }
726 732
727 int index() const { return index_; } 733 int index() const { return index_; }
728 734
729 // Commands. 735 // Commands.
730 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); 736 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height);
731 void BeginCompiledStubFrame(); 737 void BeginCompiledStubFrame();
732 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); 738 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height);
733 void BeginConstructStubFrame(int literal_id, unsigned height); 739 void BeginConstructStubFrame(int literal_id, unsigned height);
734 void BeginGetterStubFrame(int literal_id); 740 void BeginGetterStubFrame(int literal_id);
735 void BeginSetterStubFrame(int literal_id); 741 void BeginSetterStubFrame(int literal_id);
742 void BeginArgumentsObject(int args_length);
736 void StoreRegister(Register reg); 743 void StoreRegister(Register reg);
737 void StoreInt32Register(Register reg); 744 void StoreInt32Register(Register reg);
738 void StoreUint32Register(Register reg); 745 void StoreUint32Register(Register reg);
739 void StoreDoubleRegister(DoubleRegister reg); 746 void StoreDoubleRegister(DoubleRegister reg);
740 void StoreStackSlot(int index); 747 void StoreStackSlot(int index);
741 void StoreInt32StackSlot(int index); 748 void StoreInt32StackSlot(int index);
742 void StoreUint32StackSlot(int index); 749 void StoreUint32StackSlot(int index);
743 void StoreDoubleStackSlot(int index); 750 void StoreDoubleStackSlot(int index);
744 void StoreLiteral(int literal_id); 751 void StoreLiteral(int literal_id);
745 void StoreArgumentsObject(bool args_known, int args_index, int args_length);
746 void MarkDuplicate(); 752 void MarkDuplicate();
747 753
748 Zone* zone() const { return zone_; } 754 Zone* zone() const { return zone_; }
749 755
750 static int NumberOfOperandsFor(Opcode opcode); 756 static int NumberOfOperandsFor(Opcode opcode);
751 757
752 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 758 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
753 static const char* StringFor(Opcode opcode); 759 static const char* StringFor(Opcode opcode);
754 #endif 760 #endif
755 761
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 Object** expression_stack_; 950 Object** expression_stack_;
945 int source_position_; 951 int source_position_;
946 952
947 friend class Deoptimizer; 953 friend class Deoptimizer;
948 }; 954 };
949 #endif 955 #endif
950 956
951 } } // namespace v8::internal 957 } } // namespace v8::internal
952 958
953 #endif // V8_DEOPTIMIZER_H_ 959 #endif // V8_DEOPTIMIZER_H_
OLDNEW
« no previous file with comments | « src/data-flow.h ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698