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

Unified Diff: src/heap.cc

Issue 148503002: A64: Synchronize with r15545. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 506b97dbfc46ca8ad7a60f1d9a2a24e85dc85f6c..7ceb78ebd3316b278de4dd74f4e2e3fc51797f2b 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -32,6 +32,7 @@
#include "bootstrapper.h"
#include "codegen.h"
#include "compilation-cache.h"
+#include "cpu-profiler.h"
#include "debug.h"
#include "deoptimizer.h"
#include "global-handles.h"
@@ -66,7 +67,7 @@ Heap::Heap()
: isolate_(NULL),
// semispace_size_ should be a power of 2 and old_generation_size_ should be
// a multiple of Page::kPageSize.
-#if defined(V8_TARGET_ARCH_X64)
+#if V8_TARGET_ARCH_X64
#define LUMP_OF_MEMORY (2 * MB)
code_range_size_(512*MB),
#else
@@ -2854,9 +2855,9 @@ MaybeObject* Heap::AllocateCell(Object* value) {
MaybeObject* Heap::AllocatePropertyCell(Object* value) {
Object* result;
- { MaybeObject* maybe_result = AllocateRawPropertyCell();
- if (!maybe_result->ToObject(&result)) return maybe_result;
- }
+ MaybeObject* maybe_result = AllocateRawPropertyCell();
+ if (!maybe_result->ToObject(&result)) return maybe_result;
+
HeapObject::cast(result)->set_map_no_write_barrier(
global_property_cell_map());
PropertyCell* cell = PropertyCell::cast(result);
@@ -2864,6 +2865,8 @@ MaybeObject* Heap::AllocatePropertyCell(Object* value) {
SKIP_WRITE_BARRIER);
cell->set_value(value);
cell->set_type(Type::None());
+ maybe_result = cell->SetValueInferType(value);
+ if (maybe_result->IsFailure()) return maybe_result;
return result;
}
@@ -2877,6 +2880,16 @@ MaybeObject* Heap::AllocateBox(Object* value, PretenureFlag pretenure) {
}
+MaybeObject* Heap::AllocateAllocationSite() {
+ Object* result;
+ MaybeObject* maybe_result = Allocate(allocation_site_map(),
+ OLD_POINTER_SPACE);
+ if (!maybe_result->ToObject(&result)) return maybe_result;
+ AllocationSite::cast(result)->Initialize();
+ return result;
+}
+
+
MaybeObject* Heap::CreateOddball(const char* to_string,
Object* to_number,
byte kind) {
@@ -3505,6 +3518,7 @@ Heap::RootListIndex Heap::RootIndexForEmptyExternalArray(
}
}
+
ExternalArray* Heap::EmptyExternalArrayForMap(Map* map) {
return ExternalArray::cast(
roots_[RootIndexForEmptyExternalArray(map->elements_kind())]);
@@ -4187,7 +4201,7 @@ MaybeObject* Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
MaybeObject* Heap::AllocateWithAllocationSite(Map* map, AllocationSpace space,
- Handle<Object> allocation_site_info_payload) {
+ Handle<AllocationSite> allocation_site) {
ASSERT(gc_state_ == NOT_IN_GC);
ASSERT(map->instance_type() != MAP_TYPE);
// If allocation failures are disallowed, we may allocate in a different
@@ -4203,7 +4217,7 @@ MaybeObject* Heap::AllocateWithAllocationSite(Map* map, AllocationSpace space,
AllocationSiteInfo* alloc_info = reinterpret_cast<AllocationSiteInfo*>(
reinterpret_cast<Address>(result) + map->instance_size());
alloc_info->set_map_no_write_barrier(allocation_site_info_map());
- alloc_info->set_payload(*allocation_site_info_payload, SKIP_WRITE_BARRIER);
+ alloc_info->set_allocation_site(*allocation_site, SKIP_WRITE_BARRIER);
return result;
}
@@ -4462,7 +4476,7 @@ MaybeObject* Heap::AllocateJSObjectFromMap(Map* map, PretenureFlag pretenure) {
MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite(Map* map,
- Handle<Object> allocation_site_info_payload) {
+ Handle<AllocationSite> allocation_site) {
// JSFunctions should be allocated using AllocateFunction to be
// properly initialized.
ASSERT(map->instance_type() != JS_FUNCTION_TYPE);
@@ -4487,8 +4501,8 @@ MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite(Map* map,
AllocationSpace space = NEW_SPACE;
if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE;
Object* obj;
- MaybeObject* maybe_obj = AllocateWithAllocationSite(map, space,
- allocation_site_info_payload);
+ MaybeObject* maybe_obj =
+ AllocateWithAllocationSite(map, space, allocation_site);
if (!maybe_obj->To(&obj)) return maybe_obj;
// Initialize the JSObject.
@@ -4524,7 +4538,7 @@ MaybeObject* Heap::AllocateJSObject(JSFunction* constructor,
MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor,
- Handle<Object> allocation_site_info_payload) {
+ Handle<AllocationSite> allocation_site) {
// Allocate the initial map if absent.
if (!constructor->has_initial_map()) {
Object* initial_map;
@@ -4538,8 +4552,7 @@ MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor,
// advice
Map* initial_map = constructor->initial_map();
- Cell* cell = Cell::cast(*allocation_site_info_payload);
- Smi* smi = Smi::cast(cell->value());
+ Smi* smi = Smi::cast(allocation_site->payload());
ElementsKind to_kind = static_cast<ElementsKind>(smi->value());
AllocationSiteMode mode = TRACK_ALLOCATION_SITE;
if (to_kind != initial_map->elements_kind()) {
@@ -4547,13 +4560,13 @@ MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor,
if (!maybe_new_map->To(&initial_map)) return maybe_new_map;
// Possibly alter the mode, since we found an updated elements kind
// in the type info cell.
- mode = AllocationSiteInfo::GetMode(to_kind);
+ mode = AllocationSite::GetMode(to_kind);
}
MaybeObject* result;
if (mode == TRACK_ALLOCATION_SITE) {
result = AllocateJSObjectFromMapWithAllocationSite(initial_map,
- allocation_site_info_payload);
+ allocation_site);
} else {
result = AllocateJSObjectFromMap(initial_map, NOT_TENURED);
}
@@ -4648,10 +4661,10 @@ MaybeObject* Heap::AllocateJSArrayAndStorageWithAllocationSite(
ElementsKind elements_kind,
int length,
int capacity,
- Handle<Object> allocation_site_payload,
+ Handle<AllocationSite> allocation_site,
ArrayStorageAllocationMode mode) {
MaybeObject* maybe_array = AllocateJSArrayWithAllocationSite(elements_kind,
- allocation_site_payload);
+ allocation_site);
JSArray* array;
if (!maybe_array->To(&array)) return maybe_array;
return AllocateJSArrayStorage(array, length, capacity, mode);
@@ -4900,7 +4913,9 @@ MaybeObject* Heap::CopyJSObject(JSObject* source) {
}
-MaybeObject* Heap::CopyJSObjectWithAllocationSite(JSObject* source) {
+MaybeObject* Heap::CopyJSObjectWithAllocationSite(
+ JSObject* source,
+ AllocationSite* site) {
// Never used to copy functions. If functions need to be copied we
// have to be careful to clear the literals array.
SLOW_ASSERT(!source->IsJSFunction());
@@ -4950,7 +4965,7 @@ MaybeObject* Heap::CopyJSObjectWithAllocationSite(JSObject* source) {
AllocationSiteInfo* alloc_info;
if (maybe_alloc_info->To(&alloc_info)) {
alloc_info->set_map_no_write_barrier(allocation_site_info_map());
- alloc_info->set_payload(source, SKIP_WRITE_BARRIER);
+ alloc_info->set_allocation_site(site, SKIP_WRITE_BARRIER);
}
}
} else {
@@ -4972,7 +4987,7 @@ MaybeObject* Heap::CopyJSObjectWithAllocationSite(JSObject* source) {
AllocationSiteInfo* alloc_info = reinterpret_cast<AllocationSiteInfo*>(
reinterpret_cast<Address>(clone) + object_size);
alloc_info->set_map_no_write_barrier(allocation_site_info_map());
- alloc_info->set_payload(source, SKIP_WRITE_BARRIER);
+ alloc_info->set_allocation_site(site, SKIP_WRITE_BARRIER);
}
SLOW_ASSERT(
@@ -5235,6 +5250,7 @@ static inline void WriteOneByteData(String* s, uint8_t* chars, int len) {
String::WriteToFlat(s, chars, 0, len);
}
+
static inline void WriteTwoByteData(String* s, uint16_t* chars, int len) {
ASSERT(s->length() == len);
String::WriteToFlat(s, chars, 0, len);
@@ -5388,7 +5404,7 @@ MaybeObject* Heap::AllocateJSArray(
MaybeObject* Heap::AllocateJSArrayWithAllocationSite(
ElementsKind elements_kind,
- Handle<Object> allocation_site_info_payload) {
+ Handle<AllocationSite> allocation_site) {
Context* native_context = isolate()->context()->native_context();
JSFunction* array_function = native_context->array_function();
Map* map = array_function->initial_map();
@@ -5400,8 +5416,7 @@ MaybeObject* Heap::AllocateJSArrayWithAllocationSite(
map = Map::cast(maybe_transitioned_map);
}
}
- return AllocateJSObjectFromMapWithAllocationSite(map,
- allocation_site_info_payload);
+ return AllocateJSObjectFromMapWithAllocationSite(map, allocation_site);
}
@@ -5419,6 +5434,7 @@ MaybeObject* Heap::AllocateEmptyFixedArray() {
return result;
}
+
MaybeObject* Heap::AllocateEmptyExternalArray(ExternalArrayType array_type) {
return AllocateExternalArray(0, array_type, NULL, TENURED);
}
@@ -6755,6 +6771,7 @@ static void InitializeGCOnce() {
MarkCompactCollector::Initialize();
}
+
bool Heap::SetUp() {
#ifdef DEBUG
allocation_timeout_ = FLAG_gc_interval;
@@ -6865,6 +6882,7 @@ bool Heap::SetUp() {
return true;
}
+
bool Heap::CreateHeapObjects() {
// Create initial maps.
if (!CreateInitialMaps()) return false;
@@ -7030,6 +7048,7 @@ class PrintHandleVisitor: public ObjectVisitor {
}
};
+
void Heap::PrintHandles() {
PrintF("Handles:\n");
PrintHandleVisitor v;
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698