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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 // | 481 // |
482 // Accessors::FunctionLength | 482 // Accessors::FunctionLength |
483 // | 483 // |
484 | 484 |
485 | 485 |
486 Object* Accessors::FunctionGetLength(Object* object, void*) { | 486 Object* Accessors::FunctionGetLength(Object* object, void*) { |
487 bool found_it = false; | 487 bool found_it = false; |
488 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); | 488 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); |
489 if (!found_it) return Smi::FromInt(0); | 489 if (!found_it) return Smi::FromInt(0); |
490 // Check if already compiled. | 490 // Check if already compiled. |
491 if (!function->is_compiled()) { | 491 if (!function->shared()->is_compiled()) { |
492 // If the function isn't compiled yet, the length is not computed | 492 // If the function isn't compiled yet, the length is not computed |
493 // correctly yet. Compile it now and return the right length. | 493 // correctly yet. Compile it now and return the right length. |
494 HandleScope scope; | 494 HandleScope scope; |
495 Handle<SharedFunctionInfo> shared(function->shared()); | 495 Handle<SharedFunctionInfo> shared(function->shared()); |
496 if (!CompileLazyShared(shared, KEEP_EXCEPTION)) { | 496 if (!CompileLazyShared(shared, KEEP_EXCEPTION)) { |
497 return Failure::Exception(); | 497 return Failure::Exception(); |
498 } | 498 } |
499 return Smi::FromInt(shared->length()); | 499 return Smi::FromInt(shared->length()); |
500 } else { | 500 } else { |
501 return Smi::FromInt(function->shared()->length()); | 501 return Smi::FromInt(function->shared()->length()); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 } | 652 } |
653 | 653 |
654 | 654 |
655 const AccessorDescriptor Accessors::ObjectPrototype = { | 655 const AccessorDescriptor Accessors::ObjectPrototype = { |
656 ObjectGetPrototype, | 656 ObjectGetPrototype, |
657 ObjectSetPrototype, | 657 ObjectSetPrototype, |
658 0 | 658 0 |
659 }; | 659 }; |
660 | 660 |
661 } } // namespace v8::internal | 661 } } // namespace v8::internal |
OLD | NEW |