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

Side by Side Diff: src/runtime.cc

Issue 546088: Fix issue 582: preserve construct stub on first allocation in case we can't optimize it. (Closed)
Patch Set: Created 10 years, 11 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
« no previous file with comments | « no previous file | test/cctest/test-api.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 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 4764 matching lines...) Expand 10 before | Expand all | Expand 10 after
4775 if (FLAG_inline_new 4775 if (FLAG_inline_new
4776 && shared->has_only_simple_this_property_assignments()) { 4776 && shared->has_only_simple_this_property_assignments()) {
4777 ConstructStubCompiler compiler; 4777 ConstructStubCompiler compiler;
4778 Object* code = compiler.CompileConstructStub(*shared); 4778 Object* code = compiler.CompileConstructStub(*shared);
4779 if (code->IsFailure()) { 4779 if (code->IsFailure()) {
4780 return Builtins::builtin(Builtins::JSConstructStubGeneric); 4780 return Builtins::builtin(Builtins::JSConstructStubGeneric);
4781 } 4781 }
4782 return Code::cast(code); 4782 return Code::cast(code);
4783 } 4783 }
4784 4784
4785 return Builtins::builtin(Builtins::JSConstructStubGeneric); 4785 return shared->construct_stub();
4786 } 4786 }
4787 4787
4788 4788
4789 static Object* Runtime_NewObject(Arguments args) { 4789 static Object* Runtime_NewObject(Arguments args) {
4790 HandleScope scope; 4790 HandleScope scope;
4791 ASSERT(args.length() == 1); 4791 ASSERT(args.length() == 1);
4792 4792
4793 Handle<Object> constructor = args.at<Object>(0); 4793 Handle<Object> constructor = args.at<Object>(0);
4794 4794
4795 // If the constructor isn't a proper function we throw a type error. 4795 // If the constructor isn't a proper function we throw a type error.
(...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after
8163 } else { 8163 } else {
8164 // Handle last resort GC and make sure to allow future allocations 8164 // Handle last resort GC and make sure to allow future allocations
8165 // to grow the heap without causing GCs (if possible). 8165 // to grow the heap without causing GCs (if possible).
8166 Counters::gc_last_resort_from_js.Increment(); 8166 Counters::gc_last_resort_from_js.Increment();
8167 Heap::CollectAllGarbage(false); 8167 Heap::CollectAllGarbage(false);
8168 } 8168 }
8169 } 8169 }
8170 8170
8171 8171
8172 } } // namespace v8::internal 8172 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698