Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: src/full-codegen/mips64/full-codegen-mips64.cc

Issue 1618613002: [for-in] Sanitize for-in optimizations and fix bailout points. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); 1033 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot();
1034 1034
1035 Label loop, exit; 1035 Label loop, exit;
1036 ForIn loop_statement(this, stmt); 1036 ForIn loop_statement(this, stmt);
1037 increment_loop_depth(); 1037 increment_loop_depth();
1038 1038
1039 // Get the object to enumerate over. If the object is null or undefined, skip 1039 // Get the object to enumerate over. If the object is null or undefined, skip
1040 // over the loop. See ECMA-262 version 5, section 12.6.4. 1040 // over the loop. See ECMA-262 version 5, section 12.6.4.
1041 SetExpressionAsStatementPosition(stmt->enumerable()); 1041 SetExpressionAsStatementPosition(stmt->enumerable());
1042 VisitForAccumulatorValue(stmt->enumerable()); 1042 VisitForAccumulatorValue(stmt->enumerable());
1043 __ mov(a0, result_register()); // Result as param to InvokeBuiltin below. 1043 __ mov(a0, result_register());
1044 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 1044
1045 __ Branch(&exit, eq, a0, Operand(at)); 1045 // If the object is null or undefined, skip over the loop, otherwise convert
1046 Register null_value = a5; 1046 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4.
1047 __ LoadRoot(null_value, Heap::kNullValueRootIndex);
1048 __ Branch(&exit, eq, a0, Operand(null_value));
1049 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG);
1050 __ mov(a0, v0);
1051 // Convert the object to a JS object.
1052 Label convert, done_convert; 1047 Label convert, done_convert;
1053 __ JumpIfSmi(a0, &convert); 1048 __ JumpIfSmi(a0, &convert);
1054 __ GetObjectType(a0, a1, a1); 1049 __ GetObjectType(a0, a1, a1);
1055 __ Branch(&done_convert, ge, a1, Operand(FIRST_JS_RECEIVER_TYPE)); 1050 __ Branch(USE_DELAY_SLOT, &done_convert, ge, a1,
1051 Operand(FIRST_JS_RECEIVER_TYPE));
1052 __ LoadRoot(at, Heap::kNullValueRootIndex); // In delay slot.
1053 __ Branch(USE_DELAY_SLOT, &exit, eq, a0, Operand(at));
1054 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); // In delay slot.
1055 __ Branch(&exit, eq, a0, Operand(at));
1056 __ bind(&convert); 1056 __ bind(&convert);
1057 ToObjectStub stub(isolate()); 1057 ToObjectStub stub(isolate());
1058 __ CallStub(&stub); 1058 __ CallStub(&stub);
1059 __ mov(a0, v0); 1059 __ mov(a0, v0);
1060 __ bind(&done_convert); 1060 __ bind(&done_convert);
1061 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); 1061 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG);
1062 __ push(a0); 1062 __ push(a0);
1063 1063
1064 // Check for proxies.
1065 Label call_runtime;
1066 __ GetObjectType(a0, a1, a1);
1067 __ Branch(&call_runtime, eq, a1, Operand(JS_PROXY_TYPE));
1068
1069 // Check cache validity in generated code. This is a fast case for 1064 // Check cache validity in generated code. This is a fast case for
1070 // the JSObject::IsSimpleEnum cache validity checks. If we cannot 1065 // the JSObject::IsSimpleEnum cache validity checks. If we cannot
1071 // guarantee cache validity, call the runtime system to check cache 1066 // guarantee cache validity, call the runtime system to check cache
1072 // validity or get the property names in a fixed array. 1067 // validity or get the property names in a fixed array.
1073 __ CheckEnumCache(null_value, &call_runtime); 1068 // Note: Proxies never have an enum cache, so will always take the
1069 // slow path.
1070 Label call_runtime;
1071 __ CheckEnumCache(&call_runtime);
1074 1072
1075 // The enum cache is valid. Load the map of the object being 1073 // The enum cache is valid. Load the map of the object being
1076 // iterated over and use the cache for the iteration. 1074 // iterated over and use the cache for the iteration.
1077 Label use_cache; 1075 Label use_cache;
1078 __ ld(v0, FieldMemOperand(a0, HeapObject::kMapOffset)); 1076 __ ld(v0, FieldMemOperand(a0, HeapObject::kMapOffset));
1079 __ Branch(&use_cache); 1077 __ Branch(&use_cache);
1080 1078
1081 // Get the set of properties to enumerate. 1079 // Get the set of properties to enumerate.
1082 __ bind(&call_runtime); 1080 __ bind(&call_runtime);
1083 __ push(a0); // Duplicate the enumerable object on the stack. 1081 __ push(a0); // Duplicate the enumerable object on the stack.
(...skipping 3756 matching lines...) Expand 10 before | Expand all | Expand 10 after
4840 reinterpret_cast<uint64_t>( 4838 reinterpret_cast<uint64_t>(
4841 isolate->builtins()->OsrAfterStackCheck()->entry())); 4839 isolate->builtins()->OsrAfterStackCheck()->entry()));
4842 return OSR_AFTER_STACK_CHECK; 4840 return OSR_AFTER_STACK_CHECK;
4843 } 4841 }
4844 4842
4845 4843
4846 } // namespace internal 4844 } // namespace internal
4847 } // namespace v8 4845 } // namespace v8
4848 4846
4849 #endif // V8_TARGET_ARCH_MIPS64 4847 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698