Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(818)

Side by Side Diff: src/handles.cc

Issue 551189: Propagate receiver from initial call site to code generator. (Closed)
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/compiler.h ('K') | « src/handles.h ('k') | src/ic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } else { 659 } else {
660 int num_enum = object->NumberOfEnumProperties(); 660 int num_enum = object->NumberOfEnumProperties();
661 Handle<FixedArray> storage = Factory::NewFixedArray(num_enum); 661 Handle<FixedArray> storage = Factory::NewFixedArray(num_enum);
662 Handle<FixedArray> sort_array = Factory::NewFixedArray(num_enum); 662 Handle<FixedArray> sort_array = Factory::NewFixedArray(num_enum);
663 object->property_dictionary()->CopyEnumKeysTo(*storage, *sort_array); 663 object->property_dictionary()->CopyEnumKeysTo(*storage, *sort_array);
664 return storage; 664 return storage;
665 } 665 }
666 } 666 }
667 667
668 668
669 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, 669 bool EnsureCompiled(Handle<SharedFunctionInfo> shared,
670 ClearExceptionFlag flag, 670 ClearExceptionFlag flag) {
671 int loop_nesting) { 671 return shared->is_compiled() || CompileLazyShared(shared, flag);
672 }
673
674
675 static bool CompileLazyHelper(Handle<SharedFunctionInfo> shared,
676 Handle<Object> receiver,
677 ClearExceptionFlag flag,
678 int loop_nesting) {
672 // Compile the source information to a code object. 679 // Compile the source information to a code object.
673 ASSERT(!shared->is_compiled()); 680 ASSERT(!shared->is_compiled());
674 bool result = Compiler::CompileLazy(shared, loop_nesting); 681 bool result = Compiler::CompileLazy(shared, receiver, loop_nesting);
675 ASSERT(result != Top::has_pending_exception()); 682 ASSERT(result != Top::has_pending_exception());
676 if (!result && flag == CLEAR_EXCEPTION) Top::clear_pending_exception(); 683 if (!result && flag == CLEAR_EXCEPTION) Top::clear_pending_exception();
677 return result; 684 return result;
678 } 685 }
679 686
680 687
681 bool CompileLazy(Handle<JSFunction> function, ClearExceptionFlag flag) { 688 bool CompileLazyShared(Handle<SharedFunctionInfo> shared,
689 ClearExceptionFlag flag) {
690 return CompileLazyHelper(shared, Handle<Object>::null(), flag, 0);
691 }
692
693
694 bool CompileLazy(Handle<JSFunction> function,
695 Handle<Object> receiver,
696 ClearExceptionFlag flag) {
682 // Compile the source information to a code object. 697 // Compile the source information to a code object.
683 Handle<SharedFunctionInfo> shared(function->shared()); 698 Handle<SharedFunctionInfo> shared(function->shared());
684 bool result = CompileLazyShared(shared, flag, 0); 699 bool result = CompileLazyHelper(shared, receiver, flag, 0);
685 LOG(FunctionCreateEvent(*function)); 700 LOG(FunctionCreateEvent(*function));
686 return result; 701 return result;
687 } 702 }
688 703
689 704
690 bool CompileLazyInLoop(Handle<JSFunction> function, ClearExceptionFlag flag) { 705 bool CompileLazyInLoop(Handle<JSFunction> function,
706 Handle<Object> receiver,
707 ClearExceptionFlag flag) {
691 // Compile the source information to a code object. 708 // Compile the source information to a code object.
692 Handle<SharedFunctionInfo> shared(function->shared()); 709 Handle<SharedFunctionInfo> shared(function->shared());
693 bool result = CompileLazyShared(shared, flag, 1); 710 bool result = CompileLazyHelper(shared, receiver, flag, 1);
694 LOG(FunctionCreateEvent(*function)); 711 LOG(FunctionCreateEvent(*function));
695 return result; 712 return result;
696 } 713 }
697 714
715
698 OptimizedObjectForAddingMultipleProperties:: 716 OptimizedObjectForAddingMultipleProperties::
699 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, 717 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object,
700 int expected_additional_properties, 718 int expected_additional_properties,
701 bool condition) { 719 bool condition) {
702 object_ = object; 720 object_ = object;
703 if (condition && object_->HasFastProperties()) { 721 if (condition && object_->HasFastProperties()) {
704 // Normalize the properties of object to avoid n^2 behavior 722 // Normalize the properties of object to avoid n^2 behavior
705 // when extending the object multiple properties. Indicate the number of 723 // when extending the object multiple properties. Indicate the number of
706 // properties to be added. 724 // properties to be added.
707 unused_property_fields_ = object->map()->unused_property_fields(); 725 unused_property_fields_ = object->map()->unused_property_fields();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); 824 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map);
807 obj->set_map(*new_map); 825 obj->set_map(*new_map);
808 new_map->set_needs_loading(true); 826 new_map->set_needs_loading(true);
809 // Store the lazy loading info in the constructor field. We'll 827 // Store the lazy loading info in the constructor field. We'll
810 // reestablish the constructor from the fixed array after loading. 828 // reestablish the constructor from the fixed array after loading.
811 new_map->set_constructor(*arr); 829 new_map->set_constructor(*arr);
812 ASSERT(!obj->IsLoaded()); 830 ASSERT(!obj->IsLoaded());
813 } 831 }
814 832
815 } } // namespace v8::internal 833 } } // namespace v8::internal
OLDNEW
« src/compiler.h ('K') | « src/handles.h ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698