| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 | 111 |
| 112 const AccessorDescriptor kDescriptor = { | 112 const AccessorDescriptor kDescriptor = { |
| 113 TestAccessorGet, | 113 TestAccessorGet, |
| 114 0, | 114 0, |
| 115 0 | 115 0 |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 | 118 |
| 119 TEST(StressJS) { | 119 TEST(StressJS) { |
| 120 Isolate* isolate = Isolate::Current(); |
| 121 Factory* factory = isolate->factory(); |
| 120 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 122 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 121 v8::Handle<v8::Context> env = v8::Context::New(v8::Isolate::GetCurrent()); | 123 v8::Handle<v8::Context> env = v8::Context::New(v8::Isolate::GetCurrent()); |
| 122 env->Enter(); | 124 env->Enter(); |
| 123 Handle<JSFunction> function = | 125 Handle<JSFunction> function = |
| 124 FACTORY->NewFunction(FACTORY->function_string(), FACTORY->null_value()); | 126 factory->NewFunction(factory->function_string(), factory->null_value()); |
| 125 // 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 |
| 126 // something empty. | 128 // something empty. |
| 127 FACTORY->NewJSObject(function); | 129 factory->NewJSObject(function); |
| 128 function->ReplaceCode(Isolate::Current()->builtins()->builtin( | 130 function->ReplaceCode(Isolate::Current()->builtins()->builtin( |
| 129 Builtins::kEmptyFunction)); | 131 Builtins::kEmptyFunction)); |
| 130 // Patch the map to have an accessor for "get". | 132 // Patch the map to have an accessor for "get". |
| 131 Handle<Map> map(function->initial_map()); | 133 Handle<Map> map(function->initial_map()); |
| 132 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); | 134 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); |
| 133 Handle<Foreign> foreign = FACTORY->NewForeign(&kDescriptor); | 135 Handle<Foreign> foreign = factory->NewForeign(&kDescriptor); |
| 134 Handle<String> name = | 136 Handle<String> name = |
| 135 FACTORY->NewStringFromAscii(Vector<const char>("get", 3)); | 137 factory->NewStringFromAscii(Vector<const char>("get", 3)); |
| 136 ASSERT(instance_descriptors->IsEmpty()); | 138 ASSERT(instance_descriptors->IsEmpty()); |
| 137 | 139 |
| 138 Handle<DescriptorArray> new_descriptors = FACTORY->NewDescriptorArray(0, 1); | 140 Handle<DescriptorArray> new_descriptors = factory->NewDescriptorArray(0, 1); |
| 139 | 141 |
| 140 v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors); | 142 v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors); |
| 141 map->set_instance_descriptors(*new_descriptors); | 143 map->set_instance_descriptors(*new_descriptors); |
| 142 | 144 |
| 143 CallbacksDescriptor d(*name, | 145 CallbacksDescriptor d(*name, |
| 144 *foreign, | 146 *foreign, |
| 145 static_cast<PropertyAttributes>(0)); | 147 static_cast<PropertyAttributes>(0)); |
| 146 map->AppendDescriptor(&d, witness); | 148 map->AppendDescriptor(&d, witness); |
| 147 | 149 |
| 148 // Add the Foo constructor the global object. | 150 // Add the Foo constructor the global object. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 blocks[index] = blocks.RemoveLast(); | 221 blocks[index] = blocks.RemoveLast(); |
| 220 } else { | 222 } else { |
| 221 blocks.RemoveLast(); | 223 blocks.RemoveLast(); |
| 222 } | 224 } |
| 223 } | 225 } |
| 224 } | 226 } |
| 225 | 227 |
| 226 code_range->TearDown(); | 228 code_range->TearDown(); |
| 227 delete code_range; | 229 delete code_range; |
| 228 } | 230 } |
| OLD | NEW |