OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 | 402 |
403 // Only allow non-global compiles for eval. | 403 // Only allow non-global compiles for eval. |
404 ASSERT(info->is_eval() || info->is_global()); | 404 ASSERT(info->is_eval() || info->is_global()); |
405 | 405 |
406 if (!ParserApi::Parse(info)) return Handle<SharedFunctionInfo>::null(); | 406 if (!ParserApi::Parse(info)) return Handle<SharedFunctionInfo>::null(); |
407 | 407 |
408 // Measure how long it takes to do the compilation; only take the | 408 // Measure how long it takes to do the compilation; only take the |
409 // rest of the function into account to avoid overlap with the | 409 // rest of the function into account to avoid overlap with the |
410 // parsing statistics. | 410 // parsing statistics. |
411 HistogramTimer* rate = info->is_eval() | 411 HistogramTimer* rate = info->is_eval() |
412 ? COUNTERS->compile_eval() | 412 ? info->isolate()->counters()->compile_eval() |
413 : COUNTERS->compile(); | 413 : info->isolate()->counters()->compile(); |
414 HistogramTimerScope timer(rate); | 414 HistogramTimerScope timer(rate); |
415 | 415 |
416 // Compile the code. | 416 // Compile the code. |
417 FunctionLiteral* lit = info->function(); | 417 FunctionLiteral* lit = info->function(); |
418 LiveEditFunctionTracker live_edit_tracker(isolate, lit); | 418 LiveEditFunctionTracker live_edit_tracker(isolate, lit); |
419 if (!MakeCode(info)) { | 419 if (!MakeCode(info)) { |
420 isolate->StackOverflow(); | 420 isolate->StackOverflow(); |
421 return Handle<SharedFunctionInfo>::null(); | 421 return Handle<SharedFunctionInfo>::null(); |
422 } | 422 } |
423 | 423 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 473 |
474 | 474 |
475 Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source, | 475 Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source, |
476 Handle<Object> script_name, | 476 Handle<Object> script_name, |
477 int line_offset, | 477 int line_offset, |
478 int column_offset, | 478 int column_offset, |
479 v8::Extension* extension, | 479 v8::Extension* extension, |
480 ScriptDataImpl* input_pre_data, | 480 ScriptDataImpl* input_pre_data, |
481 Handle<Object> script_data, | 481 Handle<Object> script_data, |
482 NativesFlag natives) { | 482 NativesFlag natives) { |
483 Isolate* isolate = Isolate::Current(); | 483 Isolate* isolate = source->GetIsolate(); |
484 int source_length = source->length(); | 484 int source_length = source->length(); |
485 COUNTERS->total_load_size()->Increment(source_length); | 485 isolate->counters()->total_load_size()->Increment(source_length); |
486 COUNTERS->total_compile_size()->Increment(source_length); | 486 isolate->counters()->total_compile_size()->Increment(source_length); |
487 | 487 |
488 // The VM is in the COMPILER state until exiting this function. | 488 // The VM is in the COMPILER state until exiting this function. |
489 VMState state(isolate, COMPILER); | 489 VMState state(isolate, COMPILER); |
490 | 490 |
491 CompilationCache* compilation_cache = isolate->compilation_cache(); | 491 CompilationCache* compilation_cache = isolate->compilation_cache(); |
492 | 492 |
493 // Do a lookup in the compilation cache but not for extensions. | 493 // Do a lookup in the compilation cache but not for extensions. |
494 Handle<SharedFunctionInfo> result; | 494 Handle<SharedFunctionInfo> result; |
495 if (extension == NULL) { | 495 if (extension == NULL) { |
496 result = compilation_cache->LookupScript(source, | 496 result = compilation_cache->LookupScript(source, |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 shared->DebugName())); | 820 shared->DebugName())); |
821 } | 821 } |
822 } | 822 } |
823 | 823 |
824 GDBJIT(AddCode(name, | 824 GDBJIT(AddCode(name, |
825 Handle<Script>(info->script()), | 825 Handle<Script>(info->script()), |
826 Handle<Code>(info->code()))); | 826 Handle<Code>(info->code()))); |
827 } | 827 } |
828 | 828 |
829 } } // namespace v8::internal | 829 } } // namespace v8::internal |
OLD | NEW |