Index: src/runtime/runtime-literals.cc |
diff --git a/src/runtime/runtime-literals.cc b/src/runtime/runtime-literals.cc |
index ca81bc54eb1b61a31218e69e78c9c05e977ba0b8..e59b9c2c8c5f2ed0c375954979a8b7000fe17bd6 100644 |
--- a/src/runtime/runtime-literals.cc |
+++ b/src/runtime/runtime-literals.cc |
@@ -25,11 +25,11 @@ static Handle<Map> ComputeObjectLiteralMap( |
} |
MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate( |
- Isolate* isolate, Handle<LiteralsArray> literals, |
+ Isolate* isolate, Handle<TypeFeedbackVector> vector, |
Handle<BoilerplateDescription> boilerplate_description); |
MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate( |
- Isolate* isolate, Handle<LiteralsArray> literals, |
+ Isolate* isolate, Handle<TypeFeedbackVector> vector, |
Handle<BoilerplateDescription> boilerplate_description, |
bool should_have_fast_elements) { |
Handle<Context> context = isolate->native_context(); |
@@ -43,7 +43,7 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate( |
&is_result_from_cache); |
PretenureFlag pretenure_flag = |
- isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED; |
+ isolate->heap()->InNewSpace(*vector) ? NOT_TENURED : TENURED; |
Handle<JSObject> boilerplate = |
isolate->factory()->NewJSObjectFromMap(map, pretenure_flag); |
@@ -72,7 +72,7 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate( |
Handle<BoilerplateDescription>::cast(value); |
ASSIGN_RETURN_ON_EXCEPTION( |
isolate, value, |
- CreateLiteralBoilerplate(isolate, literals, boilerplate), Object); |
+ CreateLiteralBoilerplate(isolate, vector, boilerplate), Object); |
} |
MaybeHandle<Object> maybe_result; |
uint32_t element_index = 0; |
@@ -105,13 +105,13 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate( |
} |
static MaybeHandle<Object> CreateArrayLiteralBoilerplate( |
- Isolate* isolate, Handle<LiteralsArray> literals, |
+ Isolate* isolate, Handle<TypeFeedbackVector> vector, |
Handle<ConstantElementsPair> elements) { |
// Create the JSArray. |
Handle<JSFunction> constructor = isolate->array_function(); |
PretenureFlag pretenure_flag = |
- isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED; |
+ isolate->heap()->InNewSpace(*vector) ? NOT_TENURED : TENURED; |
Handle<JSArray> object = Handle<JSArray>::cast( |
isolate->factory()->NewJSObject(constructor, pretenure_flag)); |
@@ -162,7 +162,7 @@ static MaybeHandle<Object> CreateArrayLiteralBoilerplate( |
Handle<Object> result; |
ASSIGN_RETURN_ON_EXCEPTION( |
isolate, result, |
- CreateLiteralBoilerplate(isolate, literals, boilerplate), |
+ CreateLiteralBoilerplate(isolate, vector, boilerplate), |
Object); |
fixed_array_values_copy->set(i, *result); |
} |
@@ -177,24 +177,24 @@ static MaybeHandle<Object> CreateArrayLiteralBoilerplate( |
} |
MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate( |
- Isolate* isolate, Handle<LiteralsArray> literals, |
+ Isolate* isolate, Handle<TypeFeedbackVector> vector, |
Handle<BoilerplateDescription> array) { |
Handle<HeapObject> elements = CompileTimeValue::GetElements(array); |
switch (CompileTimeValue::GetLiteralType(array)) { |
case CompileTimeValue::OBJECT_LITERAL_FAST_ELEMENTS: { |
Handle<BoilerplateDescription> props = |
Handle<BoilerplateDescription>::cast(elements); |
- return CreateObjectLiteralBoilerplate(isolate, literals, props, true); |
+ return CreateObjectLiteralBoilerplate(isolate, vector, props, true); |
} |
case CompileTimeValue::OBJECT_LITERAL_SLOW_ELEMENTS: { |
Handle<BoilerplateDescription> props = |
Handle<BoilerplateDescription>::cast(elements); |
- return CreateObjectLiteralBoilerplate(isolate, literals, props, false); |
+ return CreateObjectLiteralBoilerplate(isolate, vector, props, false); |
} |
case CompileTimeValue::ARRAY_LITERAL: { |
Handle<ConstantElementsPair> elems = |
Handle<ConstantElementsPair>::cast(elements); |
- return CreateArrayLiteralBoilerplate(isolate, literals, elems); |
+ return CreateArrayLiteralBoilerplate(isolate, vector, elems); |
} |
default: |
UNREACHABLE(); |
@@ -210,13 +210,15 @@ RUNTIME_FUNCTION(Runtime_CreateRegExpLiteral) { |
CONVERT_SMI_ARG_CHECKED(index, 1); |
CONVERT_ARG_HANDLE_CHECKED(String, pattern, 2); |
CONVERT_SMI_ARG_CHECKED(flags, 3); |
+ FeedbackVectorSlot literal_slot(TypeFeedbackVector::ToSlot(index)); |
// Check if boilerplate exists. If not, create it first. |
- Handle<Object> boilerplate(closure->literals()->literal(index), isolate); |
+ Handle<Object> boilerplate(closure->feedback_vector()->Get(literal_slot), |
+ isolate); |
if (boilerplate->IsUndefined(isolate)) { |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
isolate, boilerplate, JSRegExp::New(pattern, JSRegExp::Flags(flags))); |
- closure->literals()->set_literal(index, *boilerplate); |
+ closure->feedback_vector()->Set(literal_slot, *boilerplate); |
} |
return *JSRegExp::Copy(Handle<JSRegExp>::cast(boilerplate)); |
} |
@@ -230,23 +232,22 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) { |
CONVERT_ARG_HANDLE_CHECKED(BoilerplateDescription, boilerplate_description, |
2); |
CONVERT_SMI_ARG_CHECKED(flags, 3); |
- Handle<LiteralsArray> literals(closure->literals(), isolate); |
+ Handle<TypeFeedbackVector> vector(closure->feedback_vector(), isolate); |
bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; |
bool enable_mementos = (flags & ObjectLiteral::kDisableMementos) == 0; |
- CHECK(literals_index >= 0); |
- CHECK(literals_index < literals->literals_count()); |
+ FeedbackVectorSlot literals_slot(TypeFeedbackVector::ToSlot(literals_index)); |
+ CHECK(literals_slot.ToInt() < vector->slot_count()); |
// Check if boilerplate exists. If not, create it first. |
- Handle<Object> literal_site(literals->literal(literals_index), isolate); |
+ Handle<Object> literal_site(vector->Get(literals_slot), isolate); |
Handle<AllocationSite> site; |
Handle<JSObject> boilerplate; |
if (literal_site->IsUndefined(isolate)) { |
Handle<Object> raw_boilerplate; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
isolate, raw_boilerplate, |
- CreateObjectLiteralBoilerplate(isolate, literals, |
- boilerplate_description, |
+ CreateObjectLiteralBoilerplate(isolate, vector, boilerplate_description, |
should_have_fast_elements)); |
boilerplate = Handle<JSObject>::cast(raw_boilerplate); |
@@ -257,7 +258,7 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) { |
creation_context.ExitScope(site, boilerplate); |
// Update the functions literal and return the boilerplate. |
- literals->set_literal(literals_index, *site); |
+ vector->Set(literals_slot, *site); |
} else { |
site = Handle<AllocationSite>::cast(literal_site); |
boilerplate = |
@@ -273,16 +274,16 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) { |
} |
MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite( |
- Isolate* isolate, Handle<LiteralsArray> literals, int literals_index, |
- Handle<ConstantElementsPair> elements) { |
+ Isolate* isolate, Handle<TypeFeedbackVector> vector, |
+ FeedbackVectorSlot literals_slot, Handle<ConstantElementsPair> elements) { |
// Check if boilerplate exists. If not, create it first. |
- Handle<Object> literal_site(literals->literal(literals_index), isolate); |
+ Handle<Object> literal_site(vector->Get(literals_slot), isolate); |
Handle<AllocationSite> site; |
if (literal_site->IsUndefined(isolate)) { |
Handle<Object> boilerplate; |
ASSIGN_RETURN_ON_EXCEPTION( |
isolate, boilerplate, |
- CreateArrayLiteralBoilerplate(isolate, literals, elements), |
+ CreateArrayLiteralBoilerplate(isolate, vector, elements), |
AllocationSite); |
AllocationSiteCreationContext creation_context(isolate); |
@@ -293,7 +294,7 @@ MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite( |
} |
creation_context.ExitScope(site, Handle<JSObject>::cast(boilerplate)); |
- literals->set_literal(literals_index, *site); |
+ vector->Set(literals_slot, *site); |
} else { |
site = Handle<AllocationSite>::cast(literal_site); |
} |
@@ -302,13 +303,14 @@ MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite( |
} |
static MaybeHandle<JSObject> CreateArrayLiteralImpl( |
- Isolate* isolate, Handle<LiteralsArray> literals, int literals_index, |
- Handle<ConstantElementsPair> elements, int flags) { |
- CHECK(literals_index >= 0 && literals_index < literals->literals_count()); |
+ Isolate* isolate, Handle<TypeFeedbackVector> vector, |
+ FeedbackVectorSlot literals_slot, Handle<ConstantElementsPair> elements, |
+ int flags) { |
+ CHECK(literals_slot.ToInt() < vector->slot_count()); |
Handle<AllocationSite> site; |
ASSIGN_RETURN_ON_EXCEPTION( |
isolate, site, |
- GetLiteralAllocationSite(isolate, literals, literals_index, elements), |
+ GetLiteralAllocationSite(isolate, vector, literals_slot, elements), |
JSObject); |
bool enable_mementos = (flags & ArrayLiteral::kDisableMementos) == 0; |
@@ -333,10 +335,11 @@ RUNTIME_FUNCTION(Runtime_CreateArrayLiteral) { |
CONVERT_ARG_HANDLE_CHECKED(ConstantElementsPair, elements, 2); |
CONVERT_SMI_ARG_CHECKED(flags, 3); |
- Handle<LiteralsArray> literals(closure->literals(), isolate); |
+ FeedbackVectorSlot literals_slot(TypeFeedbackVector::ToSlot(literals_index)); |
+ Handle<TypeFeedbackVector> vector(closure->feedback_vector(), isolate); |
RETURN_RESULT_OR_FAILURE( |
- isolate, CreateArrayLiteralImpl(isolate, literals, literals_index, |
- elements, flags)); |
+ isolate, |
+ CreateArrayLiteralImpl(isolate, vector, literals_slot, elements, flags)); |
} |
@@ -347,11 +350,11 @@ RUNTIME_FUNCTION(Runtime_CreateArrayLiteralStubBailout) { |
CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
CONVERT_ARG_HANDLE_CHECKED(ConstantElementsPair, elements, 2); |
- Handle<LiteralsArray> literals(closure->literals(), isolate); |
+ Handle<TypeFeedbackVector> vector(closure->feedback_vector(), isolate); |
+ FeedbackVectorSlot literals_slot(TypeFeedbackVector::ToSlot(literals_index)); |
RETURN_RESULT_OR_FAILURE( |
- isolate, |
- CreateArrayLiteralImpl(isolate, literals, literals_index, elements, |
- ArrayLiteral::kShallowElements)); |
+ isolate, CreateArrayLiteralImpl(isolate, vector, literals_slot, elements, |
+ ArrayLiteral::kShallowElements)); |
} |
} // namespace internal |