OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 SetStatementPosition(stmt, SKIP_BREAK); | 1037 SetStatementPosition(stmt, SKIP_BREAK); |
1038 | 1038 |
1039 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); | 1039 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
1040 | 1040 |
1041 // TODO(all): This visitor probably needs better comments and a revisit. | 1041 // TODO(all): This visitor probably needs better comments and a revisit. |
1042 | 1042 |
1043 Label loop, exit; | 1043 Label loop, exit; |
1044 ForIn loop_statement(this, stmt); | 1044 ForIn loop_statement(this, stmt); |
1045 increment_loop_depth(); | 1045 increment_loop_depth(); |
1046 | 1046 |
1047 // Get the object to enumerate over. If the object is null or undefined, skip | 1047 // Get the object to enumerate over. |
1048 // over the loop. See ECMA-262 version 5, section 12.6.4. | |
1049 SetExpressionAsStatementPosition(stmt->enumerable()); | 1048 SetExpressionAsStatementPosition(stmt->enumerable()); |
1050 VisitForAccumulatorValue(stmt->enumerable()); | 1049 VisitForAccumulatorValue(stmt->enumerable()); |
1051 __ JumpIfRoot(x0, Heap::kUndefinedValueRootIndex, &exit); | |
1052 Register null_value = x15; | |
1053 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | |
1054 __ Cmp(x0, null_value); | |
1055 __ B(eq, &exit); | |
1056 | 1050 |
1057 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 1051 // If the object is null or undefined, skip over the loop, otherwise convert |
1058 | 1052 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4. |
1059 // Convert the object to a JS object. | |
1060 Label convert, done_convert; | 1053 Label convert, done_convert; |
1061 __ JumpIfSmi(x0, &convert); | 1054 __ JumpIfSmi(x0, &convert); |
1062 __ JumpIfObjectType(x0, x10, x11, FIRST_JS_RECEIVER_TYPE, &done_convert, ge); | 1055 __ JumpIfObjectType(x0, x10, x11, FIRST_JS_RECEIVER_TYPE, &done_convert, ge); |
| 1056 __ JumpIfRoot(x0, Heap::kNullValueRootIndex, &exit); |
| 1057 __ JumpIfRoot(x0, Heap::kUndefinedValueRootIndex, &exit); |
1063 __ Bind(&convert); | 1058 __ Bind(&convert); |
1064 ToObjectStub stub(isolate()); | 1059 ToObjectStub stub(isolate()); |
1065 __ CallStub(&stub); | 1060 __ CallStub(&stub); |
1066 __ Bind(&done_convert); | 1061 __ Bind(&done_convert); |
1067 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); | 1062 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); |
1068 __ Push(x0); | 1063 __ Push(x0); |
1069 | 1064 |
1070 // Check for proxies. | |
1071 Label call_runtime; | |
1072 __ JumpIfObjectType(x0, x10, x11, JS_PROXY_TYPE, &call_runtime, eq); | |
1073 | |
1074 // Check cache validity in generated code. This is a fast case for | 1065 // Check cache validity in generated code. This is a fast case for |
1075 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 1066 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
1076 // guarantee cache validity, call the runtime system to check cache | 1067 // guarantee cache validity, call the runtime system to check cache |
1077 // validity or get the property names in a fixed array. | 1068 // validity or get the property names in a fixed array. |
1078 __ CheckEnumCache(x0, null_value, x10, x11, x12, x13, &call_runtime); | 1069 // Note: Proxies never have an enum cache, so will always take the |
| 1070 // slow path. |
| 1071 Label call_runtime; |
| 1072 __ CheckEnumCache(x0, x15, x10, x11, x12, x13, &call_runtime); |
1079 | 1073 |
1080 // The enum cache is valid. Load the map of the object being | 1074 // The enum cache is valid. Load the map of the object being |
1081 // iterated over and use the cache for the iteration. | 1075 // iterated over and use the cache for the iteration. |
1082 Label use_cache; | 1076 Label use_cache; |
1083 __ Ldr(x0, FieldMemOperand(x0, HeapObject::kMapOffset)); | 1077 __ Ldr(x0, FieldMemOperand(x0, HeapObject::kMapOffset)); |
1084 __ B(&use_cache); | 1078 __ B(&use_cache); |
1085 | 1079 |
1086 // Get the set of properties to enumerate. | 1080 // Get the set of properties to enumerate. |
1087 __ Bind(&call_runtime); | 1081 __ Bind(&call_runtime); |
1088 __ Push(x0); // Duplicate the enumerable object on the stack. | 1082 __ Push(x0); // Duplicate the enumerable object on the stack. |
(...skipping 3771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4860 } | 4854 } |
4861 | 4855 |
4862 return INTERRUPT; | 4856 return INTERRUPT; |
4863 } | 4857 } |
4864 | 4858 |
4865 | 4859 |
4866 } // namespace internal | 4860 } // namespace internal |
4867 } // namespace v8 | 4861 } // namespace v8 |
4868 | 4862 |
4869 #endif // V8_TARGET_ARCH_ARM64 | 4863 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |