| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Add the Foo constructor the global object. | 147 // Add the Foo constructor the global object. |
| 148 env->Global()->Set(v8::String::New("Foo"), v8::Utils::ToLocal(function)); | 148 env->Global()->Set(v8::String::New("Foo"), v8::Utils::ToLocal(function)); |
| 149 // Call the accessor through JavaScript. | 149 // Call the accessor through JavaScript. |
| 150 v8::Handle<v8::Value> result = | 150 v8::Handle<v8::Value> result = |
| 151 v8::Script::Compile(v8::String::New("(new Foo).get"))->Run(); | 151 v8::Script::Compile(v8::String::New("(new Foo).get"))->Run(); |
| 152 CHECK_EQ(42, result->Int32Value()); | 152 CHECK_EQ(42, result->Int32Value()); |
| 153 env->Exit(); | 153 env->Exit(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 | 156 |
| 157 // TODO(gc) [EVE] uncomment when CodeRange support will be rolled back |
| 158 #if 0 |
| 157 // CodeRange test. | 159 // CodeRange test. |
| 158 // Tests memory management in a CodeRange by allocating and freeing blocks, | 160 // Tests memory management in a CodeRange by allocating and freeing blocks, |
| 159 // using a pseudorandom generator to choose block sizes geometrically | 161 // using a pseudorandom generator to choose block sizes geometrically |
| 160 // distributed between 2 * Page::kPageSize and 2^5 + 1 * Page::kPageSize. | 162 // distributed between 2 * Page::kPageSize and 2^5 + 1 * Page::kPageSize. |
| 161 // Ensure that the freed chunks are collected and reused by allocating (in | 163 // Ensure that the freed chunks are collected and reused by allocating (in |
| 162 // total) more than the size of the CodeRange. | 164 // total) more than the size of the CodeRange. |
| 163 | 165 |
| 164 // This pseudorandom generator does not need to be particularly good. | 166 // This pseudorandom generator does not need to be particularly good. |
| 165 // Use the lower half of the V8::Random() generator. | 167 // Use the lower half of the V8::Random() generator. |
| 166 unsigned int Pseudorandom() { | 168 unsigned int Pseudorandom() { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 if (index < blocks.length() - 1) { | 209 if (index < blocks.length() - 1) { |
| 208 blocks[index] = blocks.RemoveLast(); | 210 blocks[index] = blocks.RemoveLast(); |
| 209 } else { | 211 } else { |
| 210 blocks.RemoveLast(); | 212 blocks.RemoveLast(); |
| 211 } | 213 } |
| 212 } | 214 } |
| 213 } | 215 } |
| 214 | 216 |
| 215 CodeRange::TearDown(); | 217 CodeRange::TearDown(); |
| 216 } | 218 } |
| 219 #endif |
| OLD | NEW |