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

Unified Diff: src/objects.h

Issue 2547483002: Store SharedFunctionInfos of a Script in a FixedArray indexed by their ID (Closed)
Patch Set: updates 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 side-by-side diff with in-line comments
Download patch
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index b2448793e821a8256a0d51e442c0fbb96f0c2c35..0280c960ac52b9f8a285b4b3e8b3f5a8a8932b42 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -7114,7 +7114,7 @@ class Script: public Struct {
// [shared_function_infos]: weak fixed array containing all shared
// function infos created from this script.
- DECL_ACCESSORS(shared_function_infos, Object)
+ DECL_ACCESSORS(shared_function_infos, FixedArray)
// [flags]: Holds an exciting bitfield.
DECL_INT_ACCESSORS(flags)
@@ -7199,7 +7199,8 @@ class Script: public Struct {
// Look through the list of existing shared function infos to find one
// that matches the function literal. Return empty handle if not found.
- MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(FunctionLiteral* fun);
+ MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(Isolate* isolate,
+ FunctionLiteral* fun);
// Iterate over all script objects on the heap.
class Iterator {
@@ -7727,9 +7728,6 @@ class SharedFunctionInfo: public HeapObject {
// Indicates that the the shared function info is deserialized from cache.
DECL_BOOLEAN_ACCESSORS(deserialized)
- // Indicates that the the shared function info has never been compiled before.
- DECL_BOOLEAN_ACCESSORS(never_compiled)
-
// Whether this function was created from a FunctionDeclaration.
DECL_BOOLEAN_ACCESSORS(is_declaration)
@@ -7817,19 +7815,35 @@ class SharedFunctionInfo: public HeapObject {
void ResetForNewContext(int new_ic_age);
- // Iterate over all shared function infos.
- class Iterator {
+ // Iterate over all shared function infos in a given script.
+ class ScriptIterator {
public:
- explicit Iterator(Isolate* isolate);
+ explicit ScriptIterator(Handle<Script> script);
+ ScriptIterator(Isolate* isolate, Handle<FixedArray> shared_function_infos);
SharedFunctionInfo* Next();
+ // Reset the iterator to run on |script|.
+ void Reset(Handle<Script> script);
+
private:
- bool NextScript();
+ Isolate* isolate_;
+ Handle<FixedArray> shared_function_infos_;
+ int index_;
+ DISALLOW_COPY_AND_ASSIGN(ScriptIterator);
+ };
+ // Iterate over all shared function infos on the heap.
+ class GlobalIterator {
+ public:
+ explicit GlobalIterator(Isolate* isolate);
+ SharedFunctionInfo* Next();
+
+ private:
Script::Iterator script_iterator_;
- WeakFixedArray::Iterator sfi_iterator_;
+ WeakFixedArray::Iterator noscript_sfi_iterator_;
+ SharedFunctionInfo::ScriptIterator sfi_iterator_;
DisallowHeapAllocation no_gc_;
- DISALLOW_COPY_AND_ASSIGN(Iterator);
+ DISALLOW_COPY_AND_ASSIGN(GlobalIterator);
};
DECLARE_CAST(SharedFunctionInfo)
@@ -7989,7 +8003,7 @@ class SharedFunctionInfo: public HeapObject {
kAllowLazyCompilation,
kMarkedForTierUp,
kOptimizationDisabled,
- kNeverCompiled,
+ kIsClassFieldInitializer,
kNative,
kStrictModeFunction,
kUsesArguments,
@@ -8011,7 +8025,6 @@ class SharedFunctionInfo: public HeapObject {
kIsDeclaration,
kIsAsmWasmBroken,
kRequiresClassFieldInit,
- kIsClassFieldInitializer,
kCompilerHintsCount, // Pseudo entry
};
// kFunctionKind has to be byte-aligned
« src/debug/liveedit.js ('K') | « src/js/promise.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698