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

Side by Side Diff: runtime/vm/raw_object.h

Issue 539153002: Port and integrate the irregexp engine from V8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Port remaining V8 regexp tests and fix exposed bugs. Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 kGetterFunction, // represents getter functions e.g: get foo() { .. }. 632 kGetterFunction, // represents getter functions e.g: get foo() { .. }.
633 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. 633 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }.
634 kConstructor, 634 kConstructor,
635 kImplicitGetter, // represents an implicit getter for fields. 635 kImplicitGetter, // represents an implicit getter for fields.
636 kImplicitSetter, // represents an implicit setter for fields. 636 kImplicitSetter, // represents an implicit setter for fields.
637 kImplicitStaticFinalGetter, // represents an implicit getter for static 637 kImplicitStaticFinalGetter, // represents an implicit getter for static
638 // final fields (incl. static const fields). 638 // final fields (incl. static const fields).
639 kMethodExtractor, // converts method into implicit closure on the receiver. 639 kMethodExtractor, // converts method into implicit closure on the receiver.
640 kNoSuchMethodDispatcher, // invokes noSuchMethod. 640 kNoSuchMethodDispatcher, // invokes noSuchMethod.
641 kInvokeFieldDispatcher, // invokes a field as a closure. 641 kInvokeFieldDispatcher, // invokes a field as a closure.
642 kIrregexpFunction, // represents a generated irregexp matcher function.
642 }; 643 };
643 644
644 enum AsyncModifier { 645 enum AsyncModifier {
645 kNoModifier, 646 kNoModifier,
646 kAsync, 647 kAsync,
647 }; 648 };
648 649
649 private: 650 private:
650 // So that the MarkingVisitor::DetachCode can null out the code fields. 651 // So that the MarkingVisitor::DetachCode can null out the code fields.
651 friend class MarkingVisitor; 652 friend class MarkingVisitor;
652 friend class Class; 653 friend class Class;
653 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); 654 RAW_HEAP_OBJECT_IMPLEMENTATION(Function);
654 static bool SkipCode(RawFunction* raw_fun); 655 static bool SkipCode(RawFunction* raw_fun);
655 656
656 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 657 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
657 RawString* name_; 658 RawString* name_;
658 RawObject* owner_; // Class or patch class or mixin class 659 RawObject* owner_; // Class or patch class or mixin class
659 // where this function is defined. 660 // where this function is defined.
661 RawJSRegExp* regexp_; // The corresponding regexp for irregexp functions.
Florian Schneider 2014/10/01 17:04:14 Maybe re-use the owner field for this? It is not u
Vyacheslav Egorov (Google) 2014/10/01 20:13:21 Kill this field by being more explicit about compi
jgruber1 2014/10/03 18:59:52 As discussed, the regexp object pointer is now sto
jgruber1 2014/10/03 18:59:53 As discussed, the regexp object pointer is now sto
660 RawAbstractType* result_type_; 662 RawAbstractType* result_type_;
661 RawArray* parameter_types_; 663 RawArray* parameter_types_;
662 RawArray* parameter_names_; 664 RawArray* parameter_names_;
663 RawObject* data_; // Additional data specific to the function kind. 665 RawObject* data_; // Additional data specific to the function kind.
664 RawObject** to_snapshot() { 666 RawObject** to_snapshot() {
665 return reinterpret_cast<RawObject**>(&ptr()->data_); 667 return reinterpret_cast<RawObject**>(&ptr()->data_);
666 } 668 }
667 // Fields below are not part of the snapshot. 669 // Fields below are not part of the snapshot.
668 RawArray* ic_data_array_; // ICData of unoptimized code. 670 RawArray* ic_data_array_; // ICData of unoptimized code.
669 RawObject** to_no_code() { 671 RawObject** to_no_code() {
670 return reinterpret_cast<RawObject**>(&ptr()->ic_data_array_); 672 return reinterpret_cast<RawObject**>(&ptr()->ic_data_array_);
671 } 673 }
672 RawInstructions* instructions_; // Instructions of currently active code. 674 RawInstructions* instructions_; // Instructions of currently active code.
673 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. 675 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization.
674 RawObject** to() { 676 RawObject** to() {
675 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_); 677 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_);
676 } 678 }
677 679
678 int32_t token_pos_; 680 int32_t token_pos_;
679 int32_t end_token_pos_; 681 int32_t end_token_pos_;
680 int32_t usage_counter_; // Incremented while function is running. 682 int32_t usage_counter_; // Incremented while function is running.
681 int16_t num_fixed_parameters_; 683 int16_t num_fixed_parameters_;
682 int16_t num_optional_parameters_; // > 0: positional; < 0: named. 684 int16_t num_optional_parameters_; // > 0: positional; < 0: named.
683 int16_t deoptimization_counter_; 685 int16_t deoptimization_counter_;
684 uint32_t kind_tag_; // See Function::KindTagBits. 686 uint32_t kind_tag_; // See Function::KindTagBits.
685 uint16_t optimized_instruction_count_; 687 uint16_t optimized_instruction_count_;
686 uint16_t optimized_call_site_count_; 688 uint16_t optimized_call_site_count_;
689 intptr_t regexp_specialization_;
Florian Schneider 2014/10/01 17:04:14 As mentioned, try using the data_ field for that.
Vyacheslav Egorov (Google) 2014/10/01 20:13:21 Ditto.
jgruber1 2014/10/03 18:59:52 As discussed, changed to int16_t and moved 3 lines
jgruber1 2014/10/03 18:59:53 As discussed, changed to int16_t and moved 3 lines
687 }; 690 };
688 691
689 692
690 class RawClosureData : public RawObject { 693 class RawClosureData : public RawObject {
691 private: 694 private:
692 RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData); 695 RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData);
693 696
694 RawObject** from() { 697 RawObject** from() {
695 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); 698 return reinterpret_cast<RawObject**>(&ptr()->context_scope_);
696 } 699 }
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 // VM type for capturing JS regular expressions. 1772 // VM type for capturing JS regular expressions.
1770 class RawJSRegExp : public RawInstance { 1773 class RawJSRegExp : public RawInstance {
1771 RAW_HEAP_OBJECT_IMPLEMENTATION(JSRegExp); 1774 RAW_HEAP_OBJECT_IMPLEMENTATION(JSRegExp);
1772 1775
1773 RawObject** from() { 1776 RawObject** from() {
1774 return reinterpret_cast<RawObject**>(&ptr()->data_length_); 1777 return reinterpret_cast<RawObject**>(&ptr()->data_length_);
1775 } 1778 }
1776 RawSmi* data_length_; 1779 RawSmi* data_length_;
1777 RawSmi* num_bracket_expressions_; 1780 RawSmi* num_bracket_expressions_;
1778 RawString* pattern_; // Pattern to be used for matching. 1781 RawString* pattern_; // Pattern to be used for matching.
1782 RawFunction* one_byte_function_;
1783 RawFunction* two_byte_function_;
1784 RawFunction* external_one_byte_function_;
1785 RawFunction* external_two_byte_function_;
1786 RawString* one_byte_subject_;
Vyacheslav Egorov (Google) 2014/10/01 20:13:21 This four subject fields smell like memory leak to
jgruber1 2014/10/03 18:59:53 Done.
1787 RawString* two_byte_subject_;
1788 RawString* external_one_byte_subject_;
1789 RawString* external_two_byte_subject_;
1779 RawObject** to() { 1790 RawObject** to() {
1780 return reinterpret_cast<RawObject**>(&ptr()->pattern_); 1791 return reinterpret_cast<RawObject**>(&ptr()->external_two_byte_subject_);
1781 } 1792 }
1782 1793
1783 // A bitfield with two fields: 1794 // A bitfield with two fields:
1784 // type: Uninitialized, simple or complex. 1795 // type: Uninitialized, simple or complex.
1785 // flags: Represents global/local, case insensitive, multiline. 1796 // flags: Represents global/local, case insensitive, multiline.
1786 int8_t type_flags_; 1797 int8_t type_flags_;
1787 1798
1788 // Variable length data follows here. 1799 // Variable length data follows here.
1789 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } 1800 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
1790 }; 1801 };
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2068 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2058 kTypedDataInt8ArrayViewCid + 15); 2069 kTypedDataInt8ArrayViewCid + 15);
2059 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2070 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2060 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2071 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2061 return (kNullCid - kTypedDataInt8ArrayCid); 2072 return (kNullCid - kTypedDataInt8ArrayCid);
2062 } 2073 }
2063 2074
2064 } // namespace dart 2075 } // namespace dart
2065 2076
2066 #endif // VM_RAW_OBJECT_H_ 2077 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698