| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "accessors.h" | 30 #include "accessors.h" |
| 31 #include "api.h" | 31 #include "api.h" |
| 32 #include "arguments.h" | 32 #include "arguments.h" |
| 33 #include "bootstrapper.h" | 33 #include "bootstrapper.h" |
| 34 #include "codegen.h" |
| 34 #include "compiler.h" | 35 #include "compiler.h" |
| 35 #include "debug.h" | 36 #include "debug.h" |
| 36 #include "execution.h" | 37 #include "execution.h" |
| 37 #include "global-handles.h" | 38 #include "global-handles.h" |
| 38 #include "natives.h" | 39 #include "natives.h" |
| 39 #include "runtime.h" | 40 #include "runtime.h" |
| 40 #include "stub-cache.h" | 41 #include "stub-cache.h" |
| 41 | 42 |
| 42 namespace v8 { | 43 namespace v8 { |
| 43 namespace internal { | 44 namespace internal { |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 } | 666 } |
| 666 } | 667 } |
| 667 | 668 |
| 668 | 669 |
| 669 bool EnsureCompiled(Handle<SharedFunctionInfo> shared, | 670 bool EnsureCompiled(Handle<SharedFunctionInfo> shared, |
| 670 ClearExceptionFlag flag) { | 671 ClearExceptionFlag flag) { |
| 671 return shared->is_compiled() || CompileLazyShared(shared, flag); | 672 return shared->is_compiled() || CompileLazyShared(shared, flag); |
| 672 } | 673 } |
| 673 | 674 |
| 674 | 675 |
| 675 static bool CompileLazyHelper(Handle<SharedFunctionInfo> shared, | 676 static bool CompileLazyHelper(CompilationInfo* info, |
| 676 Handle<Object> receiver, | 677 ClearExceptionFlag flag) { |
| 677 ClearExceptionFlag flag, | |
| 678 int loop_nesting) { | |
| 679 // Compile the source information to a code object. | 678 // Compile the source information to a code object. |
| 680 ASSERT(!shared->is_compiled()); | 679 ASSERT(!info->shared_info()->is_compiled()); |
| 681 bool result = Compiler::CompileLazy(shared, receiver, loop_nesting); | 680 bool result = Compiler::CompileLazy(info); |
| 682 ASSERT(result != Top::has_pending_exception()); | 681 ASSERT(result != Top::has_pending_exception()); |
| 683 if (!result && flag == CLEAR_EXCEPTION) Top::clear_pending_exception(); | 682 if (!result && flag == CLEAR_EXCEPTION) Top::clear_pending_exception(); |
| 684 return result; | 683 return result; |
| 685 } | 684 } |
| 686 | 685 |
| 687 | 686 |
| 688 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, | 687 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, |
| 689 ClearExceptionFlag flag) { | 688 ClearExceptionFlag flag) { |
| 690 return CompileLazyHelper(shared, Handle<Object>::null(), flag, 0); | 689 CompilationInfo info(shared, Handle<Object>::null(), 0); |
| 690 return CompileLazyHelper(&info, flag); |
| 691 } | 691 } |
| 692 | 692 |
| 693 | 693 |
| 694 bool CompileLazy(Handle<JSFunction> function, | 694 bool CompileLazy(Handle<JSFunction> function, |
| 695 Handle<Object> receiver, | 695 Handle<Object> receiver, |
| 696 ClearExceptionFlag flag) { | 696 ClearExceptionFlag flag) { |
| 697 // Compile the source information to a code object. | |
| 698 Handle<SharedFunctionInfo> shared(function->shared()); | 697 Handle<SharedFunctionInfo> shared(function->shared()); |
| 699 bool result = CompileLazyHelper(shared, receiver, flag, 0); | 698 CompilationInfo info(shared, receiver, 0); |
| 699 bool result = CompileLazyHelper(&info, flag); |
| 700 LOG(FunctionCreateEvent(*function)); | 700 LOG(FunctionCreateEvent(*function)); |
| 701 return result; | 701 return result; |
| 702 } | 702 } |
| 703 | 703 |
| 704 | 704 |
| 705 bool CompileLazyInLoop(Handle<JSFunction> function, | 705 bool CompileLazyInLoop(Handle<JSFunction> function, |
| 706 Handle<Object> receiver, | 706 Handle<Object> receiver, |
| 707 ClearExceptionFlag flag) { | 707 ClearExceptionFlag flag) { |
| 708 // Compile the source information to a code object. | |
| 709 Handle<SharedFunctionInfo> shared(function->shared()); | 708 Handle<SharedFunctionInfo> shared(function->shared()); |
| 710 bool result = CompileLazyHelper(shared, receiver, flag, 1); | 709 CompilationInfo info(shared, receiver, 1); |
| 710 bool result = CompileLazyHelper(&info, flag); |
| 711 LOG(FunctionCreateEvent(*function)); | 711 LOG(FunctionCreateEvent(*function)); |
| 712 return result; | 712 return result; |
| 713 } | 713 } |
| 714 | 714 |
| 715 | 715 |
| 716 OptimizedObjectForAddingMultipleProperties:: | 716 OptimizedObjectForAddingMultipleProperties:: |
| 717 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, | 717 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, |
| 718 int expected_additional_properties, | 718 int expected_additional_properties, |
| 719 bool condition) { | 719 bool condition) { |
| 720 object_ = object; | 720 object_ = object; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); | 824 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); |
| 825 obj->set_map(*new_map); | 825 obj->set_map(*new_map); |
| 826 new_map->set_needs_loading(true); | 826 new_map->set_needs_loading(true); |
| 827 // Store the lazy loading info in the constructor field. We'll | 827 // Store the lazy loading info in the constructor field. We'll |
| 828 // reestablish the constructor from the fixed array after loading. | 828 // reestablish the constructor from the fixed array after loading. |
| 829 new_map->set_constructor(*arr); | 829 new_map->set_constructor(*arr); |
| 830 ASSERT(!obj->IsLoaded()); | 830 ASSERT(!obj->IsLoaded()); |
| 831 } | 831 } |
| 832 | 832 |
| 833 } } // namespace v8::internal | 833 } } // namespace v8::internal |
| OLD | NEW |