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

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

Issue 1643533003: Revert of Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « src/runtime/runtime-compiler.cc ('k') | src/runtime/runtime-scopes.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/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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 DCHECK(target_shared->code()->gc_metadata() == NULL); 161 DCHECK(target_shared->code()->gc_metadata() == NULL);
162 DCHECK(source_shared->code()->gc_metadata() == NULL); 162 DCHECK(source_shared->code()->gc_metadata() == NULL);
163 target_shared->set_dont_flush(true); 163 target_shared->set_dont_flush(true);
164 source_shared->set_dont_flush(true); 164 source_shared->set_dont_flush(true);
165 165
166 // Set the code, scope info, formal parameter count, and the length 166 // Set the code, scope info, formal parameter count, and the length
167 // of the target shared function info. 167 // of the target shared function info.
168 target_shared->ReplaceCode(source_shared->code()); 168 target_shared->ReplaceCode(source_shared->code());
169 target_shared->set_scope_info(source_shared->scope_info()); 169 target_shared->set_scope_info(source_shared->scope_info());
170 target_shared->set_length(source_shared->length()); 170 target_shared->set_length(source_shared->length());
171 target_shared->set_feedback_metadata(source_shared->feedback_metadata()); 171 target_shared->set_feedback_vector(source_shared->feedback_vector());
172 target_shared->set_num_literals(source_shared->num_literals());
173 target_shared->set_internal_formal_parameter_count( 172 target_shared->set_internal_formal_parameter_count(
174 source_shared->internal_formal_parameter_count()); 173 source_shared->internal_formal_parameter_count());
175 target_shared->set_start_position_and_type( 174 target_shared->set_start_position_and_type(
176 source_shared->start_position_and_type()); 175 source_shared->start_position_and_type());
177 target_shared->set_end_position(source_shared->end_position()); 176 target_shared->set_end_position(source_shared->end_position());
178 bool was_native = target_shared->native(); 177 bool was_native = target_shared->native();
179 target_shared->set_compiler_hints(source_shared->compiler_hints()); 178 target_shared->set_compiler_hints(source_shared->compiler_hints());
180 target_shared->set_opt_count_and_bailout_reason( 179 target_shared->set_opt_count_and_bailout_reason(
181 source_shared->opt_count_and_bailout_reason()); 180 source_shared->opt_count_and_bailout_reason());
182 target_shared->set_native(was_native); 181 target_shared->set_native(was_native);
183 target_shared->set_profiler_ticks(source_shared->profiler_ticks()); 182 target_shared->set_profiler_ticks(source_shared->profiler_ticks());
184 SharedFunctionInfo::SetScript( 183 SharedFunctionInfo::SetScript(
185 target_shared, Handle<Object>(source_shared->script(), isolate)); 184 target_shared, Handle<Object>(source_shared->script(), isolate));
186 185
187 // Set the code of the target function. 186 // Set the code of the target function.
188 target->ReplaceCode(source_shared->code()); 187 target->ReplaceCode(source_shared->code());
189 DCHECK(target->next_function_link()->IsUndefined()); 188 DCHECK(target->next_function_link()->IsUndefined());
190 189
190 // Make sure we get a fresh copy of the literal vector to avoid cross
191 // context contamination.
191 Handle<Context> context(source->context()); 192 Handle<Context> context(source->context());
192 target->set_context(*context); 193 target->set_context(*context);
193 194
194 // Make sure we get a fresh copy of the literal vector to avoid cross 195 int number_of_literals = source->NumberOfLiterals();
195 // context contamination, and that the literal vector makes it's way into 196 Handle<LiteralsArray> literals =
196 // the target_shared optimized code map. 197 LiteralsArray::New(isolate, handle(target_shared->feedback_vector()),
197 JSFunction::EnsureLiterals(target); 198 number_of_literals, TENURED);
199 target->set_literals(*literals);
198 200
199 if (isolate->logger()->is_logging_code_events() || 201 if (isolate->logger()->is_logging_code_events() ||
200 isolate->cpu_profiler()->is_profiling()) { 202 isolate->cpu_profiler()->is_profiling()) {
201 isolate->logger()->LogExistingFunction(source_shared, 203 isolate->logger()->LogExistingFunction(source_shared,
202 Handle<Code>(source_shared->code())); 204 Handle<Code>(source_shared->code()));
203 } 205 }
204 206
205 return *target; 207 return *target;
206 } 208 }
207 209
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 DCHECK_EQ(1, args.length()); 352 DCHECK_EQ(1, args.length());
351 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); 353 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
352 return function->IsJSBoundFunction() 354 return function->IsJSBoundFunction()
353 ? *JSBoundFunction::ToString( 355 ? *JSBoundFunction::ToString(
354 Handle<JSBoundFunction>::cast(function)) 356 Handle<JSBoundFunction>::cast(function))
355 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); 357 : *JSFunction::ToString(Handle<JSFunction>::cast(function));
356 } 358 }
357 359
358 } // namespace internal 360 } // namespace internal
359 } // namespace v8 361 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-compiler.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698