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

Side by Side Diff: src/compilation-cache.h

Issue 669240: - Remove function boilerplate objects and use SharedFunctionInfos in... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Committed Created 10 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/codegen.cc ('k') | src/compilation-cache.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 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 22 matching lines...) Expand all
33 33
34 34
35 // The compilation cache keeps function boilerplates for compiled 35 // The compilation cache keeps function boilerplates for compiled
36 // scripts and evals. The boilerplates are looked up using the source 36 // scripts and evals. The boilerplates are looked up using the source
37 // string as the key. For regular expressions the compilation data is cached. 37 // string as the key. For regular expressions the compilation data is cached.
38 class CompilationCache { 38 class CompilationCache {
39 public: 39 public:
40 // Finds the script function boilerplate for a source 40 // Finds the script function boilerplate for a source
41 // string. Returns an empty handle if the cache doesn't contain a 41 // string. Returns an empty handle if the cache doesn't contain a
42 // script for the given source string with the right origin. 42 // script for the given source string with the right origin.
43 static Handle<JSFunction> LookupScript(Handle<String> source, 43 static Handle<SharedFunctionInfo> LookupScript(Handle<String> source,
44 Handle<Object> name, 44 Handle<Object> name,
45 int line_offset, 45 int line_offset,
46 int column_offset); 46 int column_offset);
47 47
48 // Finds the function boilerplate for a source string for eval in a 48 // Finds the function boilerplate for a source string for eval in a
49 // given context. Returns an empty handle if the cache doesn't 49 // given context. Returns an empty handle if the cache doesn't
50 // contain a script for the given source string. 50 // contain a script for the given source string.
51 static Handle<JSFunction> LookupEval(Handle<String> source, 51 static Handle<SharedFunctionInfo> LookupEval(Handle<String> source,
52 Handle<Context> context, 52 Handle<Context> context,
53 bool is_global); 53 bool is_global);
54 54
55 // Returns the regexp data associated with the given regexp if it 55 // Returns the regexp data associated with the given regexp if it
56 // is in cache, otherwise an empty handle. 56 // is in cache, otherwise an empty handle.
57 static Handle<FixedArray> LookupRegExp(Handle<String> source, 57 static Handle<FixedArray> LookupRegExp(Handle<String> source,
58 JSRegExp::Flags flags); 58 JSRegExp::Flags flags);
59 59
60 // Associate the (source, kind) pair to the boilerplate. This may 60 // Associate the (source, kind) pair to the boilerplate. This may
61 // overwrite an existing mapping. 61 // overwrite an existing mapping.
62 static void PutScript(Handle<String> source, 62 static void PutScript(Handle<String> source,
63 Handle<JSFunction> boilerplate); 63 Handle<SharedFunctionInfo> function_info);
64 64
65 // Associate the (source, context->closure()->shared(), kind) triple 65 // Associate the (source, context->closure()->shared(), kind) triple
66 // with the boilerplate. This may overwrite an existing mapping. 66 // with the boilerplate. This may overwrite an existing mapping.
67 static void PutEval(Handle<String> source, 67 static void PutEval(Handle<String> source,
68 Handle<Context> context, 68 Handle<Context> context,
69 bool is_global, 69 bool is_global,
70 Handle<JSFunction> boilerplate); 70 Handle<SharedFunctionInfo> function_info);
71 71
72 // Associate the (source, flags) pair to the given regexp data. 72 // Associate the (source, flags) pair to the given regexp data.
73 // This may overwrite an existing mapping. 73 // This may overwrite an existing mapping.
74 static void PutRegExp(Handle<String> source, 74 static void PutRegExp(Handle<String> source,
75 JSRegExp::Flags flags, 75 JSRegExp::Flags flags,
76 Handle<FixedArray> data); 76 Handle<FixedArray> data);
77 77
78 // Clear the cache - also used to initialize the cache at startup. 78 // Clear the cache - also used to initialize the cache at startup.
79 static void Clear(); 79 static void Clear();
80 80
81 // GC support. 81 // GC support.
82 static void Iterate(ObjectVisitor* v); 82 static void Iterate(ObjectVisitor* v);
83 83
84 // Notify the cache that a mark-sweep garbage collection is about to 84 // Notify the cache that a mark-sweep garbage collection is about to
85 // take place. This is used to retire entries from the cache to 85 // take place. This is used to retire entries from the cache to
86 // avoid keeping them alive too long without using them. 86 // avoid keeping them alive too long without using them.
87 static void MarkCompactPrologue(); 87 static void MarkCompactPrologue();
88 88
89 // Enable/disable compilation cache. Used by debugger to disable compilation 89 // Enable/disable compilation cache. Used by debugger to disable compilation
90 // cache during debugging to make sure new scripts are always compiled. 90 // cache during debugging to make sure new scripts are always compiled.
91 static void Enable(); 91 static void Enable();
92 static void Disable(); 92 static void Disable();
93 }; 93 };
94 94
95 95
96 } } // namespace v8::internal 96 } } // namespace v8::internal
97 97
98 #endif // V8_COMPILATION_CACHE_H_ 98 #endif // V8_COMPILATION_CACHE_H_
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/compilation-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698