| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 102   if (strlen(FLAG_stop_at) > 0 && | 102   if (strlen(FLAG_stop_at) > 0 && | 
| 103       literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 103       literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 
| 104     __ int3(); | 104     __ int3(); | 
| 105   } | 105   } | 
| 106 #endif | 106 #endif | 
| 107 | 107 | 
| 108   if (FLAG_debug_code && info->ExpectsJSReceiverAsReceiver()) { | 108   if (FLAG_debug_code && info->ExpectsJSReceiverAsReceiver()) { | 
| 109     int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; | 109     int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; | 
| 110     __ mov(ecx, Operand(esp, receiver_offset)); | 110     __ mov(ecx, Operand(esp, receiver_offset)); | 
| 111     __ AssertNotSmi(ecx); | 111     __ AssertNotSmi(ecx); | 
| 112     __ CmpObjectType(ecx, FIRST_SPEC_OBJECT_TYPE, ecx); | 112     __ CmpObjectType(ecx, FIRST_JS_RECEIVER_TYPE, ecx); | 
| 113     __ Assert(above_equal, kSloppyFunctionExpectsJSReceiverReceiver); | 113     __ Assert(above_equal, kSloppyFunctionExpectsJSReceiverReceiver); | 
| 114   } | 114   } | 
| 115 | 115 | 
| 116   // Open a frame scope to indicate that there is a frame on the stack.  The | 116   // Open a frame scope to indicate that there is a frame on the stack.  The | 
| 117   // MANUAL indicates that the scope shouldn't actually generate code to set up | 117   // MANUAL indicates that the scope shouldn't actually generate code to set up | 
| 118   // the frame (that is done below). | 118   // the frame (that is done below). | 
| 119   FrameScope frame_scope(masm_, StackFrame::MANUAL); | 119   FrameScope frame_scope(masm_, StackFrame::MANUAL); | 
| 120 | 120 | 
| 121   info->set_prologue_offset(masm_->pc_offset()); | 121   info->set_prologue_offset(masm_->pc_offset()); | 
| 122   __ Prologue(info->IsCodePreAgingActive()); | 122   __ Prologue(info->IsCodePreAgingActive()); | 
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 974   __ cmp(eax, isolate()->factory()->undefined_value()); | 974   __ cmp(eax, isolate()->factory()->undefined_value()); | 
| 975   __ j(equal, &exit); | 975   __ j(equal, &exit); | 
| 976   __ cmp(eax, isolate()->factory()->null_value()); | 976   __ cmp(eax, isolate()->factory()->null_value()); | 
| 977   __ j(equal, &exit); | 977   __ j(equal, &exit); | 
| 978 | 978 | 
| 979   PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 979   PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 
| 980 | 980 | 
| 981   // Convert the object to a JS object. | 981   // Convert the object to a JS object. | 
| 982   Label convert, done_convert; | 982   Label convert, done_convert; | 
| 983   __ JumpIfSmi(eax, &convert, Label::kNear); | 983   __ JumpIfSmi(eax, &convert, Label::kNear); | 
| 984   __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); | 984   __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx); | 
| 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_SPEC_OBJECT_TYPE); | 995   STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 
| 996   __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); | 996   __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); | 
| 997   __ j(below_equal, &call_runtime); | 997   __ j(below_equal, &call_runtime); | 
| 998 | 998 | 
| 999   // Check cache validity in generated code. This is a fast case for | 999   // Check cache validity in generated code. This is a fast case for | 
| 1000   // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 1000   // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 
| 1001   // guarantee cache validity, call the runtime system to check cache | 1001   // guarantee cache validity, call the runtime system to check cache | 
| 1002   // validity or get the property names in a fixed array. | 1002   // validity or get the property names in a fixed array. | 
| 1003   __ CheckEnumCache(&call_runtime); | 1003   __ CheckEnumCache(&call_runtime); | 
| 1004 | 1004 | 
| 1005   __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | 1005   __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1043   __ bind(&fixed_array); | 1043   __ bind(&fixed_array); | 
| 1044 | 1044 | 
| 1045   // No need for a write barrier, we are storing a Smi in the feedback vector. | 1045   // No need for a write barrier, we are storing a Smi in the feedback vector. | 
| 1046   __ EmitLoadTypeFeedbackVector(ebx); | 1046   __ EmitLoadTypeFeedbackVector(ebx); | 
| 1047   int vector_index = SmiFromSlot(slot)->value(); | 1047   int vector_index = SmiFromSlot(slot)->value(); | 
| 1048   __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), | 1048   __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), | 
| 1049          Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1049          Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 
| 1050 | 1050 | 
| 1051   __ mov(ebx, Immediate(Smi::FromInt(1)));  // Smi indicates slow check | 1051   __ mov(ebx, Immediate(Smi::FromInt(1)));  // Smi indicates slow check | 
| 1052   __ mov(ecx, Operand(esp, 0 * kPointerSize));  // Get enumerated object | 1052   __ mov(ecx, Operand(esp, 0 * kPointerSize));  // Get enumerated object | 
| 1053   STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1053   STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 
| 1054   __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); | 1054   __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); | 
| 1055   __ j(above, &non_proxy); | 1055   __ j(above, &non_proxy); | 
| 1056   __ Move(ebx, Immediate(Smi::FromInt(0)));  // Zero indicates proxy | 1056   __ Move(ebx, Immediate(Smi::FromInt(0)));  // Zero indicates proxy | 
| 1057   __ bind(&non_proxy); | 1057   __ bind(&non_proxy); | 
| 1058   __ push(ebx);  // Smi | 1058   __ push(ebx);  // Smi | 
| 1059   __ push(eax);  // Array | 1059   __ push(eax);  // Array | 
| 1060   __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); | 1060   __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); | 
| 1061   __ push(eax);  // Fixed array length (as smi). | 1061   __ push(eax);  // Fixed array length (as smi). | 
| 1062   __ push(Immediate(Smi::FromInt(0)));  // Initial index. | 1062   __ push(Immediate(Smi::FromInt(0)));  // Initial index. | 
| 1063 | 1063 | 
| (...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2985   VisitForAccumulatorValue(args->at(0)); | 2985   VisitForAccumulatorValue(args->at(0)); | 
| 2986 | 2986 | 
| 2987   Label materialize_true, materialize_false; | 2987   Label materialize_true, materialize_false; | 
| 2988   Label* if_true = NULL; | 2988   Label* if_true = NULL; | 
| 2989   Label* if_false = NULL; | 2989   Label* if_false = NULL; | 
| 2990   Label* fall_through = NULL; | 2990   Label* fall_through = NULL; | 
| 2991   context()->PrepareTest(&materialize_true, &materialize_false, | 2991   context()->PrepareTest(&materialize_true, &materialize_false, | 
| 2992                          &if_true, &if_false, &fall_through); | 2992                          &if_true, &if_false, &fall_through); | 
| 2993 | 2993 | 
| 2994   __ JumpIfSmi(eax, if_false); | 2994   __ JumpIfSmi(eax, if_false); | 
| 2995   __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ebx); | 2995   __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ebx); | 
| 2996   PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 2996   PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 
| 2997   Split(above_equal, if_true, if_false, fall_through); | 2997   Split(above_equal, if_true, if_false, fall_through); | 
| 2998 | 2998 | 
| 2999   context()->Plug(if_true, if_false); | 2999   context()->Plug(if_true, if_false); | 
| 3000 } | 3000 } | 
| 3001 | 3001 | 
| 3002 | 3002 | 
| 3003 void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) { | 3003 void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) { | 
| 3004   ZoneList<Expression*>* args = expr->arguments(); | 3004   ZoneList<Expression*>* args = expr->arguments(); | 
| 3005   DCHECK(args->length() == 1); | 3005   DCHECK(args->length() == 1); | 
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3264   VisitForAccumulatorValue(args->at(0)); | 3264   VisitForAccumulatorValue(args->at(0)); | 
| 3265 | 3265 | 
| 3266   // If the object is a smi, we return null. | 3266   // If the object is a smi, we return null. | 
| 3267   __ JumpIfSmi(eax, &null); | 3267   __ JumpIfSmi(eax, &null); | 
| 3268 | 3268 | 
| 3269   // Check that the object is a JS object but take special care of JS | 3269   // Check that the object is a JS object but take special care of JS | 
| 3270   // functions to make sure they have 'Function' as their class. | 3270   // functions to make sure they have 'Function' as their class. | 
| 3271   // Assume that there are only two callable types, and one of them is at | 3271   // Assume that there are only two callable types, and one of them is at | 
| 3272   // either end of the type range for JS object types. Saves extra comparisons. | 3272   // either end of the type range for JS object types. Saves extra comparisons. | 
| 3273   STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 3273   STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 
| 3274   __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, eax); | 3274   __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, eax); | 
| 3275   // Map is now in eax. | 3275   // Map is now in eax. | 
| 3276   __ j(below, &null); | 3276   __ j(below, &null); | 
| 3277   STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3277   STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 
| 3278                 FIRST_SPEC_OBJECT_TYPE + 1); | 3278                 FIRST_JS_RECEIVER_TYPE + 1); | 
| 3279   __ j(equal, &function); | 3279   __ j(equal, &function); | 
| 3280 | 3280 | 
| 3281   __ CmpInstanceType(eax, LAST_SPEC_OBJECT_TYPE); | 3281   __ CmpInstanceType(eax, LAST_JS_RECEIVER_TYPE); | 
| 3282   STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3282   STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 
| 3283                 LAST_SPEC_OBJECT_TYPE - 1); | 3283                 LAST_JS_RECEIVER_TYPE - 1); | 
| 3284   __ j(equal, &function); | 3284   __ j(equal, &function); | 
| 3285   // Assume that there is no larger type. | 3285   // Assume that there is no larger type. | 
| 3286   STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | 3286   STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | 
| 3287 | 3287 | 
| 3288   // Check if the constructor in the map is a JS function. | 3288   // Check if the constructor in the map is a JS function. | 
| 3289   __ GetMapConstructor(eax, eax, ebx); | 3289   __ GetMapConstructor(eax, eax, ebx); | 
| 3290   __ CmpInstanceType(ebx, JS_FUNCTION_TYPE); | 3290   __ CmpInstanceType(ebx, JS_FUNCTION_TYPE); | 
| 3291   __ j(not_equal, &non_function_constructor); | 3291   __ j(not_equal, &non_function_constructor); | 
| 3292 | 3292 | 
| 3293   // eax now contains the constructor function. Grab the | 3293   // eax now contains the constructor function. Grab the | 
| (...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4555     // Check for callable and not undetectable objects => true. | 4555     // Check for callable and not undetectable objects => true. | 
| 4556     __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); | 4556     __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); | 
| 4557     __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset)); | 4557     __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset)); | 
| 4558     __ and_(ecx, (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)); | 4558     __ and_(ecx, (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)); | 
| 4559     __ cmp(ecx, 1 << Map::kIsCallable); | 4559     __ cmp(ecx, 1 << Map::kIsCallable); | 
| 4560     Split(equal, if_true, if_false, fall_through); | 4560     Split(equal, if_true, if_false, fall_through); | 
| 4561   } else if (String::Equals(check, factory->object_string())) { | 4561   } else if (String::Equals(check, factory->object_string())) { | 
| 4562     __ JumpIfSmi(eax, if_false); | 4562     __ JumpIfSmi(eax, if_false); | 
| 4563     __ cmp(eax, isolate()->factory()->null_value()); | 4563     __ cmp(eax, isolate()->factory()->null_value()); | 
| 4564     __ j(equal, if_true); | 4564     __ j(equal, if_true); | 
| 4565     STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 4565     STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | 
| 4566     __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, edx); | 4566     __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, edx); | 
| 4567     __ j(below, if_false); | 4567     __ j(below, if_false); | 
| 4568     // Check for callable or undetectable objects => false. | 4568     // Check for callable or undetectable objects => false. | 
| 4569     __ test_b(FieldOperand(edx, Map::kBitFieldOffset), | 4569     __ test_b(FieldOperand(edx, Map::kBitFieldOffset), | 
| 4570               (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)); | 4570               (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)); | 
| 4571     Split(zero, if_true, if_false, fall_through); | 4571     Split(zero, if_true, if_false, fall_through); | 
| 4572 // clang-format off | 4572 // clang-format off | 
| 4573 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type)   \ | 4573 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type)   \ | 
| 4574   } else if (String::Equals(check, factory->type##_string())) { \ | 4574   } else if (String::Equals(check, factory->type##_string())) { \ | 
| 4575     __ JumpIfSmi(eax, if_false);                                \ | 4575     __ JumpIfSmi(eax, if_false);                                \ | 
| 4576     __ cmp(FieldOperand(eax, HeapObject::kMapOffset),           \ | 4576     __ cmp(FieldOperand(eax, HeapObject::kMapOffset),           \ | 
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4874             Assembler::target_address_at(call_target_address, | 4874             Assembler::target_address_at(call_target_address, | 
| 4875                                          unoptimized_code)); | 4875                                          unoptimized_code)); | 
| 4876   return OSR_AFTER_STACK_CHECK; | 4876   return OSR_AFTER_STACK_CHECK; | 
| 4877 } | 4877 } | 
| 4878 | 4878 | 
| 4879 | 4879 | 
| 4880 }  // namespace internal | 4880 }  // namespace internal | 
| 4881 }  // namespace v8 | 4881 }  // namespace v8 | 
| 4882 | 4882 | 
| 4883 #endif  // V8_TARGET_ARCH_IA32 | 4883 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW | 
|---|