| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 6 | 6 |
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 991 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
| 992 Comment cmnt(masm_, "[ ForInStatement"); | 992 Comment cmnt(masm_, "[ ForInStatement"); |
| 993 SetStatementPosition(stmt, SKIP_BREAK); | 993 SetStatementPosition(stmt, SKIP_BREAK); |
| 994 | 994 |
| 995 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); | 995 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
| 996 | 996 |
| 997 Label loop, exit; | 997 Label loop, exit; |
| 998 ForIn loop_statement(this, stmt); | 998 ForIn loop_statement(this, stmt); |
| 999 increment_loop_depth(); | 999 increment_loop_depth(); |
| 1000 | 1000 |
| 1001 // Get the object to enumerate over. If the object is null or undefined, skip | 1001 // Get the object to enumerate over. |
| 1002 // over the loop. See ECMA-262 version 5, section 12.6.4. | |
| 1003 SetExpressionAsStatementPosition(stmt->enumerable()); | 1002 SetExpressionAsStatementPosition(stmt->enumerable()); |
| 1004 VisitForAccumulatorValue(stmt->enumerable()); | 1003 VisitForAccumulatorValue(stmt->enumerable()); |
| 1005 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | |
| 1006 __ cmp(r3, ip); | |
| 1007 __ beq(&exit); | |
| 1008 Register null_value = r7; | |
| 1009 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | |
| 1010 __ cmp(r3, null_value); | |
| 1011 __ beq(&exit); | |
| 1012 | 1004 |
| 1013 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 1005 // If the object is null or undefined, skip over the loop, otherwise convert |
| 1014 | 1006 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4. |
| 1015 // Convert the object to a JS object. | |
| 1016 Label convert, done_convert; | 1007 Label convert, done_convert; |
| 1017 __ JumpIfSmi(r3, &convert); | 1008 __ JumpIfSmi(r3, &convert); |
| 1018 __ CompareObjectType(r3, r4, r4, FIRST_JS_RECEIVER_TYPE); | 1009 __ CompareObjectType(r3, r4, r4, FIRST_JS_RECEIVER_TYPE); |
| 1019 __ bge(&done_convert); | 1010 __ bge(&done_convert); |
| 1011 __ CompareRoot(r3, Heap::kNullValueRootIndex); |
| 1012 __ beq(&exit); |
| 1013 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); |
| 1014 __ beq(&exit); |
| 1020 __ bind(&convert); | 1015 __ bind(&convert); |
| 1021 ToObjectStub stub(isolate()); | 1016 ToObjectStub stub(isolate()); |
| 1022 __ CallStub(&stub); | 1017 __ CallStub(&stub); |
| 1023 __ bind(&done_convert); | 1018 __ bind(&done_convert); |
| 1024 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); | 1019 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); |
| 1025 __ push(r3); | 1020 __ push(r3); |
| 1026 | 1021 |
| 1027 // Check for proxies. | |
| 1028 Label call_runtime; | |
| 1029 __ CompareObjectType(r3, r4, r4, JS_PROXY_TYPE); | |
| 1030 __ beq(&call_runtime); | |
| 1031 | |
| 1032 // Check cache validity in generated code. This is a fast case for | 1022 // Check cache validity in generated code. This is a fast case for |
| 1033 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 1023 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
| 1034 // guarantee cache validity, call the runtime system to check cache | 1024 // guarantee cache validity, call the runtime system to check cache |
| 1035 // validity or get the property names in a fixed array. | 1025 // validity or get the property names in a fixed array. |
| 1036 __ CheckEnumCache(null_value, &call_runtime); | 1026 // Note: Proxies never have an enum cache, so will always take the |
| 1027 // slow path. |
| 1028 Label call_runtime; |
| 1029 __ CheckEnumCache(&call_runtime); |
| 1037 | 1030 |
| 1038 // The enum cache is valid. Load the map of the object being | 1031 // The enum cache is valid. Load the map of the object being |
| 1039 // iterated over and use the cache for the iteration. | 1032 // iterated over and use the cache for the iteration. |
| 1040 Label use_cache; | 1033 Label use_cache; |
| 1041 __ LoadP(r3, FieldMemOperand(r3, HeapObject::kMapOffset)); | 1034 __ LoadP(r3, FieldMemOperand(r3, HeapObject::kMapOffset)); |
| 1042 __ b(&use_cache); | 1035 __ b(&use_cache); |
| 1043 | 1036 |
| 1044 // Get the set of properties to enumerate. | 1037 // Get the set of properties to enumerate. |
| 1045 __ bind(&call_runtime); | 1038 __ bind(&call_runtime); |
| 1046 __ push(r3); // Duplicate the enumerable object on the stack. | 1039 __ push(r3); // Duplicate the enumerable object on the stack. |
| (...skipping 3767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4814 return ON_STACK_REPLACEMENT; | 4807 return ON_STACK_REPLACEMENT; |
| 4815 } | 4808 } |
| 4816 | 4809 |
| 4817 DCHECK(interrupt_address == | 4810 DCHECK(interrupt_address == |
| 4818 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4811 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 4819 return OSR_AFTER_STACK_CHECK; | 4812 return OSR_AFTER_STACK_CHECK; |
| 4820 } | 4813 } |
| 4821 } // namespace internal | 4814 } // namespace internal |
| 4822 } // namespace v8 | 4815 } // namespace v8 |
| 4823 #endif // V8_TARGET_ARCH_PPC | 4816 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |