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

Side by Side Diff: src/runtime.cc

Issue 11818052: Fix shared function info code replacement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Hannes Payer. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-inl.h ('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 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 2138
2139 if (!JSFunction::EnsureCompiled(source, KEEP_EXCEPTION)) { 2139 if (!JSFunction::EnsureCompiled(source, KEEP_EXCEPTION)) {
2140 return Failure::Exception(); 2140 return Failure::Exception();
2141 } 2141 }
2142 2142
2143 // Set the code, scope info, formal parameter count, and the length 2143 // Set the code, scope info, formal parameter count, and the length
2144 // of the target shared function info. Set the source code of the 2144 // of the target shared function info. Set the source code of the
2145 // target function to undefined. SetCode is only used for built-in 2145 // target function to undefined. SetCode is only used for built-in
2146 // constructors like String, Array, and Object, and some web code 2146 // constructors like String, Array, and Object, and some web code
2147 // doesn't like seeing source code for constructors. 2147 // doesn't like seeing source code for constructors.
2148 target_shared->set_code(source_shared->code()); 2148 target_shared->ReplaceCode(source_shared->code());
2149 target_shared->set_scope_info(source_shared->scope_info()); 2149 target_shared->set_scope_info(source_shared->scope_info());
2150 target_shared->set_length(source_shared->length()); 2150 target_shared->set_length(source_shared->length());
2151 target_shared->set_formal_parameter_count( 2151 target_shared->set_formal_parameter_count(
2152 source_shared->formal_parameter_count()); 2152 source_shared->formal_parameter_count());
2153 target_shared->set_script(isolate->heap()->undefined_value()); 2153 target_shared->set_script(isolate->heap()->undefined_value());
2154 2154
2155 // Since we don't store the source we should never optimize this. 2155 // Since we don't store the source we should never optimize this.
2156 target_shared->code()->set_optimizable(false); 2156 target_shared->code()->set_optimizable(false);
2157 2157
2158 // Clear the optimization hints related to the compiled code as these 2158 // Clear the optimization hints related to the compiled code as these
(...skipping 11461 matching lines...) Expand 10 before | Expand all | Expand 10 after
13620 // Handle last resort GC and make sure to allow future allocations 13620 // Handle last resort GC and make sure to allow future allocations
13621 // to grow the heap without causing GCs (if possible). 13621 // to grow the heap without causing GCs (if possible).
13622 isolate->counters()->gc_last_resort_from_js()->Increment(); 13622 isolate->counters()->gc_last_resort_from_js()->Increment();
13623 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13623 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13624 "Runtime::PerformGC"); 13624 "Runtime::PerformGC");
13625 } 13625 }
13626 } 13626 }
13627 13627
13628 13628
13629 } } // namespace v8::internal 13629 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698