OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 1034 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
1035 Comment cmnt(masm_, "[ ForInStatement"); | 1035 Comment cmnt(masm_, "[ ForInStatement"); |
1036 SetStatementPosition(stmt, SKIP_BREAK); | 1036 SetStatementPosition(stmt, SKIP_BREAK); |
1037 | 1037 |
1038 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); | 1038 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
1039 | 1039 |
1040 Label loop, exit; | 1040 Label loop, exit; |
1041 ForIn loop_statement(this, stmt); | 1041 ForIn loop_statement(this, stmt); |
1042 increment_loop_depth(); | 1042 increment_loop_depth(); |
1043 | 1043 |
1044 // Get the object to enumerate over. If the object is null or undefined, skip | 1044 // Get the object to enumerate over. |
1045 // over the loop. See ECMA-262 version 5, section 12.6.4. | |
1046 SetExpressionAsStatementPosition(stmt->enumerable()); | 1045 SetExpressionAsStatementPosition(stmt->enumerable()); |
1047 VisitForAccumulatorValue(stmt->enumerable()); | 1046 VisitForAccumulatorValue(stmt->enumerable()); |
1048 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | |
1049 __ cmp(r0, ip); | |
1050 __ b(eq, &exit); | |
1051 Register null_value = r5; | |
1052 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | |
1053 __ cmp(r0, null_value); | |
1054 __ b(eq, &exit); | |
1055 | 1047 |
1056 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 1048 // If the object is null or undefined, skip over the loop, otherwise convert |
1057 | 1049 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4. |
1058 // Convert the object to a JS object. | |
1059 Label convert, done_convert; | 1050 Label convert, done_convert; |
1060 __ JumpIfSmi(r0, &convert); | 1051 __ JumpIfSmi(r0, &convert); |
1061 __ CompareObjectType(r0, r1, r1, FIRST_JS_RECEIVER_TYPE); | 1052 __ CompareObjectType(r0, r1, r1, FIRST_JS_RECEIVER_TYPE); |
1062 __ b(ge, &done_convert); | 1053 __ b(ge, &done_convert); |
| 1054 __ CompareRoot(r0, Heap::kNullValueRootIndex); |
| 1055 __ b(eq, &exit); |
| 1056 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex); |
| 1057 __ b(eq, &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(r0); | 1063 __ push(r0); |
1069 | 1064 |
1070 // Check for proxies. | |
1071 Label call_runtime; | |
1072 __ CompareObjectType(r0, r1, r1, JS_PROXY_TYPE); | |
1073 __ b(eq, &call_runtime); | |
1074 | |
1075 // 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 |
1076 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 1066 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
1077 // guarantee cache validity, call the runtime system to check cache | 1067 // guarantee cache validity, call the runtime system to check cache |
1078 // validity or get the property names in a fixed array. | 1068 // validity or get the property names in a fixed array. |
1079 __ CheckEnumCache(null_value, &call_runtime); | 1069 // Note: Proxies never have an enum cache, so will always take the |
| 1070 // slow path. |
| 1071 Label call_runtime; |
| 1072 __ CheckEnumCache(&call_runtime); |
1080 | 1073 |
1081 // 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 |
1082 // iterated over and use the cache for the iteration. | 1075 // iterated over and use the cache for the iteration. |
1083 Label use_cache; | 1076 Label use_cache; |
1084 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); | 1077 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); |
1085 __ b(&use_cache); | 1078 __ b(&use_cache); |
1086 | 1079 |
1087 // Get the set of properties to enumerate. | 1080 // Get the set of properties to enumerate. |
1088 __ bind(&call_runtime); | 1081 __ bind(&call_runtime); |
1089 __ push(r0); // Duplicate the enumerable object on the stack. | 1082 __ push(r0); // Duplicate the enumerable object on the stack. |
(...skipping 3788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4878 DCHECK(interrupt_address == | 4871 DCHECK(interrupt_address == |
4879 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4872 isolate->builtins()->OsrAfterStackCheck()->entry()); |
4880 return OSR_AFTER_STACK_CHECK; | 4873 return OSR_AFTER_STACK_CHECK; |
4881 } | 4874 } |
4882 | 4875 |
4883 | 4876 |
4884 } // namespace internal | 4877 } // namespace internal |
4885 } // namespace v8 | 4878 } // namespace v8 |
4886 | 4879 |
4887 #endif // V8_TARGET_ARCH_ARM | 4880 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |