ASC-4041: Skip two spidermonkey regression tests due to stack overflow when compiling...
[tamarin-stm.git] / extensions / ST_mmgc_gcheap.cpp
blobf390c62069ccda59562cb0f9669774c893fdbbcd
1 // Generated from ST_mmgc_gcheap.st
2 // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
3 //
4 // ***** BEGIN LICENSE BLOCK *****
5 // Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 //
7 // The contents of this file are subject to the Mozilla Public License Version
8 // 1.1 (the "License"); you may not use this file except in compliance with
9 // the License. You may obtain a copy of the License at
10 // http://www.mozilla.org/MPL/
12 // Software distributed under the License is distributed on an "AS IS" basis,
13 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 // for the specific language governing rights and limitations under the
15 // License.
17 // The Original Code is [Open Source Virtual Machine.].
19 // The Initial Developer of the Original Code is
20 // Adobe System Incorporated.
21 // Portions created by the Initial Developer are Copyright (C) 2004-2006
22 // the Initial Developer. All Rights Reserved.
24 // Contributor(s):
25 // Adobe AS3 Team
27 // Alternatively, the contents of this file may be used under the terms of
28 // either the GNU General Public License Version 2 or later (the "GPL"), or
29 // the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 // in which case the provisions of the GPL or the LGPL are applicable instead
31 // of those above. If you wish to allow use of your version of this file only
32 // under the terms of either the GPL or the LGPL, and not to allow others to
33 // use your version of this file under the terms of the MPL, indicate your
34 // decision by deleting the provisions above and replace them with the notice
35 // and other provisions required by the GPL or the LGPL. If you do not delete
36 // the provisions above, a recipient may use your version of this file under
37 // the terms of any one of the MPL, the GPL or the LGPL.
39 // ***** END LICENSE BLOCK ***** */
41 #include "avmshell.h"
42 #ifdef VMCFG_SELFTEST
43 namespace avmplus {
44 class ST_mmgc_gcheap : public Selftest {
45 public:
46 ST_mmgc_gcheap(AvmCore* core);
47 virtual void run(int n);
48 private:
49 static const char* ST_names[];
50 static const bool ST_explicits[];
51 void test0();
52 void test1();
54 ST_mmgc_gcheap::ST_mmgc_gcheap(AvmCore* core)
55 : Selftest(core, "mmgc", "gcheap", ST_mmgc_gcheap::ST_names,ST_mmgc_gcheap::ST_explicits)
57 const char* ST_mmgc_gcheap::ST_names[] = {"largeAlloc","largeAllocAlignment", NULL };
58 const bool ST_mmgc_gcheap::ST_explicits[] = {false,false, false };
59 void ST_mmgc_gcheap::run(int n) {
60 switch(n) {
61 case 0: test0(); return;
62 case 1: test1(); return;
65 using namespace MMgc;
67 void ST_mmgc_gcheap::test0() {
68 GCHeap *heap = GCHeap::GetGCHeap();
69 for(int i=1;i<4;i++) {
70 void *item = heap->Alloc(GCHeap::kOSAllocThreshold*i);
71 #line 50 "ST_mmgc_gcheap.st"
72 verifyPass(heap->Size(item) == GCHeap::kOSAllocThreshold*i, "heap->Size(item) == GCHeap::kOSAllocThreshold*i", __FILE__, __LINE__);
73 heap->Free(item);
75 #line 53 "ST_mmgc_gcheap.st"
76 verifyPass(true, "true", __FILE__, __LINE__);
79 void ST_mmgc_gcheap::test1() {
80 GCHeap *heap = GCHeap::GetGCHeap();
81 for(int i=1;i<10;i++) {
82 void *item = heap->Alloc(GCHeap::kOSAllocThreshold*i, GCHeap::flags_Alloc, 1<<i);
83 #line 59 "ST_mmgc_gcheap.st"
84 verifyPass(heap->Size(item) == GCHeap::kOSAllocThreshold*i, "heap->Size(item) == GCHeap::kOSAllocThreshold*i", __FILE__, __LINE__);
85 #line 60 "ST_mmgc_gcheap.st"
86 verifyPass(uintptr_t(((GCHeap::kBlockSize<<(i-1))-1) & uintptr_t(item)) == 0, "uintptr_t(((GCHeap::kBlockSize<<(i-1))-1) & uintptr_t(item)) == 0", __FILE__, __LINE__);
87 heap->Free(item);
92 void create_mmgc_gcheap(AvmCore* core) { new ST_mmgc_gcheap(core); }
94 #endif