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