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

Side by Side Diff: src/objects.h

Issue 39186: Revert revisions 1383, 1384, 1391, 1398, 1401, 1402,... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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/macros.py ('k') | src/objects.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after
2949 2949
2950 // Layout description. 2950 // Layout description.
2951 static const int kValueOffset = JSObject::kHeaderSize; 2951 static const int kValueOffset = JSObject::kHeaderSize;
2952 static const int kSize = kValueOffset + kPointerSize; 2952 static const int kSize = kValueOffset + kPointerSize;
2953 2953
2954 private: 2954 private:
2955 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); 2955 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue);
2956 }; 2956 };
2957 2957
2958 // Regular expressions 2958 // Regular expressions
2959 // The regular expression holds a single reference to a FixedArray in
2960 // the kDataOffset field.
2961 // The FixedArray contains the following data:
2962 // - tag : type of regexp implementation (not compiled yet, atom or irregexp)
2963 // - reference to the original source string
2964 // - reference to the original flag string
2965 // If it is an atom regexp
2966 // - a reference to a literal string to search for
2967 // If it is an irregexp regexp:
2968 // - a reference to code for ASCII inputs (bytecode or compiled).
2969 // - a reference to code for UC16 inputs (bytecode or compiled).
2970 // - max number of registers used by irregexp implementations.
2971 // - number of capture registers (output values) of the regexp.
2972 class JSRegExp: public JSObject { 2959 class JSRegExp: public JSObject {
2973 public: 2960 public:
2974 // Meaning of Type: 2961 // Meaning of Type:
2975 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. 2962 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet.
2976 // ATOM: A simple string to match against using an indexOf operation. 2963 // ATOM: A simple string to match against using an indexOf operation.
2977 // IRREGEXP: Compiled with Irregexp. 2964 // IRREGEXP: Compiled with Irregexp.
2978 // IRREGEXP_NATIVE: Compiled to native code with Irregexp. 2965 // IRREGEXP_NATIVE: Compiled to native code with Irregexp.
2979 enum Type { NOT_COMPILED, ATOM, IRREGEXP }; 2966 enum Type { NOT_COMPILED, ATOM, IRREGEXP };
2980 enum Flag { NONE = 0, GLOBAL = 1, IGNORE_CASE = 2, MULTILINE = 4 }; 2967 enum Flag { NONE = 0, GLOBAL = 1, IGNORE_CASE = 2, MULTILINE = 4 };
2981 2968
2982 class Flags { 2969 class Flags {
2983 public: 2970 public:
2984 explicit Flags(uint32_t value) : value_(value) { } 2971 explicit Flags(uint32_t value) : value_(value) { }
2985 bool is_global() { return (value_ & GLOBAL) != 0; } 2972 bool is_global() { return (value_ & GLOBAL) != 0; }
2986 bool is_ignore_case() { return (value_ & IGNORE_CASE) != 0; } 2973 bool is_ignore_case() { return (value_ & IGNORE_CASE) != 0; }
2987 bool is_multiline() { return (value_ & MULTILINE) != 0; } 2974 bool is_multiline() { return (value_ & MULTILINE) != 0; }
2988 uint32_t value() { return value_; } 2975 uint32_t value() { return value_; }
2989 private: 2976 private:
2990 uint32_t value_; 2977 uint32_t value_;
2991 }; 2978 };
2992 2979
2993 DECL_ACCESSORS(data, Object) 2980 DECL_ACCESSORS(data, Object)
2994 2981
2995 inline Type TypeTag(); 2982 inline Type TypeTag();
2996 inline Flags GetFlags(); 2983 inline Flags GetFlags();
2997 inline String* Pattern(); 2984 inline String* Pattern();
2998 inline Object* DataAt(int index); 2985 inline Object* DataAt(int index);
2999 // Set implementation data after the object has been prepared.
3000 inline void SetDataAt(int index, Object* value);
3001 2986
3002 static inline JSRegExp* cast(Object* obj); 2987 static inline JSRegExp* cast(Object* obj);
3003 2988
3004 // Dispatched behavior. 2989 // Dispatched behavior.
3005 #ifdef DEBUG 2990 #ifdef DEBUG
3006 void JSRegExpVerify(); 2991 void JSRegExpVerify();
3007 #endif 2992 #endif
3008 2993
3009 static const int kDataOffset = JSObject::kHeaderSize; 2994 static const int kDataOffset = JSObject::kHeaderSize;
3010 static const int kSize = kDataOffset + kIntSize; 2995 static const int kSize = kDataOffset + kIntSize;
3011 2996
3012 // Indices in the data array.
3013 static const int kTagIndex = 0; 2997 static const int kTagIndex = 0;
3014 static const int kSourceIndex = kTagIndex + 1; 2998 static const int kSourceIndex = kTagIndex + 1;
3015 static const int kFlagsIndex = kSourceIndex + 1; 2999 static const int kFlagsIndex = kSourceIndex + 1;
3016 static const int kDataIndex = kFlagsIndex + 1; 3000 // These two are the same since the same entry is shared for
3017 // The data fields are used in different ways depending on the 3001 // different purposes in different types of regexps.
3018 // value of the tag. 3002 static const int kAtomPatternIndex = kFlagsIndex + 1;
3019 // Atom regexps (literal strings). 3003 static const int kIrregexpDataIndex = kFlagsIndex + 1;
3020 static const int kAtomPatternIndex = kDataIndex; 3004 static const int kDataSize = kAtomPatternIndex + 1;
3021
3022 static const int kAtomDataSize = kAtomPatternIndex + 1;
3023
3024 // Irregexp compiled code or bytecode for ASCII.
3025 static const int kIrregexpASCIICodeIndex = kDataIndex;
3026 // Irregexp compiled code or bytecode for UC16.
3027 static const int kIrregexpUC16CodeIndex = kDataIndex + 1;
3028 // Maximal number of registers used by either ASCII or UC16.
3029 // Only used to check that there is enough stack space
3030 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 2;
3031 // Number of captures in the compiled regexp.
3032 static const int kIrregexpCaptureCountIndex = kDataIndex + 3;
3033
3034 static const int kIrregexpDataSize = kIrregexpCaptureCountIndex + 1;
3035 }; 3005 };
3036 3006
3037 3007
3038 class CompilationCacheTable: public HashTable<0, 2> { 3008 class CompilationCacheTable: public HashTable<0, 2> {
3039 public: 3009 public:
3040 // Find cached value for a string key, otherwise return null. 3010 // Find cached value for a string key, otherwise return null.
3041 Object* Lookup(String* src); 3011 Object* Lookup(String* src);
3042 Object* LookupEval(String* src, Context* context); 3012 Object* LookupEval(String* src, Context* context);
3043 Object* LookupRegExp(String* source, JSRegExp::Flags flags); 3013 Object* LookupRegExp(String* source, JSRegExp::Flags flags);
3044 Object* Put(String* src, Object* value); 3014 Object* Put(String* src, Object* value);
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
3819 3789
3820 // Set the content of the array to the content of storage. 3790 // Set the content of the array to the content of storage.
3821 inline void SetContent(FixedArray* storage); 3791 inline void SetContent(FixedArray* storage);
3822 3792
3823 // Support for sorting 3793 // Support for sorting
3824 Object* RemoveHoles(); 3794 Object* RemoveHoles();
3825 3795
3826 // Casting. 3796 // Casting.
3827 static inline JSArray* cast(Object* obj); 3797 static inline JSArray* cast(Object* obj);
3828 3798
3829 // Uses handles. Ensures that the fixed array backing the JSArray has at
3830 // least the stated size.
3831 void EnsureSize(int minimum_size_of_backing_fixed_array);
3832
3833 // Dispatched behavior. 3799 // Dispatched behavior.
3834 #ifdef DEBUG 3800 #ifdef DEBUG
3835 void JSArrayPrint(); 3801 void JSArrayPrint();
3836 void JSArrayVerify(); 3802 void JSArrayVerify();
3837 #endif 3803 #endif
3838 3804
3839 // Layout description. 3805 // Layout description.
3840 static const int kLengthOffset = JSObject::kHeaderSize; 3806 static const int kLengthOffset = JSObject::kHeaderSize;
3841 static const int kSize = kLengthOffset + kPointerSize; 3807 static const int kSize = kLengthOffset + kPointerSize;
3842 3808
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
4289 } else { 4255 } else {
4290 value &= ~(1 << bit_position); 4256 value &= ~(1 << bit_position);
4291 } 4257 }
4292 return value; 4258 return value;
4293 } 4259 }
4294 }; 4260 };
4295 4261
4296 } } // namespace v8::internal 4262 } } // namespace v8::internal
4297 4263
4298 #endif // V8_OBJECTS_H_ 4264 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/macros.py ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698