OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors); | 142 v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors); |
143 map->set_instance_descriptors(*new_descriptors); | 143 map->set_instance_descriptors(*new_descriptors); |
144 | 144 |
145 CallbacksDescriptor d(*name, | 145 CallbacksDescriptor d(*name, |
146 *foreign, | 146 *foreign, |
147 static_cast<PropertyAttributes>(0)); | 147 static_cast<PropertyAttributes>(0)); |
148 map->AppendDescriptor(&d, witness); | 148 map->AppendDescriptor(&d, witness); |
149 | 149 |
150 // Add the Foo constructor the global object. | 150 // Add the Foo constructor the global object. |
151 env->Global()->Set(v8::String::New("Foo"), v8::Utils::ToLocal(function)); | 151 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "Foo"), |
| 152 v8::Utils::ToLocal(function)); |
152 // Call the accessor through JavaScript. | 153 // Call the accessor through JavaScript. |
153 v8::Handle<v8::Value> result = | 154 v8::Handle<v8::Value> result = v8::Script::Compile( |
154 v8::Script::Compile(v8::String::New("(new Foo).get"))->Run(); | 155 v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get"))->Run(); |
155 CHECK_EQ(42, result->Int32Value()); | 156 CHECK_EQ(42, result->Int32Value()); |
156 env->Exit(); | 157 env->Exit(); |
157 } | 158 } |
158 | 159 |
159 | 160 |
160 // CodeRange test. | 161 // CodeRange test. |
161 // Tests memory management in a CodeRange by allocating and freeing blocks, | 162 // Tests memory management in a CodeRange by allocating and freeing blocks, |
162 // using a pseudorandom generator to choose block sizes geometrically | 163 // using a pseudorandom generator to choose block sizes geometrically |
163 // distributed between 2 * Page::kPageSize and 2^5 + 1 * Page::kPageSize. | 164 // distributed between 2 * Page::kPageSize and 2^5 + 1 * Page::kPageSize. |
164 // Ensure that the freed chunks are collected and reused by allocating (in | 165 // Ensure that the freed chunks are collected and reused by allocating (in |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 if (index < blocks.length() - 1) { | 220 if (index < blocks.length() - 1) { |
220 blocks[index] = blocks.RemoveLast(); | 221 blocks[index] = blocks.RemoveLast(); |
221 } else { | 222 } else { |
222 blocks.RemoveLast(); | 223 blocks.RemoveLast(); |
223 } | 224 } |
224 } | 225 } |
225 } | 226 } |
226 | 227 |
227 code_range.TearDown(); | 228 code_range.TearDown(); |
228 } | 229 } |
OLD | NEW |