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

Side by Side Diff: src/full-codegen.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/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
389 void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) { 401 void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) {
390 // Fill in the deoptimization information. 402 // Fill in the deoptimization information.
391 ASSERT(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty()); 403 ASSERT(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty());
392 if (!info_->HasDeoptimizationSupport()) return; 404 if (!info_->HasDeoptimizationSupport()) return;
393 int length = bailout_entries_.length(); 405 int length = bailout_entries_.length();
394 Handle<DeoptimizationOutputData> data = isolate()->factory()-> 406 Handle<DeoptimizationOutputData> data = isolate()->factory()->
395 NewDeoptimizationOutputData(length, TENURED); 407 NewDeoptimizationOutputData(length, TENURED);
396 for (int i = 0; i < length; i++) { 408 for (int i = 0; i < length; i++) {
397 data->SetAstId(i, bailout_entries_[i].id); 409 data->SetAstId(i, bailout_entries_[i].id);
398 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state)); 410 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state));
399 } 411 }
400 code->set_deoptimization_data(*data); 412 code->set_deoptimization_data(*data);
401 } 413 }
402 414
403 415
404 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) { 416 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) {
405 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo(); 417 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo();
406 info->set_ic_total_count(ic_total_count_); 418 info->set_ic_total_count(ic_total_count_);
419 info->set_feedback_vector(*FeedbackVector());
407 ASSERT(!isolate()->heap()->InNewSpace(*info)); 420 ASSERT(!isolate()->heap()->InNewSpace(*info));
408 code->set_type_feedback_info(*info); 421 code->set_type_feedback_info(*info);
409 } 422 }
410 423
411 424
412 void FullCodeGenerator::Initialize() { 425 void FullCodeGenerator::Initialize() {
413 // The generation of debug code must match between the snapshot code and the 426 // The generation of debug code must match between the snapshot code and the
414 // code that is generated later. This is assumed by the debugger when it is 427 // code that is generated later. This is assumed by the debugger when it is
415 // calculating PC offsets after generating a debug version of code. Therefore 428 // calculating PC offsets after generating a debug version of code. Therefore
416 // we disable the production of debug code in the full compiler if we are 429 // 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
1598 ASSERT(!fun_template.IsEmpty()); 1611 ASSERT(!fun_template.IsEmpty());
1599 1612
1600 // Instantiate the function and create a shared function info from it. 1613 // Instantiate the function and create a shared function info from it.
1601 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); 1614 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction());
1602 const int literals = fun->NumberOfLiterals(); 1615 const int literals = fun->NumberOfLiterals();
1603 Handle<Code> code = Handle<Code>(fun->shared()->code()); 1616 Handle<Code> code = Handle<Code>(fun->shared()->code());
1604 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); 1617 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub());
1605 bool is_generator = false; 1618 bool is_generator = false;
1606 Handle<SharedFunctionInfo> shared = 1619 Handle<SharedFunctionInfo> shared =
1607 isolate()->factory()->NewSharedFunctionInfo(name, literals, is_generator, 1620 isolate()->factory()->NewSharedFunctionInfo(name, literals, is_generator,
1608 code, Handle<ScopeInfo>(fun->shared()->scope_info()), 1621 code, Handle<ScopeInfo>(fun->shared()->scope_info()));
1609 Handle<FixedArray>(fun->shared()->feedback_vector()));
1610 shared->set_construct_stub(*construct_stub); 1622 shared->set_construct_stub(*construct_stub);
1611 1623
1612 // Copy the function data to the shared function info. 1624 // Copy the function data to the shared function info.
1613 shared->set_function_data(fun->shared()->function_data()); 1625 shared->set_function_data(fun->shared()->function_data());
1614 int parameters = fun->shared()->formal_parameter_count(); 1626 int parameters = fun->shared()->formal_parameter_count();
1615 shared->set_formal_parameter_count(parameters); 1627 shared->set_formal_parameter_count(parameters);
1616 1628
1617 EmitNewClosure(shared, false); 1629 EmitNewClosure(shared, false);
1618 } 1630 }
1619 1631
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 } 1758 }
1747 return true; 1759 return true;
1748 } 1760 }
1749 #endif // DEBUG 1761 #endif // DEBUG
1750 1762
1751 1763
1752 #undef __ 1764 #undef __
1753 1765
1754 1766
1755 } } // namespace v8::internal 1767 } } // 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