699add3afc
Remove virtual destructor from ZoneAllocated. Instead, subclasses that need one have it explicitly declared. This makes ZoneAllocated objects without virtual functions smaller because there won't be a vtable for them. R=srdjan@google.com Review URL: https://codereview.chromium.org//317273005 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37228 260f80e4-7a28-3924-810f-c04153c831b5
33 lines
902 B
C++
33 lines
902 B
C++
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "vm/allocation.h"
|
|
|
|
#include "platform/assert.h"
|
|
#include "vm/isolate.h"
|
|
#include "vm/zone.h"
|
|
|
|
namespace dart {
|
|
|
|
static void* Allocate(uword size, BaseIsolate* isolate) {
|
|
ASSERT(isolate != NULL);
|
|
ASSERT(isolate->current_zone() != NULL);
|
|
if (size > static_cast<uword>(kIntptrMax)) {
|
|
FATAL1("ZoneAllocated object has unexpectedly large size %" Pu "", size);
|
|
}
|
|
return reinterpret_cast<void*>(isolate->current_zone()->AllocUnsafe(size));
|
|
}
|
|
|
|
|
|
void* ZoneAllocated::operator new(uword size) {
|
|
return Allocate(size, Isolate::Current());
|
|
}
|
|
|
|
|
|
void* ZoneAllocated::operator new(uword size, BaseIsolate* isolate) {
|
|
return Allocate(size, isolate);
|
|
}
|
|
|
|
} // namespace dart
|