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