| OLD | NEW | 
|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ | 
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ | 
| 7 | 7 | 
| 8 #include <iosfwd> | 8 #include <iosfwd> | 
| 9 | 9 | 
| 10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" | 
| (...skipping 6438 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6449   // function source. Encoded in the 'flags' field. | 6449   // function source. Encoded in the 'flags' field. | 
| 6450   inline bool hide_source(); | 6450   inline bool hide_source(); | 
| 6451   inline void set_hide_source(bool value); | 6451   inline void set_hide_source(bool value); | 
| 6452 | 6452 | 
| 6453   // [origin_options]: optional attributes set by the embedder via ScriptOrigin, | 6453   // [origin_options]: optional attributes set by the embedder via ScriptOrigin, | 
| 6454   // and used by the embedder to make decisions about the script. V8 just passes | 6454   // and used by the embedder to make decisions about the script. V8 just passes | 
| 6455   // this through. Encoded in the 'flags' field. | 6455   // this through. Encoded in the 'flags' field. | 
| 6456   inline v8::ScriptOriginOptions origin_options(); | 6456   inline v8::ScriptOriginOptions origin_options(); | 
| 6457   inline void set_origin_options(ScriptOriginOptions origin_options); | 6457   inline void set_origin_options(ScriptOriginOptions origin_options); | 
| 6458 | 6458 | 
|  | 6459   // [is_module]: determines whether the script is an ES2015 module. Encoded in | 
|  | 6460   // the 'flags' field. | 
|  | 6461   inline bool is_module(); | 
|  | 6462   inline void set_is_module(bool value); | 
|  | 6463 | 
| 6459   DECLARE_CAST(Script) | 6464   DECLARE_CAST(Script) | 
| 6460 | 6465 | 
| 6461   // If script source is an external string, check that the underlying | 6466   // If script source is an external string, check that the underlying | 
| 6462   // resource is accessible. Otherwise, always return true. | 6467   // resource is accessible. Otherwise, always return true. | 
| 6463   inline bool HasValidSource(); | 6468   inline bool HasValidSource(); | 
| 6464 | 6469 | 
| 6465   static Handle<Object> GetNameOrSourceURL(Handle<Script> script); | 6470   static Handle<Object> GetNameOrSourceURL(Handle<Script> script); | 
| 6466 | 6471 | 
| 6467   // Set eval origin for stack trace formatting. | 6472   // Set eval origin for stack trace formatting. | 
| 6468   static void SetEvalOrigin(Handle<Script> script, | 6473   static void SetEvalOrigin(Handle<Script> script, | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6546   int GetLineNumberWithArray(int code_pos); | 6551   int GetLineNumberWithArray(int code_pos); | 
| 6547 | 6552 | 
| 6548   // Bit positions in the flags field. | 6553   // Bit positions in the flags field. | 
| 6549   static const int kCompilationTypeBit = 0; | 6554   static const int kCompilationTypeBit = 0; | 
| 6550   static const int kCompilationStateBit = 1; | 6555   static const int kCompilationStateBit = 1; | 
| 6551   static const int kHideSourceBit = 2; | 6556   static const int kHideSourceBit = 2; | 
| 6552   static const int kOriginOptionsShift = 3; | 6557   static const int kOriginOptionsShift = 3; | 
| 6553   static const int kOriginOptionsSize = 3; | 6558   static const int kOriginOptionsSize = 3; | 
| 6554   static const int kOriginOptionsMask = ((1 << kOriginOptionsSize) - 1) | 6559   static const int kOriginOptionsMask = ((1 << kOriginOptionsSize) - 1) | 
| 6555                                         << kOriginOptionsShift; | 6560                                         << kOriginOptionsShift; | 
|  | 6561   static const int kIsModuleBit = kOriginOptionsShift + kOriginOptionsSize; | 
| 6556 | 6562 | 
| 6557   DISALLOW_IMPLICIT_CONSTRUCTORS(Script); | 6563   DISALLOW_IMPLICIT_CONSTRUCTORS(Script); | 
| 6558 }; | 6564 }; | 
| 6559 | 6565 | 
| 6560 | 6566 | 
| 6561 // List of builtin functions we want to identify to improve code | 6567 // List of builtin functions we want to identify to improve code | 
| 6562 // generation. | 6568 // generation. | 
| 6563 // | 6569 // | 
| 6564 // Each entry has a name of a global object property holding an object | 6570 // Each entry has a name of a global object property holding an object | 
| 6565 // optionally followed by ".prototype", a name of a builtin function | 6571 // optionally followed by ".prototype", a name of a builtin function | 
| (...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8098 // is called while such a hash is live in the cache, the hash gets replaced by | 8104 // is called while such a hash is live in the cache, the hash gets replaced by | 
| 8099 // an actual cache entry. Age also removes stale live entries from the cache. | 8105 // an actual cache entry. Age also removes stale live entries from the cache. | 
| 8100 // Such entries are identified by SharedFunctionInfos pointing to either the | 8106 // Such entries are identified by SharedFunctionInfos pointing to either the | 
| 8101 // recompilation stub, or to "old" code. This avoids memory leaks due to | 8107 // recompilation stub, or to "old" code. This avoids memory leaks due to | 
| 8102 // premature caching of scripts and eval strings that are never needed later. | 8108 // premature caching of scripts and eval strings that are never needed later. | 
| 8103 class CompilationCacheTable: public HashTable<CompilationCacheTable, | 8109 class CompilationCacheTable: public HashTable<CompilationCacheTable, | 
| 8104                                               CompilationCacheShape, | 8110                                               CompilationCacheShape, | 
| 8105                                               HashTableKey*> { | 8111                                               HashTableKey*> { | 
| 8106  public: | 8112  public: | 
| 8107   // Find cached value for a string key, otherwise return null. | 8113   // Find cached value for a string key, otherwise return null. | 
| 8108   Handle<Object> Lookup( | 8114   Handle<Object> Lookup(Handle<String> src, Handle<Context> context, | 
| 8109       Handle<String> src, Handle<Context> context, LanguageMode language_mode); | 8115                         LanguageMode language_mode, bool is_module); | 
| 8110   Handle<Object> LookupEval( | 8116   Handle<Object> LookupEval( | 
| 8111       Handle<String> src, Handle<SharedFunctionInfo> shared, | 8117       Handle<String> src, Handle<SharedFunctionInfo> shared, | 
| 8112       LanguageMode language_mode, int scope_position); | 8118       LanguageMode language_mode, int scope_position); | 
| 8113   Handle<Object> LookupRegExp(Handle<String> source, JSRegExp::Flags flags); | 8119   Handle<Object> LookupRegExp(Handle<String> source, JSRegExp::Flags flags); | 
| 8114   static Handle<CompilationCacheTable> Put( | 8120   static Handle<CompilationCacheTable> Put(Handle<CompilationCacheTable> cache, | 
| 8115       Handle<CompilationCacheTable> cache, Handle<String> src, | 8121                                            Handle<String> src, | 
| 8116       Handle<Context> context, LanguageMode language_mode, | 8122                                            Handle<Context> context, | 
| 8117       Handle<Object> value); | 8123                                            LanguageMode language_mode, | 
|  | 8124                                            bool is_module, | 
|  | 8125                                            Handle<Object> value); | 
| 8118   static Handle<CompilationCacheTable> PutEval( | 8126   static Handle<CompilationCacheTable> PutEval( | 
| 8119       Handle<CompilationCacheTable> cache, Handle<String> src, | 8127       Handle<CompilationCacheTable> cache, Handle<String> src, | 
| 8120       Handle<SharedFunctionInfo> context, Handle<SharedFunctionInfo> value, | 8128       Handle<SharedFunctionInfo> context, Handle<SharedFunctionInfo> value, | 
| 8121       int scope_position); | 8129       int scope_position); | 
| 8122   static Handle<CompilationCacheTable> PutRegExp( | 8130   static Handle<CompilationCacheTable> PutRegExp( | 
| 8123       Handle<CompilationCacheTable> cache, Handle<String> src, | 8131       Handle<CompilationCacheTable> cache, Handle<String> src, | 
| 8124       JSRegExp::Flags flags, Handle<FixedArray> value); | 8132       JSRegExp::Flags flags, Handle<FixedArray> value); | 
| 8125   void Remove(Object* value); | 8133   void Remove(Object* value); | 
| 8126   void Age(); | 8134   void Age(); | 
| 8127   static const int kHashGenerations = 10; | 8135   static const int kHashGenerations = 10; | 
| (...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 10806     } | 10814     } | 
| 10807     return value; | 10815     return value; | 
| 10808   } | 10816   } | 
| 10809 }; | 10817 }; | 
| 10810 | 10818 | 
| 10811 | 10819 | 
| 10812 }  // NOLINT, false-positive due to second-order macros. | 10820 }  // NOLINT, false-positive due to second-order macros. | 
| 10813 }  // NOLINT, false-positive due to second-order macros. | 10821 }  // NOLINT, false-positive due to second-order macros. | 
| 10814 | 10822 | 
| 10815 #endif  // V8_OBJECTS_H_ | 10823 #endif  // V8_OBJECTS_H_ | 
| OLD | NEW | 
|---|