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

Side by Side Diff: src/runtime.cc

Issue 173469: Handle pre-allocated properties when copying map (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 3 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/objects-debug.cc ('k') | test/mjsunit/simple-constructor.js » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 4355 matching lines...) Expand 10 before | Expand all | Expand 10 after
4366 // allocate JSFunctions since it does not properly initialize 4366 // allocate JSFunctions since it does not properly initialize
4367 // the shared part of the function. Since the receiver is 4367 // the shared part of the function. Since the receiver is
4368 // ignored anyway, we use the global object as the receiver 4368 // ignored anyway, we use the global object as the receiver
4369 // instead of a new JSFunction object. This way, errors are 4369 // instead of a new JSFunction object. This way, errors are
4370 // reported the same way whether or not 'Function' is called 4370 // reported the same way whether or not 'Function' is called
4371 // using 'new'. 4371 // using 'new'.
4372 return Top::context()->global(); 4372 return Top::context()->global();
4373 } 4373 }
4374 } 4374 }
4375 4375
4376 // The function should be compiled for the optimization hints to be available.
4377 if (!function->shared()->is_compiled()) {
4378 CompileLazyShared(Handle<SharedFunctionInfo>(function->shared()),
4379 CLEAR_EXCEPTION,
4380 0);
4381 }
4382
4376 bool first_allocation = !function->has_initial_map(); 4383 bool first_allocation = !function->has_initial_map();
4377 Handle<JSObject> result = Factory::NewJSObject(function); 4384 Handle<JSObject> result = Factory::NewJSObject(function);
4378 if (first_allocation) { 4385 if (first_allocation) {
4379 Handle<Map> map = Handle<Map>(function->initial_map()); 4386 Handle<Map> map = Handle<Map>(function->initial_map());
4380 Handle<Code> stub = ComputeConstructStub(map); 4387 Handle<Code> stub = ComputeConstructStub(map);
4381 function->shared()->set_construct_stub(*stub); 4388 function->shared()->set_construct_stub(*stub);
4382 } 4389 }
4383 Counters::constructed_objects.Increment(); 4390 Counters::constructed_objects.Increment();
4384 Counters::constructed_objects_runtime.Increment(); 4391 Counters::constructed_objects_runtime.Increment();
4385 return *result; 4392 return *result;
(...skipping 3246 matching lines...) Expand 10 before | Expand all | Expand 10 after
7632 } else { 7639 } else {
7633 // Handle last resort GC and make sure to allow future allocations 7640 // Handle last resort GC and make sure to allow future allocations
7634 // to grow the heap without causing GCs (if possible). 7641 // to grow the heap without causing GCs (if possible).
7635 Counters::gc_last_resort_from_js.Increment(); 7642 Counters::gc_last_resort_from_js.Increment();
7636 Heap::CollectAllGarbage(false); 7643 Heap::CollectAllGarbage(false);
7637 } 7644 }
7638 } 7645 }
7639 7646
7640 7647
7641 } } // namespace v8::internal 7648 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | test/mjsunit/simple-constructor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698