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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 __ j(above_equal, &done_convert, Label::kNear); | 973 __ j(above_equal, &done_convert, Label::kNear); |
974 __ bind(&convert); | 974 __ bind(&convert); |
975 ToObjectStub stub(isolate()); | 975 ToObjectStub stub(isolate()); |
976 __ CallStub(&stub); | 976 __ CallStub(&stub); |
977 __ bind(&done_convert); | 977 __ bind(&done_convert); |
978 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); | 978 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); |
979 __ push(eax); | 979 __ push(eax); |
980 | 980 |
981 // Check for proxies. | 981 // Check for proxies. |
982 Label call_runtime, use_cache, fixed_array; | 982 Label call_runtime, use_cache, fixed_array; |
983 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 983 __ CmpObjectType(eax, JS_PROXY_TYPE, ecx); |
984 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); | 984 __ j(equal, &call_runtime); |
985 __ j(below_equal, &call_runtime); | |
986 | 985 |
987 // Check cache validity in generated code. This is a fast case for | 986 // Check cache validity in generated code. This is a fast case for |
988 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 987 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
989 // guarantee cache validity, call the runtime system to check cache | 988 // guarantee cache validity, call the runtime system to check cache |
990 // validity or get the property names in a fixed array. | 989 // validity or get the property names in a fixed array. |
991 __ CheckEnumCache(&call_runtime); | 990 __ CheckEnumCache(&call_runtime); |
992 | 991 |
993 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | 992 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); |
994 __ jmp(&use_cache, Label::kNear); | 993 __ jmp(&use_cache, Label::kNear); |
995 | 994 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 __ bind(&fixed_array); | 1030 __ bind(&fixed_array); |
1032 | 1031 |
1033 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1032 // No need for a write barrier, we are storing a Smi in the feedback vector. |
1034 __ EmitLoadTypeFeedbackVector(ebx); | 1033 __ EmitLoadTypeFeedbackVector(ebx); |
1035 int vector_index = SmiFromSlot(slot)->value(); | 1034 int vector_index = SmiFromSlot(slot)->value(); |
1036 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), | 1035 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), |
1037 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1036 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1038 | 1037 |
1039 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check | 1038 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check |
1040 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object | 1039 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object |
1041 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 1040 STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
1042 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); | 1041 __ CmpObjectType(ecx, JS_PROXY_TYPE, ecx); |
1043 __ j(above, &non_proxy); | 1042 __ j(above, &non_proxy); |
1044 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy | 1043 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy |
1045 __ bind(&non_proxy); | 1044 __ bind(&non_proxy); |
1046 __ push(ebx); // Smi | 1045 __ push(ebx); // Smi |
1047 __ push(eax); // Array | 1046 __ push(eax); // Array |
1048 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); | 1047 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); |
1049 __ push(eax); // Fixed array length (as smi). | 1048 __ push(eax); // Fixed array length (as smi). |
1050 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1049 __ push(Immediate(Smi::FromInt(0))); // Initial index. |
1051 | 1050 |
1052 // Generate code for doing the condition check. | 1051 // Generate code for doing the condition check. |
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3130 VisitForAccumulatorValue(args->at(0)); | 3129 VisitForAccumulatorValue(args->at(0)); |
3131 | 3130 |
3132 Label materialize_true, materialize_false; | 3131 Label materialize_true, materialize_false; |
3133 Label* if_true = NULL; | 3132 Label* if_true = NULL; |
3134 Label* if_false = NULL; | 3133 Label* if_false = NULL; |
3135 Label* fall_through = NULL; | 3134 Label* fall_through = NULL; |
3136 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, | 3135 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
3137 &if_false, &fall_through); | 3136 &if_false, &fall_through); |
3138 | 3137 |
3139 __ JumpIfSmi(eax, if_false); | 3138 __ JumpIfSmi(eax, if_false); |
3140 Register map = ebx; | 3139 __ CmpObjectType(eax, JS_PROXY_TYPE, ebx); |
3141 __ mov(map, FieldOperand(eax, HeapObject::kMapOffset)); | |
3142 __ CmpInstanceType(map, FIRST_JS_PROXY_TYPE); | |
3143 __ j(less, if_false); | |
3144 __ CmpInstanceType(map, LAST_JS_PROXY_TYPE); | |
3145 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3140 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3146 Split(less_equal, if_true, if_false, fall_through); | 3141 Split(equal, if_true, if_false, fall_through); |
3147 | 3142 |
3148 context()->Plug(if_true, if_false); | 3143 context()->Plug(if_true, if_false); |
3149 } | 3144 } |
3150 | 3145 |
3151 | 3146 |
3152 void FullCodeGenerator::EmitObjectEquals(CallRuntime* expr) { | 3147 void FullCodeGenerator::EmitObjectEquals(CallRuntime* expr) { |
3153 ZoneList<Expression*>* args = expr->arguments(); | 3148 ZoneList<Expression*>* args = expr->arguments(); |
3154 DCHECK(args->length() == 2); | 3149 DCHECK(args->length() == 2); |
3155 | 3150 |
3156 // Load the two objects into registers and perform the comparison. | 3151 // Load the two objects into registers and perform the comparison. |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4829 Assembler::target_address_at(call_target_address, | 4824 Assembler::target_address_at(call_target_address, |
4830 unoptimized_code)); | 4825 unoptimized_code)); |
4831 return OSR_AFTER_STACK_CHECK; | 4826 return OSR_AFTER_STACK_CHECK; |
4832 } | 4827 } |
4833 | 4828 |
4834 | 4829 |
4835 } // namespace internal | 4830 } // namespace internal |
4836 } // namespace v8 | 4831 } // namespace v8 |
4837 | 4832 |
4838 #endif // V8_TARGET_ARCH_IA32 | 4833 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |