OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 Handle<Map> map(function->initial_map()); | 151 Handle<Map> map(function->initial_map()); |
152 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); | 152 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); |
153 Handle<Foreign> foreign = FACTORY->NewForeign(&kDescriptor); | 153 Handle<Foreign> foreign = FACTORY->NewForeign(&kDescriptor); |
154 Handle<String> name = | 154 Handle<String> name = |
155 FACTORY->NewStringFromAscii(Vector<const char>("get", 3)); | 155 FACTORY->NewStringFromAscii(Vector<const char>("get", 3)); |
156 ASSERT(instance_descriptors->IsEmpty()); | 156 ASSERT(instance_descriptors->IsEmpty()); |
157 | 157 |
158 Handle<DescriptorArray> new_descriptors = FACTORY->NewDescriptorArray(1); | 158 Handle<DescriptorArray> new_descriptors = FACTORY->NewDescriptorArray(1); |
159 | 159 |
160 v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors); | 160 v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors); |
| 161 map->set_instance_descriptors(*new_descriptors); |
161 | 162 |
162 CallbacksDescriptor d(*name, | 163 CallbacksDescriptor d(*name, |
163 *foreign, | 164 *foreign, |
164 static_cast<PropertyAttributes>(0), | 165 static_cast<PropertyAttributes>(0), |
165 v8::internal::PropertyDetails::kInitialIndex); | 166 v8::internal::PropertyDetails::kInitialIndex); |
166 new_descriptors->Set(0, &d, witness); | 167 map->AppendDescriptor(&d, witness); |
167 new_descriptors->SetLastAdded(0); | |
168 | 168 |
169 map->set_instance_descriptors(*new_descriptors); | |
170 // Add the Foo constructor the global object. | 169 // Add the Foo constructor the global object. |
171 env->Global()->Set(v8::String::New("Foo"), v8::Utils::ToLocal(function)); | 170 env->Global()->Set(v8::String::New("Foo"), v8::Utils::ToLocal(function)); |
172 // Call the accessor through JavaScript. | 171 // Call the accessor through JavaScript. |
173 v8::Handle<v8::Value> result = | 172 v8::Handle<v8::Value> result = |
174 v8::Script::Compile(v8::String::New("(new Foo).get"))->Run(); | 173 v8::Script::Compile(v8::String::New("(new Foo).get"))->Run(); |
175 CHECK_EQ(42, result->Int32Value()); | 174 CHECK_EQ(42, result->Int32Value()); |
176 env->Exit(); | 175 env->Exit(); |
177 } | 176 } |
178 | 177 |
179 | 178 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 blocks[index] = blocks.RemoveLast(); | 238 blocks[index] = blocks.RemoveLast(); |
240 } else { | 239 } else { |
241 blocks.RemoveLast(); | 240 blocks.RemoveLast(); |
242 } | 241 } |
243 } | 242 } |
244 } | 243 } |
245 | 244 |
246 code_range->TearDown(); | 245 code_range->TearDown(); |
247 delete code_range; | 246 delete code_range; |
248 } | 247 } |
OLD | NEW |