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/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/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 SharedFunctionInfo::SetScript( | 229 SharedFunctionInfo::SetScript( |
230 target_shared, Handle<Object>(source_shared->script(), isolate)); | 230 target_shared, Handle<Object>(source_shared->script(), isolate)); |
231 | 231 |
232 // Set the code of the target function. | 232 // Set the code of the target function. |
233 target->ReplaceCode(source_shared->code()); | 233 target->ReplaceCode(source_shared->code()); |
234 DCHECK(target->next_function_link()->IsUndefined()); | 234 DCHECK(target->next_function_link()->IsUndefined()); |
235 | 235 |
236 // Make sure we get a fresh copy of the literal vector to avoid cross | 236 // Make sure we get a fresh copy of the literal vector to avoid cross |
237 // context contamination. | 237 // context contamination. |
238 Handle<Context> context(source->context()); | 238 Handle<Context> context(source->context()); |
| 239 target->set_context(*context); |
| 240 |
239 int number_of_literals = source->NumberOfLiterals(); | 241 int number_of_literals = source->NumberOfLiterals(); |
240 Handle<FixedArray> literals = | 242 Handle<LiteralsArray> literals = |
241 isolate->factory()->NewFixedArray(number_of_literals, TENURED); | 243 LiteralsArray::New(isolate, handle(target_shared->feedback_vector()), |
242 target->set_context(*context); | 244 number_of_literals, TENURED); |
243 target->set_literals(*literals); | 245 target->set_literals(*literals); |
244 | 246 |
245 if (isolate->logger()->is_logging_code_events() || | 247 if (isolate->logger()->is_logging_code_events() || |
246 isolate->cpu_profiler()->is_profiling()) { | 248 isolate->cpu_profiler()->is_profiling()) { |
247 isolate->logger()->LogExistingFunction(source_shared, | 249 isolate->logger()->LogExistingFunction(source_shared, |
248 Handle<Code>(source_shared->code())); | 250 Handle<Code>(source_shared->code())); |
249 } | 251 } |
250 | 252 |
251 return *target; | 253 return *target; |
252 } | 254 } |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 604 |
603 | 605 |
604 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 606 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
605 HandleScope scope(isolate); | 607 HandleScope scope(isolate); |
606 DCHECK(args.length() == 0); | 608 DCHECK(args.length() == 0); |
607 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 609 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
608 NewTypeError(MessageTemplate::kStrongArity)); | 610 NewTypeError(MessageTemplate::kStrongArity)); |
609 } | 611 } |
610 } // namespace internal | 612 } // namespace internal |
611 } // namespace v8 | 613 } // namespace v8 |
OLD | NEW |