| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_INTERFACE_H_ | 5 #ifndef V8_INTERFACE_H_ |
| 6 #define V8_INTERFACE_H_ | 6 #define V8_INTERFACE_H_ |
| 7 | 7 |
| 8 #include "src/ast-value-factory.h" | 8 #include "src/ast-value-factory.h" |
| 9 #include "src/zone-inl.h" // For operator new. | 9 #include "src/zone-inl.h" // For operator new. |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 class Interface : public ZoneObject { | 35 class Interface : public ZoneObject { |
| 36 public: | 36 public: |
| 37 // --------------------------------------------------------------------------- | 37 // --------------------------------------------------------------------------- |
| 38 // Factory methods. | 38 // Factory methods. |
| 39 | 39 |
| 40 static Interface* NewUnknown(Zone* zone) { | 40 static Interface* NewUnknown(Zone* zone) { |
| 41 return new(zone) Interface(NONE); | 41 return new(zone) Interface(NONE); |
| 42 } | 42 } |
| 43 | 43 |
| 44 static Interface* NewValue() { | 44 static Interface* NewValue(); |
| 45 static Interface value_interface(VALUE + FROZEN); // Cached. | |
| 46 return &value_interface; | |
| 47 } | |
| 48 | 45 |
| 49 static Interface* NewConst() { | 46 static Interface* NewConst(); |
| 50 static Interface value_interface(VALUE + CONST + FROZEN); // Cached. | |
| 51 return &value_interface; | |
| 52 } | |
| 53 | 47 |
| 54 static Interface* NewModule(Zone* zone) { | 48 static Interface* NewModule(Zone* zone) { |
| 55 return new(zone) Interface(MODULE); | 49 return new(zone) Interface(MODULE); |
| 56 } | 50 } |
| 57 | 51 |
| 58 // --------------------------------------------------------------------------- | 52 // --------------------------------------------------------------------------- |
| 59 // Mutators. | 53 // Mutators. |
| 60 | 54 |
| 61 // Add a name to the list of exports. If it already exists, unify with | 55 // Add a name to the list of exports. If it already exists, unify with |
| 62 // interface, otherwise insert unless this is closed. | 56 // interface, otherwise insert unless this is closed. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 165 |
| 172 // --------------------------------------------------------------------------- | 166 // --------------------------------------------------------------------------- |
| 173 // Debugging. | 167 // Debugging. |
| 174 #ifdef DEBUG | 168 #ifdef DEBUG |
| 175 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively | 169 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively |
| 176 #endif | 170 #endif |
| 177 | 171 |
| 178 // --------------------------------------------------------------------------- | 172 // --------------------------------------------------------------------------- |
| 179 // Implementation. | 173 // Implementation. |
| 180 private: | 174 private: |
| 175 struct ValueCreate; |
| 176 struct ConstCreate; |
| 177 |
| 181 enum Flags { // All flags are monotonic | 178 enum Flags { // All flags are monotonic |
| 182 NONE = 0, | 179 NONE = 0, |
| 183 VALUE = 1, // This type describes a value | 180 VALUE = 1, // This type describes a value |
| 184 CONST = 2, // This type describes a constant | 181 CONST = 2, // This type describes a constant |
| 185 MODULE = 4, // This type describes a module | 182 MODULE = 4, // This type describes a module |
| 186 FROZEN = 8 // This type is fully determined | 183 FROZEN = 8 // This type is fully determined |
| 187 }; | 184 }; |
| 188 | 185 |
| 189 int flags_; | 186 int flags_; |
| 190 Interface* forward_; // Unification link | 187 Interface* forward_; // Unification link |
| (...skipping 19 matching lines...) Expand all Loading... |
| 210 } | 207 } |
| 211 | 208 |
| 212 void DoAdd(const void* name, uint32_t hash, Interface* interface, Zone* zone, | 209 void DoAdd(const void* name, uint32_t hash, Interface* interface, Zone* zone, |
| 213 bool* ok); | 210 bool* ok); |
| 214 void DoUnify(Interface* that, bool* ok, Zone* zone); | 211 void DoUnify(Interface* that, bool* ok, Zone* zone); |
| 215 }; | 212 }; |
| 216 | 213 |
| 217 } } // namespace v8::internal | 214 } } // namespace v8::internal |
| 218 | 215 |
| 219 #endif // V8_INTERFACE_H_ | 216 #endif // V8_INTERFACE_H_ |
| OLD | NEW |