OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 MaybeObject* Accessors::FunctionGetLength(Object* object, void*) { | 520 MaybeObject* Accessors::FunctionGetLength(Object* object, void*) { |
521 bool found_it = false; | 521 bool found_it = false; |
522 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); | 522 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); |
523 if (!found_it) return Smi::FromInt(0); | 523 if (!found_it) return Smi::FromInt(0); |
524 // Check if already compiled. | 524 // Check if already compiled. |
525 if (!function->shared()->is_compiled()) { | 525 if (!function->shared()->is_compiled()) { |
526 // If the function isn't compiled yet, the length is not computed | 526 // If the function isn't compiled yet, the length is not computed |
527 // correctly yet. Compile it now and return the right length. | 527 // correctly yet. Compile it now and return the right length. |
528 HandleScope scope; | 528 HandleScope scope; |
529 Handle<JSFunction> handle(function); | 529 Handle<JSFunction> handle(function); |
530 if (!CompileLazy(handle, KEEP_EXCEPTION)) return Failure::Exception(); | 530 if (!JSFunction::CompileLazy(handle, KEEP_EXCEPTION)) { |
| 531 return Failure::Exception(); |
| 532 } |
531 return Smi::FromInt(handle->shared()->length()); | 533 return Smi::FromInt(handle->shared()->length()); |
532 } else { | 534 } else { |
533 return Smi::FromInt(function->shared()->length()); | 535 return Smi::FromInt(function->shared()->length()); |
534 } | 536 } |
535 } | 537 } |
536 | 538 |
537 | 539 |
538 const AccessorDescriptor Accessors::FunctionLength = { | 540 const AccessorDescriptor Accessors::FunctionLength = { |
539 FunctionGetLength, | 541 FunctionGetLength, |
540 ReadOnlySetAccessor, | 542 ReadOnlySetAccessor, |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 } | 802 } |
801 | 803 |
802 | 804 |
803 const AccessorDescriptor Accessors::ObjectPrototype = { | 805 const AccessorDescriptor Accessors::ObjectPrototype = { |
804 ObjectGetPrototype, | 806 ObjectGetPrototype, |
805 ObjectSetPrototype, | 807 ObjectSetPrototype, |
806 0 | 808 0 |
807 }; | 809 }; |
808 | 810 |
809 } } // namespace v8::internal | 811 } } // namespace v8::internal |
OLD | NEW |