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

Side by Side Diff: src/runtime/runtime-function.cc

Issue 2547483002: Store SharedFunctionInfos of a Script in a FixedArray indexed by their ID (Closed)
Patch Set: updates Created 4 years 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/frames-inl.h" 10 #include "src/frames-inl.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 target_shared->set_start_position_and_type( 197 target_shared->set_start_position_and_type(
198 source_shared->start_position_and_type()); 198 source_shared->start_position_and_type());
199 target_shared->set_end_position(source_shared->end_position()); 199 target_shared->set_end_position(source_shared->end_position());
200 bool was_native = target_shared->native(); 200 bool was_native = target_shared->native();
201 target_shared->set_compiler_hints(source_shared->compiler_hints()); 201 target_shared->set_compiler_hints(source_shared->compiler_hints());
202 target_shared->set_opt_count_and_bailout_reason( 202 target_shared->set_opt_count_and_bailout_reason(
203 source_shared->opt_count_and_bailout_reason()); 203 source_shared->opt_count_and_bailout_reason());
204 target_shared->set_native(was_native); 204 target_shared->set_native(was_native);
205 target_shared->set_profiler_ticks(source_shared->profiler_ticks()); 205 target_shared->set_profiler_ticks(source_shared->profiler_ticks());
206 target_shared->set_function_literal_id(source_shared->function_literal_id()); 206 target_shared->set_function_literal_id(source_shared->function_literal_id());
207 SharedFunctionInfo::SetScript( 207
208 target_shared, Handle<Object>(source_shared->script(), isolate)); 208 Handle<Object> source_script(source_shared->script(), isolate);
209 if (source_script->IsScript()) {
210 SharedFunctionInfo::SetScript(source_shared,
211 isolate->factory()->undefined_value());
212 }
213 SharedFunctionInfo::SetScript(target_shared, source_script);
209 214
210 // Set the code of the target function. 215 // Set the code of the target function.
211 target->ReplaceCode(source_shared->code()); 216 target->ReplaceCode(source_shared->code());
212 DCHECK(target->next_function_link()->IsUndefined(isolate)); 217 DCHECK(target->next_function_link()->IsUndefined(isolate));
213 218
214 Handle<Context> context(source->context()); 219 Handle<Context> context(source->context());
215 target->set_context(*context); 220 target->set_context(*context);
216 221
217 // Make sure we get a fresh copy of the literal vector to avoid cross 222 // Make sure we get a fresh copy of the literal vector to avoid cross
218 // context contamination, and that the literal vector makes it's way into 223 // context contamination, and that the literal vector makes it's way into
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 DCHECK_EQ(1, args.length()); 307 DCHECK_EQ(1, args.length());
303 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); 308 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
304 return function->IsJSBoundFunction() 309 return function->IsJSBoundFunction()
305 ? *JSBoundFunction::ToString( 310 ? *JSBoundFunction::ToString(
306 Handle<JSBoundFunction>::cast(function)) 311 Handle<JSBoundFunction>::cast(function))
307 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); 312 : *JSFunction::ToString(Handle<JSFunction>::cast(function));
308 } 313 }
309 314
310 } // namespace internal 315 } // namespace internal
311 } // namespace v8 316 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698