OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 // If there isn't an arguments variable in the stack, we need to | 375 // If there isn't an arguments variable in the stack, we need to |
376 // find the frame that holds the actual arguments passed to the | 376 // find the frame that holds the actual arguments passed to the |
377 // function on the stack. | 377 // function on the stack. |
378 it.AdvanceToArgumentsFrame(); | 378 it.AdvanceToArgumentsFrame(); |
379 frame = it.frame(); | 379 frame = it.frame(); |
380 | 380 |
381 // Get the number of arguments and construct an arguments object | 381 // Get the number of arguments and construct an arguments object |
382 // mirror for the right frame. | 382 // mirror for the right frame. |
383 const int length = frame->GetProvidedParametersCount(); | 383 const int length = frame->GetProvidedParametersCount(); |
384 Handle<JSObject> arguments = Factory::NewArgumentsObject(function, length); | 384 Handle<JSObject> arguments = Factory::NewArgumentsObject(function, length); |
| 385 Handle<FixedArray> array = Factory::NewFixedArray(length); |
385 | 386 |
386 // Copy the parameters to the arguments object. | 387 // Copy the parameters to the arguments object. |
387 FixedArray* array = FixedArray::cast(arguments->elements()); | |
388 ASSERT(array->length() == length); | 388 ASSERT(array->length() == length); |
389 for (int i = 0; i < length; i++) array->set(i, frame->GetParameter(i)); | 389 for (int i = 0; i < length; i++) array->set(i, frame->GetParameter(i)); |
| 390 arguments->set_elements(*array); |
390 | 391 |
391 // Return the freshly allocated arguments object. | 392 // Return the freshly allocated arguments object. |
392 return *arguments; | 393 return *arguments; |
393 } | 394 } |
394 | 395 |
395 // No frame corresponding to the given function found. Return null. | 396 // No frame corresponding to the given function found. Return null. |
396 return Heap::null_value(); | 397 return Heap::null_value(); |
397 } | 398 } |
398 | 399 |
399 | 400 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 } | 501 } |
501 | 502 |
502 | 503 |
503 const AccessorDescriptor Accessors::ObjectPrototype = { | 504 const AccessorDescriptor Accessors::ObjectPrototype = { |
504 ObjectGetPrototype, | 505 ObjectGetPrototype, |
505 ObjectSetPrototype, | 506 ObjectSetPrototype, |
506 0 | 507 0 |
507 }; | 508 }; |
508 | 509 |
509 } } // namespace v8::internal | 510 } } // namespace v8::internal |
OLD | NEW |