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

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

Issue 650073002: vector-based ICs did not update type feedback counts correctly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports. Created 6 years, 2 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/debug.h" 10 #include "src/debug.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return false; 326 return false;
327 } 327 }
328 unsigned table_offset = cgen.EmitBackEdgeTable(); 328 unsigned table_offset = cgen.EmitBackEdgeTable();
329 329
330 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION); 330 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION);
331 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); 331 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info);
332 code->set_optimizable(info->IsOptimizable() && 332 code->set_optimizable(info->IsOptimizable() &&
333 !info->function()->dont_optimize() && 333 !info->function()->dont_optimize() &&
334 info->function()->scope()->AllowsLazyCompilation()); 334 info->function()->scope()->AllowsLazyCompilation());
335 cgen.PopulateDeoptimizationData(code); 335 cgen.PopulateDeoptimizationData(code);
336 cgen.PopulateTypeFeedbackInfo(code); 336 cgen.PopulateTypeFeedbackInfo(code, info->feedback_vector());
337 code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); 337 code->set_has_deoptimization_support(info->HasDeoptimizationSupport());
338 code->set_handler_table(*cgen.handler_table()); 338 code->set_handler_table(*cgen.handler_table());
339 code->set_compiled_optimizable(info->IsOptimizable()); 339 code->set_compiled_optimizable(info->IsOptimizable());
340 code->set_allow_osr_at_loop_nesting_level(0); 340 code->set_allow_osr_at_loop_nesting_level(0);
341 code->set_profiler_ticks(0); 341 code->set_profiler_ticks(0);
342 code->set_back_edge_table_offset(table_offset); 342 code->set_back_edge_table_offset(table_offset);
343 CodeGenerator::PrintCode(code, info); 343 CodeGenerator::PrintCode(code, info);
344 info->SetCode(code); 344 info->SetCode(code);
345 void* line_info = masm.positions_recorder()->DetachJITHandlerData(); 345 void* line_info = masm.positions_recorder()->DetachJITHandlerData();
346 LOG_CODE_EVENT(isolate, CodeEndLinePosInfoRecordEvent(*code, line_info)); 346 LOG_CODE_EVENT(isolate, CodeEndLinePosInfoRecordEvent(*code, line_info));
(...skipping 13 matching lines...) Expand all
360 __ dd(back_edges_[i].id.ToInt()); 360 __ dd(back_edges_[i].id.ToInt());
361 __ dd(back_edges_[i].pc); 361 __ dd(back_edges_[i].pc);
362 __ dd(back_edges_[i].loop_depth); 362 __ dd(back_edges_[i].loop_depth);
363 } 363 }
364 return offset; 364 return offset;
365 } 365 }
366 366
367 367
368 void FullCodeGenerator::EnsureSlotContainsAllocationSite( 368 void FullCodeGenerator::EnsureSlotContainsAllocationSite(
369 FeedbackVectorSlot slot) { 369 FeedbackVectorSlot slot) {
370 Handle<FixedArray> vector = FeedbackVector(); 370 Handle<TypeFeedbackVector> vector = FeedbackVector();
371 if (!vector->get(slot.ToInt())->IsAllocationSite()) { 371 if (!vector->Get(slot)->IsAllocationSite()) {
372 Handle<AllocationSite> allocation_site = 372 Handle<AllocationSite> allocation_site =
373 isolate()->factory()->NewAllocationSite(); 373 isolate()->factory()->NewAllocationSite();
374 vector->set(slot.ToInt(), *allocation_site); 374 vector->Set(slot, *allocation_site);
375 } 375 }
376 } 376 }
377 377
378
379 void FullCodeGenerator::EnsureSlotContainsAllocationSite(
380 FeedbackVectorICSlot slot) {
381 Handle<TypeFeedbackVector> vector = FeedbackVector();
382 if (!vector->Get(slot)->IsAllocationSite()) {
383 Handle<AllocationSite> allocation_site =
384 isolate()->factory()->NewAllocationSite();
385 vector->Set(slot, *allocation_site);
386 }
387 }
388
378 389
379 void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) { 390 void FullCodeGenerator::PopulateDeoptimizationData(Handle<Code> code) {
380 // Fill in the deoptimization information. 391 // Fill in the deoptimization information.
381 DCHECK(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty()); 392 DCHECK(info_->HasDeoptimizationSupport() || bailout_entries_.is_empty());
382 if (!info_->HasDeoptimizationSupport()) return; 393 if (!info_->HasDeoptimizationSupport()) return;
383 int length = bailout_entries_.length(); 394 int length = bailout_entries_.length();
384 Handle<DeoptimizationOutputData> data = 395 Handle<DeoptimizationOutputData> data =
385 DeoptimizationOutputData::New(isolate(), length, TENURED); 396 DeoptimizationOutputData::New(isolate(), length, TENURED);
386 for (int i = 0; i < length; i++) { 397 for (int i = 0; i < length; i++) {
387 data->SetAstId(i, bailout_entries_[i].id); 398 data->SetAstId(i, bailout_entries_[i].id);
388 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state)); 399 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state));
389 } 400 }
390 code->set_deoptimization_data(*data); 401 code->set_deoptimization_data(*data);
391 } 402 }
392 403
393 404
394 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) { 405 void FullCodeGenerator::PopulateTypeFeedbackInfo(
395 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo(); 406 Handle<Code> code, Handle<TypeFeedbackVector> vector) {
407 Handle<TypeFeedbackInfo> info =
408 isolate()->factory()->NewTypeFeedbackInfo(vector);
396 info->set_ic_total_count(ic_total_count_); 409 info->set_ic_total_count(ic_total_count_);
397 DCHECK(!isolate()->heap()->InNewSpace(*info)); 410 DCHECK(!isolate()->heap()->InNewSpace(*info));
398 code->set_type_feedback_info(*info); 411 code->set_type_feedback_info(*info);
399 } 412 }
400 413
401 414
402 void FullCodeGenerator::Initialize() { 415 void FullCodeGenerator::Initialize() {
403 InitializeAstVisitor(info_->zone()); 416 InitializeAstVisitor(info_->zone());
404 // The generation of debug code must match between the snapshot code and the 417 // The generation of debug code must match between the snapshot code and the
405 // code that is generated later. This is assumed by the debugger when it is 418 // code that is generated later. This is assumed by the debugger when it is
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 } 1746 }
1734 return true; 1747 return true;
1735 } 1748 }
1736 #endif // DEBUG 1749 #endif // DEBUG
1737 1750
1738 1751
1739 #undef __ 1752 #undef __
1740 1753
1741 1754
1742 } } // namespace v8::internal 1755 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.h ('k') | src/heap/objects-visiting-inl.h » ('j') | src/ic/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698