OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 Handle<Script> script, | 85 Handle<Script> script, |
86 Handle<Context> context, | 86 Handle<Context> context, |
87 v8::Extension* extension, | 87 v8::Extension* extension, |
88 ScriptDataImpl* pre_data) { | 88 ScriptDataImpl* pre_data) { |
89 ZoneScope zone_scope(DELETE_ON_EXIT); | 89 ZoneScope zone_scope(DELETE_ON_EXIT); |
90 | 90 |
91 // Make sure we have an initial stack limit. | 91 // Make sure we have an initial stack limit. |
92 StackGuard guard; | 92 StackGuard guard; |
93 PostponeInterruptsScope postpone; | 93 PostponeInterruptsScope postpone; |
94 | 94 |
| 95 #ifdef ENABLE_DEBUGGER_SUPPORT |
95 // Notify debugger | 96 // Notify debugger |
96 Debugger::OnBeforeCompile(script); | 97 Debugger::OnBeforeCompile(script); |
| 98 #endif |
97 | 99 |
98 // Only allow non-global compiles for eval. | 100 // Only allow non-global compiles for eval. |
99 ASSERT(is_eval || is_global); | 101 ASSERT(is_eval || is_global); |
100 | 102 |
101 // Build AST. | 103 // Build AST. |
102 FunctionLiteral* lit = MakeAST(is_global, script, extension, pre_data); | 104 FunctionLiteral* lit = MakeAST(is_global, script, extension, pre_data); |
103 | 105 |
104 // Check for parse errors. | 106 // Check for parse errors. |
105 if (lit == NULL) { | 107 if (lit == NULL) { |
106 ASSERT(Top::has_pending_exception()); | 108 ASSERT(Top::has_pending_exception()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 RelocInfo::kNoPosition, | 155 RelocInfo::kNoPosition, |
154 lit->start_position(), lit->end_position(), | 156 lit->start_position(), lit->end_position(), |
155 lit->is_expression(), true, script, | 157 lit->is_expression(), true, script, |
156 lit->inferred_name()); | 158 lit->inferred_name()); |
157 | 159 |
158 // Hint to the runtime system used when allocating space for initial | 160 // Hint to the runtime system used when allocating space for initial |
159 // property space by setting the expected number of properties for | 161 // property space by setting the expected number of properties for |
160 // the instances of the function. | 162 // the instances of the function. |
161 SetExpectedNofPropertiesFromEstimate(fun, lit->expected_property_count()); | 163 SetExpectedNofPropertiesFromEstimate(fun, lit->expected_property_count()); |
162 | 164 |
| 165 #ifdef ENABLE_DEBUGGER_SUPPORT |
163 // Notify debugger | 166 // Notify debugger |
164 Debugger::OnAfterCompile(script, fun); | 167 Debugger::OnAfterCompile(script, fun); |
| 168 #endif |
165 | 169 |
166 return fun; | 170 return fun; |
167 } | 171 } |
168 | 172 |
169 | 173 |
170 static StaticResource<SafeStringInputBuffer> safe_string_input_buffer; | 174 static StaticResource<SafeStringInputBuffer> safe_string_input_buffer; |
171 | 175 |
172 | 176 |
173 Handle<JSFunction> Compiler::Compile(Handle<String> source, | 177 Handle<JSFunction> Compiler::Compile(Handle<String> source, |
174 Handle<Object> script_name, | 178 Handle<Object> script_name, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 // Set the expected number of properties for instances. | 348 // Set the expected number of properties for instances. |
345 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); | 349 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); |
346 | 350 |
347 // Check the function has compiled code. | 351 // Check the function has compiled code. |
348 ASSERT(shared->is_compiled()); | 352 ASSERT(shared->is_compiled()); |
349 return true; | 353 return true; |
350 } | 354 } |
351 | 355 |
352 | 356 |
353 } } // namespace v8::internal | 357 } } // namespace v8::internal |
OLD | NEW |