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

Unified Diff: src/runtime/runtime-scopes.cc

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index 2e349f00d3b64dbc4fd6d3e91943b49f253d2b73..26c9692097b851042e9a23d02b4cf917b0a5c9ae 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -140,6 +140,7 @@ Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations,
FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < length, i += 4, {
Handle<String> name(String::cast(declarations->get(i)), isolate);
FeedbackVectorSlot slot(Smi::cast(declarations->get(i + 1))->value());
+ Handle<Object> possibly_literal_slot(declarations->get(i + 2), isolate);
Handle<Object> initial_value(declarations->get(i + 3), isolate);
bool is_var = initial_value->IsUndefined(isolate);
@@ -148,12 +149,17 @@ Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations,
Handle<Object> value;
if (is_function) {
+ DCHECK(possibly_literal_slot->IsSmi());
// Copy the function and update its context. Use it as value.
Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>::cast(initial_value);
+ FeedbackVectorSlot literals_slot(
+ Smi::cast(*possibly_literal_slot)->value());
+ Handle<Cell> literals(Cell::cast(feedback_vector->Get(literals_slot)),
+ isolate);
Handle<JSFunction> function =
- isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context,
- TENURED);
+ isolate->factory()->NewFunctionFromSharedFunctionInfo(
+ shared, context, literals, TENURED);
value = function;
} else {
value = isolate->factory()->undefined_value();
@@ -613,10 +619,14 @@ RUNTIME_FUNCTION(Runtime_NewClosure) {
HandleScope scope(isolate);
DCHECK_EQ(3, args.length());
CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
+ CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1);
+ CONVERT_SMI_ARG_CHECKED(index, 2);
Handle<Context> context(isolate->context(), isolate);
+ FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(index);
+ Handle<Cell> literals(Cell::cast(vector->Get(slot)), isolate);
Handle<JSFunction> function =
- isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context,
- NOT_TENURED);
+ isolate->factory()->NewFunctionFromSharedFunctionInfo(
+ shared, context, literals, NOT_TENURED);
return *function;
}
@@ -625,12 +635,16 @@ RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) {
HandleScope scope(isolate);
DCHECK_EQ(3, args.length());
CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
+ CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1);
+ CONVERT_SMI_ARG_CHECKED(index, 2);
Handle<Context> context(isolate->context(), isolate);
+ FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(index);
+ Handle<Cell> literals(Cell::cast(vector->Get(slot)), isolate);
// The caller ensures that we pretenure closures that are assigned
// directly to properties.
Handle<JSFunction> function =
isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context,
- TENURED);
+ literals, TENURED);
return *function;
}

Powered by Google App Engine
This is Rietveld 408576698