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

Unified Diff: src/liveedit.cc

Issue 670953003: Move feedback slot allocation to post-pass (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased patch Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/liveedit.h ('k') | src/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/liveedit.cc
diff --git a/src/liveedit.cc b/src/liveedit.cc
index b1476a0b6ec32c09a8b04f7fb86e729234db32f7..29eaa974a6cc002cde618f88443593cd467fd006 100644
--- a/src/liveedit.cc
+++ b/src/liveedit.cc
@@ -605,17 +605,17 @@ static int GetArrayLength(Handle<JSArray> array) {
}
-void FunctionInfoWrapper::SetInitialProperties(
- Handle<String> name, int start_position, int end_position, int param_num,
- int literal_count, int slot_count, int ic_slot_count, int parent_index) {
+void FunctionInfoWrapper::SetInitialProperties(Handle<String> name,
+ int start_position,
+ int end_position, int param_num,
+ int literal_count,
+ int parent_index) {
HandleScope scope(isolate());
this->SetField(kFunctionNameOffset_, name);
this->SetSmiValueField(kStartPositionOffset_, start_position);
this->SetSmiValueField(kEndPositionOffset_, end_position);
this->SetSmiValueField(kParamNumOffset_, param_num);
this->SetSmiValueField(kLiteralNumOffset_, literal_count);
- this->SetSmiValueField(kSlotNumOffset_, slot_count);
- this->SetSmiValueField(kICSlotNumOffset_, ic_slot_count);
this->SetSmiValueField(kParentIndexOffset_, parent_index);
}
@@ -646,26 +646,18 @@ Handle<Code> FunctionInfoWrapper::GetFunctionCode() {
}
-Handle<TypeFeedbackVector> FunctionInfoWrapper::GetFeedbackVector() {
+MaybeHandle<TypeFeedbackVector> FunctionInfoWrapper::GetFeedbackVector() {
Handle<Object> element = this->GetField(kSharedFunctionInfoOffset_);
- Handle<TypeFeedbackVector> result;
if (element->IsJSValue()) {
Handle<JSValue> value_wrapper = Handle<JSValue>::cast(element);
Handle<Object> raw_result = UnwrapJSValue(value_wrapper);
Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>::cast(raw_result);
- result = Handle<TypeFeedbackVector>(shared->feedback_vector(), isolate());
- CHECK_EQ(result->Slots(), GetSlotCount());
- CHECK_EQ(result->ICSlots(), GetICSlotCount());
+ return Handle<TypeFeedbackVector>(shared->feedback_vector(), isolate());
} else {
- // Scripts may never have a SharedFunctionInfo created, so
- // create a type feedback vector here.
- int slot_count = GetSlotCount();
- int ic_slot_count = GetICSlotCount();
- result =
- isolate()->factory()->NewTypeFeedbackVector(slot_count, ic_slot_count);
+ // Scripts may never have a SharedFunctionInfo created.
+ return MaybeHandle<TypeFeedbackVector>();
}
- return result;
}
@@ -706,10 +698,10 @@ class FunctionInfoListener {
void FunctionStarted(FunctionLiteral* fun) {
HandleScope scope(isolate());
FunctionInfoWrapper info = FunctionInfoWrapper::Create(isolate());
- info.SetInitialProperties(
- fun->name(), fun->start_position(), fun->end_position(),
- fun->parameter_count(), fun->materialized_literal_count(),
- fun->slot_count(), fun->ic_slot_count(), current_parent_index_);
+ info.SetInitialProperties(fun->name(), fun->start_position(),
+ fun->end_position(), fun->parameter_count(),
+ fun->materialized_literal_count(),
+ current_parent_index_);
current_parent_index_ = len_;
SetElementSloppy(result_, len_, info.GetJSArray());
len_++;
@@ -1201,10 +1193,12 @@ void LiveEdit::ReplaceFunctionCode(
shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info));
}
shared_info->DisableOptimization(kLiveEdit);
- // Update the type feedback vector
- Handle<TypeFeedbackVector> feedback_vector =
+ // Update the type feedback vector, if needed.
+ MaybeHandle<TypeFeedbackVector> feedback_vector =
compile_info_wrapper.GetFeedbackVector();
- shared_info->set_feedback_vector(*feedback_vector);
+ if (!feedback_vector.is_null()) {
+ shared_info->set_feedback_vector(*feedback_vector.ToHandleChecked());
+ }
}
if (shared_info->debug_info()->IsDebugInfo()) {
« no previous file with comments | « src/liveedit.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698