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

Side by Side Diff: src/compiler.cc

Issue 477263002: ES6: Add support for method shorthand in object literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 lit->AllowsLazyCompilationWithoutContext()); 655 lit->AllowsLazyCompilationWithoutContext());
656 function_info->set_strict_mode(lit->strict_mode()); 656 function_info->set_strict_mode(lit->strict_mode());
657 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); 657 function_info->set_uses_arguments(lit->scope()->arguments() != NULL);
658 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); 658 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters());
659 function_info->set_ast_node_count(lit->ast_node_count()); 659 function_info->set_ast_node_count(lit->ast_node_count());
660 function_info->set_is_function(lit->is_function()); 660 function_info->set_is_function(lit->is_function());
661 function_info->set_bailout_reason(lit->dont_optimize_reason()); 661 function_info->set_bailout_reason(lit->dont_optimize_reason());
662 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); 662 function_info->set_dont_cache(lit->flags()->Contains(kDontCache));
663 function_info->set_is_generator(lit->is_generator()); 663 function_info->set_is_generator(lit->is_generator());
664 function_info->set_is_arrow(lit->is_arrow()); 664 function_info->set_is_arrow(lit->is_arrow());
665 function_info->set_is_concise_method(lit->is_concise_method());
665 } 666 }
666 667
667 668
668 static bool CompileUnoptimizedCode(CompilationInfo* info) { 669 static bool CompileUnoptimizedCode(CompilationInfo* info) {
669 DCHECK(AllowCompilation::IsAllowed(info->isolate())); 670 DCHECK(AllowCompilation::IsAllowed(info->isolate()));
670 DCHECK(info->function() != NULL); 671 DCHECK(info->function() != NULL);
671 if (!Rewriter::Rewrite(info)) return false; 672 if (!Rewriter::Rewrite(info)) return false;
672 if (!Scope::Analyze(info)) return false; 673 if (!Scope::Analyze(info)) return false;
673 DCHECK(info->scope() != NULL); 674 DCHECK(info->scope() != NULL);
674 675
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 872
872 // Compile the code. 873 // Compile the code.
873 if (!CompileUnoptimizedCode(info)) { 874 if (!CompileUnoptimizedCode(info)) {
874 return Handle<SharedFunctionInfo>::null(); 875 return Handle<SharedFunctionInfo>::null();
875 } 876 }
876 877
877 // Allocate function. 878 // Allocate function.
878 DCHECK(!info->code().is_null()); 879 DCHECK(!info->code().is_null());
879 result = isolate->factory()->NewSharedFunctionInfo( 880 result = isolate->factory()->NewSharedFunctionInfo(
880 lit->name(), lit->materialized_literal_count(), lit->is_generator(), 881 lit->name(), lit->materialized_literal_count(), lit->is_generator(),
881 lit->is_arrow(), info->code(), 882 lit->is_arrow(), lit->is_concise_method(), info->code(),
882 ScopeInfo::Create(info->scope(), info->zone()), 883 ScopeInfo::Create(info->scope(), info->zone()),
883 info->feedback_vector()); 884 info->feedback_vector());
884 885
885 DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position()); 886 DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position());
886 SetFunctionInfo(result, lit, true, script); 887 SetFunctionInfo(result, lit, true, script);
887 888
888 Handle<String> script_name = script->name()->IsString() 889 Handle<String> script_name = script->name()->IsString()
889 ? Handle<String>(String::cast(script->name())) 890 ? Handle<String>(String::cast(script->name()))
890 : isolate->factory()->empty_string(); 891 : isolate->factory()->empty_string();
891 Logger::LogEventsAndTags log_tag = info->is_eval() 892 Logger::LogEventsAndTags log_tag = info->is_eval()
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 } else if (FullCodeGenerator::MakeCode(&info)) { 1095 } else if (FullCodeGenerator::MakeCode(&info)) {
1095 DCHECK(!info.code().is_null()); 1096 DCHECK(!info.code().is_null());
1096 scope_info = ScopeInfo::Create(info.scope(), info.zone()); 1097 scope_info = ScopeInfo::Create(info.scope(), info.zone());
1097 } else { 1098 } else {
1098 return Handle<SharedFunctionInfo>::null(); 1099 return Handle<SharedFunctionInfo>::null();
1099 } 1100 }
1100 1101
1101 // Create a shared function info object. 1102 // Create a shared function info object.
1102 Handle<SharedFunctionInfo> result = factory->NewSharedFunctionInfo( 1103 Handle<SharedFunctionInfo> result = factory->NewSharedFunctionInfo(
1103 literal->name(), literal->materialized_literal_count(), 1104 literal->name(), literal->materialized_literal_count(),
1104 literal->is_generator(), literal->is_arrow(), info.code(), scope_info, 1105 literal->is_generator(), literal->is_arrow(),
1106 literal->is_concise_method(), info.code(), scope_info,
1105 info.feedback_vector()); 1107 info.feedback_vector());
1106 SetFunctionInfo(result, literal, false, script); 1108 SetFunctionInfo(result, literal, false, script);
1107 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); 1109 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result);
1108 result->set_allows_lazy_compilation(allow_lazy); 1110 result->set_allows_lazy_compilation(allow_lazy);
1109 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); 1111 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx);
1110 1112
1111 // Set the expected number of properties for instances and return 1113 // Set the expected number of properties for instances and return
1112 // the resulting function. 1114 // the resulting function.
1113 SetExpectedNofPropertiesFromEstimate(result, 1115 SetExpectedNofPropertiesFromEstimate(result,
1114 literal->expected_property_count()); 1116 literal->expected_property_count());
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 AllowHandleDereference allow_deref; 1384 AllowHandleDereference allow_deref;
1383 bool tracing_on = info()->IsStub() 1385 bool tracing_on = info()->IsStub()
1384 ? FLAG_trace_hydrogen_stubs 1386 ? FLAG_trace_hydrogen_stubs
1385 : (FLAG_trace_hydrogen && 1387 : (FLAG_trace_hydrogen &&
1386 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1388 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1387 return (tracing_on && 1389 return (tracing_on &&
1388 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1390 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1389 } 1391 }
1390 1392
1391 } } // namespace v8::internal 1393 } } // namespace v8::internal
OLDNEW
« src/ast.h ('K') | « src/code-stubs-hydrogen.cc ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698