Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: test/cctest/test-alloc.cc

Issue 238773009: Set code on the SharedFunctionInfo before creating the function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/factory.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 0 115 0
116 }; 116 };
117 117
118 118
119 TEST(StressJS) { 119 TEST(StressJS) {
120 Isolate* isolate = CcTest::i_isolate(); 120 Isolate* isolate = CcTest::i_isolate();
121 Factory* factory = isolate->factory(); 121 Factory* factory = isolate->factory();
122 v8::HandleScope scope(CcTest::isolate()); 122 v8::HandleScope scope(CcTest::isolate());
123 v8::Handle<v8::Context> env = v8::Context::New(CcTest::isolate()); 123 v8::Handle<v8::Context> env = v8::Context::New(CcTest::isolate());
124 env->Enter(); 124 env->Enter();
125 Handle<JSFunction> function = 125 Handle<JSFunction> function = factory->NewFunctionWithPrototype(
126 factory->NewFunction(factory->function_string(), factory->null_value()); 126 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 =
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 if (index < blocks.length() - 1) { 217 if (index < blocks.length() - 1) {
218 blocks[index] = blocks.RemoveLast(); 218 blocks[index] = blocks.RemoveLast();
219 } else { 219 } else {
220 blocks.RemoveLast(); 220 blocks.RemoveLast();
221 } 221 }
222 } 222 }
223 } 223 }
224 224
225 code_range.TearDown(); 225 code_range.TearDown();
226 } 226 }
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698