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

Side by Side Diff: src/liveedit.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: REBASE. 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
« no previous file with comments | « src/liveedit.h ('k') | src/mips/code-stubs-mips.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 // 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 5
6 #include "src/v8.h" 6 #include "src/v8.h"
7 7
8 #include "src/liveedit.h" 8 #include "src/liveedit.h"
9 9
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 } 598 }
599 599
600 600
601 static int GetArrayLength(Handle<JSArray> array) { 601 static int GetArrayLength(Handle<JSArray> array) {
602 Object* length = array->length(); 602 Object* length = array->length();
603 CHECK(length->IsSmi()); 603 CHECK(length->IsSmi());
604 return Smi::cast(length)->value(); 604 return Smi::cast(length)->value();
605 } 605 }
606 606
607 607
608 void FunctionInfoWrapper::SetInitialProperties(Handle<String> name, 608 void FunctionInfoWrapper::SetInitialProperties(
609 int start_position, 609 Handle<String> name, int start_position, int end_position, int param_num,
610 int end_position, 610 int literal_count, int slot_count, int ic_slot_count, int parent_index) {
611 int param_num,
612 int literal_count,
613 int slot_count,
614 int parent_index) {
615 HandleScope scope(isolate()); 611 HandleScope scope(isolate());
616 this->SetField(kFunctionNameOffset_, name); 612 this->SetField(kFunctionNameOffset_, name);
617 this->SetSmiValueField(kStartPositionOffset_, start_position); 613 this->SetSmiValueField(kStartPositionOffset_, start_position);
618 this->SetSmiValueField(kEndPositionOffset_, end_position); 614 this->SetSmiValueField(kEndPositionOffset_, end_position);
619 this->SetSmiValueField(kParamNumOffset_, param_num); 615 this->SetSmiValueField(kParamNumOffset_, param_num);
620 this->SetSmiValueField(kLiteralNumOffset_, literal_count); 616 this->SetSmiValueField(kLiteralNumOffset_, literal_count);
621 this->SetSmiValueField(kSlotNumOffset_, slot_count); 617 this->SetSmiValueField(kSlotNumOffset_, slot_count);
618 this->SetSmiValueField(kICSlotNumOffset_, ic_slot_count);
622 this->SetSmiValueField(kParentIndexOffset_, parent_index); 619 this->SetSmiValueField(kParentIndexOffset_, parent_index);
623 } 620 }
624 621
625 622
626 void FunctionInfoWrapper::SetFunctionCode(Handle<Code> function_code, 623 void FunctionInfoWrapper::SetFunctionCode(Handle<Code> function_code,
627 Handle<HeapObject> code_scope_info) { 624 Handle<HeapObject> code_scope_info) {
628 Handle<JSValue> code_wrapper = WrapInJSValue(function_code); 625 Handle<JSValue> code_wrapper = WrapInJSValue(function_code);
629 this->SetField(kCodeOffset_, code_wrapper); 626 this->SetField(kCodeOffset_, code_wrapper);
630 627
631 Handle<JSValue> scope_wrapper = WrapInJSValue(code_scope_info); 628 Handle<JSValue> scope_wrapper = WrapInJSValue(code_scope_info);
(...skipping 19 matching lines...) Expand all
651 648
652 Handle<TypeFeedbackVector> FunctionInfoWrapper::GetFeedbackVector() { 649 Handle<TypeFeedbackVector> FunctionInfoWrapper::GetFeedbackVector() {
653 Handle<Object> element = this->GetField(kSharedFunctionInfoOffset_); 650 Handle<Object> element = this->GetField(kSharedFunctionInfoOffset_);
654 Handle<TypeFeedbackVector> result; 651 Handle<TypeFeedbackVector> result;
655 if (element->IsJSValue()) { 652 if (element->IsJSValue()) {
656 Handle<JSValue> value_wrapper = Handle<JSValue>::cast(element); 653 Handle<JSValue> value_wrapper = Handle<JSValue>::cast(element);
657 Handle<Object> raw_result = UnwrapJSValue(value_wrapper); 654 Handle<Object> raw_result = UnwrapJSValue(value_wrapper);
658 Handle<SharedFunctionInfo> shared = 655 Handle<SharedFunctionInfo> shared =
659 Handle<SharedFunctionInfo>::cast(raw_result); 656 Handle<SharedFunctionInfo>::cast(raw_result);
660 result = Handle<TypeFeedbackVector>(shared->feedback_vector(), isolate()); 657 result = Handle<TypeFeedbackVector>(shared->feedback_vector(), isolate());
661 CHECK_EQ(result->length(), GetSlotCount()); 658 CHECK_EQ(result->Slots(), GetSlotCount());
659 CHECK_EQ(result->ICSlots(), GetICSlotCount());
662 } else { 660 } else {
663 // Scripts may never have a SharedFunctionInfo created, so 661 // Scripts may never have a SharedFunctionInfo created, so
664 // create a type feedback vector here. 662 // create a type feedback vector here.
665 int slot_count = GetSlotCount(); 663 int slot_count = GetSlotCount();
666 result = isolate()->factory()->NewTypeFeedbackVector(slot_count); 664 int ic_slot_count = GetICSlotCount();
665 result =
666 isolate()->factory()->NewTypeFeedbackVector(slot_count, ic_slot_count);
667 } 667 }
668 return result; 668 return result;
669 } 669 }
670 670
671 671
672 Handle<Object> FunctionInfoWrapper::GetCodeScopeInfo() { 672 Handle<Object> FunctionInfoWrapper::GetCodeScopeInfo() {
673 Handle<Object> element = this->GetField(kCodeScopeInfoOffset_); 673 Handle<Object> element = this->GetField(kCodeScopeInfoOffset_);
674 return UnwrapJSValue(Handle<JSValue>::cast(element)); 674 return UnwrapJSValue(Handle<JSValue>::cast(element));
675 } 675 }
676 676
(...skipping 22 matching lines...) Expand all
699 public: 699 public:
700 explicit FunctionInfoListener(Isolate* isolate) { 700 explicit FunctionInfoListener(Isolate* isolate) {
701 current_parent_index_ = -1; 701 current_parent_index_ = -1;
702 len_ = 0; 702 len_ = 0;
703 result_ = isolate->factory()->NewJSArray(10); 703 result_ = isolate->factory()->NewJSArray(10);
704 } 704 }
705 705
706 void FunctionStarted(FunctionLiteral* fun) { 706 void FunctionStarted(FunctionLiteral* fun) {
707 HandleScope scope(isolate()); 707 HandleScope scope(isolate());
708 FunctionInfoWrapper info = FunctionInfoWrapper::Create(isolate()); 708 FunctionInfoWrapper info = FunctionInfoWrapper::Create(isolate());
709 info.SetInitialProperties(fun->name(), fun->start_position(), 709 info.SetInitialProperties(
710 fun->end_position(), fun->parameter_count(), 710 fun->name(), fun->start_position(), fun->end_position(),
711 fun->materialized_literal_count(), 711 fun->parameter_count(), fun->materialized_literal_count(),
712 fun->slot_count(), 712 fun->slot_count(), fun->ic_slot_count(), current_parent_index_);
713 current_parent_index_);
714 current_parent_index_ = len_; 713 current_parent_index_ = len_;
715 SetElementSloppy(result_, len_, info.GetJSArray()); 714 SetElementSloppy(result_, len_, info.GetJSArray());
716 len_++; 715 len_++;
717 } 716 }
718 717
719 void FunctionDone() { 718 void FunctionDone() {
720 HandleScope scope(isolate()); 719 HandleScope scope(isolate());
721 FunctionInfoWrapper info = 720 FunctionInfoWrapper info =
722 FunctionInfoWrapper::cast( 721 FunctionInfoWrapper::cast(
723 *Object::GetElement( 722 *Object::GetElement(
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { 2077 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) {
2079 isolate_->active_function_info_listener()->FunctionCode(code); 2078 isolate_->active_function_info_listener()->FunctionCode(code);
2080 } 2079 }
2081 2080
2082 2081
2083 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2082 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2084 return isolate->active_function_info_listener() != NULL; 2083 return isolate->active_function_info_listener() != NULL;
2085 } 2084 }
2086 2085
2087 } } // namespace v8::internal 2086 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/liveedit.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698