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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 PropertyAttributes attrs = static_cast<PropertyAttributes>(0); | 154 PropertyAttributes attrs = static_cast<PropertyAttributes>(0); |
155 Handle<AccessorInfo> foreign = TestAccessorInfo(isolate, attrs); | 155 Handle<AccessorInfo> foreign = TestAccessorInfo(isolate, attrs); |
156 Map::EnsureDescriptorSlack(map, 1); | 156 Map::EnsureDescriptorSlack(map, 1); |
157 | 157 |
158 AccessorConstantDescriptor d(Handle<Name>(Name::cast(foreign->name())), | 158 AccessorConstantDescriptor d(Handle<Name>(Name::cast(foreign->name())), |
159 foreign, attrs); | 159 foreign, attrs); |
160 map->AppendDescriptor(&d); | 160 map->AppendDescriptor(&d); |
161 | 161 |
162 // Add the Foo constructor the global object. | 162 // Add the Foo constructor the global object. |
163 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "Foo"), | 163 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "Foo"), |
164 v8::Utils::ToLocal(function)); | 164 v8::Utils::FunctionToLocal(function)); |
165 // Call the accessor through JavaScript. | 165 // Call the accessor through JavaScript. |
166 v8::Handle<v8::Value> result = v8::Script::Compile( | 166 v8::Handle<v8::Value> result = v8::Script::Compile( |
167 v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get"))->Run(); | 167 v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get"))->Run(); |
168 CHECK_EQ(true, result->BooleanValue()); | 168 CHECK_EQ(true, result->BooleanValue()); |
169 env->Exit(); | 169 env->Exit(); |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 // CodeRange test. | 173 // CodeRange test. |
174 // Tests memory management in a CodeRange by allocating and freeing blocks, | 174 // Tests memory management in a CodeRange by allocating and freeing blocks, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 code_range.FreeRawMemory(blocks[index].base, blocks[index].size); | 234 code_range.FreeRawMemory(blocks[index].base, blocks[index].size); |
235 current_allocated -= blocks[index].size; | 235 current_allocated -= blocks[index].size; |
236 if (index < blocks.length() - 1) { | 236 if (index < blocks.length() - 1) { |
237 blocks[index] = blocks.RemoveLast(); | 237 blocks[index] = blocks.RemoveLast(); |
238 } else { | 238 } else { |
239 blocks.RemoveLast(); | 239 blocks.RemoveLast(); |
240 } | 240 } |
241 } | 241 } |
242 } | 242 } |
243 } | 243 } |
OLD | NEW |