Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: src/compiler.cc

Issue 10690043: Implement proper module linking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Michael's comments. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ast.cc ('k') | src/contexts.h » ('j') | src/full-codegen.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 526
527 // Compile the function and add it to the cache. 527 // Compile the function and add it to the cache.
528 CompilationInfoWithZone info(script); 528 CompilationInfoWithZone info(script);
529 info.MarkAsGlobal(); 529 info.MarkAsGlobal();
530 info.SetExtension(extension); 530 info.SetExtension(extension);
531 info.SetPreParseData(pre_data); 531 info.SetPreParseData(pre_data);
532 if (FLAG_use_strict) { 532 if (FLAG_use_strict) {
533 info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE); 533 info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE);
534 } 534 }
535 result = MakeFunctionInfo(&info); 535 result = MakeFunctionInfo(&info);
536 if (extension == NULL && !result.is_null()) { 536 if (extension == NULL && !result.is_null() && !result->dont_cache()) {
537 compilation_cache->PutScript(source, result); 537 compilation_cache->PutScript(source, result);
538 } 538 }
539 } else { 539 } else {
540 if (result->ic_age() != HEAP->global_ic_age()) { 540 if (result->ic_age() != HEAP->global_ic_age()) {
541 result->ResetForNewContext(HEAP->global_ic_age()); 541 result->ResetForNewContext(HEAP->global_ic_age());
542 } 542 }
543 } 543 }
544 544
545 if (result.is_null()) isolate->ReportPendingMessages(); 545 if (result.is_null()) isolate->ReportPendingMessages();
546 return result; 546 return result;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 result->DisableOptimization(); 585 result->DisableOptimization();
586 586
587 // If caller is strict mode, the result must be in strict mode or 587 // If caller is strict mode, the result must be in strict mode or
588 // extended mode as well, but not the other way around. Consider: 588 // extended mode as well, but not the other way around. Consider:
589 // eval("'use strict'; ..."); 589 // eval("'use strict'; ...");
590 ASSERT(language_mode != STRICT_MODE || !result->is_classic_mode()); 590 ASSERT(language_mode != STRICT_MODE || !result->is_classic_mode());
591 // If caller is in extended mode, the result must also be in 591 // If caller is in extended mode, the result must also be in
592 // extended mode. 592 // extended mode.
593 ASSERT(language_mode != EXTENDED_MODE || 593 ASSERT(language_mode != EXTENDED_MODE ||
594 result->is_extended_mode()); 594 result->is_extended_mode());
595 compilation_cache->PutEval( 595 if (!result->dont_cache()) {
596 source, context, is_global, result, scope_position); 596 compilation_cache->PutEval(
597 source, context, is_global, result, scope_position);
598 }
597 } 599 }
598 } else { 600 } else {
599 if (result->ic_age() != HEAP->global_ic_age()) { 601 if (result->ic_age() != HEAP->global_ic_age()) {
600 result->ResetForNewContext(HEAP->global_ic_age()); 602 result->ResetForNewContext(HEAP->global_ic_age());
601 } 603 }
602 } 604 }
603 605
604 return result; 606 return result;
605 } 607 }
606 608
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 // compiled function. 702 // compiled function.
701 shared->SetThisPropertyAssignmentsInfo( 703 shared->SetThisPropertyAssignmentsInfo(
702 lit->has_only_simple_this_property_assignments(), 704 lit->has_only_simple_this_property_assignments(),
703 *lit->this_property_assignments()); 705 *lit->this_property_assignments());
704 706
705 // Check the function has compiled code. 707 // Check the function has compiled code.
706 ASSERT(shared->is_compiled()); 708 ASSERT(shared->is_compiled());
707 shared->set_code_age(0); 709 shared->set_code_age(0);
708 shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); 710 shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize));
709 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); 711 shared->set_dont_inline(lit->flags()->Contains(kDontInline));
712 shared->set_dont_cache(lit->flags()->Contains(kDontCache));
710 shared->set_ast_node_count(lit->ast_node_count()); 713 shared->set_ast_node_count(lit->ast_node_count());
711 714
712 if (V8::UseCrankshaft()&& 715 if (V8::UseCrankshaft()&&
713 !function.is_null() && 716 !function.is_null() &&
714 !shared->optimization_disabled()) { 717 !shared->optimization_disabled()) {
715 // If we're asked to always optimize, we compile the optimized 718 // If we're asked to always optimize, we compile the optimized
716 // version of the function right away - unless the debugger is 719 // version of the function right away - unless the debugger is
717 // active as it makes no sense to compile optimized code then. 720 // active as it makes no sense to compile optimized code then.
718 if (FLAG_always_opt && 721 if (FLAG_always_opt &&
719 !Isolate::Current()->DebuggerHasBreakPoints()) { 722 !Isolate::Current()->DebuggerHasBreakPoints()) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation()); 817 function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation());
815 function_info->set_allows_lazy_compilation_without_context( 818 function_info->set_allows_lazy_compilation_without_context(
816 lit->AllowsLazyCompilationWithoutContext()); 819 lit->AllowsLazyCompilationWithoutContext());
817 function_info->set_language_mode(lit->language_mode()); 820 function_info->set_language_mode(lit->language_mode());
818 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); 821 function_info->set_uses_arguments(lit->scope()->arguments() != NULL);
819 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); 822 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters());
820 function_info->set_ast_node_count(lit->ast_node_count()); 823 function_info->set_ast_node_count(lit->ast_node_count());
821 function_info->set_is_function(lit->is_function()); 824 function_info->set_is_function(lit->is_function());
822 function_info->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); 825 function_info->set_dont_optimize(lit->flags()->Contains(kDontOptimize));
823 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); 826 function_info->set_dont_inline(lit->flags()->Contains(kDontInline));
827 function_info->set_dont_cache(lit->flags()->Contains(kDontCache));
824 } 828 }
825 829
826 830
827 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, 831 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
828 CompilationInfo* info, 832 CompilationInfo* info,
829 Handle<SharedFunctionInfo> shared) { 833 Handle<SharedFunctionInfo> shared) {
830 // SharedFunctionInfo is passed separately, because if CompilationInfo 834 // SharedFunctionInfo is passed separately, because if CompilationInfo
831 // was created using Script object, it will not have it. 835 // was created using Script object, it will not have it.
832 836
833 // Log the code generation. If source information is available include 837 // Log the code generation. If source information is available include
(...skipping 23 matching lines...) Expand all
857 } 861 }
858 } 862 }
859 863
860 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 864 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
861 Handle<Script>(info->script()), 865 Handle<Script>(info->script()),
862 Handle<Code>(info->code()), 866 Handle<Code>(info->code()),
863 info)); 867 info));
864 } 868 }
865 869
866 } } // namespace v8::internal 870 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/contexts.h » ('j') | src/full-codegen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698