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

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

Issue 254623002: Simplify feedback vector creation and store in SharedFunctionInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code comments Created 6 years, 7 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-snapshot-generator.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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 __ dd(length); 377 __ dd(length);
378 for (unsigned i = 0; i < length; ++i) { 378 for (unsigned i = 0; i < length; ++i) {
379 __ dd(back_edges_[i].id.ToInt()); 379 __ dd(back_edges_[i].id.ToInt());
380 __ dd(back_edges_[i].pc); 380 __ dd(back_edges_[i].pc);
381 __ dd(back_edges_[i].loop_depth); 381 __ dd(back_edges_[i].loop_depth);
382 } 382 }
383 return offset; 383 return offset;
384 } 384 }
385 385
386 386
387 void FullCodeGenerator::InitializeFeedbackVector() { 387 void FullCodeGenerator::EnsureSlotContainsAllocationSite(int slot) {
388 int length = info_->function()->slot_count(); 388 Handle<FixedArray> vector = FeedbackVector();
389 feedback_vector_ = isolate()->factory()->NewFixedArray(length, TENURED); 389 if (!vector->get(slot)->IsAllocationSite()) {
390 Handle<Object> sentinel = TypeFeedbackInfo::UninitializedSentinel(isolate()); 390 vector->set(slot, *isolate()->factory()->NewAllocationSite());
391 // Ensure that it's safe to set without using a write barrier.
392 ASSERT_EQ(isolate()->heap()->uninitialized_symbol(), *sentinel);
393 for (int i = 0; i < length; i++) {
394 feedback_vector_->set(i, *sentinel, SKIP_WRITE_BARRIER);
395 } 391 }
396 } 392 }
397 393
398 394
399 void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) { 395 void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) {
400 // Fill in the deoptimization information. 396 // Fill in the deoptimization information.
401 ASSERT(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty()); 397 ASSERT(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty());
402 if (!info_->HasDeoptimizationSupport()) return; 398 if (!info_->HasDeoptimizationSupport()) return;
403 int length = bailout_entries_.length(); 399 int length = bailout_entries_.length();
404 Handle<DeoptimizationOutputData> data = isolate()->factory()-> 400 Handle<DeoptimizationOutputData> data = isolate()->factory()->
405 NewDeoptimizationOutputData(length, TENURED); 401 NewDeoptimizationOutputData(length, TENURED);
406 for (int i = 0; i < length; i++) { 402 for (int i = 0; i < length; i++) {
407 data->SetAstId(i, bailout_entries_[i].id); 403 data->SetAstId(i, bailout_entries_[i].id);
408 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state)); 404 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state));
409 } 405 }
410 code->set_deoptimization_data(*data); 406 code->set_deoptimization_data(*data);
411 } 407 }
412 408
413 409
414 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) { 410 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) {
415 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo(); 411 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo();
416 info->set_ic_total_count(ic_total_count_); 412 info->set_ic_total_count(ic_total_count_);
417 info->set_feedback_vector(*FeedbackVector());
418 ASSERT(!isolate()->heap()->InNewSpace(*info)); 413 ASSERT(!isolate()->heap()->InNewSpace(*info));
419 code->set_type_feedback_info(*info); 414 code->set_type_feedback_info(*info);
420 } 415 }
421 416
422 417
423 void FullCodeGenerator::Initialize() { 418 void FullCodeGenerator::Initialize() {
424 // The generation of debug code must match between the snapshot code and the 419 // The generation of debug code must match between the snapshot code and the
425 // code that is generated later. This is assumed by the debugger when it is 420 // code that is generated later. This is assumed by the debugger when it is
426 // calculating PC offsets after generating a debug version of code. Therefore 421 // calculating PC offsets after generating a debug version of code. Therefore
427 // we disable the production of debug code in the full compiler if we are 422 // we disable the production of debug code in the full compiler if we are
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 reinterpret_cast<v8::Isolate*>(isolate()), v8::Utils::ToLocal(name)); 1565 reinterpret_cast<v8::Isolate*>(isolate()), v8::Utils::ToLocal(name));
1571 ASSERT(!fun_template.IsEmpty()); 1566 ASSERT(!fun_template.IsEmpty());
1572 1567
1573 // Instantiate the function and create a shared function info from it. 1568 // Instantiate the function and create a shared function info from it.
1574 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); 1569 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction());
1575 const int literals = fun->NumberOfLiterals(); 1570 const int literals = fun->NumberOfLiterals();
1576 Handle<Code> code = Handle<Code>(fun->shared()->code()); 1571 Handle<Code> code = Handle<Code>(fun->shared()->code());
1577 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); 1572 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub());
1578 bool is_generator = false; 1573 bool is_generator = false;
1579 Handle<SharedFunctionInfo> shared = 1574 Handle<SharedFunctionInfo> shared =
1580 isolate()->factory()->NewSharedFunctionInfo(name, literals, is_generator, 1575 isolate()->factory()->NewSharedFunctionInfo(
1581 code, Handle<ScopeInfo>(fun->shared()->scope_info())); 1576 name, literals, is_generator,
1577 code, Handle<ScopeInfo>(fun->shared()->scope_info()),
1578 Handle<FixedArray>(fun->shared()->feedback_vector()));
1582 shared->set_construct_stub(*construct_stub); 1579 shared->set_construct_stub(*construct_stub);
1583 1580
1584 // Copy the function data to the shared function info. 1581 // Copy the function data to the shared function info.
1585 shared->set_function_data(fun->shared()->function_data()); 1582 shared->set_function_data(fun->shared()->function_data());
1586 int parameters = fun->shared()->formal_parameter_count(); 1583 int parameters = fun->shared()->formal_parameter_count();
1587 shared->set_formal_parameter_count(parameters); 1584 shared->set_formal_parameter_count(parameters);
1588 1585
1589 EmitNewClosure(shared, false); 1586 EmitNewClosure(shared, false);
1590 } 1587 }
1591 1588
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 } 1715 }
1719 return true; 1716 return true;
1720 } 1717 }
1721 #endif // DEBUG 1718 #endif // DEBUG
1722 1719
1723 1720
1724 #undef __ 1721 #undef __
1725 1722
1726 1723
1727 } } // namespace v8::internal 1724 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.h ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698