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

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: Addressed feedback. 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
« no previous file with comments | « src/compiler.h ('k') | src/feedback-slots.h » ('j') | no next file with comments »
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 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::PrepareForCompilation(Scope* scope) {
247 ASSERT(scope_ == NULL);
248 scope_ = scope;
249 function()->ProcessFeedbackSlots(isolate_);
250 }
251
252
246 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { 253 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder {
247 public: 254 public:
248 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) 255 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info)
249 : HOptimizedGraphBuilder(info) { 256 : HOptimizedGraphBuilder(info) {
250 } 257 }
251 258
252 #define DEF_VISIT(type) \ 259 #define DEF_VISIT(type) \
253 virtual void Visit##type(type* node) V8_OVERRIDE { \ 260 virtual void Visit##type(type* node) V8_OVERRIDE { \
254 if (node->position() != RelocInfo::kNoPosition) { \ 261 if (node->position() != RelocInfo::kNoPosition) { \
255 SetSourcePosition(node->position()); \ 262 SetSourcePosition(node->position()); \
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); 363 bool should_recompile = !info()->shared_info()->has_deoptimization_support();
357 if (should_recompile || FLAG_hydrogen_stats) { 364 if (should_recompile || FLAG_hydrogen_stats) {
358 ElapsedTimer timer; 365 ElapsedTimer timer;
359 if (FLAG_hydrogen_stats) { 366 if (FLAG_hydrogen_stats) {
360 timer.Start(); 367 timer.Start();
361 } 368 }
362 CompilationInfoWithZone unoptimized(info()->shared_info()); 369 CompilationInfoWithZone unoptimized(info()->shared_info());
363 // Note that we use the same AST that we will use for generating the 370 // Note that we use the same AST that we will use for generating the
364 // optimized code. 371 // optimized code.
365 unoptimized.SetFunction(info()->function()); 372 unoptimized.SetFunction(info()->function());
366 unoptimized.SetScope(info()->scope()); 373 unoptimized.PrepareForCompilation(info()->scope());
367 unoptimized.SetContext(info()->context()); 374 unoptimized.SetContext(info()->context());
368 if (should_recompile) unoptimized.EnableDeoptimizationSupport(); 375 if (should_recompile) unoptimized.EnableDeoptimizationSupport();
369 bool succeeded = FullCodeGenerator::MakeCode(&unoptimized); 376 bool succeeded = FullCodeGenerator::MakeCode(&unoptimized);
370 if (should_recompile) { 377 if (should_recompile) {
371 if (!succeeded) return SetLastStatus(FAILED); 378 if (!succeeded) return SetLastStatus(FAILED);
372 Handle<SharedFunctionInfo> shared = info()->shared_info(); 379 Handle<SharedFunctionInfo> shared = info()->shared_info();
373 shared->EnableDeoptimizationSupport(*unoptimized.code()); 380 shared->EnableDeoptimizationSupport(*unoptimized.code());
374 // The existing unoptimized code was replaced with the new one. 381 // The existing unoptimized code was replaced with the new one.
375 Compiler::RecordFunctionCompilation( 382 Compiler::RecordFunctionCompilation(
376 Logger::LAZY_COMPILE_TAG, &unoptimized, shared); 383 Logger::LAZY_COMPILE_TAG, &unoptimized, shared);
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
982 // Precondition: code has been parsed and scopes have been analyzed. 989 // Precondition: code has been parsed and scopes have been analyzed.
983 CompilationInfoWithZone info(script); 990 CompilationInfoWithZone info(script);
984 info.SetFunction(literal); 991 info.SetFunction(literal);
985 info.SetScope(literal->scope()); 992 info.PrepareForCompilation(literal->scope());
986 info.SetLanguageMode(literal->scope()->language_mode()); 993 info.SetLanguageMode(literal->scope()->language_mode());
987 994
988 Isolate* isolate = info.isolate(); 995 Isolate* isolate = info.isolate();
989 Factory* factory = isolate->factory(); 996 Factory* factory = isolate->factory();
990 LiveEditFunctionTracker live_edit_tracker(isolate, literal); 997 LiveEditFunctionTracker live_edit_tracker(isolate, literal);
991 // Determine if the function can be lazily compiled. This is necessary to 998 // 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 999 // 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 1000 // 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 1001 // if a function uses the special natives syntax, which is something the
995 // parser records. 1002 // parser records.
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 AllowHandleDereference allow_deref; 1298 AllowHandleDereference allow_deref;
1292 bool tracing_on = info()->IsStub() 1299 bool tracing_on = info()->IsStub()
1293 ? FLAG_trace_hydrogen_stubs 1300 ? FLAG_trace_hydrogen_stubs
1294 : (FLAG_trace_hydrogen && 1301 : (FLAG_trace_hydrogen &&
1295 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1302 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1296 return (tracing_on && 1303 return (tracing_on &&
1297 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1304 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1298 } 1305 }
1299 1306
1300 } } // namespace v8::internal 1307 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/feedback-slots.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698