OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 static const int kMapSpaceFillerSize = Map::kSize; | 83 static const int kMapSpaceFillerSize = Map::kSize; |
84 InstanceType instance_type = JS_OBJECT_TYPE; | 84 InstanceType instance_type = JS_OBJECT_TYPE; |
85 int instance_size = JSObject::kHeaderSize; | 85 int instance_size = JSObject::kHeaderSize; |
86 while (map_space->Available() > kMapSpaceFillerSize) { | 86 while (map_space->Available() > kMapSpaceFillerSize) { |
87 CHECK(!heap->AllocateMap(instance_type, instance_size)->IsFailure()); | 87 CHECK(!heap->AllocateMap(instance_type, instance_size)->IsFailure()); |
88 } | 88 } |
89 CHECK(!heap->AllocateMap(instance_type, instance_size)->IsFailure()); | 89 CHECK(!heap->AllocateMap(instance_type, instance_size)->IsFailure()); |
90 | 90 |
91 // Test that we can allocate in old pointer space and code space. | 91 // Test that we can allocate in old pointer space and code space. |
92 CHECK(!heap->AllocateFixedArray(100, TENURED)->IsFailure()); | 92 CHECK(!heap->AllocateFixedArray(100, TENURED)->IsFailure()); |
93 CHECK(!heap->CopyCode(Builtins::builtin(Builtins::Illegal))->IsFailure()); | 93 CHECK(!heap->CopyCode(Isolate::Current()->builtins()->builtin( |
| 94 Builtins::Illegal))->IsFailure()); |
94 | 95 |
95 // Return success. | 96 // Return success. |
96 return Smi::FromInt(42); | 97 return Smi::FromInt(42); |
97 } | 98 } |
98 | 99 |
99 | 100 |
100 static Handle<Object> Test() { | 101 static Handle<Object> Test() { |
101 CALL_HEAP_FUNCTION(AllocateAfterFailures(), Object); | 102 CALL_HEAP_FUNCTION(AllocateAfterFailures(), Object); |
102 } | 103 } |
103 | 104 |
(...skipping 22 matching lines...) Expand all Loading... |
126 | 127 |
127 TEST(StressJS) { | 128 TEST(StressJS) { |
128 v8::Persistent<v8::Context> env = v8::Context::New(); | 129 v8::Persistent<v8::Context> env = v8::Context::New(); |
129 v8::HandleScope scope; | 130 v8::HandleScope scope; |
130 env->Enter(); | 131 env->Enter(); |
131 Handle<JSFunction> function = | 132 Handle<JSFunction> function = |
132 Factory::NewFunction(Factory::function_symbol(), Factory::null_value()); | 133 Factory::NewFunction(Factory::function_symbol(), Factory::null_value()); |
133 // Force the creation of an initial map and set the code to | 134 // Force the creation of an initial map and set the code to |
134 // something empty. | 135 // something empty. |
135 Factory::NewJSObject(function); | 136 Factory::NewJSObject(function); |
136 function->set_code(Builtins::builtin(Builtins::EmptyFunction)); | 137 function->set_code(Isolate::Current()->builtins()->builtin( |
| 138 Builtins::EmptyFunction)); |
137 // Patch the map to have an accessor for "get". | 139 // Patch the map to have an accessor for "get". |
138 Handle<Map> map(function->initial_map()); | 140 Handle<Map> map(function->initial_map()); |
139 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); | 141 Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); |
140 Handle<Proxy> proxy = Factory::NewProxy(&kDescriptor); | 142 Handle<Proxy> proxy = Factory::NewProxy(&kDescriptor); |
141 instance_descriptors = Factory::CopyAppendProxyDescriptor( | 143 instance_descriptors = Factory::CopyAppendProxyDescriptor( |
142 instance_descriptors, | 144 instance_descriptors, |
143 Factory::NewStringFromAscii(Vector<const char>("get", 3)), | 145 Factory::NewStringFromAscii(Vector<const char>("get", 3)), |
144 proxy, | 146 proxy, |
145 static_cast<PropertyAttributes>(0)); | 147 static_cast<PropertyAttributes>(0)); |
146 map->set_instance_descriptors(*instance_descriptors); | 148 map->set_instance_descriptors(*instance_descriptors); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 if (index < blocks.length() - 1) { | 211 if (index < blocks.length() - 1) { |
210 blocks[index] = blocks.RemoveLast(); | 212 blocks[index] = blocks.RemoveLast(); |
211 } else { | 213 } else { |
212 blocks.RemoveLast(); | 214 blocks.RemoveLast(); |
213 } | 215 } |
214 } | 216 } |
215 } | 217 } |
216 | 218 |
217 Isolate::Current()->code_range()->TearDown(); | 219 Isolate::Current()->code_range()->TearDown(); |
218 } | 220 } |
OLD | NEW |