fschneider@chromium.org | 35814e5 | 2012-03-01 15:43:35 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | // Flags: --allow-natives-syntax --inline-construct --nolimit-inlining |
| 29 | |
| 30 | // Test that huge constructors (more than 256 this assignments) are |
| 31 | // handled correctly. |
| 32 | |
| 33 | // Test huge constructor when being inlined into hydrogen. |
| 34 | function test() { |
| 35 | return new huge(); |
| 36 | } |
| 37 | test(); |
| 38 | test(); |
| 39 | %OptimizeFunctionOnNextCall(test); |
| 40 | var o = test(); |
| 41 | assertEquals(1, o.foo1); |
| 42 | assertEquals(257, o.foo257); |
| 43 | |
| 44 | // Test huge constructor with specialized constructor stub. |
| 45 | var o = new huge(); |
| 46 | assertEquals(1, o.foo1); |
| 47 | assertEquals(257, o.foo257); |
| 48 | |
| 49 | // The huge constructor, nothing interesting beyond this point. |
| 50 | function huge() { |
| 51 | this.foo1 = 1; |
| 52 | this.foo2 = 2; |
| 53 | this.foo3 = 3; |
| 54 | this.foo4 = 4; |
| 55 | this.foo5 = 5; |
| 56 | this.foo6 = 6; |
| 57 | this.foo7 = 7; |
| 58 | this.foo8 = 8; |
| 59 | this.foo9 = 9; |
| 60 | this.foo10 = 10; |
| 61 | this.foo11 = 11; |
| 62 | this.foo12 = 12; |
| 63 | this.foo13 = 13; |
| 64 | this.foo14 = 14; |
| 65 | this.foo15 = 15; |
| 66 | this.foo16 = 16; |
| 67 | this.foo17 = 17; |
| 68 | this.foo18 = 18; |
| 69 | this.foo19 = 19; |
| 70 | this.foo20 = 20; |
| 71 | this.foo21 = 21; |
| 72 | this.foo22 = 22; |
| 73 | this.foo23 = 23; |
| 74 | this.foo24 = 24; |
| 75 | this.foo25 = 25; |
| 76 | this.foo26 = 26; |
| 77 | this.foo27 = 27; |
| 78 | this.foo28 = 28; |
| 79 | this.foo29 = 29; |
| 80 | this.foo30 = 30; |
| 81 | this.foo31 = 31; |
| 82 | this.foo32 = 32; |
| 83 | this.foo33 = 33; |
| 84 | this.foo34 = 34; |
| 85 | this.foo35 = 35; |
| 86 | this.foo36 = 36; |
| 87 | this.foo37 = 37; |
| 88 | this.foo38 = 38; |
| 89 | this.foo39 = 39; |
| 90 | this.foo40 = 40; |
| 91 | this.foo41 = 41; |
| 92 | this.foo42 = 42; |
| 93 | this.foo43 = 43; |
| 94 | this.foo44 = 44; |
| 95 | this.foo45 = 45; |
| 96 | this.foo46 = 46; |
| 97 | this.foo47 = 47; |
| 98 | this.foo48 = 48; |
| 99 | this.foo49 = 49; |
| 100 | this.foo50 = 50; |
| 101 | this.foo51 = 51; |
| 102 | this.foo52 = 52; |
| 103 | this.foo53 = 53; |
| 104 | this.foo54 = 54; |
| 105 | this.foo55 = 55; |
| 106 | this.foo56 = 56; |
| 107 | this.foo57 = 57; |
| 108 | this.foo58 = 58; |
| 109 | this.foo59 = 59; |
| 110 | this.foo60 = 60; |
| 111 | this.foo61 = 61; |
| 112 | this.foo62 = 62; |
| 113 | this.foo63 = 63; |
| 114 | this.foo64 = 64; |
| 115 | this.foo65 = 65; |
| 116 | this.foo66 = 66; |
| 117 | this.foo67 = 67; |
| 118 | this.foo68 = 68; |
| 119 | this.foo69 = 69; |
| 120 | this.foo70 = 70; |
| 121 | this.foo71 = 71; |
| 122 | this.foo72 = 72; |
| 123 | this.foo73 = 73; |
| 124 | this.foo74 = 74; |
| 125 | this.foo75 = 75; |
| 126 | this.foo76 = 76; |
| 127 | this.foo77 = 77; |
| 128 | this.foo78 = 78; |
| 129 | this.foo79 = 79; |
| 130 | this.foo80 = 80; |
| 131 | this.foo81 = 81; |
| 132 | this.foo82 = 82; |
| 133 | this.foo83 = 83; |
| 134 | this.foo84 = 84; |
| 135 | this.foo85 = 85; |
| 136 | this.foo86 = 86; |
| 137 | this.foo87 = 87; |
| 138 | this.foo88 = 88; |
| 139 | this.foo89 = 89; |
| 140 | this.foo90 = 90; |
| 141 | this.foo91 = 91; |
| 142 | this.foo92 = 92; |
| 143 | this.foo93 = 93; |
| 144 | this.foo94 = 94; |
| 145 | this.foo95 = 95; |
| 146 | this.foo96 = 96; |
| 147 | this.foo97 = 97; |
| 148 | this.foo98 = 98; |
| 149 | this.foo99 = 99; |
| 150 | this.foo100 = 100; |
| 151 | this.foo101 = 101; |
| 152 | this.foo102 = 102; |
| 153 | this.foo103 = 103; |
| 154 | this.foo104 = 104; |
| 155 | this.foo105 = 105; |
| 156 | this.foo106 = 106; |
| 157 | this.foo107 = 107; |
| 158 | this.foo108 = 108; |
| 159 | this.foo109 = 109; |
| 160 | this.foo110 = 110; |
| 161 | this.foo111 = 111; |
| 162 | this.foo112 = 112; |
| 163 | this.foo113 = 113; |
| 164 | this.foo114 = 114; |
| 165 | this.foo115 = 115; |
| 166 | this.foo116 = 116; |
| 167 | this.foo117 = 117; |
| 168 | this.foo118 = 118; |
| 169 | this.foo119 = 119; |
| 170 | this.foo120 = 120; |
| 171 | this.foo121 = 121; |
| 172 | this.foo122 = 122; |
| 173 | this.foo123 = 123; |
| 174 | this.foo124 = 124; |
| 175 | this.foo125 = 125; |
| 176 | this.foo126 = 126; |
| 177 | this.foo127 = 127; |
| 178 | this.foo128 = 128; |
| 179 | this.foo129 = 129; |
| 180 | this.foo130 = 130; |
| 181 | this.foo131 = 131; |
| 182 | this.foo132 = 132; |
| 183 | this.foo133 = 133; |
| 184 | this.foo134 = 134; |
| 185 | this.foo135 = 135; |
| 186 | this.foo136 = 136; |
| 187 | this.foo137 = 137; |
| 188 | this.foo138 = 138; |
| 189 | this.foo139 = 139; |
| 190 | this.foo140 = 140; |
| 191 | this.foo141 = 141; |
| 192 | this.foo142 = 142; |
| 193 | this.foo143 = 143; |
| 194 | this.foo144 = 144; |
| 195 | this.foo145 = 145; |
| 196 | this.foo146 = 146; |
| 197 | this.foo147 = 147; |
| 198 | this.foo148 = 148; |
| 199 | this.foo149 = 149; |
| 200 | this.foo150 = 150; |
| 201 | this.foo151 = 151; |
| 202 | this.foo152 = 152; |
| 203 | this.foo153 = 153; |
| 204 | this.foo154 = 154; |
| 205 | this.foo155 = 155; |
| 206 | this.foo156 = 156; |
| 207 | this.foo157 = 157; |
| 208 | this.foo158 = 158; |
| 209 | this.foo159 = 159; |
| 210 | this.foo160 = 160; |
| 211 | this.foo161 = 161; |
| 212 | this.foo162 = 162; |
| 213 | this.foo163 = 163; |
| 214 | this.foo164 = 164; |
| 215 | this.foo165 = 165; |
| 216 | this.foo166 = 166; |
| 217 | this.foo167 = 167; |
| 218 | this.foo168 = 168; |
| 219 | this.foo169 = 169; |
| 220 | this.foo170 = 170; |
| 221 | this.foo171 = 171; |
| 222 | this.foo172 = 172; |
| 223 | this.foo173 = 173; |
| 224 | this.foo174 = 174; |
| 225 | this.foo175 = 175; |
| 226 | this.foo176 = 176; |
| 227 | this.foo177 = 177; |
| 228 | this.foo178 = 178; |
| 229 | this.foo179 = 179; |
| 230 | this.foo180 = 180; |
| 231 | this.foo181 = 181; |
| 232 | this.foo182 = 182; |
| 233 | this.foo183 = 183; |
| 234 | this.foo184 = 184; |
| 235 | this.foo185 = 185; |
| 236 | this.foo186 = 186; |
| 237 | this.foo187 = 187; |
| 238 | this.foo188 = 188; |
| 239 | this.foo189 = 189; |
| 240 | this.foo190 = 190; |
| 241 | this.foo191 = 191; |
| 242 | this.foo192 = 192; |
| 243 | this.foo193 = 193; |
| 244 | this.foo194 = 194; |
| 245 | this.foo195 = 195; |
| 246 | this.foo196 = 196; |
| 247 | this.foo197 = 197; |
| 248 | this.foo198 = 198; |
| 249 | this.foo199 = 199; |
| 250 | this.foo200 = 200; |
| 251 | this.foo201 = 201; |
| 252 | this.foo202 = 202; |
| 253 | this.foo203 = 203; |
| 254 | this.foo204 = 204; |
| 255 | this.foo205 = 205; |
| 256 | this.foo206 = 206; |
| 257 | this.foo207 = 207; |
| 258 | this.foo208 = 208; |
| 259 | this.foo209 = 209; |
| 260 | this.foo210 = 210; |
| 261 | this.foo211 = 211; |
| 262 | this.foo212 = 212; |
| 263 | this.foo213 = 213; |
| 264 | this.foo214 = 214; |
| 265 | this.foo215 = 215; |
| 266 | this.foo216 = 216; |
| 267 | this.foo217 = 217; |
| 268 | this.foo218 = 218; |
| 269 | this.foo219 = 219; |
| 270 | this.foo220 = 220; |
| 271 | this.foo221 = 221; |
| 272 | this.foo222 = 222; |
| 273 | this.foo223 = 223; |
| 274 | this.foo224 = 224; |
| 275 | this.foo225 = 225; |
| 276 | this.foo226 = 226; |
| 277 | this.foo227 = 227; |
| 278 | this.foo228 = 228; |
| 279 | this.foo229 = 229; |
| 280 | this.foo230 = 230; |
| 281 | this.foo231 = 231; |
| 282 | this.foo232 = 232; |
| 283 | this.foo233 = 233; |
| 284 | this.foo234 = 234; |
| 285 | this.foo235 = 235; |
| 286 | this.foo236 = 236; |
| 287 | this.foo237 = 237; |
| 288 | this.foo238 = 238; |
| 289 | this.foo239 = 239; |
| 290 | this.foo240 = 240; |
| 291 | this.foo241 = 241; |
| 292 | this.foo242 = 242; |
| 293 | this.foo243 = 243; |
| 294 | this.foo244 = 244; |
| 295 | this.foo245 = 245; |
| 296 | this.foo246 = 246; |
| 297 | this.foo247 = 247; |
| 298 | this.foo248 = 248; |
| 299 | this.foo249 = 249; |
| 300 | this.foo250 = 250; |
| 301 | this.foo251 = 251; |
| 302 | this.foo252 = 252; |
| 303 | this.foo253 = 253; |
| 304 | this.foo254 = 254; |
| 305 | this.foo255 = 255; |
| 306 | this.foo256 = 256; |
| 307 | this.foo257 = 257; |
| 308 | } |