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

Side by Side Diff: src/full-codegen.cc

Issue 199973004: Continued fix for 351257. Reusing the feedback vector is too complex. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE. 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/full-codegen.h ('k') | src/heap.cc » ('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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 __ dd(length); 379 __ dd(length);
380 for (unsigned i = 0; i < length; ++i) { 380 for (unsigned i = 0; i < length; ++i) {
381 __ dd(back_edges_[i].id.ToInt()); 381 __ dd(back_edges_[i].id.ToInt());
382 __ dd(back_edges_[i].pc); 382 __ dd(back_edges_[i].pc);
383 __ dd(back_edges_[i].loop_depth); 383 __ dd(back_edges_[i].loop_depth);
384 } 384 }
385 return offset; 385 return offset;
386 } 386 }
387 387
388 388
389 void FullCodeGenerator::InitializeFeedbackVector() {
390 int length = info_->function()->slot_count();
391 feedback_vector_ = isolate()->factory()->NewFixedArray(length, TENURED);
392 Handle<Object> sentinel = TypeFeedbackInfo::UninitializedSentinel(isolate());
393 // Ensure that it's safe to set without using a write barrier.
394 ASSERT_EQ(isolate()->heap()->uninitialized_symbol(), *sentinel);
395 for (int i = 0; i < length; i++) {
396 feedback_vector_->set(i, *sentinel, SKIP_WRITE_BARRIER);
397 }
398 }
399
400
401 void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) { 389 void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) {
402 // Fill in the deoptimization information. 390 // Fill in the deoptimization information.
403 ASSERT(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty()); 391 ASSERT(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty());
404 if (!info_->HasDeoptimizationSupport()) return; 392 if (!info_->HasDeoptimizationSupport()) return;
405 int length = bailout_entries_.length(); 393 int length = bailout_entries_.length();
406 Handle<DeoptimizationOutputData> data = isolate()->factory()-> 394 Handle<DeoptimizationOutputData> data = isolate()->factory()->
407 NewDeoptimizationOutputData(length, TENURED); 395 NewDeoptimizationOutputData(length, TENURED);
408 for (int i = 0; i < length; i++) { 396 for (int i = 0; i < length; i++) {
409 data->SetAstId(i, bailout_entries_[i].id); 397 data->SetAstId(i, bailout_entries_[i].id);
410 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state)); 398 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state));
411 } 399 }
412 code->set_deoptimization_data(*data); 400 code->set_deoptimization_data(*data);
413 } 401 }
414 402
415 403
416 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) { 404 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) {
417 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo(); 405 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo();
418 info->set_ic_total_count(ic_total_count_); 406 info->set_ic_total_count(ic_total_count_);
419 info->set_feedback_vector(*FeedbackVector());
420 ASSERT(!isolate()->heap()->InNewSpace(*info)); 407 ASSERT(!isolate()->heap()->InNewSpace(*info));
421 code->set_type_feedback_info(*info); 408 code->set_type_feedback_info(*info);
422 } 409 }
423 410
424 411
425 void FullCodeGenerator::Initialize() { 412 void FullCodeGenerator::Initialize() {
426 // The generation of debug code must match between the snapshot code and the 413 // The generation of debug code must match between the snapshot code and the
427 // code that is generated later. This is assumed by the debugger when it is 414 // code that is generated later. This is assumed by the debugger when it is
428 // calculating PC offsets after generating a debug version of code. Therefore 415 // calculating PC offsets after generating a debug version of code. Therefore
429 // we disable the production of debug code in the full compiler if we are 416 // we disable the production of debug code in the full compiler if we are
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 ASSERT(!fun_template.IsEmpty()); 1598 ASSERT(!fun_template.IsEmpty());
1612 1599
1613 // Instantiate the function and create a shared function info from it. 1600 // Instantiate the function and create a shared function info from it.
1614 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); 1601 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction());
1615 const int literals = fun->NumberOfLiterals(); 1602 const int literals = fun->NumberOfLiterals();
1616 Handle<Code> code = Handle<Code>(fun->shared()->code()); 1603 Handle<Code> code = Handle<Code>(fun->shared()->code());
1617 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); 1604 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub());
1618 bool is_generator = false; 1605 bool is_generator = false;
1619 Handle<SharedFunctionInfo> shared = 1606 Handle<SharedFunctionInfo> shared =
1620 isolate()->factory()->NewSharedFunctionInfo(name, literals, is_generator, 1607 isolate()->factory()->NewSharedFunctionInfo(name, literals, is_generator,
1621 code, Handle<ScopeInfo>(fun->shared()->scope_info())); 1608 code, Handle<ScopeInfo>(fun->shared()->scope_info()),
1609 Handle<FixedArray>(fun->shared()->feedback_vector()));
1622 shared->set_construct_stub(*construct_stub); 1610 shared->set_construct_stub(*construct_stub);
1623 1611
1624 // Copy the function data to the shared function info. 1612 // Copy the function data to the shared function info.
1625 shared->set_function_data(fun->shared()->function_data()); 1613 shared->set_function_data(fun->shared()->function_data());
1626 int parameters = fun->shared()->formal_parameter_count(); 1614 int parameters = fun->shared()->formal_parameter_count();
1627 shared->set_formal_parameter_count(parameters); 1615 shared->set_formal_parameter_count(parameters);
1628 1616
1629 EmitNewClosure(shared, false); 1617 EmitNewClosure(shared, false);
1630 } 1618 }
1631 1619
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 } 1746 }
1759 return true; 1747 return true;
1760 } 1748 }
1761 #endif // DEBUG 1749 #endif // DEBUG
1762 1750
1763 1751
1764 #undef __ 1752 #undef __
1765 1753
1766 1754
1767 } } // namespace v8::internal 1755 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.h ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698