OLD | NEW |
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/v8.h" | 5 #include "src/v8.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/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 source_shared->set_dont_flush(true); | 225 source_shared->set_dont_flush(true); |
226 | 226 |
227 // Set the code, scope info, formal parameter count, and the length | 227 // Set the code, scope info, formal parameter count, and the length |
228 // of the target shared function info. | 228 // of the target shared function info. |
229 target_shared->ReplaceCode(source_shared->code()); | 229 target_shared->ReplaceCode(source_shared->code()); |
230 target_shared->set_scope_info(source_shared->scope_info()); | 230 target_shared->set_scope_info(source_shared->scope_info()); |
231 target_shared->set_length(source_shared->length()); | 231 target_shared->set_length(source_shared->length()); |
232 target_shared->set_feedback_vector(source_shared->feedback_vector()); | 232 target_shared->set_feedback_vector(source_shared->feedback_vector()); |
233 target_shared->set_internal_formal_parameter_count( | 233 target_shared->set_internal_formal_parameter_count( |
234 source_shared->internal_formal_parameter_count()); | 234 source_shared->internal_formal_parameter_count()); |
235 target_shared->set_script(source_shared->script()); | |
236 target_shared->set_start_position_and_type( | 235 target_shared->set_start_position_and_type( |
237 source_shared->start_position_and_type()); | 236 source_shared->start_position_and_type()); |
238 target_shared->set_end_position(source_shared->end_position()); | 237 target_shared->set_end_position(source_shared->end_position()); |
239 bool was_native = target_shared->native(); | 238 bool was_native = target_shared->native(); |
240 target_shared->set_compiler_hints(source_shared->compiler_hints()); | 239 target_shared->set_compiler_hints(source_shared->compiler_hints()); |
241 target_shared->set_opt_count_and_bailout_reason( | 240 target_shared->set_opt_count_and_bailout_reason( |
242 source_shared->opt_count_and_bailout_reason()); | 241 source_shared->opt_count_and_bailout_reason()); |
243 target_shared->set_native(was_native); | 242 target_shared->set_native(was_native); |
244 target_shared->set_profiler_ticks(source_shared->profiler_ticks()); | 243 target_shared->set_profiler_ticks(source_shared->profiler_ticks()); |
| 244 SharedFunctionInfo::SetScript( |
| 245 target_shared, Handle<Object>(source_shared->script(), isolate)); |
245 | 246 |
246 // Set the code of the target function. | 247 // Set the code of the target function. |
247 target->ReplaceCode(source_shared->code()); | 248 target->ReplaceCode(source_shared->code()); |
248 DCHECK(target->next_function_link()->IsUndefined()); | 249 DCHECK(target->next_function_link()->IsUndefined()); |
249 | 250 |
250 // Make sure we get a fresh copy of the literal vector to avoid cross | 251 // Make sure we get a fresh copy of the literal vector to avoid cross |
251 // context contamination. | 252 // context contamination. |
252 Handle<Context> context(source->context()); | 253 Handle<Context> context(source->context()); |
253 int number_of_literals = source->NumberOfLiterals(); | 254 int number_of_literals = source->NumberOfLiterals(); |
254 Handle<FixedArray> literals = | 255 Handle<FixedArray> literals = |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 | 624 |
624 | 625 |
625 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 626 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
626 HandleScope scope(isolate); | 627 HandleScope scope(isolate); |
627 DCHECK(args.length() == 0); | 628 DCHECK(args.length() == 0); |
628 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 629 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
629 NewTypeError(MessageTemplate::kStrongArity)); | 630 NewTypeError(MessageTemplate::kStrongArity)); |
630 } | 631 } |
631 } // namespace internal | 632 } // namespace internal |
632 } // namespace v8 | 633 } // namespace v8 |
OLD | NEW |