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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 factory->NewFunction(factory->function_string(), factory->null_value()); | 126 factory->NewFunction(factory->function_string(), factory->null_value()); |
127 // Force the creation of an initial map and set the code to | 127 // Force the creation of an initial map and set the code to |
128 // something empty. | 128 // something empty. |
129 factory->NewJSObject(function); | 129 factory->NewJSObject(function); |
130 function->ReplaceCode(CcTest::i_isolate()->builtins()->builtin( | 130 function->ReplaceCode(CcTest::i_isolate()->builtins()->builtin( |
131 Builtins::kEmptyFunction)); | 131 Builtins::kEmptyFunction)); |
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 = factory->NewStringFromStaticAscii("get"); |
137 factory->NewStringFromAscii(Vector<const char>("get", 3)); | |
138 ASSERT(instance_descriptors->IsEmpty()); | 137 ASSERT(instance_descriptors->IsEmpty()); |
139 | 138 |
140 Map::EnsureDescriptorSlack(map, 1); | 139 Map::EnsureDescriptorSlack(map, 1); |
141 | 140 |
142 CallbacksDescriptor d(name, | 141 CallbacksDescriptor d(name, |
143 foreign, | 142 foreign, |
144 static_cast<PropertyAttributes>(0)); | 143 static_cast<PropertyAttributes>(0)); |
145 map->AppendDescriptor(&d); | 144 map->AppendDescriptor(&d); |
146 | 145 |
147 // Add the Foo constructor the global object. | 146 // Add the Foo constructor the global object. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 if (index < blocks.length() - 1) { | 216 if (index < blocks.length() - 1) { |
218 blocks[index] = blocks.RemoveLast(); | 217 blocks[index] = blocks.RemoveLast(); |
219 } else { | 218 } else { |
220 blocks.RemoveLast(); | 219 blocks.RemoveLast(); |
221 } | 220 } |
222 } | 221 } |
223 } | 222 } |
224 | 223 |
225 code_range.TearDown(); | 224 code_range.TearDown(); |
226 } | 225 } |
OLD | NEW |