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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // Patch the map to have an accessor for "get". | 132 // Patch the map to have an accessor for "get". |
133 Handle<Map> map(function->initial_map()); | 133 Handle<Map> map(function->initial_map()); |
134 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); | 134 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); |
135 Handle<Foreign> foreign = factory->NewForeign(&kDescriptor); | 135 Handle<Foreign> foreign = factory->NewForeign(&kDescriptor); |
136 Handle<String> name = | 136 Handle<String> name = |
137 factory->NewStringFromAscii(Vector<const char>("get", 3)); | 137 factory->NewStringFromAscii(Vector<const char>("get", 3)); |
138 ASSERT(instance_descriptors->IsEmpty()); | 138 ASSERT(instance_descriptors->IsEmpty()); |
139 | 139 |
140 Handle<DescriptorArray> new_descriptors = factory->NewDescriptorArray(0, 1); | 140 Handle<DescriptorArray> new_descriptors = factory->NewDescriptorArray(0, 1); |
141 | 141 |
142 v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors); | |
143 map->set_instance_descriptors(*new_descriptors); | 142 map->set_instance_descriptors(*new_descriptors); |
144 | 143 |
145 CallbacksDescriptor d(name, | 144 CallbacksDescriptor d(name, |
146 foreign, | 145 foreign, |
147 static_cast<PropertyAttributes>(0)); | 146 static_cast<PropertyAttributes>(0)); |
148 map->AppendDescriptor(&d, witness); | 147 map->AppendDescriptor(&d); |
149 | 148 |
150 // Add the Foo constructor the global object. | 149 // Add the Foo constructor the global object. |
151 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "Foo"), | 150 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "Foo"), |
152 v8::Utils::ToLocal(function)); | 151 v8::Utils::ToLocal(function)); |
153 // Call the accessor through JavaScript. | 152 // Call the accessor through JavaScript. |
154 v8::Handle<v8::Value> result = v8::Script::Compile( | 153 v8::Handle<v8::Value> result = v8::Script::Compile( |
155 v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get"))->Run(); | 154 v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get"))->Run(); |
156 CHECK_EQ(42, result->Int32Value()); | 155 CHECK_EQ(42, result->Int32Value()); |
157 env->Exit(); | 156 env->Exit(); |
158 } | 157 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 if (index < blocks.length() - 1) { | 219 if (index < blocks.length() - 1) { |
221 blocks[index] = blocks.RemoveLast(); | 220 blocks[index] = blocks.RemoveLast(); |
222 } else { | 221 } else { |
223 blocks.RemoveLast(); | 222 blocks.RemoveLast(); |
224 } | 223 } |
225 } | 224 } |
226 } | 225 } |
227 | 226 |
228 code_range.TearDown(); | 227 code_range.TearDown(); |
229 } | 228 } |
OLD | NEW |