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

Side by Side Diff: src/compiler.cc

Issue 196343021: Revert "Continued fix for 351257. Reusing the feedback vector is too complex." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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/factory.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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 !function()->dont_optimize() && 242 !function()->dont_optimize() &&
243 function()->scope()->AllowsLazyCompilation() && 243 function()->scope()->AllowsLazyCompilation() &&
244 (shared_info().is_null() || !shared_info()->optimization_disabled()); 244 (shared_info().is_null() || !shared_info()->optimization_disabled());
245 } 245 }
246 246
247 247
248 void CompilationInfo::PrepareForCompilation(Scope* scope) { 248 void CompilationInfo::PrepareForCompilation(Scope* scope) {
249 ASSERT(scope_ == NULL); 249 ASSERT(scope_ == NULL);
250 scope_ = scope; 250 scope_ = scope;
251 function()->ProcessFeedbackSlots(isolate_); 251 function()->ProcessFeedbackSlots(isolate_);
252 int length = function()->slot_count();
253 // Allocate the feedback vector too.
254 feedback_vector_ = isolate()->factory()->NewFixedArray(length, TENURED);
255 // Ensure we can skip the write barrier
256 ASSERT_EQ(isolate()->heap()->uninitialized_symbol(),
257 *TypeFeedbackInfo::UninitializedSentinel(isolate()));
258 for (int i = 0; i < length; i++) {
259 feedback_vector_->set(i,
260 *TypeFeedbackInfo::UninitializedSentinel(isolate()),
261 SKIP_WRITE_BARRIER);
262 }
263 } 252 }
264 253
265 254
266 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { 255 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder {
267 public: 256 public:
268 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) 257 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info)
269 : HOptimizedGraphBuilder(info) { 258 : HOptimizedGraphBuilder(info) {
270 } 259 }
271 260
272 #define DEF_VISIT(type) \ 261 #define DEF_VISIT(type) \
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 Handle<SharedFunctionInfo> shared = info->shared_info(); 563 Handle<SharedFunctionInfo> shared = info->shared_info();
575 Handle<ScopeInfo> scope_info = 564 Handle<ScopeInfo> scope_info =
576 ScopeInfo::Create(info->scope(), info->zone()); 565 ScopeInfo::Create(info->scope(), info->zone());
577 shared->set_scope_info(*scope_info); 566 shared->set_scope_info(*scope_info);
578 567
579 Handle<Code> code = info->code(); 568 Handle<Code> code = info->code();
580 CHECK(code->kind() == Code::FUNCTION); 569 CHECK(code->kind() == Code::FUNCTION);
581 shared->ReplaceCode(*code); 570 shared->ReplaceCode(*code);
582 if (shared->optimization_disabled()) code->set_optimizable(false); 571 if (shared->optimization_disabled()) code->set_optimizable(false);
583 572
584 shared->set_feedback_vector(*info->feedback_vector());
585
586 // Set the expected number of properties for instances. 573 // Set the expected number of properties for instances.
587 FunctionLiteral* lit = info->function(); 574 FunctionLiteral* lit = info->function();
588 int expected = lit->expected_property_count(); 575 int expected = lit->expected_property_count();
589 SetExpectedNofPropertiesFromEstimate(shared, expected); 576 SetExpectedNofPropertiesFromEstimate(shared, expected);
590 577
591 // Check the function has compiled code. 578 // Check the function has compiled code.
592 ASSERT(shared->is_compiled()); 579 ASSERT(shared->is_compiled());
593 shared->set_dont_optimize_reason(lit->dont_optimize_reason()); 580 shared->set_dont_optimize_reason(lit->dont_optimize_reason());
594 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); 581 shared->set_dont_inline(lit->flags()->Contains(kDontInline));
595 shared->set_ast_node_count(lit->ast_node_count()); 582 shared->set_ast_node_count(lit->ast_node_count());
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 return Handle<SharedFunctionInfo>::null(); 816 return Handle<SharedFunctionInfo>::null();
830 } 817 }
831 818
832 // Allocate function. 819 // Allocate function.
833 ASSERT(!info->code().is_null()); 820 ASSERT(!info->code().is_null());
834 result = isolate->factory()->NewSharedFunctionInfo( 821 result = isolate->factory()->NewSharedFunctionInfo(
835 lit->name(), 822 lit->name(),
836 lit->materialized_literal_count(), 823 lit->materialized_literal_count(),
837 lit->is_generator(), 824 lit->is_generator(),
838 info->code(), 825 info->code(),
839 ScopeInfo::Create(info->scope(), info->zone()), 826 ScopeInfo::Create(info->scope(), info->zone()));
840 info->feedback_vector());
841 827
842 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); 828 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position());
843 SetFunctionInfo(result, lit, true, script); 829 SetFunctionInfo(result, lit, true, script);
844 830
845 Handle<String> script_name = script->name()->IsString() 831 Handle<String> script_name = script->name()->IsString()
846 ? Handle<String>(String::cast(script->name())) 832 ? Handle<String>(String::cast(script->name()))
847 : isolate->factory()->empty_string(); 833 : isolate->factory()->empty_string();
848 Logger::LogEventsAndTags log_tag = info->is_eval() 834 Logger::LogEventsAndTags log_tag = info->is_eval()
849 ? Logger::EVAL_TAG 835 ? Logger::EVAL_TAG
850 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script); 836 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 } else { 1015 } else {
1030 return Handle<SharedFunctionInfo>::null(); 1016 return Handle<SharedFunctionInfo>::null();
1031 } 1017 }
1032 1018
1033 // Create a shared function info object. 1019 // Create a shared function info object.
1034 Handle<SharedFunctionInfo> result = 1020 Handle<SharedFunctionInfo> result =
1035 factory->NewSharedFunctionInfo(literal->name(), 1021 factory->NewSharedFunctionInfo(literal->name(),
1036 literal->materialized_literal_count(), 1022 literal->materialized_literal_count(),
1037 literal->is_generator(), 1023 literal->is_generator(),
1038 info.code(), 1024 info.code(),
1039 scope_info, 1025 scope_info);
1040 info.feedback_vector());
1041 SetFunctionInfo(result, literal, false, script); 1026 SetFunctionInfo(result, literal, false, script);
1042 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); 1027 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result);
1043 result->set_allows_lazy_compilation(allow_lazy); 1028 result->set_allows_lazy_compilation(allow_lazy);
1044 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); 1029 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx);
1045 1030
1046 // Set the expected number of properties for instances and return 1031 // Set the expected number of properties for instances and return
1047 // the resulting function. 1032 // the resulting function.
1048 SetExpectedNofPropertiesFromEstimate(result, 1033 SetExpectedNofPropertiesFromEstimate(result,
1049 literal->expected_property_count()); 1034 literal->expected_property_count());
1050 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); 1035 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone());
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 AllowHandleDereference allow_deref; 1292 AllowHandleDereference allow_deref;
1308 bool tracing_on = info()->IsStub() 1293 bool tracing_on = info()->IsStub()
1309 ? FLAG_trace_hydrogen_stubs 1294 ? FLAG_trace_hydrogen_stubs
1310 : (FLAG_trace_hydrogen && 1295 : (FLAG_trace_hydrogen &&
1311 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1296 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1312 return (tracing_on && 1297 return (tracing_on &&
1313 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1298 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1314 } 1299 }
1315 1300
1316 } } // namespace v8::internal 1301 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698