| OLD | NEW |
| 1 // Copyright 2012 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 |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 if (function->shared()->is_compiled()) { | 894 if (function->shared()->is_compiled()) { |
| 895 return Smi::FromInt(function->shared()->length()); | 895 return Smi::FromInt(function->shared()->length()); |
| 896 } | 896 } |
| 897 // If the function isn't compiled yet, the length is not computed correctly | 897 // If the function isn't compiled yet, the length is not computed correctly |
| 898 // yet. Compile it now and return the right length. | 898 // yet. Compile it now and return the right length. |
| 899 HandleScope scope(isolate); | 899 HandleScope scope(isolate); |
| 900 Handle<JSFunction> function_handle(function); | 900 Handle<JSFunction> function_handle(function); |
| 901 if (Compiler::EnsureCompiled(function_handle, KEEP_EXCEPTION)) { | 901 if (Compiler::EnsureCompiled(function_handle, KEEP_EXCEPTION)) { |
| 902 return Smi::FromInt(function_handle->shared()->length()); | 902 return Smi::FromInt(function_handle->shared()->length()); |
| 903 } | 903 } |
| 904 return Failure::Exception(); | 904 return isolate->heap()->exception(); |
| 905 } | 905 } |
| 906 | 906 |
| 907 | 907 |
| 908 const AccessorDescriptor Accessors::FunctionLength = { | 908 const AccessorDescriptor Accessors::FunctionLength = { |
| 909 FunctionGetLength, | 909 FunctionGetLength, |
| 910 ReadOnlySetAccessor, | 910 ReadOnlySetAccessor, |
| 911 0 | 911 0 |
| 912 }; | 912 }; |
| 913 | 913 |
| 914 | 914 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 info->set_data(Smi::FromInt(index)); | 1218 info->set_data(Smi::FromInt(index)); |
| 1219 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1219 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
| 1220 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1220 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
| 1221 info->set_getter(*getter); | 1221 info->set_getter(*getter); |
| 1222 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1222 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
| 1223 return info; | 1223 return info; |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 | 1226 |
| 1227 } } // namespace v8::internal | 1227 } } // namespace v8::internal |
| OLD | NEW |