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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 486 |
487 Object* Accessors::FunctionGetLength(Object* object, void*) { | 487 Object* Accessors::FunctionGetLength(Object* object, void*) { |
488 bool found_it = false; | 488 bool found_it = false; |
489 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); | 489 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); |
490 if (!found_it) return Smi::FromInt(0); | 490 if (!found_it) return Smi::FromInt(0); |
491 // Check if already compiled. | 491 // Check if already compiled. |
492 if (!function->is_compiled()) { | 492 if (!function->is_compiled()) { |
493 // If the function isn't compiled yet, the length is not computed | 493 // If the function isn't compiled yet, the length is not computed |
494 // correctly yet. Compile it now and return the right length. | 494 // correctly yet. Compile it now and return the right length. |
495 HandleScope scope; | 495 HandleScope scope; |
496 Handle<JSFunction> function_handle(function); | 496 Handle<SharedFunctionInfo> shared(function->shared()); |
497 if (!CompileLazy(function_handle, KEEP_EXCEPTION)) { | 497 if (!CompileLazyShared(shared, KEEP_EXCEPTION)) { |
498 return Failure::Exception(); | 498 return Failure::Exception(); |
499 } | 499 } |
500 return Smi::FromInt(function_handle->shared()->length()); | 500 return Smi::FromInt(shared->length()); |
501 } else { | 501 } else { |
502 return Smi::FromInt(function->shared()->length()); | 502 return Smi::FromInt(function->shared()->length()); |
503 } | 503 } |
504 } | 504 } |
505 | 505 |
506 | 506 |
507 const AccessorDescriptor Accessors::FunctionLength = { | 507 const AccessorDescriptor Accessors::FunctionLength = { |
508 FunctionGetLength, | 508 FunctionGetLength, |
509 ReadOnlySetAccessor, | 509 ReadOnlySetAccessor, |
510 0 | 510 0 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 } | 686 } |
687 | 687 |
688 | 688 |
689 const AccessorDescriptor Accessors::ObjectPrototype = { | 689 const AccessorDescriptor Accessors::ObjectPrototype = { |
690 ObjectGetPrototype, | 690 ObjectGetPrototype, |
691 ObjectSetPrototype, | 691 ObjectSetPrototype, |
692 0 | 692 0 |
693 }; | 693 }; |
694 | 694 |
695 } } // namespace v8::internal | 695 } } // namespace v8::internal |
OLD | NEW |