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/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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 static SmartArrayPointer<Handle<Object> > GetCallerArguments(Isolate* isolate, | 330 static SmartArrayPointer<Handle<Object> > GetCallerArguments(Isolate* isolate, |
331 int prefix_argc, | 331 int prefix_argc, |
332 int* total_argc) { | 332 int* total_argc) { |
333 // Find frame containing arguments passed to the caller. | 333 // Find frame containing arguments passed to the caller. |
334 JavaScriptFrameIterator it(isolate); | 334 JavaScriptFrameIterator it(isolate); |
335 JavaScriptFrame* frame = it.frame(); | 335 JavaScriptFrame* frame = it.frame(); |
336 List<JSFunction*> functions(2); | 336 List<JSFunction*> functions(2); |
337 frame->GetFunctions(&functions); | 337 frame->GetFunctions(&functions); |
338 if (functions.length() > 1) { | 338 if (functions.length() > 1) { |
339 int inlined_jsframe_index = functions.length() - 1; | 339 int inlined_jsframe_index = functions.length() - 1; |
340 JSFunction* inlined_function = functions[inlined_jsframe_index]; | 340 TranslatedState translated_values(frame); |
341 SlotRefValueBuilder slot_refs( | 341 translated_values.Prepare(false, frame->fp()); |
342 frame, inlined_jsframe_index, | |
343 inlined_function->shared()->internal_formal_parameter_count()); | |
344 | 342 |
345 int args_count = slot_refs.args_length(); | 343 int argument_count = 0; |
| 344 TranslatedFrame* translated_frame = |
| 345 translated_values.GetArgumentsInfoFromJSFrameIndex( |
| 346 inlined_jsframe_index, &argument_count); |
| 347 TranslatedFrame::ValueIterator iter = translated_frame->begin(); |
346 | 348 |
347 *total_argc = prefix_argc + args_count; | 349 // Skip the receiver. |
| 350 iter++; |
| 351 argument_count--; |
| 352 |
| 353 *total_argc = prefix_argc + argument_count; |
348 SmartArrayPointer<Handle<Object> > param_data( | 354 SmartArrayPointer<Handle<Object> > param_data( |
349 NewArray<Handle<Object> >(*total_argc)); | 355 NewArray<Handle<Object> >(*total_argc)); |
350 slot_refs.Prepare(isolate); | 356 bool should_deoptimize = false; |
351 for (int i = 0; i < args_count; i++) { | 357 for (int i = 0; i < argument_count; i++) { |
352 Handle<Object> val = slot_refs.GetNext(isolate, 0); | 358 should_deoptimize = should_deoptimize || iter->IsMaterializedObject(); |
353 param_data[prefix_argc + i] = val; | 359 Handle<Object> value = iter->GetValue(); |
| 360 param_data[prefix_argc + i] = value; |
| 361 iter++; |
354 } | 362 } |
355 slot_refs.Finish(isolate); | 363 |
| 364 if (should_deoptimize) { |
| 365 translated_values.StoreMaterializedValuesAndDeopt(); |
| 366 } |
356 | 367 |
357 return param_data; | 368 return param_data; |
358 } else { | 369 } else { |
359 it.AdvanceToArgumentsFrame(); | 370 it.AdvanceToArgumentsFrame(); |
360 frame = it.frame(); | 371 frame = it.frame(); |
361 int args_count = frame->ComputeParametersCount(); | 372 int args_count = frame->ComputeParametersCount(); |
362 | 373 |
363 *total_argc = prefix_argc + args_count; | 374 *total_argc = prefix_argc + args_count; |
364 SmartArrayPointer<Handle<Object> > param_data( | 375 SmartArrayPointer<Handle<Object> > param_data( |
365 NewArray<Handle<Object> >(*total_argc)); | 376 NewArray<Handle<Object> >(*total_argc)); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 620 |
610 | 621 |
611 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 622 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
612 HandleScope scope(isolate); | 623 HandleScope scope(isolate); |
613 DCHECK(args.length() == 0); | 624 DCHECK(args.length() == 0); |
614 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 625 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
615 NewTypeError(MessageTemplate::kStrongArity)); | 626 NewTypeError(MessageTemplate::kStrongArity)); |
616 } | 627 } |
617 } // namespace internal | 628 } // namespace internal |
618 } // namespace v8 | 629 } // namespace v8 |
OLD | NEW |