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

Side by Side Diff: src/compiler.cc

Issue 137403009: Adding a type vector to replace type cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: PORTS. Created 6 years, 10 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 // 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. 236 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time.
237 bool CompilationInfo::ShouldSelfOptimize() { 237 bool CompilationInfo::ShouldSelfOptimize() {
238 return FLAG_crankshaft && 238 return FLAG_crankshaft &&
239 !function()->flags()->Contains(kDontSelfOptimize) && 239 !function()->flags()->Contains(kDontSelfOptimize) &&
240 !function()->dont_optimize() && 240 !function()->dont_optimize() &&
241 function()->scope()->AllowsLazyCompilation() && 241 function()->scope()->AllowsLazyCompilation() &&
242 (shared_info().is_null() || !shared_info()->optimization_disabled()); 242 (shared_info().is_null() || !shared_info()->optimization_disabled());
243 } 243 }
244 244
245 245
246 void CompilationInfo::ProcessFeedbackSlots() {
Benedikt Meurer 2014/02/04 08:53:50 Why is this in CompilationInfo? And why do we need
mvstanton 2014/02/04 13:03:27 I managed to reduce this to a single chokepoint, S
247 // Scope analysis must have been done.
Benedikt Meurer 2014/02/04 08:53:50 Can we ASSERT that?
mvstanton 2014/02/04 13:03:27 It's enough to do the work in InitializeScope() no
248 function()->ProcessFeedbackSlots(isolate_);
249 }
250
251
246 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { 252 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder {
247 public: 253 public:
248 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) 254 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info)
249 : HOptimizedGraphBuilder(info) { 255 : HOptimizedGraphBuilder(info) {
250 } 256 }
251 257
252 #define DEF_VISIT(type) \ 258 #define DEF_VISIT(type) \
253 virtual void Visit##type(type* node) V8_OVERRIDE { \ 259 virtual void Visit##type(type* node) V8_OVERRIDE { \
254 if (node->position() != RelocInfo::kNoPosition) { \ 260 if (node->position() != RelocInfo::kNoPosition) { \
255 SetSourcePosition(node->position()); \ 261 SetSourcePosition(node->position()); \
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); 612 function_info->set_dont_cache(lit->flags()->Contains(kDontCache));
607 function_info->set_is_generator(lit->is_generator()); 613 function_info->set_is_generator(lit->is_generator());
608 } 614 }
609 615
610 616
611 static bool CompileUnoptimizedCode(CompilationInfo* info) { 617 static bool CompileUnoptimizedCode(CompilationInfo* info) {
612 ASSERT(info->function() != NULL); 618 ASSERT(info->function() != NULL);
613 if (!Rewriter::Rewrite(info)) return false; 619 if (!Rewriter::Rewrite(info)) return false;
614 if (!Scope::Analyze(info)) return false; 620 if (!Scope::Analyze(info)) return false;
615 ASSERT(info->scope() != NULL); 621 ASSERT(info->scope() != NULL);
622 info->ProcessFeedbackSlots();
616 623
617 if (!FullCodeGenerator::MakeCode(info)) { 624 if (!FullCodeGenerator::MakeCode(info)) {
618 Isolate* isolate = info->isolate(); 625 Isolate* isolate = info->isolate();
619 if (!isolate->has_pending_exception()) isolate->StackOverflow(); 626 if (!isolate->has_pending_exception()) isolate->StackOverflow();
620 return false; 627 return false;
621 } 628 }
622 return true; 629 return true;
623 } 630 }
624 631
625 632
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 } else if (result->ic_age() != isolate->heap()->global_ic_age()) { 978 } else if (result->ic_age() != isolate->heap()->global_ic_age()) {
972 result->ResetForNewContext(isolate->heap()->global_ic_age()); 979 result->ResetForNewContext(isolate->heap()->global_ic_age());
973 } 980 }
974 981
975 if (result.is_null()) isolate->ReportPendingMessages(); 982 if (result.is_null()) isolate->ReportPendingMessages();
976 return result; 983 return result;
977 } 984 }
978 985
979 986
980 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, 987 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal,
981 Handle<Script> script) { 988 Handle<Script> script,
989 bool process_feedback) {
982 // Precondition: code has been parsed and scopes have been analyzed. 990 // Precondition: code has been parsed and scopes have been analyzed.
983 CompilationInfoWithZone info(script); 991 CompilationInfoWithZone info(script);
984 info.SetFunction(literal); 992 info.SetFunction(literal);
985 info.SetScope(literal->scope()); 993 info.SetScope(literal->scope());
994 if (process_feedback) {
995 info.ProcessFeedbackSlots();
996 }
986 info.SetLanguageMode(literal->scope()->language_mode()); 997 info.SetLanguageMode(literal->scope()->language_mode());
987 998
988 Isolate* isolate = info.isolate(); 999 Isolate* isolate = info.isolate();
989 Factory* factory = isolate->factory(); 1000 Factory* factory = isolate->factory();
990 LiveEditFunctionTracker live_edit_tracker(isolate, literal); 1001 LiveEditFunctionTracker live_edit_tracker(isolate, literal);
991 // Determine if the function can be lazily compiled. This is necessary to 1002 // Determine if the function can be lazily compiled. This is necessary to
992 // allow some of our builtin JS files to be lazily compiled. These 1003 // allow some of our builtin JS files to be lazily compiled. These
993 // builtins cannot be handled lazily by the parser, since we have to know 1004 // builtins cannot be handled lazily by the parser, since we have to know
994 // if a function uses the special natives syntax, which is something the 1005 // if a function uses the special natives syntax, which is something the
995 // parser records. 1006 // parser records.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 } 1087 }
1077 1088
1078 1089
1079 static bool CompileOptimizedPrologue(CompilationInfo* info) { 1090 static bool CompileOptimizedPrologue(CompilationInfo* info) {
1080 if (!Parser::Parse(info)) return false; 1091 if (!Parser::Parse(info)) return false;
1081 LanguageMode language_mode = info->function()->language_mode(); 1092 LanguageMode language_mode = info->function()->language_mode();
1082 info->SetLanguageMode(language_mode); 1093 info->SetLanguageMode(language_mode);
1083 1094
1084 if (!Rewriter::Rewrite(info)) return false; 1095 if (!Rewriter::Rewrite(info)) return false;
1085 if (!Scope::Analyze(info)) return false; 1096 if (!Scope::Analyze(info)) return false;
1097 info->ProcessFeedbackSlots();
1086 ASSERT(info->scope() != NULL); 1098 ASSERT(info->scope() != NULL);
1087 return true; 1099 return true;
1088 } 1100 }
1089 1101
1090 1102
1091 static bool GetOptimizedCodeNow(CompilationInfo* info) { 1103 static bool GetOptimizedCodeNow(CompilationInfo* info) {
1092 if (!CompileOptimizedPrologue(info)) return false; 1104 if (!CompileOptimizedPrologue(info)) return false;
1093 1105
1094 Logger::TimerEventScope timer( 1106 Logger::TimerEventScope timer(
1095 info->isolate(), Logger::TimerEventScope::v8_recompile_synchronous); 1107 info->isolate(), Logger::TimerEventScope::v8_recompile_synchronous);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 AllowHandleDereference allow_deref; 1303 AllowHandleDereference allow_deref;
1292 bool tracing_on = info()->IsStub() 1304 bool tracing_on = info()->IsStub()
1293 ? FLAG_trace_hydrogen_stubs 1305 ? FLAG_trace_hydrogen_stubs
1294 : (FLAG_trace_hydrogen && 1306 : (FLAG_trace_hydrogen &&
1295 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1307 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1296 return (tracing_on && 1308 return (tracing_on &&
1297 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1309 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1298 } 1310 }
1299 1311
1300 } } // namespace v8::internal 1312 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698