Changeset 36317 in webkit for trunk/JavaScriptCore/VM/CodeGenerator.cpp
- Timestamp:
- Sep 10, 2008, 2:23:35 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/CodeGenerator.cpp
r36263 r36317 678 678 } 679 679 680 bool CodeGenerator::findScopedProperty(const Identifier& property, int& index, size_t& stackDepth, bool forWriting )680 bool CodeGenerator::findScopedProperty(const Identifier& property, int& index, size_t& stackDepth, bool forWriting, JSValue*& globalObject) 681 681 { 682 682 // Cases where we cannot optimise the lookup … … 703 703 stackDepth = 0; 704 704 index = missingSymbolMarker(); 705 if (++iter == end) 706 globalObject = currentVariableObject; 705 707 return false; 706 708 } 707 709 stackDepth = depth; 708 710 index = entry.getIndex(); 711 if (++iter == end) 712 globalObject = currentVariableObject; 709 713 return true; 710 714 } … … 716 720 stackDepth = depth; 717 721 index = missingSymbolMarker(); 722 JSObject* scope = *iter; 723 if (++iter == end) 724 globalObject = scope; 718 725 return true; 719 726 } … … 723 730 size_t depth = 0; 724 731 int index = 0; 725 if (!findScopedProperty(property, index, depth, false)) { 732 JSValue* globalObject = 0; 733 if (!findScopedProperty(property, index, depth, false, globalObject)) { 726 734 // We can't optimise at all :-( 727 735 emitOpcode(op_resolve); … … 742 750 743 751 // Directly index the property lookup across multiple scopes. Yay! 744 return emitGetScopedVar(dst, depth, index); 745 } 746 747 RegisterID* CodeGenerator::emitGetScopedVar(RegisterID* dst, size_t depth, int index) 748 { 752 return emitGetScopedVar(dst, depth, index, globalObject); 753 } 754 755 RegisterID* CodeGenerator::emitGetScopedVar(RegisterID* dst, size_t depth, int index, JSValue* globalObject) 756 { 757 if (globalObject) { 758 emitOpcode(op_get_global_var); 759 instructions().append(dst->index()); 760 instructions().append(static_cast<JSCell*>(globalObject)); 761 instructions().append(index); 762 return dst; 763 } 764 749 765 emitOpcode(op_get_scoped_var); 750 766 instructions().append(dst->index()); … … 754 770 } 755 771 756 RegisterID* CodeGenerator::emitPutScopedVar(size_t depth, int index, RegisterID* value) 757 { 772 RegisterID* CodeGenerator::emitPutScopedVar(size_t depth, int index, RegisterID* value, JSValue* globalObject) 773 { 774 if (globalObject) { 775 emitOpcode(op_put_global_var); 776 instructions().append(static_cast<JSCell*>(globalObject)); 777 instructions().append(index); 778 instructions().append(value->index()); 779 return value; 780 } 758 781 emitOpcode(op_put_scoped_var); 759 782 instructions().append(index);
Note:
See TracChangeset
for help on using the changeset viewer.