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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 | 150 |
151 #ifdef ENABLE_DEBUGGER_SUPPORT | 151 #ifdef ENABLE_DEBUGGER_SUPPORT |
152 Handle<Code> MakeCodeForLiveEdit(CompilationInfo* info) { | 152 Handle<Code> MakeCodeForLiveEdit(CompilationInfo* info) { |
153 Handle<Context> context = Handle<Context>::null(); | 153 Handle<Context> context = Handle<Context>::null(); |
154 return MakeCode(context, info); | 154 return MakeCode(context, info); |
155 } | 155 } |
156 #endif | 156 #endif |
157 | 157 |
158 | 158 |
159 static Handle<JSFunction> MakeFunction(bool is_global, | 159 static Handle<SharedFunctionInfo> MakeFunctionInfo(bool is_global, |
160 bool is_eval, | 160 bool is_eval, |
161 Compiler::ValidationState validate, | 161 Compiler::ValidationState validate, |
162 Handle<Script> script, | 162 Handle<Script> script, |
163 Handle<Context> context, | 163 Handle<Context> context, |
164 v8::Extension* extension, | 164 v8::Extension* extension, |
165 ScriptDataImpl* pre_data) { | 165 ScriptDataImpl* pre_data) { |
166 CompilationZoneScope zone_scope(DELETE_ON_EXIT); | 166 CompilationZoneScope zone_scope(DELETE_ON_EXIT); |
167 | 167 |
168 PostponeInterruptsScope postpone; | 168 PostponeInterruptsScope postpone; |
169 | 169 |
170 ASSERT(!i::Top::global_context().is_null()); | 170 ASSERT(!i::Top::global_context().is_null()); |
171 script->set_context_data((*i::Top::global_context())->data()); | 171 script->set_context_data((*i::Top::global_context())->data()); |
172 | 172 |
173 bool is_json = (validate == Compiler::VALIDATE_JSON); | 173 bool is_json = (validate == Compiler::VALIDATE_JSON); |
174 #ifdef ENABLE_DEBUGGER_SUPPORT | 174 #ifdef ENABLE_DEBUGGER_SUPPORT |
175 if (is_eval || is_json) { | 175 if (is_eval || is_json) { |
(...skipping 21 matching lines...) Expand all Loading... |
197 // Only allow non-global compiles for eval. | 197 // Only allow non-global compiles for eval. |
198 ASSERT(is_eval || is_global); | 198 ASSERT(is_eval || is_global); |
199 | 199 |
200 // Build AST. | 200 // Build AST. |
201 FunctionLiteral* lit = | 201 FunctionLiteral* lit = |
202 MakeAST(is_global, script, extension, pre_data, is_json); | 202 MakeAST(is_global, script, extension, pre_data, is_json); |
203 | 203 |
204 // Check for parse errors. | 204 // Check for parse errors. |
205 if (lit == NULL) { | 205 if (lit == NULL) { |
206 ASSERT(Top::has_pending_exception()); | 206 ASSERT(Top::has_pending_exception()); |
207 return Handle<JSFunction>::null(); | 207 return Handle<SharedFunctionInfo>::null(); |
208 } | 208 } |
209 | 209 |
210 // Measure how long it takes to do the compilation; only take the | 210 // Measure how long it takes to do the compilation; only take the |
211 // rest of the function into account to avoid overlap with the | 211 // rest of the function into account to avoid overlap with the |
212 // parsing statistics. | 212 // parsing statistics. |
213 HistogramTimer* rate = is_eval | 213 HistogramTimer* rate = is_eval |
214 ? &Counters::compile_eval | 214 ? &Counters::compile_eval |
215 : &Counters::compile; | 215 : &Counters::compile; |
216 HistogramTimerScope timer(rate); | 216 HistogramTimerScope timer(rate); |
217 | 217 |
218 // Compile the code. | 218 // Compile the code. |
219 CompilationInfo info(lit, script, is_eval); | 219 CompilationInfo info(lit, script, is_eval); |
220 Handle<Code> code = MakeCode(context, &info); | 220 Handle<Code> code = MakeCode(context, &info); |
221 | 221 |
222 // Check for stack-overflow exceptions. | 222 // Check for stack-overflow exceptions. |
223 if (code.is_null()) { | 223 if (code.is_null()) { |
224 Top::StackOverflow(); | 224 Top::StackOverflow(); |
225 return Handle<JSFunction>::null(); | 225 return Handle<SharedFunctionInfo>::null(); |
226 } | 226 } |
227 | 227 |
228 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT | 228 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT |
229 // Log the code generation for the script. Check explicit whether logging is | 229 // Log the code generation for the script. Check explicit whether logging is |
230 // to avoid allocating when not required. | 230 // to avoid allocating when not required. |
231 if (Logger::is_logging() || OProfileAgent::is_enabled()) { | 231 if (Logger::is_logging() || OProfileAgent::is_enabled()) { |
232 if (script->name()->IsString()) { | 232 if (script->name()->IsString()) { |
233 SmartPointer<char> data = | 233 SmartPointer<char> data = |
234 String::cast(script->name())->ToCString(DISALLOW_NULLS); | 234 String::cast(script->name())->ToCString(DISALLOW_NULLS); |
235 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, | 235 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, |
236 *code, *data)); | 236 *code, *data)); |
237 OProfileAgent::CreateNativeCodeRegion(*data, | 237 OProfileAgent::CreateNativeCodeRegion(*data, |
238 code->instruction_start(), | 238 code->instruction_start(), |
239 code->instruction_size()); | 239 code->instruction_size()); |
240 } else { | 240 } else { |
241 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, | 241 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, |
242 *code, "")); | 242 *code, "")); |
243 OProfileAgent::CreateNativeCodeRegion(is_eval ? "Eval" : "Script", | 243 OProfileAgent::CreateNativeCodeRegion(is_eval ? "Eval" : "Script", |
244 code->instruction_start(), | 244 code->instruction_start(), |
245 code->instruction_size()); | 245 code->instruction_size()); |
246 } | 246 } |
247 } | 247 } |
248 #endif | 248 #endif |
249 | 249 |
250 // Allocate function. | 250 // Allocate function. |
251 Handle<JSFunction> fun = | 251 Handle<SharedFunctionInfo> result = |
252 Factory::NewFunctionBoilerplate(lit->name(), | 252 Factory::NewSharedFunctionInfo(lit->name(), |
253 lit->materialized_literal_count(), | 253 lit->materialized_literal_count(), |
254 code); | 254 code); |
255 | 255 |
256 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); | 256 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); |
257 Compiler::SetFunctionInfo(fun, lit, true, script); | 257 Compiler::SetFunctionInfo(result, lit, true, script); |
258 | 258 |
259 // Hint to the runtime system used when allocating space for initial | 259 // Hint to the runtime system used when allocating space for initial |
260 // property space by setting the expected number of properties for | 260 // property space by setting the expected number of properties for |
261 // the instances of the function. | 261 // the instances of the function. |
262 SetExpectedNofPropertiesFromEstimate(fun, lit->expected_property_count()); | 262 SetExpectedNofPropertiesFromEstimate(result, lit->expected_property_count()); |
263 | 263 |
264 #ifdef ENABLE_DEBUGGER_SUPPORT | 264 #ifdef ENABLE_DEBUGGER_SUPPORT |
265 // Notify debugger | 265 // Notify debugger |
266 Debugger::OnAfterCompile(script, Debugger::NO_AFTER_COMPILE_FLAGS); | 266 Debugger::OnAfterCompile(script, Debugger::NO_AFTER_COMPILE_FLAGS); |
267 #endif | 267 #endif |
268 | 268 |
269 return fun; | 269 return result; |
270 } | 270 } |
271 | 271 |
272 | 272 |
273 static StaticResource<SafeStringInputBuffer> safe_string_input_buffer; | 273 static StaticResource<SafeStringInputBuffer> safe_string_input_buffer; |
274 | 274 |
275 | 275 |
276 Handle<JSFunction> Compiler::Compile(Handle<String> source, | 276 Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source, |
277 Handle<Object> script_name, | 277 Handle<Object> script_name, |
278 int line_offset, int column_offset, | 278 int line_offset, |
279 v8::Extension* extension, | 279 int column_offset, |
280 ScriptDataImpl* input_pre_data, | 280 v8::Extension* extension, |
281 Handle<Object> script_data, | 281 ScriptDataImpl* input_pre_data, |
282 NativesFlag natives) { | 282 Handle<Object> script_data, |
| 283 NativesFlag natives) { |
283 int source_length = source->length(); | 284 int source_length = source->length(); |
284 Counters::total_load_size.Increment(source_length); | 285 Counters::total_load_size.Increment(source_length); |
285 Counters::total_compile_size.Increment(source_length); | 286 Counters::total_compile_size.Increment(source_length); |
286 | 287 |
287 // The VM is in the COMPILER state until exiting this function. | 288 // The VM is in the COMPILER state until exiting this function. |
288 VMState state(COMPILER); | 289 VMState state(COMPILER); |
289 | 290 |
290 // Do a lookup in the compilation cache but not for extensions. | 291 // Do a lookup in the compilation cache but not for extensions. |
291 Handle<JSFunction> result; | 292 Handle<SharedFunctionInfo> result; |
292 if (extension == NULL) { | 293 if (extension == NULL) { |
293 result = CompilationCache::LookupScript(source, | 294 result = CompilationCache::LookupScript(source, |
294 script_name, | 295 script_name, |
295 line_offset, | 296 line_offset, |
296 column_offset); | 297 column_offset); |
297 } | 298 } |
298 | 299 |
299 if (result.is_null()) { | 300 if (result.is_null()) { |
300 // No cache entry found. Do pre-parsing and compile the script. | 301 // No cache entry found. Do pre-parsing and compile the script. |
301 ScriptDataImpl* pre_data = input_pre_data; | 302 ScriptDataImpl* pre_data = input_pre_data; |
(...skipping 11 matching lines...) Expand all Loading... |
313 if (!script_name.is_null()) { | 314 if (!script_name.is_null()) { |
314 script->set_name(*script_name); | 315 script->set_name(*script_name); |
315 script->set_line_offset(Smi::FromInt(line_offset)); | 316 script->set_line_offset(Smi::FromInt(line_offset)); |
316 script->set_column_offset(Smi::FromInt(column_offset)); | 317 script->set_column_offset(Smi::FromInt(column_offset)); |
317 } | 318 } |
318 | 319 |
319 script->set_data(script_data.is_null() ? Heap::undefined_value() | 320 script->set_data(script_data.is_null() ? Heap::undefined_value() |
320 : *script_data); | 321 : *script_data); |
321 | 322 |
322 // Compile the function and add it to the cache. | 323 // Compile the function and add it to the cache. |
323 result = MakeFunction(true, | 324 result = MakeFunctionInfo(true, |
324 false, | 325 false, |
325 DONT_VALIDATE_JSON, | 326 DONT_VALIDATE_JSON, |
326 script, | 327 script, |
327 Handle<Context>::null(), | 328 Handle<Context>::null(), |
328 extension, | 329 extension, |
329 pre_data); | 330 pre_data); |
330 if (extension == NULL && !result.is_null()) { | 331 if (extension == NULL && !result.is_null()) { |
331 CompilationCache::PutScript(source, result); | 332 CompilationCache::PutScript(source, result); |
332 } | 333 } |
333 | 334 |
334 // Get rid of the pre-parsing data (if necessary). | 335 // Get rid of the pre-parsing data (if necessary). |
335 if (input_pre_data == NULL && pre_data != NULL) { | 336 if (input_pre_data == NULL && pre_data != NULL) { |
336 delete pre_data; | 337 delete pre_data; |
337 } | 338 } |
338 } | 339 } |
339 | 340 |
340 if (result.is_null()) Top::ReportPendingMessages(); | 341 if (result.is_null()) Top::ReportPendingMessages(); |
341 return result; | 342 return result; |
342 } | 343 } |
343 | 344 |
344 | 345 |
345 Handle<JSFunction> Compiler::CompileEval(Handle<String> source, | 346 Handle<SharedFunctionInfo> Compiler::CompileEval(Handle<String> source, |
346 Handle<Context> context, | 347 Handle<Context> context, |
347 bool is_global, | 348 bool is_global, |
348 ValidationState validate) { | 349 ValidationState validate) { |
349 // Note that if validation is required then no path through this | 350 // Note that if validation is required then no path through this |
350 // function is allowed to return a value without validating that | 351 // function is allowed to return a value without validating that |
351 // the input is legal json. | 352 // the input is legal json. |
352 | 353 |
353 int source_length = source->length(); | 354 int source_length = source->length(); |
354 Counters::total_eval_size.Increment(source_length); | 355 Counters::total_eval_size.Increment(source_length); |
355 Counters::total_compile_size.Increment(source_length); | 356 Counters::total_compile_size.Increment(source_length); |
356 | 357 |
357 // The VM is in the COMPILER state until exiting this function. | 358 // The VM is in the COMPILER state until exiting this function. |
358 VMState state(COMPILER); | 359 VMState state(COMPILER); |
359 | 360 |
360 // Do a lookup in the compilation cache; if the entry is not there, | 361 // Do a lookup in the compilation cache; if the entry is not there, |
361 // invoke the compiler and add the result to the cache. If we're | 362 // invoke the compiler and add the result to the cache. If we're |
362 // evaluating json we bypass the cache since we can't be sure a | 363 // evaluating json we bypass the cache since we can't be sure a |
363 // potential value in the cache has been validated. | 364 // potential value in the cache has been validated. |
364 Handle<JSFunction> result; | 365 Handle<SharedFunctionInfo> result; |
365 if (validate == DONT_VALIDATE_JSON) | 366 if (validate == DONT_VALIDATE_JSON) |
366 result = CompilationCache::LookupEval(source, context, is_global); | 367 result = CompilationCache::LookupEval(source, context, is_global); |
367 | 368 |
368 if (result.is_null()) { | 369 if (result.is_null()) { |
369 // Create a script object describing the script to be compiled. | 370 // Create a script object describing the script to be compiled. |
370 Handle<Script> script = Factory::NewScript(source); | 371 Handle<Script> script = Factory::NewScript(source); |
371 result = MakeFunction(is_global, | 372 result = MakeFunctionInfo(is_global, |
372 true, | 373 true, |
373 validate, | 374 validate, |
374 script, | 375 script, |
375 context, | 376 context, |
376 NULL, | 377 NULL, |
377 NULL); | 378 NULL); |
378 if (!result.is_null() && validate != VALIDATE_JSON) { | 379 if (!result.is_null() && validate != VALIDATE_JSON) { |
379 // For json it's unlikely that we'll ever see exactly the same | 380 // For json it's unlikely that we'll ever see exactly the same |
380 // string again so we don't use the compilation cache. | 381 // string again so we don't use the compilation cache. |
381 CompilationCache::PutEval(source, context, is_global, result); | 382 CompilationCache::PutEval(source, context, is_global, result); |
382 } | 383 } |
383 } | 384 } |
384 | 385 |
385 return result; | 386 return result; |
386 } | 387 } |
387 | 388 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 shared->SetThisPropertyAssignmentsInfo( | 453 shared->SetThisPropertyAssignmentsInfo( |
453 lit->has_only_simple_this_property_assignments(), | 454 lit->has_only_simple_this_property_assignments(), |
454 *lit->this_property_assignments()); | 455 *lit->this_property_assignments()); |
455 | 456 |
456 // Check the function has compiled code. | 457 // Check the function has compiled code. |
457 ASSERT(shared->is_compiled()); | 458 ASSERT(shared->is_compiled()); |
458 return true; | 459 return true; |
459 } | 460 } |
460 | 461 |
461 | 462 |
462 Handle<JSFunction> Compiler::BuildBoilerplate(FunctionLiteral* literal, | 463 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, |
463 Handle<Script> script, | 464 Handle<Script> script, |
464 AstVisitor* caller) { | 465 AstVisitor* caller) { |
465 #ifdef DEBUG | 466 #ifdef DEBUG |
466 // We should not try to compile the same function literal more than | 467 // We should not try to compile the same function literal more than |
467 // once. | 468 // once. |
468 literal->mark_as_compiled(); | 469 literal->mark_as_compiled(); |
469 #endif | 470 #endif |
470 | 471 |
471 // Determine if the function can be lazily compiled. This is | 472 // Determine if the function can be lazily compiled. This is |
472 // necessary to allow some of our builtin JS files to be lazily | 473 // necessary to allow some of our builtin JS files to be lazily |
473 // compiled. These builtins cannot be handled lazily by the parser, | 474 // compiled. These builtins cannot be handled lazily by the parser, |
474 // since we have to know if a function uses the special natives | 475 // since we have to know if a function uses the special natives |
475 // syntax, which is something the parser records. | 476 // syntax, which is something the parser records. |
476 bool allow_lazy = literal->AllowsLazyCompilation() && | 477 bool allow_lazy = literal->AllowsLazyCompilation() && |
477 !LiveEditFunctionTracker::IsActive(); | 478 !LiveEditFunctionTracker::IsActive(); |
478 | 479 |
479 // Generate code | 480 // Generate code |
480 Handle<Code> code; | 481 Handle<Code> code; |
481 if (FLAG_lazy && allow_lazy) { | 482 if (FLAG_lazy && allow_lazy) { |
482 code = ComputeLazyCompile(literal->num_parameters()); | 483 code = ComputeLazyCompile(literal->num_parameters()); |
483 } else { | 484 } else { |
484 // The bodies of function literals have not yet been visited by | 485 // The bodies of function literals have not yet been visited by |
485 // the AST optimizer/analyzer. | 486 // the AST optimizer/analyzer. |
486 if (!Rewriter::Optimize(literal)) { | 487 if (!Rewriter::Optimize(literal)) { |
487 return Handle<JSFunction>::null(); | 488 return Handle<SharedFunctionInfo>::null(); |
488 } | 489 } |
489 | 490 |
490 if (literal->scope()->num_parameters() > 0 || | 491 if (literal->scope()->num_parameters() > 0 || |
491 literal->scope()->num_stack_slots()) { | 492 literal->scope()->num_stack_slots()) { |
492 AssignedVariablesAnalyzer ava(literal); | 493 AssignedVariablesAnalyzer ava(literal); |
493 ava.Analyze(); | 494 ava.Analyze(); |
494 if (ava.HasStackOverflow()) { | 495 if (ava.HasStackOverflow()) { |
495 return Handle<JSFunction>::null(); | 496 return Handle<SharedFunctionInfo>::null(); |
496 } | 497 } |
497 } | 498 } |
498 | 499 |
499 if (FLAG_use_flow_graph) { | 500 if (FLAG_use_flow_graph) { |
500 int variable_count = | 501 int variable_count = |
501 literal->num_parameters() + literal->scope()->num_stack_slots(); | 502 literal->num_parameters() + literal->scope()->num_stack_slots(); |
502 FlowGraphBuilder builder(variable_count); | 503 FlowGraphBuilder builder(variable_count); |
503 builder.Build(literal); | 504 builder.Build(literal); |
504 | 505 |
505 if (!builder.HasStackOverflow()) { | 506 if (!builder.HasStackOverflow()) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 547 } |
547 | 548 |
548 if (!is_compiled) { | 549 if (!is_compiled) { |
549 // We fall back to the classic V8 code generator. | 550 // We fall back to the classic V8 code generator. |
550 code = CodeGenerator::MakeCode(&info); | 551 code = CodeGenerator::MakeCode(&info); |
551 } | 552 } |
552 | 553 |
553 // Check for stack-overflow exception. | 554 // Check for stack-overflow exception. |
554 if (code.is_null()) { | 555 if (code.is_null()) { |
555 caller->SetStackOverflow(); | 556 caller->SetStackOverflow(); |
556 return Handle<JSFunction>::null(); | 557 return Handle<SharedFunctionInfo>::null(); |
557 } | 558 } |
558 | 559 |
559 // Function compilation complete. | 560 // Function compilation complete. |
560 | 561 |
561 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT | 562 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT |
562 LogCodeCreateEvent(Logger::FUNCTION_TAG, | 563 LogCodeCreateEvent(Logger::FUNCTION_TAG, |
563 literal->name(), | 564 literal->name(), |
564 literal->inferred_name(), | 565 literal->inferred_name(), |
565 literal->start_position(), | 566 literal->start_position(), |
566 script, | 567 script, |
567 code); | 568 code); |
568 #endif | 569 #endif |
569 } | 570 } |
570 | 571 |
571 // Create a boilerplate function. | 572 // Create a boilerplate function. |
572 Handle<JSFunction> function = | 573 Handle<SharedFunctionInfo> result = |
573 Factory::NewFunctionBoilerplate(literal->name(), | 574 Factory::NewSharedFunctionInfo(literal->name(), |
574 literal->materialized_literal_count(), | 575 literal->materialized_literal_count(), |
575 code); | 576 code); |
576 SetFunctionInfo(function, literal, false, script); | 577 SetFunctionInfo(result, literal, false, script); |
577 | |
578 #ifdef ENABLE_DEBUGGER_SUPPORT | |
579 // Notify debugger that a new function has been added. | |
580 Debugger::OnNewFunction(function); | |
581 #endif | |
582 | 578 |
583 // Set the expected number of properties for instances and return | 579 // Set the expected number of properties for instances and return |
584 // the resulting function. | 580 // the resulting function. |
585 SetExpectedNofPropertiesFromEstimate(function, | 581 SetExpectedNofPropertiesFromEstimate(result, |
586 literal->expected_property_count()); | 582 literal->expected_property_count()); |
587 return function; | 583 return result; |
588 } | 584 } |
589 | 585 |
590 | 586 |
591 // Sets the function info on a function. | 587 // Sets the function info on a function. |
592 // The start_position points to the first '(' character after the function name | 588 // The start_position points to the first '(' character after the function name |
593 // in the full script source. When counting characters in the script source the | 589 // in the full script source. When counting characters in the script source the |
594 // the first character is number 0 (not 1). | 590 // the first character is number 0 (not 1). |
595 void Compiler::SetFunctionInfo(Handle<JSFunction> fun, | 591 void Compiler::SetFunctionInfo(Handle<SharedFunctionInfo> function_info, |
596 FunctionLiteral* lit, | 592 FunctionLiteral* lit, |
597 bool is_toplevel, | 593 bool is_toplevel, |
598 Handle<Script> script) { | 594 Handle<Script> script) { |
599 fun->shared()->set_length(lit->num_parameters()); | 595 function_info->set_length(lit->num_parameters()); |
600 fun->shared()->set_formal_parameter_count(lit->num_parameters()); | 596 function_info->set_formal_parameter_count(lit->num_parameters()); |
601 fun->shared()->set_script(*script); | 597 function_info->set_script(*script); |
602 fun->shared()->set_function_token_position(lit->function_token_position()); | 598 function_info->set_function_token_position(lit->function_token_position()); |
603 fun->shared()->set_start_position(lit->start_position()); | 599 function_info->set_start_position(lit->start_position()); |
604 fun->shared()->set_end_position(lit->end_position()); | 600 function_info->set_end_position(lit->end_position()); |
605 fun->shared()->set_is_expression(lit->is_expression()); | 601 function_info->set_is_expression(lit->is_expression()); |
606 fun->shared()->set_is_toplevel(is_toplevel); | 602 function_info->set_is_toplevel(is_toplevel); |
607 fun->shared()->set_inferred_name(*lit->inferred_name()); | 603 function_info->set_inferred_name(*lit->inferred_name()); |
608 fun->shared()->SetThisPropertyAssignmentsInfo( | 604 function_info->SetThisPropertyAssignmentsInfo( |
609 lit->has_only_simple_this_property_assignments(), | 605 lit->has_only_simple_this_property_assignments(), |
610 *lit->this_property_assignments()); | 606 *lit->this_property_assignments()); |
611 fun->shared()->set_try_full_codegen(lit->try_full_codegen()); | 607 function_info->set_try_full_codegen(lit->try_full_codegen()); |
612 } | 608 } |
613 | 609 |
614 | 610 |
615 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT | 611 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT |
616 void Compiler::LogCodeCreateEvent(Logger::LogEventsAndTags tag, | 612 void Compiler::LogCodeCreateEvent(Logger::LogEventsAndTags tag, |
617 Handle<String> name, | 613 Handle<String> name, |
618 Handle<String> inferred_name, | 614 Handle<String> inferred_name, |
619 int start_position, | 615 int start_position, |
620 Handle<Script> script, | 616 Handle<Script> script, |
621 Handle<Code> code) { | 617 Handle<Code> code) { |
(...skipping 15 matching lines...) Expand all Loading... |
637 LOG(CodeCreateEvent(tag, *code, *func_name)); | 633 LOG(CodeCreateEvent(tag, *code, *func_name)); |
638 OProfileAgent::CreateNativeCodeRegion(*func_name, | 634 OProfileAgent::CreateNativeCodeRegion(*func_name, |
639 code->instruction_start(), | 635 code->instruction_start(), |
640 code->instruction_size()); | 636 code->instruction_size()); |
641 } | 637 } |
642 } | 638 } |
643 } | 639 } |
644 #endif | 640 #endif |
645 | 641 |
646 } } // namespace v8::internal | 642 } } // namespace v8::internal |
OLD | NEW |