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

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

Issue 1563213002: Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Exclude an ignition test. 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_vector(source_shared->feedback_vector()); 171 target_shared->set_feedback_metadata(source_shared->feedback_metadata());
172 target_shared->set_internal_formal_parameter_count( 172 target_shared->set_internal_formal_parameter_count(
173 source_shared->internal_formal_parameter_count()); 173 source_shared->internal_formal_parameter_count());
174 target_shared->set_start_position_and_type( 174 target_shared->set_start_position_and_type(
175 source_shared->start_position_and_type()); 175 source_shared->start_position_and_type());
176 target_shared->set_end_position(source_shared->end_position()); 176 target_shared->set_end_position(source_shared->end_position());
177 bool was_native = target_shared->native(); 177 bool was_native = target_shared->native();
178 target_shared->set_compiler_hints(source_shared->compiler_hints()); 178 target_shared->set_compiler_hints(source_shared->compiler_hints());
179 target_shared->set_opt_count_and_bailout_reason( 179 target_shared->set_opt_count_and_bailout_reason(
180 source_shared->opt_count_and_bailout_reason()); 180 source_shared->opt_count_and_bailout_reason());
181 target_shared->set_native(was_native); 181 target_shared->set_native(was_native);
182 target_shared->set_profiler_ticks(source_shared->profiler_ticks()); 182 target_shared->set_profiler_ticks(source_shared->profiler_ticks());
183 SharedFunctionInfo::SetScript( 183 SharedFunctionInfo::SetScript(
184 target_shared, Handle<Object>(source_shared->script(), isolate)); 184 target_shared, Handle<Object>(source_shared->script(), isolate));
185 185
186 // Set the code of the target function. 186 // Set the code of the target function.
187 target->ReplaceCode(source_shared->code()); 187 target->ReplaceCode(source_shared->code());
188 DCHECK(target->next_function_link()->IsUndefined()); 188 DCHECK(target->next_function_link()->IsUndefined());
189 189
190 // Make sure we get a fresh copy of the literal vector to avoid cross 190 // Make sure we get a fresh copy of the literal vector to avoid cross
191 // context contamination. 191 // context contamination.
192 Handle<Context> context(source->context()); 192 Handle<Context> context(source->context());
193 target->set_context(*context); 193 target->set_context(*context);
194 194
195 int number_of_literals = source->NumberOfLiterals(); 195 int number_of_literals = source->NumberOfLiterals();
196 Handle<TypeFeedbackVector> vector = TypeFeedbackVector::New(
197 isolate, handle(target_shared->feedback_metadata()));
196 Handle<LiteralsArray> literals = 198 Handle<LiteralsArray> literals =
197 LiteralsArray::New(isolate, handle(target_shared->feedback_vector()), 199 LiteralsArray::New(isolate, vector, number_of_literals, TENURED);
198 number_of_literals, TENURED);
199 target->set_literals(*literals); 200 target->set_literals(*literals);
200 201
201 if (isolate->logger()->is_logging_code_events() || 202 if (isolate->logger()->is_logging_code_events() ||
202 isolate->cpu_profiler()->is_profiling()) { 203 isolate->cpu_profiler()->is_profiling()) {
203 isolate->logger()->LogExistingFunction(source_shared, 204 isolate->logger()->LogExistingFunction(source_shared,
204 Handle<Code>(source_shared->code())); 205 Handle<Code>(source_shared->code()));
205 } 206 }
206 207
207 return *target; 208 return *target;
208 } 209 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 DCHECK_EQ(1, args.length()); 353 DCHECK_EQ(1, args.length());
353 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); 354 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
354 return function->IsJSBoundFunction() 355 return function->IsJSBoundFunction()
355 ? *JSBoundFunction::ToString( 356 ? *JSBoundFunction::ToString(
356 Handle<JSBoundFunction>::cast(function)) 357 Handle<JSBoundFunction>::cast(function))
357 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); 358 : *JSFunction::ToString(Handle<JSFunction>::cast(function));
358 } 359 }
359 360
360 } // namespace internal 361 } // namespace internal
361 } // namespace v8 362 } // 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