1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/jitcraft/Functions.cpp Mon Jul 02 01:52:57 2012 -0700
1.3 @@ -0,0 +1,37 @@
1.4 +/*
1.5 + * Copyright (C) 2012 David Anderson
1.6 + *
1.7 + * This file is part of JITCraft.
1.8 + *
1.9 + * JITCraft is free software: you can redistribute it and/or modify it under
1.10 + * the terms of the GNU General Public License as published by the Free
1.11 + * Software Foundation, either version 3 of the License, or (at your option)
1.12 + * any later version.
1.13 + *
1.14 + * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
1.15 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
1.17 + *
1.18 + * You should have received a copy of the GNU General Public License along with
1.19 + * JITCraft. If not, see http://www.gnu.org/licenses/.
1.20 + */
1.21 +#include "Functions.h"
1.22 +#include "Modules.h"
1.23 +#include "Zone.h"
1.24 +#include "Heap-inl.h"
1.25 +
1.26 +using namespace jc;
1.27 +
1.28 +Function *
1.29 +Function::New(Zone *zone, Module *module, Code *code, Type *type, const SourcePosition &pos)
1.30 +{
1.31 + Function *fun = Function::cast(zone->allocate(MapKind_Function, sizeof(Function), Heap::Tenure_Old));
1.32 + if (!fun)
1.33 + return NULL;
1.34 +
1.35 + fun->code_ = code;
1.36 + fun->module_ = module;
1.37 + fun->pos_ = pos;
1.38 + fun->type_ = type;
1.39 + return fun;
1.40 +}