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

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

Issue 952303002: Remove NativeContext from Literal array, since we always create the literals in the native context … (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 5 years, 9 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 | « src/preparser.h ('k') | src/runtime/runtime-literals.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 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // Set the code of the target function. 288 // Set the code of the target function.
289 target->ReplaceCode(source_shared->code()); 289 target->ReplaceCode(source_shared->code());
290 DCHECK(target->next_function_link()->IsUndefined()); 290 DCHECK(target->next_function_link()->IsUndefined());
291 291
292 // Make sure we get a fresh copy of the literal vector to avoid cross 292 // Make sure we get a fresh copy of the literal vector to avoid cross
293 // context contamination. 293 // context contamination.
294 Handle<Context> context(source->context()); 294 Handle<Context> context(source->context());
295 int number_of_literals = source->NumberOfLiterals(); 295 int number_of_literals = source->NumberOfLiterals();
296 Handle<FixedArray> literals = 296 Handle<FixedArray> literals =
297 isolate->factory()->NewFixedArray(number_of_literals, TENURED); 297 isolate->factory()->NewFixedArray(number_of_literals, TENURED);
298 if (number_of_literals > 0) {
299 literals->set(JSFunction::kLiteralNativeContextIndex,
300 context->native_context());
301 }
302 target->set_context(*context); 298 target->set_context(*context);
303 target->set_literals(*literals); 299 target->set_literals(*literals);
304 300
305 if (isolate->logger()->is_logging_code_events() || 301 if (isolate->logger()->is_logging_code_events() ||
306 isolate->cpu_profiler()->is_profiling()) { 302 isolate->cpu_profiler()->is_profiling()) {
307 isolate->logger()->LogExistingFunction(source_shared, 303 isolate->logger()->LogExistingFunction(source_shared,
308 Handle<Code>(source_shared->code())); 304 Handle<Code>(source_shared->code()));
309 } 305 }
310 306
311 return *target; 307 return *target;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 642
647 643
648 RUNTIME_FUNCTION(RuntimeReference_IsFunction) { 644 RUNTIME_FUNCTION(RuntimeReference_IsFunction) {
649 SealHandleScope shs(isolate); 645 SealHandleScope shs(isolate);
650 DCHECK(args.length() == 1); 646 DCHECK(args.length() == 1);
651 CONVERT_ARG_CHECKED(Object, obj, 0); 647 CONVERT_ARG_CHECKED(Object, obj, 0);
652 return isolate->heap()->ToBoolean(obj->IsJSFunction()); 648 return isolate->heap()->ToBoolean(obj->IsJSFunction());
653 } 649 }
654 } 650 }
655 } // namespace v8::internal 651 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/runtime/runtime-literals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698