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

Side by Side Diff: src/objects.h

Issue 2577063002: Reland of "Store SharedFunctionInfos of a Script in a FixedArray indexed by their ID" (Closed)
Patch Set: fix Created 4 years 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
« no previous file with comments | « src/js/promise.js ('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 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 #include <memory> 9 #include <memory>
10 10
(...skipping 7105 matching lines...) Expand 10 before | Expand all | Expand 10 after
7116 // function from which eval was called. 7116 // function from which eval was called.
7117 DECL_ACCESSORS(eval_from_shared, Object) 7117 DECL_ACCESSORS(eval_from_shared, Object)
7118 7118
7119 // [eval_from_position]: the source position in the code for the function 7119 // [eval_from_position]: the source position in the code for the function
7120 // from which eval was called, as positive integer. Or the code offset in the 7120 // from which eval was called, as positive integer. Or the code offset in the
7121 // code from which eval was called, as negative integer. 7121 // code from which eval was called, as negative integer.
7122 DECL_INT_ACCESSORS(eval_from_position) 7122 DECL_INT_ACCESSORS(eval_from_position)
7123 7123
7124 // [shared_function_infos]: weak fixed array containing all shared 7124 // [shared_function_infos]: weak fixed array containing all shared
7125 // function infos created from this script. 7125 // function infos created from this script.
7126 DECL_ACCESSORS(shared_function_infos, Object) 7126 DECL_ACCESSORS(shared_function_infos, FixedArray)
7127 7127
7128 // [flags]: Holds an exciting bitfield. 7128 // [flags]: Holds an exciting bitfield.
7129 DECL_INT_ACCESSORS(flags) 7129 DECL_INT_ACCESSORS(flags)
7130 7130
7131 // [source_url]: sourceURL from magic comment 7131 // [source_url]: sourceURL from magic comment
7132 DECL_ACCESSORS(source_url, Object) 7132 DECL_ACCESSORS(source_url, Object)
7133 7133
7134 // [source_mapping_url]: sourceMappingURL magic comment 7134 // [source_mapping_url]: sourceMappingURL magic comment
7135 DECL_ACCESSORS(source_mapping_url, Object) 7135 DECL_ACCESSORS(source_mapping_url, Object)
7136 7136
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
7201 static int GetColumnNumber(Handle<Script> script, int code_offset); 7201 static int GetColumnNumber(Handle<Script> script, int code_offset);
7202 int GetColumnNumber(int code_pos) const; 7202 int GetColumnNumber(int code_pos) const;
7203 static int GetLineNumber(Handle<Script> script, int code_offset); 7203 static int GetLineNumber(Handle<Script> script, int code_offset);
7204 int GetLineNumber(int code_pos) const; 7204 int GetLineNumber(int code_pos) const;
7205 7205
7206 // Get the JS object wrapping the given script; create it if none exists. 7206 // Get the JS object wrapping the given script; create it if none exists.
7207 static Handle<JSObject> GetWrapper(Handle<Script> script); 7207 static Handle<JSObject> GetWrapper(Handle<Script> script);
7208 7208
7209 // Look through the list of existing shared function infos to find one 7209 // Look through the list of existing shared function infos to find one
7210 // that matches the function literal. Return empty handle if not found. 7210 // that matches the function literal. Return empty handle if not found.
7211 MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(FunctionLiteral* fun); 7211 MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(Isolate* isolate,
7212 FunctionLiteral* fun);
7212 7213
7213 // Iterate over all script objects on the heap. 7214 // Iterate over all script objects on the heap.
7214 class Iterator { 7215 class Iterator {
7215 public: 7216 public:
7216 explicit Iterator(Isolate* isolate); 7217 explicit Iterator(Isolate* isolate);
7217 Script* Next(); 7218 Script* Next();
7218 7219
7219 private: 7220 private:
7220 WeakFixedArray::Iterator iterator_; 7221 WeakFixedArray::Iterator iterator_;
7221 DISALLOW_COPY_AND_ASSIGN(Iterator); 7222 DISALLOW_COPY_AND_ASSIGN(Iterator);
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
7729 // Indicates that this is a synthesized function to set up class instance 7730 // Indicates that this is a synthesized function to set up class instance
7730 // fields. 7731 // fields.
7731 DECL_BOOLEAN_ACCESSORS(is_class_field_initializer) 7732 DECL_BOOLEAN_ACCESSORS(is_class_field_initializer)
7732 7733
7733 // Indicates that this function is an asm function. 7734 // Indicates that this function is an asm function.
7734 DECL_BOOLEAN_ACCESSORS(asm_function) 7735 DECL_BOOLEAN_ACCESSORS(asm_function)
7735 7736
7736 // Indicates that the the shared function info is deserialized from cache. 7737 // Indicates that the the shared function info is deserialized from cache.
7737 DECL_BOOLEAN_ACCESSORS(deserialized) 7738 DECL_BOOLEAN_ACCESSORS(deserialized)
7738 7739
7739 // Indicates that the the shared function info has never been compiled before.
7740 DECL_BOOLEAN_ACCESSORS(never_compiled)
7741
7742 // Whether this function was created from a FunctionDeclaration. 7740 // Whether this function was created from a FunctionDeclaration.
7743 DECL_BOOLEAN_ACCESSORS(is_declaration) 7741 DECL_BOOLEAN_ACCESSORS(is_declaration)
7744 7742
7745 // Whether this function was marked to be tiered up. 7743 // Whether this function was marked to be tiered up.
7746 DECL_BOOLEAN_ACCESSORS(marked_for_tier_up) 7744 DECL_BOOLEAN_ACCESSORS(marked_for_tier_up)
7747 7745
7748 // Indicates that asm->wasm conversion failed and should not be re-attempted. 7746 // Indicates that asm->wasm conversion failed and should not be re-attempted.
7749 DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken) 7747 DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken)
7750 7748
7751 inline FunctionKind kind() const; 7749 inline FunctionKind kind() const;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
7819 // Initialize a SharedFunctionInfo from a parsed function literal. 7817 // Initialize a SharedFunctionInfo from a parsed function literal.
7820 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, 7818 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info,
7821 FunctionLiteral* lit); 7819 FunctionLiteral* lit);
7822 7820
7823 // Dispatched behavior. 7821 // Dispatched behavior.
7824 DECLARE_PRINTER(SharedFunctionInfo) 7822 DECLARE_PRINTER(SharedFunctionInfo)
7825 DECLARE_VERIFIER(SharedFunctionInfo) 7823 DECLARE_VERIFIER(SharedFunctionInfo)
7826 7824
7827 void ResetForNewContext(int new_ic_age); 7825 void ResetForNewContext(int new_ic_age);
7828 7826
7829 // Iterate over all shared function infos. 7827 // Iterate over all shared function infos in a given script.
7830 class Iterator { 7828 class ScriptIterator {
7831 public: 7829 public:
7832 explicit Iterator(Isolate* isolate); 7830 explicit ScriptIterator(Handle<Script> script);
7831 ScriptIterator(Isolate* isolate, Handle<FixedArray> shared_function_infos);
7832 SharedFunctionInfo* Next();
7833
7834 // Reset the iterator to run on |script|.
7835 void Reset(Handle<Script> script);
7836
7837 private:
7838 Isolate* isolate_;
7839 Handle<FixedArray> shared_function_infos_;
7840 int index_;
7841 DISALLOW_COPY_AND_ASSIGN(ScriptIterator);
7842 };
7843
7844 // Iterate over all shared function infos on the heap.
7845 class GlobalIterator {
7846 public:
7847 explicit GlobalIterator(Isolate* isolate);
7833 SharedFunctionInfo* Next(); 7848 SharedFunctionInfo* Next();
7834 7849
7835 private: 7850 private:
7836 bool NextScript();
7837
7838 Script::Iterator script_iterator_; 7851 Script::Iterator script_iterator_;
7839 WeakFixedArray::Iterator sfi_iterator_; 7852 WeakFixedArray::Iterator noscript_sfi_iterator_;
7853 SharedFunctionInfo::ScriptIterator sfi_iterator_;
7840 DisallowHeapAllocation no_gc_; 7854 DisallowHeapAllocation no_gc_;
7841 DISALLOW_COPY_AND_ASSIGN(Iterator); 7855 DISALLOW_COPY_AND_ASSIGN(GlobalIterator);
7842 }; 7856 };
7843 7857
7844 DECLARE_CAST(SharedFunctionInfo) 7858 DECLARE_CAST(SharedFunctionInfo)
7845 7859
7846 // Constants. 7860 // Constants.
7847 static const int kDontAdaptArgumentsSentinel = -1; 7861 static const int kDontAdaptArgumentsSentinel = -1;
7848 7862
7849 // Layout description. 7863 // Layout description.
7850 // Pointer fields. 7864 // Pointer fields.
7851 static const int kCodeOffset = HeapObject::kHeaderSize; 7865 static const int kCodeOffset = HeapObject::kHeaderSize;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
7991 static const int kIsTopLevelBit = 1; 8005 static const int kIsTopLevelBit = 1;
7992 static const int kStartPositionShift = 2; 8006 static const int kStartPositionShift = 2;
7993 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); 8007 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1);
7994 8008
7995 // Bit positions in compiler_hints. 8009 // Bit positions in compiler_hints.
7996 enum CompilerHints { 8010 enum CompilerHints {
7997 // byte 0 8011 // byte 0
7998 kAllowLazyCompilation, 8012 kAllowLazyCompilation,
7999 kMarkedForTierUp, 8013 kMarkedForTierUp,
8000 kOptimizationDisabled, 8014 kOptimizationDisabled,
8001 kNeverCompiled, 8015 kIsClassFieldInitializer,
8002 kNative, 8016 kNative,
8003 kStrictModeFunction, 8017 kStrictModeFunction,
8004 kUsesArguments, 8018 kUsesArguments,
8005 kNeedsHomeObject, 8019 kNeedsHomeObject,
8006 // byte 1 8020 // byte 1
8007 kHasDuplicateParameters, 8021 kHasDuplicateParameters,
8008 kForceInline, 8022 kForceInline,
8009 kIsAsmFunction, 8023 kIsAsmFunction,
8010 kIsAnonymousExpression, 8024 kIsAnonymousExpression,
8011 kNameShouldPrintAsAnonymous, 8025 kNameShouldPrintAsAnonymous,
8012 kIsFunction, 8026 kIsFunction,
8013 kMustUseIgnitionTurbo, 8027 kMustUseIgnitionTurbo,
8014 kDontFlush, 8028 kDontFlush,
8015 // byte 2 8029 // byte 2
8016 kFunctionKind, 8030 kFunctionKind,
8017 // rest of byte 2 and first two bits of byte 3 are used by FunctionKind 8031 // rest of byte 2 and first two bits of byte 3 are used by FunctionKind
8018 // byte 3 8032 // byte 3
8019 kDeserialized = kFunctionKind + 10, 8033 kDeserialized = kFunctionKind + 10,
8020 kIsDeclaration, 8034 kIsDeclaration,
8021 kIsAsmWasmBroken, 8035 kIsAsmWasmBroken,
8022 kRequiresClassFieldInit, 8036 kRequiresClassFieldInit,
8023 kIsClassFieldInitializer,
8024 kCompilerHintsCount, // Pseudo entry 8037 kCompilerHintsCount, // Pseudo entry
8025 }; 8038 };
8026 // kFunctionKind has to be byte-aligned 8039 // kFunctionKind has to be byte-aligned
8027 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); 8040 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0);
8028 8041
8029 class FunctionKindBits : public BitField<FunctionKind, kFunctionKind, 10> {}; 8042 class FunctionKindBits : public BitField<FunctionKind, kFunctionKind, 10> {};
8030 8043
8031 class DeoptCountBits : public BitField<int, 0, 4> {}; 8044 class DeoptCountBits : public BitField<int, 0, 4> {};
8032 class OptReenableTriesBits : public BitField<int, 4, 18> {}; 8045 class OptReenableTriesBits : public BitField<int, 4, 18> {};
8033 class ICAgeBits : public BitField<int, 22, 8> {}; 8046 class ICAgeBits : public BitField<int, 22, 8> {};
(...skipping 3974 matching lines...) Expand 10 before | Expand all | Expand 10 after
12008 } 12021 }
12009 return value; 12022 return value;
12010 } 12023 }
12011 }; 12024 };
12012 12025
12013 12026
12014 } // NOLINT, false-positive due to second-order macros. 12027 } // NOLINT, false-positive due to second-order macros.
12015 } // NOLINT, false-positive due to second-order macros. 12028 } // NOLINT, false-positive due to second-order macros.
12016 12029
12017 #endif // V8_OBJECTS_H_ 12030 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/js/promise.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698