Commit 8a9ada48 authored by mythria's avatar mythria Committed by Commit bot

[Interpreter] Handles BytecodeArrays when scanning objects in heap.

Handles bytecodeArray Objects when verifying the heap and also when
collecting code statistics. The changes include:
1. BytecodeArrays could be a part of the large object space. When
verifying the large object space we should also allow BytecodeArray
objects.
2. Adds support for BytecodeArrays when collecting code statistics.

BUG=v8:4280,chromium:599001
LOG=N

Review URL: https://codereview.chromium.org/1850443006

Cr-Commit-Position: refs/heads/master@{#35202}
parent 0c32e98e
......@@ -1646,7 +1646,7 @@ void NewSpace::Verify() {
// The object should not be code or a map.
CHECK(!object->IsMap());
CHECK(!object->IsCode());
CHECK(!object->IsAbstractCode());
// The object itself should look OK.
object->ObjectVerify();
......@@ -2780,9 +2780,14 @@ void PagedSpace::CollectCodeStatistics() {
Isolate* isolate = heap()->isolate();
HeapObjectIterator obj_it(this);
for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) {
if (obj->IsAbstractCode()) {
AbstractCode* code = AbstractCode::cast(obj);
isolate->code_kind_statistics()[code->kind()] += code->Size();
}
if (obj->IsCode()) {
// TODO(mythria): Also enable this for BytecodeArray when it supports
// RelocInformation.
Code* code = Code::cast(obj);
isolate->code_kind_statistics()[code->kind()] += code->Size();
RelocIterator it(code);
int delta = 0;
const byte* prev_pc = code->instruction_start();
......@@ -3073,7 +3078,7 @@ void LargeObjectSpace::Verify() {
// (sequential strings that have been morphed into external
// strings), fixed arrays, byte arrays, and constant pool arrays in the
// large object space.
CHECK(object->IsCode() || object->IsSeqString() ||
CHECK(object->IsAbstractCode() || object->IsSeqString() ||
object->IsExternalString() || object->IsFixedArray() ||
object->IsFixedDoubleArray() || object->IsByteArray());
......@@ -3081,7 +3086,7 @@ void LargeObjectSpace::Verify() {
object->ObjectVerify();
// Byte arrays and strings don't have interior pointers.
if (object->IsCode()) {
if (object->IsAbstractCode()) {
VerifyPointersVisitor code_visitor;
object->IterateBody(map->instance_type(), object->Size(), &code_visitor);
} else if (object->IsFixedArray()) {
......@@ -3132,8 +3137,8 @@ void LargeObjectSpace::CollectCodeStatistics() {
Isolate* isolate = heap()->isolate();
LargeObjectIterator obj_it(this);
for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) {
if (obj->IsCode()) {
Code* code = Code::cast(obj);
if (obj->IsAbstractCode()) {
AbstractCode* code = AbstractCode::cast(obj);
isolate->code_kind_statistics()[code->kind()] += code->Size();
}
}
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --verify-heap --expose-gc
// Tests that verify heap works for BytecodeArrays in the large object space.
// Creates a list of variable declarations and calls it through eval to
// generate a large BytecodeArray.
var s = "";
for (var i = 0; i < 65535; i++) {
s += ("var a" + i + ";");
}
(function() { eval(s); })();
gc();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment