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 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_COMPILER_H_ | 28 #ifndef V8_COMPILER_H_ |
29 #define V8_COMPILER_H_ | 29 #define V8_COMPILER_H_ |
30 | 30 |
31 #include "frame-element.h" | |
32 #include "parser.h" | 31 #include "parser.h" |
33 #include "zone.h" | |
34 | 32 |
35 namespace v8 { namespace internal { | 33 namespace v8 { namespace internal { |
36 | 34 |
37 // The V8 compiler | 35 // The V8 compiler |
38 // | 36 // |
39 // General strategy: Source code is translated into an anonymous function w/o | 37 // General strategy: Source code is translated into an anonymous function w/o |
40 // parameters which then can be executed. If the source code contains other | 38 // parameters which then can be executed. If the source code contains other |
41 // functions, they will be compiled and allocated as part of the compilation | 39 // functions, they will be compiled and allocated as part of the compilation |
42 // of the source code. | 40 // of the source code. |
43 | 41 |
(...skipping 20 matching lines...) Expand all Loading... |
64 int line_offset, | 62 int line_offset, |
65 bool is_global, | 63 bool is_global, |
66 bool is_json); | 64 bool is_json); |
67 | 65 |
68 // Compile from function info (used for lazy compilation). Returns | 66 // Compile from function info (used for lazy compilation). Returns |
69 // true on success and false if the compilation resulted in a stack | 67 // true on success and false if the compilation resulted in a stack |
70 // overflow. | 68 // overflow. |
71 static bool CompileLazy(Handle<SharedFunctionInfo> shared, int loop_nesting); | 69 static bool CompileLazy(Handle<SharedFunctionInfo> shared, int loop_nesting); |
72 }; | 70 }; |
73 | 71 |
74 | |
75 // During compilation we need a global list of handles to constants | |
76 // for frame elements. When the zone gets deleted, we make sure to | |
77 // clear this list of handles as well. | |
78 class CompilationZoneScope : public ZoneScope { | |
79 public: | |
80 CompilationZoneScope() : ZoneScope(DELETE_ON_EXIT) { } | |
81 virtual ~CompilationZoneScope() { | |
82 if (ShouldDeleteOnExit()) FrameElement::ClearConstantList(); | |
83 } | |
84 }; | |
85 | |
86 | |
87 } } // namespace v8::internal | 72 } } // namespace v8::internal |
88 | 73 |
89 #endif // V8_COMPILER_H_ | 74 #endif // V8_COMPILER_H_ |
OLD | NEW |