OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Compile a String source within a context for Eval. | 64 // Compile a String source within a context for Eval. |
65 static Handle<JSFunction> CompileEval(Handle<String> source, | 65 static Handle<JSFunction> CompileEval(Handle<String> source, |
66 Handle<Context> context, | 66 Handle<Context> context, |
67 bool is_global, | 67 bool is_global, |
68 ValidationState validation); | 68 ValidationState validation); |
69 | 69 |
70 // Compile from function info (used for lazy compilation). Returns | 70 // Compile from function info (used for lazy compilation). Returns |
71 // true on success and false if the compilation resulted in a stack | 71 // true on success and false if the compilation resulted in a stack |
72 // overflow. | 72 // overflow. |
73 static bool CompileLazy(Handle<SharedFunctionInfo> shared, int loop_nesting); | 73 static bool CompileLazy(Handle<SharedFunctionInfo> shared, int loop_nesting); |
| 74 |
| 75 // Compile a function boilerplate object (the function is possibly |
| 76 // lazily compiled). Called recursively from a backend code |
| 77 // generator 'caller' to build the boilerplate. |
| 78 static Handle<JSFunction> BuildBoilerplate(FunctionLiteral* node, |
| 79 Handle<Script> script, |
| 80 AstVisitor* caller); |
| 81 |
| 82 // Set the function info for a newly compiled function. |
| 83 static void SetFunctionInfo(Handle<JSFunction> fun, |
| 84 FunctionLiteral* lit, |
| 85 bool is_toplevel, |
| 86 Handle<Script> script); |
74 }; | 87 }; |
75 | 88 |
76 | 89 |
77 // During compilation we need a global list of handles to constants | 90 // During compilation we need a global list of handles to constants |
78 // for frame elements. When the zone gets deleted, we make sure to | 91 // for frame elements. When the zone gets deleted, we make sure to |
79 // clear this list of handles as well. | 92 // clear this list of handles as well. |
80 class CompilationZoneScope : public ZoneScope { | 93 class CompilationZoneScope : public ZoneScope { |
81 public: | 94 public: |
82 explicit CompilationZoneScope(ZoneScopeMode mode) : ZoneScope(mode) { } | 95 explicit CompilationZoneScope(ZoneScopeMode mode) : ZoneScope(mode) { } |
83 virtual ~CompilationZoneScope() { | 96 virtual ~CompilationZoneScope() { |
84 if (ShouldDeleteOnExit()) { | 97 if (ShouldDeleteOnExit()) { |
85 FrameElement::ClearConstantList(); | 98 FrameElement::ClearConstantList(); |
86 Result::ClearConstantList(); | 99 Result::ClearConstantList(); |
87 } | 100 } |
88 } | 101 } |
89 }; | 102 }; |
90 | 103 |
91 | 104 |
92 } } // namespace v8::internal | 105 } } // namespace v8::internal |
93 | 106 |
94 #endif // V8_COMPILER_H_ | 107 #endif // V8_COMPILER_H_ |
OLD | NEW |