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

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

Issue 178463007: Moved type feedback vector to SharedFunctionInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports and comment response. 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
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 ASSERT_EQ(isolate()->heap()->the_hole_value(),
392 *TypeFeedbackInfo::UninitializedSentinel(isolate()));
393 feedback_vector_ = isolate()->factory()->NewFixedArrayWithHoles(length,
394 TENURED);
395 }
396
397
398 void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) { 389 void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) {
399 // Fill in the deoptimization information. 390 // Fill in the deoptimization information.
400 ASSERT(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty()); 391 ASSERT(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty());
401 if (!info_->HasDeoptimizationSupport()) return; 392 if (!info_->HasDeoptimizationSupport()) return;
402 int length = bailout_entries_.length(); 393 int length = bailout_entries_.length();
403 Handle<DeoptimizationOutputData> data = isolate()->factory()-> 394 Handle<DeoptimizationOutputData> data = isolate()->factory()->
404 NewDeoptimizationOutputData(length, TENURED); 395 NewDeoptimizationOutputData(length, TENURED);
405 for (int i = 0; i < length; i++) { 396 for (int i = 0; i < length; i++) {
406 data->SetAstId(i, bailout_entries_[i].id); 397 data->SetAstId(i, bailout_entries_[i].id);
407 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state)); 398 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state));
408 } 399 }
409 code->set_deoptimization_data(*data); 400 code->set_deoptimization_data(*data);
410 } 401 }
411 402
412 403
413 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) { 404 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) {
414 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo(); 405 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo();
415 info->set_ic_total_count(ic_total_count_); 406 info->set_ic_total_count(ic_total_count_);
416 info->set_feedback_vector(*FeedbackVector());
417 ASSERT(!isolate()->heap()->InNewSpace(*info)); 407 ASSERT(!isolate()->heap()->InNewSpace(*info));
418 code->set_type_feedback_info(*info); 408 code->set_type_feedback_info(*info);
419 } 409 }
420 410
421 411
422 void FullCodeGenerator::Initialize() { 412 void FullCodeGenerator::Initialize() {
423 // 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
424 // 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
425 // calculating PC offsets after generating a debug version of code. Therefore 415 // calculating PC offsets after generating a debug version of code. Therefore
426 // 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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 ASSERT(!fun_template.IsEmpty()); 1571 ASSERT(!fun_template.IsEmpty());
1582 1572
1583 // Instantiate the function and create a shared function info from it. 1573 // Instantiate the function and create a shared function info from it.
1584 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); 1574 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction());
1585 const int literals = fun->NumberOfLiterals(); 1575 const int literals = fun->NumberOfLiterals();
1586 Handle<Code> code = Handle<Code>(fun->shared()->code()); 1576 Handle<Code> code = Handle<Code>(fun->shared()->code());
1587 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); 1577 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub());
1588 bool is_generator = false; 1578 bool is_generator = false;
1589 Handle<SharedFunctionInfo> shared = 1579 Handle<SharedFunctionInfo> shared =
1590 isolate()->factory()->NewSharedFunctionInfo(name, literals, is_generator, 1580 isolate()->factory()->NewSharedFunctionInfo(name, literals, is_generator,
1591 code, Handle<ScopeInfo>(fun->shared()->scope_info())); 1581 code, Handle<ScopeInfo>(fun->shared()->scope_info()),
1582 Handle<FixedArray>(fun->shared()->feedback_vector()));
1592 shared->set_construct_stub(*construct_stub); 1583 shared->set_construct_stub(*construct_stub);
1593 1584
1594 // Copy the function data to the shared function info. 1585 // Copy the function data to the shared function info.
1595 shared->set_function_data(fun->shared()->function_data()); 1586 shared->set_function_data(fun->shared()->function_data());
1596 int parameters = fun->shared()->formal_parameter_count(); 1587 int parameters = fun->shared()->formal_parameter_count();
1597 shared->set_formal_parameter_count(parameters); 1588 shared->set_formal_parameter_count(parameters);
1598 1589
1599 EmitNewClosure(shared, false); 1590 EmitNewClosure(shared, false);
1600 } 1591 }
1601 1592
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 } 1719 }
1729 return true; 1720 return true;
1730 } 1721 }
1731 #endif // DEBUG 1722 #endif // DEBUG
1732 1723
1733 1724
1734 #undef __ 1725 #undef __
1735 1726
1736 1727
1737 } } // namespace v8::internal 1728 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698