// r0 = regexp literal clone.
// r2-5 are used as temporaries.
int literal_offset =
- FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
+ LiteralsArray::OffsetOfLiteralAt(instr->hydrogen()->literal_index());
__ Move(r6, instr->hydrogen()->literals());
__ ldr(r1, FieldMemOperand(r6, literal_offset));
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
// x0 = regexp literal clone.
// x10-x12 are used as temporaries.
int literal_offset =
- FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
+ LiteralsArray::OffsetOfLiteralAt(instr->hydrogen()->literal_index());
__ LoadObject(x7, instr->hydrogen()->literals());
__ Ldr(x1, FieldMemOperand(x7, literal_offset));
__ JumpIfNotRoot(x1, Heap::kUndefinedValueRootIndex, &materialized);
// so that it doesn't build and eager frame.
info()->MarkMustNotHaveEagerFrame();
- HInstruction* allocation_site =
- Add<HLoadKeyed>(GetParameter(0), GetParameter(1), nullptr, FAST_ELEMENTS);
+ HInstruction* allocation_site = Add<HLoadKeyed>(
+ GetParameter(0), GetParameter(1), nullptr, FAST_ELEMENTS,
+ NEVER_RETURN_HOLE, LiteralsArray::kOffsetToFirstLiteral - kHeapObjectTag);
IfBuilder checker(this);
checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site,
undefined);
HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
HValue* undefined = graph()->GetConstantUndefined();
- HInstruction* allocation_site =
- Add<HLoadKeyed>(GetParameter(0), GetParameter(1), nullptr, FAST_ELEMENTS);
+ HInstruction* allocation_site = Add<HLoadKeyed>(
+ GetParameter(0), GetParameter(1), nullptr, FAST_ELEMENTS,
+ NEVER_RETURN_HOLE, LiteralsArray::kOffsetToFirstLiteral - kHeapObjectTag);
IfBuilder checker(this);
checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site,
// Cache optimized context-specific code.
if (FLAG_cache_optimized_code) {
Handle<SharedFunctionInfo> shared(function->shared());
- Handle<FixedArray> literals(function->literals());
+ Handle<LiteralsArray> literals(function->literals());
Handle<Context> native_context(function->context()->native_context());
SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
literals, info->osr_ast_id());
// collect all functions and fix their literal arrays.
Handle<FixedArray> function_instances =
CollectJSFunctions(shared_info, isolate);
+ Handle<TypeFeedbackVector> vector(shared_info->feedback_vector());
+
for (int i = 0; i < function_instances->length(); i++) {
Handle<JSFunction> fun(JSFunction::cast(function_instances->get(i)));
- Handle<FixedArray> new_literals =
- isolate->factory()->NewFixedArray(new_literal_count);
+ Handle<LiteralsArray> new_literals =
+ LiteralsArray::New(isolate, vector, new_literal_count, TENURED);
fun->set_literals(*new_literals);
}
} else if (!info->bound()) {
int number_of_literals = info->num_literals();
- Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure);
+ Handle<LiteralsArray> literals =
+ LiteralsArray::New(isolate(), handle(info->feedback_vector()),
+ number_of_literals, pretenure);
result->set_literals(*literals);
// Cache context-specific literals.
if (FLAG_cache_optimized_code) {
// r0 = RegExp literal clone
__ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ ldr(r4, FieldMemOperand(r0, JSFunction::kLiteralsOffset));
- int literal_offset =
- FixedArray::kHeaderSize + expr->literal_index() * kPointerSize;
+ int literal_offset = LiteralsArray::OffsetOfLiteralAt(expr->literal_index());
__ ldr(r5, FieldMemOperand(r4, literal_offset));
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
__ cmp(r5, ip);
// x0 = RegExp literal clone
__ Ldr(x10, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ Ldr(x4, FieldMemOperand(x10, JSFunction::kLiteralsOffset));
- int literal_offset =
- FixedArray::kHeaderSize + expr->literal_index() * kPointerSize;
+ int literal_offset = LiteralsArray::OffsetOfLiteralAt(expr->literal_index());
__ Ldr(x5, FieldMemOperand(x4, literal_offset));
__ JumpIfNotRoot(x5, Heap::kUndefinedValueRootIndex, &materialized);
// eax = regexp literal clone.
__ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
__ mov(ecx, FieldOperand(edi, JSFunction::kLiteralsOffset));
- int literal_offset =
- FixedArray::kHeaderSize + expr->literal_index() * kPointerSize;
+ int literal_offset = LiteralsArray::OffsetOfLiteralAt(expr->literal_index());
__ mov(ebx, FieldOperand(ecx, literal_offset));
__ cmp(ebx, isolate()->factory()->undefined_value());
__ j(not_equal, &materialized, Label::kNear);
// a0 = RegExp literal clone
__ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ lw(t0, FieldMemOperand(a0, JSFunction::kLiteralsOffset));
- int literal_offset =
- FixedArray::kHeaderSize + expr->literal_index() * kPointerSize;
+ int literal_offset = LiteralsArray::OffsetOfLiteralAt(expr->literal_index());
__ lw(t1, FieldMemOperand(t0, literal_offset));
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
__ Branch(&materialized, ne, t1, Operand(at));
// a0 = RegExp literal clone
__ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ ld(a4, FieldMemOperand(a0, JSFunction::kLiteralsOffset));
- int literal_offset =
- FixedArray::kHeaderSize + expr->literal_index() * kPointerSize;
+ int literal_offset = LiteralsArray::OffsetOfLiteralAt(expr->literal_index());
__ ld(a5, FieldMemOperand(a4, literal_offset));
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
__ Branch(&materialized, ne, a5, Operand(at));
// rax = regexp literal clone.
__ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
__ movp(rcx, FieldOperand(rdi, JSFunction::kLiteralsOffset));
- int literal_offset =
- FixedArray::kHeaderSize + expr->literal_index() * kPointerSize;
+ int literal_offset = LiteralsArray::OffsetOfLiteralAt(expr->literal_index());
__ movp(rbx, FieldOperand(rcx, literal_offset));
__ CompareRoot(rbx, Heap::kUndefinedValueRootIndex);
__ j(not_equal, &materialized, Label::kNear);
DCHECK(current_block() != NULL);
DCHECK(current_block()->HasPredecessor());
Handle<JSFunction> closure = function_state()->compilation_info()->closure();
- Handle<FixedArray> literals(closure->literals());
+ Handle<LiteralsArray> literals(closure->literals());
HRegExpLiteral* instr = New<HRegExpLiteral>(literals,
expr->pattern(),
expr->flags(),
// Check whether to use fast or slow deep-copying for boilerplate.
int max_properties = kMaxFastLiteralProperties;
- Handle<Object> literals_cell(closure->literals()->get(expr->literal_index()),
- isolate());
+ Handle<Object> literals_cell(
+ closure->literals()->literal(expr->literal_index()), isolate());
Handle<AllocationSite> site;
Handle<JSObject> boilerplate;
if (!literals_cell->IsUndefined()) {
site_context.ExitScope(site, boilerplate);
} else {
NoObservableSideEffectsScope no_effects(this);
- Handle<FixedArray> closure_literals(closure->literals(), isolate());
+ Handle<LiteralsArray> closure_literals(closure->literals(), isolate());
Handle<FixedArray> constant_properties = expr->constant_properties();
int literal_index = expr->literal_index();
int flags = expr->ComputeFlags(true);
HInstruction* literal;
Handle<AllocationSite> site;
- Handle<FixedArray> literals(environment()->closure()->literals(), isolate());
+ Handle<LiteralsArray> literals(environment()->closure()->literals(),
+ isolate());
bool uninitialized = false;
- Handle<Object> literals_cell(literals->get(expr->literal_index()),
+ Handle<Object> literals_cell(literals->literal(expr->literal_index()),
isolate());
Handle<JSObject> boilerplate_object;
if (literals_cell->IsUndefined()) {
return Bailout(kArrayBoilerplateCreationFailed);
}
creation_context.ExitScope(site, boilerplate_object);
- literals->set(expr->literal_index(), *site);
+ literals->set_literal(expr->literal_index(), *site);
if (boilerplate_object->elements()->map() ==
isolate()->heap()->fixed_cow_array_map()) {
// eax = regexp literal clone.
// esi = context.
int literal_offset =
- FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
+ LiteralsArray::OffsetOfLiteralAt(instr->hydrogen()->literal_index());
__ LoadHeapObject(ecx, instr->hydrogen()->literals());
__ mov(ebx, FieldOperand(ecx, literal_offset));
__ cmp(ebx, factory()->undefined_value());
// a0 = regexp literal clone.
// a2 and t0-t2 are used as temporaries.
int literal_offset =
- FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
+ LiteralsArray::OffsetOfLiteralAt(instr->hydrogen()->literal_index());
__ li(t3, instr->hydrogen()->literals());
__ lw(a1, FieldMemOperand(t3, literal_offset));
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
// a0 = regexp literal clone.
// a2 and a4-a6 are used as temporaries.
int literal_offset =
- FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
+ LiteralsArray::OffsetOfLiteralAt(instr->hydrogen()->literal_index());
__ li(a7, instr->hydrogen()->literals());
__ ld(a1, FieldMemOperand(a7, literal_offset));
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
bool Object::IsTypeFeedbackVector() const { return IsFixedArray(); }
+bool Object::IsLiteralsArray() const { return IsFixedArray(); }
+
+
bool Object::IsDeoptimizationInputData() const {
// Must be a fixed array.
if (!IsFixedArray()) return false;
}
+Object* LiteralsArray::get(int index) const { return FixedArray::get(index); }
+
+
+void LiteralsArray::set(int index, Object* value) {
+ FixedArray::set(index, value);
+}
+
+
+void LiteralsArray::set(int index, Smi* value) {
+ FixedArray::set(index, value);
+}
+
+
+void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) {
+ FixedArray::set(index, value, mode);
+}
+
+
+LiteralsArray* LiteralsArray::cast(Object* object) {
+ SLOW_DCHECK(object->IsLiteralsArray());
+ return reinterpret_cast<LiteralsArray*>(object);
+}
+
+
+TypeFeedbackVector* LiteralsArray::feedback_vector() const {
+ return TypeFeedbackVector::cast(get(kVectorIndex));
+}
+
+
+void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) {
+ set(kVectorIndex, vector);
+}
+
+
+Object* LiteralsArray::literal(int literal_index) const {
+ return get(kFirstLiteralIndex + literal_index);
+}
+
+
+void LiteralsArray::set_literal(int literal_index, Object* literal) {
+ set(kFirstLiteralIndex + literal_index, literal);
+}
+
+
+int LiteralsArray::literals_count() const {
+ return length() - kFirstLiteralIndex;
+}
+
+
void HandlerTable::SetRangeStart(int index, int value) {
set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value));
}
}
-FixedArray* JSFunction::literals() {
+LiteralsArray* JSFunction::literals() {
DCHECK(!shared()->bound());
- return literals_or_bindings();
+ return LiteralsArray::cast(literals_or_bindings());
}
-void JSFunction::set_literals(FixedArray* literals) {
+void JSFunction::set_literals(LiteralsArray* literals) {
DCHECK(!shared()->bound());
set_literals_or_bindings(literals);
}
}
+// static
+Handle<LiteralsArray> LiteralsArray::New(Isolate* isolate,
+ Handle<TypeFeedbackVector> vector,
+ int number_of_literals,
+ PretenureFlag pretenure) {
+ Handle<FixedArray> literals = isolate->factory()->NewFixedArray(
+ number_of_literals + kFirstLiteralIndex, pretenure);
+ Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals);
+ casted_literals->set_feedback_vector(*vector);
+ return casted_literals;
+}
+
+
int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out,
CatchPrediction* prediction_out) {
int innermost_handler = -1, innermost_start = -1;
void SharedFunctionInfo::AddToOptimizedCodeMap(
Handle<SharedFunctionInfo> shared, Handle<Context> native_context,
- Handle<HeapObject> code, Handle<FixedArray> literals,
+ Handle<HeapObject> code, Handle<LiteralsArray> literals,
BailoutId osr_ast_id) {
Isolate* isolate = shared->GetIsolate();
DCHECK(*code == isolate->heap()->undefined_value() ||
DCHECK_LE(entry + kEntryLength, code_map->length());
Object* code = code_map->get(entry + kCachedCodeOffset);
result = {code->IsUndefined() ? nullptr : Code::cast(code),
- FixedArray::cast(code_map->get(entry + kLiteralsOffset))};
+ LiteralsArray::cast(code_map->get(entry + kLiteralsOffset))};
}
}
if (FLAG_trace_opt && !optimized_code_map()->IsSmi() &&
// - BytecodeArray
// - FixedArray
// - DescriptorArray
+// - LiteralsArray
// - HashTable
// - Dictionary
// - StringTable
class GlobalObject;
class JSBuiltinsObject;
class LayoutDescriptor;
+class LiteralsArray;
class LookupIterator;
class ObjectHashTable;
class ObjectVisitor;
V(Map) \
V(DescriptorArray) \
V(TransitionArray) \
+ V(LiteralsArray) \
V(TypeFeedbackVector) \
V(DeoptimizationInputData) \
V(DeoptimizationOutputData) \
};
+// A literals array contains the literals for a JSFunction. It also holds
+// the type feedback vector.
+class LiteralsArray : public FixedArray {
+ public:
+ static const int kVectorIndex = 0;
+ static const int kFirstLiteralIndex = 1;
+ static const int kOffsetToFirstLiteral =
+ FixedArray::kHeaderSize + kPointerSize;
+
+ static int OffsetOfLiteralAt(int index) {
+ return SizeFor(index + kFirstLiteralIndex);
+ }
+
+ inline TypeFeedbackVector* feedback_vector() const;
+ inline void set_feedback_vector(TypeFeedbackVector* vector);
+ inline Object* literal(int literal_index) const;
+ inline void set_literal(int literal_index, Object* literal);
+ inline int literals_count() const;
+
+ static Handle<LiteralsArray> New(Isolate* isolate,
+ Handle<TypeFeedbackVector> vector,
+ int number_of_literals,
+ PretenureFlag pretenure);
+
+ DECLARE_CAST(LiteralsArray)
+
+ private:
+ inline Object* get(int index) const;
+ inline void set(int index, Object* value);
+ inline void set(int index, Smi* value);
+ inline void set(int index, Object* value, WriteBarrierMode mode);
+};
+
+
// HandlerTable is a fixed array containing entries for exception handlers in
// the code object it is associated with. The tables comes in two flavors:
// 1) Based on ranges: Used for unoptimized code. Contains one entry per
// that both {code} and {literals} can be NULL to pass search result status.
struct CodeAndLiterals {
Code* code; // Cached optimized code.
- FixedArray* literals; // Cached literals array.
+ LiteralsArray* literals; // Cached literals array.
};
static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
Handle<Context> native_context,
Handle<HeapObject> code,
- Handle<FixedArray> literals,
+ Handle<LiteralsArray> literals,
BailoutId osr_ast_id);
// Set up the link between shared function info and the script. The shared
// arguments. Bound functions never contain literals.
DECL_ACCESSORS(literals_or_bindings, FixedArray)
- inline FixedArray* literals();
- inline void set_literals(FixedArray* literals);
+ inline LiteralsArray* literals();
+ inline void set_literals(LiteralsArray* literals);
inline FixedArray* function_bindings();
inline void set_function_bindings(FixedArray* bindings);
// Make sure we get a fresh copy of the literal vector to avoid cross
// context contamination.
Handle<Context> context(source->context());
- int number_of_literals = source->NumberOfLiterals();
- Handle<FixedArray> literals =
- isolate->factory()->NewFixedArray(number_of_literals, TENURED);
target->set_context(*context);
+
+ int number_of_literals = source->NumberOfLiterals();
+ Handle<LiteralsArray> literals =
+ LiteralsArray::New(isolate, handle(target_shared->feedback_vector()),
+ number_of_literals, TENURED);
target->set_literals(*literals);
if (isolate->logger()->is_logging_code_events() ||
}
MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
- Isolate* isolate, Handle<FixedArray> literals,
+ Isolate* isolate, Handle<LiteralsArray> literals,
Handle<FixedArray> constant_properties, bool is_strong);
MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
- Isolate* isolate, Handle<FixedArray> literals,
+ Isolate* isolate, Handle<LiteralsArray> literals,
Handle<FixedArray> constant_properties, bool should_have_fast_elements,
bool has_function_literal, bool is_strong) {
Handle<Context> context = isolate->native_context();
MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate(
- Isolate* isolate, Handle<FixedArray> literals,
+ Isolate* isolate, Handle<LiteralsArray> literals,
Handle<FixedArray> elements, bool is_strong) {
// Create the JSArray.
Handle<JSFunction> constructor = isolate->array_function();
MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
- Isolate* isolate, Handle<FixedArray> literals, Handle<FixedArray> array,
+ Isolate* isolate, Handle<LiteralsArray> literals, Handle<FixedArray> array,
bool is_strong) {
Handle<FixedArray> elements = CompileTimeValue::GetElements(array);
const bool kHasNoFunctionLiteral = false;
RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
HandleScope scope(isolate);
DCHECK(args.length() == 4);
- CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
+ CONVERT_ARG_HANDLE_CHECKED(LiteralsArray, literals, 0);
CONVERT_SMI_ARG_CHECKED(literals_index, 1);
CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2);
CONVERT_SMI_ARG_CHECKED(flags, 3);
bool enable_mementos = (flags & ObjectLiteral::kDisableMementos) == 0;
bool is_strong = (flags & ObjectLiteral::kIsStrong) != 0;
- RUNTIME_ASSERT(literals_index >= 0 && literals_index < literals->length());
+ RUNTIME_ASSERT(literals_index >= 0 &&
+ literals_index < literals->literals_count());
// Check if boilerplate exists. If not, create it first.
- Handle<Object> literal_site(literals->get(literals_index), isolate);
+ Handle<Object> literal_site(literals->literal(literals_index), isolate);
Handle<AllocationSite> site;
Handle<JSObject> boilerplate;
if (*literal_site == isolate->heap()->undefined_value()) {
creation_context.ExitScope(site, boilerplate);
// Update the functions literal and return the boilerplate.
- literals->set(literals_index, *site);
+ literals->set_literal(literals_index, *site);
} else {
site = Handle<AllocationSite>::cast(literal_site);
boilerplate =
MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite(
- Isolate* isolate, Handle<FixedArray> literals, int literals_index,
+ Isolate* isolate, Handle<LiteralsArray> literals, int literals_index,
Handle<FixedArray> elements, bool is_strong) {
// Check if boilerplate exists. If not, create it first.
- Handle<Object> literal_site(literals->get(literals_index), isolate);
+ Handle<Object> literal_site(literals->literal(literals_index), isolate);
Handle<AllocationSite> site;
if (*literal_site == isolate->heap()->undefined_value()) {
DCHECK(*elements != isolate->heap()->empty_fixed_array());
}
creation_context.ExitScope(site, Handle<JSObject>::cast(boilerplate));
- literals->set(literals_index, *site);
+ literals->set_literal(literals_index, *site);
} else {
site = Handle<AllocationSite>::cast(literal_site);
}
}
-static MaybeHandle<JSObject> CreateArrayLiteralImpl(Isolate* isolate,
- Handle<FixedArray> literals,
- int literals_index,
- Handle<FixedArray> elements,
- int flags) {
+static MaybeHandle<JSObject> CreateArrayLiteralImpl(
+ Isolate* isolate, Handle<LiteralsArray> literals, int literals_index,
+ Handle<FixedArray> elements, int flags) {
RUNTIME_ASSERT_HANDLIFIED(
- literals_index >= 0 && literals_index < literals->length(), JSObject);
+ literals_index >= 0 && literals_index < literals->literals_count(),
+ JSObject);
Handle<AllocationSite> site;
bool is_strong = (flags & ArrayLiteral::kIsStrong) != 0;
ASSIGN_RETURN_ON_EXCEPTION(
RUNTIME_FUNCTION(Runtime_CreateArrayLiteral) {
HandleScope scope(isolate);
DCHECK(args.length() == 4);
- CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
+ CONVERT_ARG_HANDLE_CHECKED(LiteralsArray, literals, 0);
CONVERT_SMI_ARG_CHECKED(literals_index, 1);
CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
CONVERT_SMI_ARG_CHECKED(flags, 3);
RUNTIME_FUNCTION(Runtime_CreateArrayLiteralStubBailout) {
HandleScope scope(isolate);
DCHECK(args.length() == 3);
- CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
+ CONVERT_ARG_HANDLE_CHECKED(LiteralsArray, literals, 0);
CONVERT_SMI_ARG_CHECKED(literals_index, 1);
CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_SMI_ARG_CHECKED(store_index, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
- CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3);
+ CONVERT_ARG_HANDLE_CHECKED(LiteralsArray, literals, 3);
CONVERT_SMI_ARG_CHECKED(literal_index, 4);
- Object* raw_literal_cell = literals->get(literal_index);
+ Object* raw_literal_cell = literals->literal(literal_index);
JSArray* boilerplate = NULL;
if (raw_literal_cell->IsAllocationSite()) {
AllocationSite* site = AllocationSite::cast(raw_literal_cell);
RUNTIME_FUNCTION(Runtime_MaterializeRegExpLiteral) {
HandleScope scope(isolate);
DCHECK(args.length() == 4);
- CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
+ CONVERT_ARG_HANDLE_CHECKED(LiteralsArray, literals, 0);
CONVERT_SMI_ARG_CHECKED(index, 1);
CONVERT_ARG_HANDLE_CHECKED(String, pattern, 2);
CONVERT_ARG_HANDLE_CHECKED(String, flags, 3);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, regexp,
RegExpImpl::CreateRegExpLiteral(constructor, pattern, flags));
- literals->set(index, *regexp);
+ literals->set_literal(index, *regexp);
return *regexp;
}
// Used in runtime.cc and hydrogen's VisitArrayLiteral.
MUST_USE_RESULT static MaybeHandle<Object> CreateArrayLiteralBoilerplate(
- Isolate* isolate, Handle<FixedArray> literals,
+ Isolate* isolate, Handle<LiteralsArray> literals,
Handle<FixedArray> elements, bool is_strong);
static MaybeHandle<JSArray> GetInternalProperties(Isolate* isolate,
// rbx = regexp literal.
// rax = regexp literal clone.
int literal_offset =
- FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
+ LiteralsArray::OffsetOfLiteralAt(instr->hydrogen()->literal_index());
__ Move(rcx, instr->hydrogen()->literals());
__ movp(rbx, FieldOperand(rcx, literal_offset));
__ CompareRoot(rbx, Heap::kUndefinedValueRootIndex);
if (!code->is_optimized_code()) return;
}
- Handle<FixedArray> lit = isolate->factory()->empty_fixed_array();
+ Handle<TypeFeedbackVector> vector = handle(shared->feedback_vector());
+ Handle<LiteralsArray> lit =
+ LiteralsArray::New(isolate, vector, shared->num_literals(), TENURED);
Handle<Context> context(isolate->context());
// Add the new code several times to the optimized code map and also set an
if (!code->is_optimized_code()) return;
}
- Handle<FixedArray> lit = isolate->factory()->empty_fixed_array();
+ Handle<TypeFeedbackVector> vector = handle(shared->feedback_vector());
+ Handle<LiteralsArray> lit =
+ LiteralsArray::New(isolate, vector, shared->num_literals(), TENURED);
Handle<Context> context(isolate->context());
// Add the code several times to the optimized code map.
AlwaysAllocateScope always_allocate(isolate);
// Make sure literal is placed on an old-space evacuation candidate.
SimulateFullSpace(heap->old_space());
- Handle<FixedArray> lit = isolate->factory()->NewFixedArray(23, TENURED);
+
+ // Make sure there the number of literals is > 0.
+ Handle<LiteralsArray> lit =
+ LiteralsArray::New(isolate, vector, 23, TENURED);
+
evac_page = Page::FromAddress(lit->address());
BailoutId id = BailoutId(100);
SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id);