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 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 __ j(above_equal, &done_convert, Label::kNear); | 985 __ j(above_equal, &done_convert, Label::kNear); |
986 __ bind(&convert); | 986 __ bind(&convert); |
987 ToObjectStub stub(isolate()); | 987 ToObjectStub stub(isolate()); |
988 __ CallStub(&stub); | 988 __ CallStub(&stub); |
989 __ bind(&done_convert); | 989 __ bind(&done_convert); |
990 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); | 990 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); |
991 __ push(eax); | 991 __ push(eax); |
992 | 992 |
993 // Check for proxies. | 993 // Check for proxies. |
994 Label call_runtime, use_cache, fixed_array; | 994 Label call_runtime, use_cache, fixed_array; |
995 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 995 __ CmpObjectType(eax, JS_PROXY_TYPE, ecx); |
996 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); | 996 __ j(equal, &call_runtime); |
997 __ j(below_equal, &call_runtime); | |
998 | 997 |
999 // Check cache validity in generated code. This is a fast case for | 998 // Check cache validity in generated code. This is a fast case for |
1000 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 999 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
1001 // guarantee cache validity, call the runtime system to check cache | 1000 // guarantee cache validity, call the runtime system to check cache |
1002 // validity or get the property names in a fixed array. | 1001 // validity or get the property names in a fixed array. |
1003 __ CheckEnumCache(&call_runtime); | 1002 __ CheckEnumCache(&call_runtime); |
1004 | 1003 |
1005 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | 1004 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); |
1006 __ jmp(&use_cache, Label::kNear); | 1005 __ jmp(&use_cache, Label::kNear); |
1007 | 1006 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 __ bind(&fixed_array); | 1042 __ bind(&fixed_array); |
1044 | 1043 |
1045 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1044 // No need for a write barrier, we are storing a Smi in the feedback vector. |
1046 __ EmitLoadTypeFeedbackVector(ebx); | 1045 __ EmitLoadTypeFeedbackVector(ebx); |
1047 int vector_index = SmiFromSlot(slot)->value(); | 1046 int vector_index = SmiFromSlot(slot)->value(); |
1048 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), | 1047 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), |
1049 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1048 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1050 | 1049 |
1051 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check | 1050 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check |
1052 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object | 1051 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object |
1053 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 1052 STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
1054 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); | 1053 __ CmpObjectType(ecx, JS_PROXY_TYPE, ecx); |
1055 __ j(above, &non_proxy); | 1054 __ j(above, &non_proxy); |
1056 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy | 1055 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy |
1057 __ bind(&non_proxy); | 1056 __ bind(&non_proxy); |
1058 __ push(ebx); // Smi | 1057 __ push(ebx); // Smi |
1059 __ push(eax); // Array | 1058 __ push(eax); // Array |
1060 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); | 1059 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); |
1061 __ push(eax); // Fixed array length (as smi). | 1060 __ push(eax); // Fixed array length (as smi). |
1062 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1061 __ push(Immediate(Smi::FromInt(0))); // Initial index. |
1063 | 1062 |
1064 // Generate code for doing the condition check. | 1063 // Generate code for doing the condition check. |
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3142 VisitForAccumulatorValue(args->at(0)); | 3141 VisitForAccumulatorValue(args->at(0)); |
3143 | 3142 |
3144 Label materialize_true, materialize_false; | 3143 Label materialize_true, materialize_false; |
3145 Label* if_true = NULL; | 3144 Label* if_true = NULL; |
3146 Label* if_false = NULL; | 3145 Label* if_false = NULL; |
3147 Label* fall_through = NULL; | 3146 Label* fall_through = NULL; |
3148 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, | 3147 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
3149 &if_false, &fall_through); | 3148 &if_false, &fall_through); |
3150 | 3149 |
3151 __ JumpIfSmi(eax, if_false); | 3150 __ JumpIfSmi(eax, if_false); |
3152 Register map = ebx; | 3151 __ CmpObjectType(eax, JS_PROXY_TYPE, ebx); |
3153 __ mov(map, FieldOperand(eax, HeapObject::kMapOffset)); | |
3154 __ CmpInstanceType(map, FIRST_JS_PROXY_TYPE); | |
3155 __ j(less, if_false); | |
3156 __ CmpInstanceType(map, LAST_JS_PROXY_TYPE); | |
3157 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3152 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3158 Split(less_equal, if_true, if_false, fall_through); | 3153 Split(equal, if_true, if_false, fall_through); |
3159 | 3154 |
3160 context()->Plug(if_true, if_false); | 3155 context()->Plug(if_true, if_false); |
3161 } | 3156 } |
3162 | 3157 |
3163 | 3158 |
3164 void FullCodeGenerator::EmitObjectEquals(CallRuntime* expr) { | 3159 void FullCodeGenerator::EmitObjectEquals(CallRuntime* expr) { |
3165 ZoneList<Expression*>* args = expr->arguments(); | 3160 ZoneList<Expression*>* args = expr->arguments(); |
3166 DCHECK(args->length() == 2); | 3161 DCHECK(args->length() == 2); |
3167 | 3162 |
3168 // Load the two objects into registers and perform the comparison. | 3163 // Load the two objects into registers and perform the comparison. |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4841 Assembler::target_address_at(call_target_address, | 4836 Assembler::target_address_at(call_target_address, |
4842 unoptimized_code)); | 4837 unoptimized_code)); |
4843 return OSR_AFTER_STACK_CHECK; | 4838 return OSR_AFTER_STACK_CHECK; |
4844 } | 4839 } |
4845 | 4840 |
4846 | 4841 |
4847 } // namespace internal | 4842 } // namespace internal |
4848 } // namespace v8 | 4843 } // namespace v8 |
4849 | 4844 |
4850 #endif // V8_TARGET_ARCH_IA32 | 4845 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |