| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 | 847 |
| 848 | 848 |
| 849 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 849 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
| 850 Comment cmnt(masm_, "[ ForInStatement"); | 850 Comment cmnt(masm_, "[ ForInStatement"); |
| 851 SetStatementPosition(stmt); | 851 SetStatementPosition(stmt); |
| 852 | 852 |
| 853 Label loop, exit; | 853 Label loop, exit; |
| 854 ForIn loop_statement(this, stmt); | 854 ForIn loop_statement(this, stmt); |
| 855 increment_loop_depth(); | 855 increment_loop_depth(); |
| 856 | 856 |
| 857 // Load null value as it is used several times below. | |
| 858 Register null_value = rdi; | |
| 859 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | |
| 860 | |
| 861 // Get the object to enumerate over. Both SpiderMonkey and JSC | 857 // Get the object to enumerate over. Both SpiderMonkey and JSC |
| 862 // ignore null and undefined in contrast to the specification; see | 858 // ignore null and undefined in contrast to the specification; see |
| 863 // ECMA-262 section 12.6.4. | 859 // ECMA-262 section 12.6.4. |
| 864 VisitForAccumulatorValue(stmt->enumerable()); | 860 VisitForAccumulatorValue(stmt->enumerable()); |
| 865 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); | 861 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
| 866 __ j(equal, &exit); | 862 __ j(equal, &exit); |
| 863 Register null_value = rdi; |
| 864 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
| 867 __ cmpq(rax, null_value); | 865 __ cmpq(rax, null_value); |
| 868 __ j(equal, &exit); | 866 __ j(equal, &exit); |
| 869 | 867 |
| 870 // Convert the object to a JS object. | 868 // Convert the object to a JS object. |
| 871 Label convert, done_convert; | 869 Label convert, done_convert; |
| 872 __ JumpIfSmi(rax, &convert); | 870 __ JumpIfSmi(rax, &convert); |
| 873 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx); | 871 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx); |
| 874 __ j(above_equal, &done_convert); | 872 __ j(above_equal, &done_convert); |
| 875 __ bind(&convert); | 873 __ bind(&convert); |
| 876 __ push(rax); | 874 __ push(rax); |
| (...skipping 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3852 __ ret(0); | 3850 __ ret(0); |
| 3853 } | 3851 } |
| 3854 | 3852 |
| 3855 | 3853 |
| 3856 #undef __ | 3854 #undef __ |
| 3857 | 3855 |
| 3858 | 3856 |
| 3859 } } // namespace v8::internal | 3857 } } // namespace v8::internal |
| 3860 | 3858 |
| 3861 #endif // V8_TARGET_ARCH_X64 | 3859 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |