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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (strlen(FLAG_stop_at) > 0 && | 113 if (strlen(FLAG_stop_at) > 0 && |
114 info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 114 info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
115 __ stop("stop-at"); | 115 __ stop("stop-at"); |
116 } | 116 } |
117 #endif | 117 #endif |
118 | 118 |
119 if (FLAG_debug_code && info->ExpectsJSReceiverAsReceiver()) { | 119 if (FLAG_debug_code && info->ExpectsJSReceiverAsReceiver()) { |
120 int receiver_offset = info->scope()->num_parameters() * kPointerSize; | 120 int receiver_offset = info->scope()->num_parameters() * kPointerSize; |
121 __ ldr(r2, MemOperand(sp, receiver_offset)); | 121 __ ldr(r2, MemOperand(sp, receiver_offset)); |
122 __ AssertNotSmi(r2); | 122 __ AssertNotSmi(r2); |
123 __ CompareObjectType(r2, r2, no_reg, FIRST_SPEC_OBJECT_TYPE); | 123 __ CompareObjectType(r2, r2, no_reg, FIRST_JS_RECEIVER_TYPE); |
124 __ Assert(ge, kSloppyFunctionExpectsJSReceiverReceiver); | 124 __ Assert(ge, kSloppyFunctionExpectsJSReceiverReceiver); |
125 } | 125 } |
126 | 126 |
127 // Open a frame scope to indicate that there is a frame on the stack. The | 127 // Open a frame scope to indicate that there is a frame on the stack. The |
128 // MANUAL indicates that the scope shouldn't actually generate code to set up | 128 // MANUAL indicates that the scope shouldn't actually generate code to set up |
129 // the frame (that is done below). | 129 // the frame (that is done below). |
130 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 130 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
131 | 131 |
132 info->set_prologue_offset(masm_->pc_offset()); | 132 info->set_prologue_offset(masm_->pc_offset()); |
133 __ Prologue(info->IsCodePreAgingActive()); | 133 __ Prologue(info->IsCodePreAgingActive()); |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 Register null_value = r5; | 1034 Register null_value = r5; |
1035 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 1035 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
1036 __ cmp(r0, null_value); | 1036 __ cmp(r0, null_value); |
1037 __ b(eq, &exit); | 1037 __ b(eq, &exit); |
1038 | 1038 |
1039 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 1039 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); |
1040 | 1040 |
1041 // Convert the object to a JS object. | 1041 // Convert the object to a JS object. |
1042 Label convert, done_convert; | 1042 Label convert, done_convert; |
1043 __ JumpIfSmi(r0, &convert); | 1043 __ JumpIfSmi(r0, &convert); |
1044 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); | 1044 __ CompareObjectType(r0, r1, r1, FIRST_JS_RECEIVER_TYPE); |
1045 __ b(ge, &done_convert); | 1045 __ b(ge, &done_convert); |
1046 __ bind(&convert); | 1046 __ bind(&convert); |
1047 ToObjectStub stub(isolate()); | 1047 ToObjectStub stub(isolate()); |
1048 __ CallStub(&stub); | 1048 __ CallStub(&stub); |
1049 __ bind(&done_convert); | 1049 __ bind(&done_convert); |
1050 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); | 1050 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); |
1051 __ push(r0); | 1051 __ push(r0); |
1052 | 1052 |
1053 // Check for proxies. | 1053 // Check for proxies. |
1054 Label call_runtime; | 1054 Label call_runtime; |
1055 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1055 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
1056 __ CompareObjectType(r0, r1, r1, LAST_JS_PROXY_TYPE); | 1056 __ CompareObjectType(r0, r1, r1, LAST_JS_PROXY_TYPE); |
1057 __ b(le, &call_runtime); | 1057 __ b(le, &call_runtime); |
1058 | 1058 |
1059 // Check cache validity in generated code. This is a fast case for | 1059 // Check cache validity in generated code. This is a fast case for |
1060 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 1060 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
1061 // guarantee cache validity, call the runtime system to check cache | 1061 // guarantee cache validity, call the runtime system to check cache |
1062 // validity or get the property names in a fixed array. | 1062 // validity or get the property names in a fixed array. |
1063 __ CheckEnumCache(null_value, &call_runtime); | 1063 __ CheckEnumCache(null_value, &call_runtime); |
1064 | 1064 |
1065 // The enum cache is valid. Load the map of the object being | 1065 // The enum cache is valid. Load the map of the object being |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 Label non_proxy; | 1110 Label non_proxy; |
1111 __ bind(&fixed_array); | 1111 __ bind(&fixed_array); |
1112 | 1112 |
1113 __ EmitLoadTypeFeedbackVector(r1); | 1113 __ EmitLoadTypeFeedbackVector(r1); |
1114 __ mov(r2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1114 __ mov(r2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1115 int vector_index = SmiFromSlot(slot)->value(); | 1115 int vector_index = SmiFromSlot(slot)->value(); |
1116 __ str(r2, FieldMemOperand(r1, FixedArray::OffsetOfElementAt(vector_index))); | 1116 __ str(r2, FieldMemOperand(r1, FixedArray::OffsetOfElementAt(vector_index))); |
1117 | 1117 |
1118 __ mov(r1, Operand(Smi::FromInt(1))); // Smi indicates slow check | 1118 __ mov(r1, Operand(Smi::FromInt(1))); // Smi indicates slow check |
1119 __ ldr(r2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object | 1119 __ ldr(r2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object |
1120 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1120 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
1121 __ CompareObjectType(r2, r3, r3, LAST_JS_PROXY_TYPE); | 1121 __ CompareObjectType(r2, r3, r3, LAST_JS_PROXY_TYPE); |
1122 __ b(gt, &non_proxy); | 1122 __ b(gt, &non_proxy); |
1123 __ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy | 1123 __ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy |
1124 __ bind(&non_proxy); | 1124 __ bind(&non_proxy); |
1125 __ Push(r1, r0); // Smi and array | 1125 __ Push(r1, r0); // Smi and array |
1126 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 1126 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
1127 __ mov(r0, Operand(Smi::FromInt(0))); | 1127 __ mov(r0, Operand(Smi::FromInt(0))); |
1128 __ Push(r1, r0); // Fixed array length (as smi) and initial index. | 1128 __ Push(r1, r0); // Fixed array length (as smi) and initial index. |
1129 | 1129 |
1130 // Generate code for doing the condition check. | 1130 // Generate code for doing the condition check. |
(...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3101 VisitForAccumulatorValue(args->at(0)); | 3101 VisitForAccumulatorValue(args->at(0)); |
3102 | 3102 |
3103 Label materialize_true, materialize_false; | 3103 Label materialize_true, materialize_false; |
3104 Label* if_true = NULL; | 3104 Label* if_true = NULL; |
3105 Label* if_false = NULL; | 3105 Label* if_false = NULL; |
3106 Label* fall_through = NULL; | 3106 Label* fall_through = NULL; |
3107 context()->PrepareTest(&materialize_true, &materialize_false, | 3107 context()->PrepareTest(&materialize_true, &materialize_false, |
3108 &if_true, &if_false, &fall_through); | 3108 &if_true, &if_false, &fall_through); |
3109 | 3109 |
3110 __ JumpIfSmi(r0, if_false); | 3110 __ JumpIfSmi(r0, if_false); |
3111 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); | 3111 __ CompareObjectType(r0, r1, r1, FIRST_JS_RECEIVER_TYPE); |
3112 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3112 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3113 Split(ge, if_true, if_false, fall_through); | 3113 Split(ge, if_true, if_false, fall_through); |
3114 | 3114 |
3115 context()->Plug(if_true, if_false); | 3115 context()->Plug(if_true, if_false); |
3116 } | 3116 } |
3117 | 3117 |
3118 | 3118 |
3119 void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) { | 3119 void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) { |
3120 ZoneList<Expression*>* args = expr->arguments(); | 3120 ZoneList<Expression*>* args = expr->arguments(); |
3121 DCHECK(args->length() == 1); | 3121 DCHECK(args->length() == 1); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3373 VisitForAccumulatorValue(args->at(0)); | 3373 VisitForAccumulatorValue(args->at(0)); |
3374 | 3374 |
3375 // If the object is a smi, we return null. | 3375 // If the object is a smi, we return null. |
3376 __ JumpIfSmi(r0, &null); | 3376 __ JumpIfSmi(r0, &null); |
3377 | 3377 |
3378 // Check that the object is a JS object but take special care of JS | 3378 // Check that the object is a JS object but take special care of JS |
3379 // functions to make sure they have 'Function' as their class. | 3379 // functions to make sure they have 'Function' as their class. |
3380 // Assume that there are only two callable types, and one of them is at | 3380 // Assume that there are only two callable types, and one of them is at |
3381 // either end of the type range for JS object types. Saves extra comparisons. | 3381 // either end of the type range for JS object types. Saves extra comparisons. |
3382 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 3382 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
3383 __ CompareObjectType(r0, r0, r1, FIRST_SPEC_OBJECT_TYPE); | 3383 __ CompareObjectType(r0, r0, r1, FIRST_JS_RECEIVER_TYPE); |
3384 // Map is now in r0. | 3384 // Map is now in r0. |
3385 __ b(lt, &null); | 3385 __ b(lt, &null); |
3386 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3386 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
3387 FIRST_SPEC_OBJECT_TYPE + 1); | 3387 FIRST_JS_RECEIVER_TYPE + 1); |
3388 __ b(eq, &function); | 3388 __ b(eq, &function); |
3389 | 3389 |
3390 __ cmp(r1, Operand(LAST_SPEC_OBJECT_TYPE)); | 3390 __ cmp(r1, Operand(LAST_JS_RECEIVER_TYPE)); |
3391 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3391 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
3392 LAST_SPEC_OBJECT_TYPE - 1); | 3392 LAST_JS_RECEIVER_TYPE - 1); |
3393 __ b(eq, &function); | 3393 __ b(eq, &function); |
3394 // Assume that there is no larger type. | 3394 // Assume that there is no larger type. |
3395 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | 3395 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); |
3396 | 3396 |
3397 // Check if the constructor in the map is a JS function. | 3397 // Check if the constructor in the map is a JS function. |
3398 Register instance_type = r2; | 3398 Register instance_type = r2; |
3399 __ GetMapConstructor(r0, r0, r1, instance_type); | 3399 __ GetMapConstructor(r0, r0, r1, instance_type); |
3400 __ cmp(instance_type, Operand(JS_FUNCTION_TYPE)); | 3400 __ cmp(instance_type, Operand(JS_FUNCTION_TYPE)); |
3401 __ b(ne, &non_function_constructor); | 3401 __ b(ne, &non_function_constructor); |
3402 | 3402 |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4625 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); | 4625 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); |
4626 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); | 4626 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); |
4627 __ and_(r1, r1, | 4627 __ and_(r1, r1, |
4628 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); | 4628 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); |
4629 __ cmp(r1, Operand(1 << Map::kIsCallable)); | 4629 __ cmp(r1, Operand(1 << Map::kIsCallable)); |
4630 Split(eq, if_true, if_false, fall_through); | 4630 Split(eq, if_true, if_false, fall_through); |
4631 } else if (String::Equals(check, factory->object_string())) { | 4631 } else if (String::Equals(check, factory->object_string())) { |
4632 __ JumpIfSmi(r0, if_false); | 4632 __ JumpIfSmi(r0, if_false); |
4633 __ CompareRoot(r0, Heap::kNullValueRootIndex); | 4633 __ CompareRoot(r0, Heap::kNullValueRootIndex); |
4634 __ b(eq, if_true); | 4634 __ b(eq, if_true); |
4635 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 4635 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
4636 __ CompareObjectType(r0, r0, r1, FIRST_SPEC_OBJECT_TYPE); | 4636 __ CompareObjectType(r0, r0, r1, FIRST_JS_RECEIVER_TYPE); |
4637 __ b(lt, if_false); | 4637 __ b(lt, if_false); |
4638 // Check for callable or undetectable objects => false. | 4638 // Check for callable or undetectable objects => false. |
4639 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); | 4639 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); |
4640 __ tst(r1, Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); | 4640 __ tst(r1, Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); |
4641 Split(eq, if_true, if_false, fall_through); | 4641 Split(eq, if_true, if_false, fall_through); |
4642 // clang-format off | 4642 // clang-format off |
4643 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ | 4643 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
4644 } else if (String::Equals(check, factory->type##_string())) { \ | 4644 } else if (String::Equals(check, factory->type##_string())) { \ |
4645 __ JumpIfSmi(r0, if_false); \ | 4645 __ JumpIfSmi(r0, if_false); \ |
4646 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); \ | 4646 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); \ |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5005 DCHECK(interrupt_address == | 5005 DCHECK(interrupt_address == |
5006 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5006 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5007 return OSR_AFTER_STACK_CHECK; | 5007 return OSR_AFTER_STACK_CHECK; |
5008 } | 5008 } |
5009 | 5009 |
5010 | 5010 |
5011 } // namespace internal | 5011 } // namespace internal |
5012 } // namespace v8 | 5012 } // namespace v8 |
5013 | 5013 |
5014 #endif // V8_TARGET_ARCH_ARM | 5014 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |