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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 Builtins::kEmptyFunction)); | 145 Builtins::kEmptyFunction)); |
146 // Patch the map to have an accessor for "get". | 146 // Patch the map to have an accessor for "get". |
147 Handle<Map> map(function->initial_map()); | 147 Handle<Map> map(function->initial_map()); |
148 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); | 148 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); |
149 DCHECK(instance_descriptors->IsEmpty()); | 149 DCHECK(instance_descriptors->IsEmpty()); |
150 | 150 |
151 PropertyAttributes attrs = static_cast<PropertyAttributes>(0); | 151 PropertyAttributes attrs = static_cast<PropertyAttributes>(0); |
152 Handle<AccessorInfo> foreign = TestAccessorInfo(isolate, attrs); | 152 Handle<AccessorInfo> foreign = TestAccessorInfo(isolate, attrs); |
153 Map::EnsureDescriptorSlack(map, 1); | 153 Map::EnsureDescriptorSlack(map, 1); |
154 | 154 |
155 CallbacksDescriptor d(Handle<Name>(Name::cast(foreign->name())), | 155 AccessorConstantDescriptor d(Handle<Name>(Name::cast(foreign->name())), |
156 foreign, attrs); | 156 foreign, attrs); |
157 map->AppendDescriptor(&d); | 157 map->AppendDescriptor(&d); |
158 | 158 |
159 // Add the Foo constructor the global object. | 159 // Add the Foo constructor the global object. |
160 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "Foo"), | 160 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "Foo"), |
161 v8::Utils::ToLocal(function)); | 161 v8::Utils::ToLocal(function)); |
162 // Call the accessor through JavaScript. | 162 // Call the accessor through JavaScript. |
163 v8::Handle<v8::Value> result = v8::Script::Compile( | 163 v8::Handle<v8::Value> result = v8::Script::Compile( |
164 v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get"))->Run(); | 164 v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get"))->Run(); |
165 CHECK_EQ(true, result->BooleanValue()); | 165 CHECK_EQ(true, result->BooleanValue()); |
166 env->Exit(); | 166 env->Exit(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (index < blocks.length() - 1) { | 230 if (index < blocks.length() - 1) { |
231 blocks[index] = blocks.RemoveLast(); | 231 blocks[index] = blocks.RemoveLast(); |
232 } else { | 232 } else { |
233 blocks.RemoveLast(); | 233 blocks.RemoveLast(); |
234 } | 234 } |
235 } | 235 } |
236 } | 236 } |
237 | 237 |
238 code_range.TearDown(); | 238 code_range.TearDown(); |
239 } | 239 } |
OLD | NEW |