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

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

Issue 1906823002: Move of the type feedback vector to the closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 4 years, 7 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
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 source_shared->set_dont_flush(true); 174 source_shared->set_dont_flush(true);
175 175
176 // Set the code, scope info, formal parameter count, and the length 176 // Set the code, scope info, formal parameter count, and the length
177 // of the target shared function info. 177 // of the target shared function info.
178 target_shared->ReplaceCode(source_shared->code()); 178 target_shared->ReplaceCode(source_shared->code());
179 if (source_shared->HasBytecodeArray()) { 179 if (source_shared->HasBytecodeArray()) {
180 target_shared->set_bytecode_array(source_shared->bytecode_array()); 180 target_shared->set_bytecode_array(source_shared->bytecode_array());
181 } 181 }
182 target_shared->set_scope_info(source_shared->scope_info()); 182 target_shared->set_scope_info(source_shared->scope_info());
183 target_shared->set_length(source_shared->length()); 183 target_shared->set_length(source_shared->length());
184 target_shared->set_feedback_vector(source_shared->feedback_vector()); 184 target_shared->set_feedback_metadata(source_shared->feedback_metadata());
185 target_shared->set_num_literals(source_shared->num_literals());
185 target_shared->set_internal_formal_parameter_count( 186 target_shared->set_internal_formal_parameter_count(
186 source_shared->internal_formal_parameter_count()); 187 source_shared->internal_formal_parameter_count());
187 target_shared->set_start_position_and_type( 188 target_shared->set_start_position_and_type(
188 source_shared->start_position_and_type()); 189 source_shared->start_position_and_type());
189 target_shared->set_end_position(source_shared->end_position()); 190 target_shared->set_end_position(source_shared->end_position());
190 bool was_native = target_shared->native(); 191 bool was_native = target_shared->native();
191 target_shared->set_compiler_hints(source_shared->compiler_hints()); 192 target_shared->set_compiler_hints(source_shared->compiler_hints());
192 target_shared->set_opt_count_and_bailout_reason( 193 target_shared->set_opt_count_and_bailout_reason(
193 source_shared->opt_count_and_bailout_reason()); 194 source_shared->opt_count_and_bailout_reason());
194 target_shared->set_native(was_native); 195 target_shared->set_native(was_native);
195 target_shared->set_profiler_ticks(source_shared->profiler_ticks()); 196 target_shared->set_profiler_ticks(source_shared->profiler_ticks());
196 SharedFunctionInfo::SetScript( 197 SharedFunctionInfo::SetScript(
197 target_shared, Handle<Object>(source_shared->script(), isolate)); 198 target_shared, Handle<Object>(source_shared->script(), isolate));
198 199
199 // Set the code of the target function. 200 // Set the code of the target function.
200 target->ReplaceCode(source_shared->code()); 201 target->ReplaceCode(source_shared->code());
201 DCHECK(target->next_function_link()->IsUndefined()); 202 DCHECK(target->next_function_link()->IsUndefined());
202 203
203 // Make sure we get a fresh copy of the literal vector to avoid cross
204 // context contamination.
205 Handle<Context> context(source->context()); 204 Handle<Context> context(source->context());
206 target->set_context(*context); 205 target->set_context(*context);
207 206
208 int number_of_literals = source->NumberOfLiterals(); 207 // Make sure we get a fresh copy of the literal vector to avoid cross
209 Handle<LiteralsArray> literals = 208 // context contamination, and that the literal vector makes it's way into
210 LiteralsArray::New(isolate, handle(target_shared->feedback_vector()), 209 // the target_shared optimized code map.
211 number_of_literals, TENURED); 210 JSFunction::EnsureLiterals(target);
212 target->set_literals(*literals);
213 211
214 if (isolate->logger()->is_logging_code_events() || 212 if (isolate->logger()->is_logging_code_events() ||
215 isolate->cpu_profiler()->is_profiling()) { 213 isolate->cpu_profiler()->is_profiling()) {
216 isolate->logger()->LogExistingFunction( 214 isolate->logger()->LogExistingFunction(
217 source_shared, Handle<AbstractCode>(source_shared->abstract_code())); 215 source_shared, Handle<AbstractCode>(source_shared->abstract_code()));
218 } 216 }
219 217
220 return *target; 218 return *target;
221 } 219 }
222 220
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 DCHECK_EQ(2, args.length()); 306 DCHECK_EQ(2, args.length());
309 307
310 CONVERT_ARG_HANDLE_CHECKED(JSObject, wasm, 0); 308 CONVERT_ARG_HANDLE_CHECKED(JSObject, wasm, 0);
311 CONVERT_SMI_ARG_CHECKED(func_index, 1); 309 CONVERT_SMI_ARG_CHECKED(func_index, 1);
312 310
313 return *wasm::GetWasmFunctionName(wasm, func_index); 311 return *wasm::GetWasmFunctionName(wasm, func_index);
314 } 312 }
315 313
316 } // namespace internal 314 } // namespace internal
317 } // namespace v8 315 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698