OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 // | 567 // |
568 // Accessors::FunctionArguments | 568 // Accessors::FunctionArguments |
569 // | 569 // |
570 | 570 |
571 | 571 |
572 static MaybeObject* ConstructArgumentsObjectForInlinedFunction( | 572 static MaybeObject* ConstructArgumentsObjectForInlinedFunction( |
573 JavaScriptFrame* frame, | 573 JavaScriptFrame* frame, |
574 Handle<JSFunction> inlined_function, | 574 Handle<JSFunction> inlined_function, |
575 int inlined_frame_index) { | 575 int inlined_frame_index) { |
576 Factory* factory = Isolate::Current()->factory(); | 576 Factory* factory = Isolate::Current()->factory(); |
577 int args_count = inlined_function->shared()->formal_parameter_count(); | 577 Vector<SlotRef> args_slots = |
578 ScopedVector<SlotRef> args_slots(args_count); | 578 SlotRef::ComputeSlotMappingForArguments( |
579 SlotRef::ComputeSlotMappingForArguments(frame, | 579 frame, |
580 inlined_frame_index, | 580 inlined_frame_index, |
581 &args_slots); | 581 inlined_function->shared()->formal_parameter_count()); |
| 582 int args_count = args_slots.length(); |
582 Handle<JSObject> arguments = | 583 Handle<JSObject> arguments = |
583 factory->NewArgumentsObject(inlined_function, args_count); | 584 factory->NewArgumentsObject(inlined_function, args_count); |
584 Handle<FixedArray> array = factory->NewFixedArray(args_count); | 585 Handle<FixedArray> array = factory->NewFixedArray(args_count); |
585 for (int i = 0; i < args_count; ++i) { | 586 for (int i = 0; i < args_count; ++i) { |
586 Handle<Object> value = args_slots[i].GetValue(); | 587 Handle<Object> value = args_slots[i].GetValue(); |
587 array->set(i, *value); | 588 array->set(i, *value); |
588 } | 589 } |
589 arguments->set_elements(*array); | 590 arguments->set_elements(*array); |
| 591 args_slots.Dispose(); |
590 | 592 |
591 // Return the freshly allocated arguments object. | 593 // Return the freshly allocated arguments object. |
592 return *arguments; | 594 return *arguments; |
593 } | 595 } |
594 | 596 |
595 | 597 |
596 MaybeObject* Accessors::FunctionGetArguments(Object* object, void*) { | 598 MaybeObject* Accessors::FunctionGetArguments(Object* object, void*) { |
597 Isolate* isolate = Isolate::Current(); | 599 Isolate* isolate = Isolate::Current(); |
598 HandleScope scope(isolate); | 600 HandleScope scope(isolate); |
599 bool found_it = false; | 601 bool found_it = false; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 } | 805 } |
804 | 806 |
805 | 807 |
806 const AccessorDescriptor Accessors::ObjectPrototype = { | 808 const AccessorDescriptor Accessors::ObjectPrototype = { |
807 ObjectGetPrototype, | 809 ObjectGetPrototype, |
808 ObjectSetPrototype, | 810 ObjectSetPrototype, |
809 0 | 811 0 |
810 }; | 812 }; |
811 | 813 |
812 } } // namespace v8::internal | 814 } } // namespace v8::internal |
OLD | NEW |