| 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 __ j(above_equal, &done_convert, Label::kNear); | 1000 __ j(above_equal, &done_convert, Label::kNear); |
| 1001 __ bind(&convert); | 1001 __ bind(&convert); |
| 1002 ToObjectStub stub(isolate()); | 1002 ToObjectStub stub(isolate()); |
| 1003 __ CallStub(&stub); | 1003 __ CallStub(&stub); |
| 1004 __ bind(&done_convert); | 1004 __ bind(&done_convert); |
| 1005 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); | 1005 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); |
| 1006 __ Push(rax); | 1006 __ Push(rax); |
| 1007 | 1007 |
| 1008 // Check for proxies. | 1008 // Check for proxies. |
| 1009 Label call_runtime; | 1009 Label call_runtime; |
| 1010 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 1010 __ CmpObjectType(rax, JS_PROXY_TYPE, rcx); |
| 1011 __ CmpObjectType(rax, LAST_JS_PROXY_TYPE, rcx); | 1011 __ j(equal, &call_runtime); |
| 1012 __ j(below_equal, &call_runtime); | |
| 1013 | 1012 |
| 1014 // Check cache validity in generated code. This is a fast case for | 1013 // Check cache validity in generated code. This is a fast case for |
| 1015 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 1014 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
| 1016 // guarantee cache validity, call the runtime system to check cache | 1015 // guarantee cache validity, call the runtime system to check cache |
| 1017 // validity or get the property names in a fixed array. | 1016 // validity or get the property names in a fixed array. |
| 1018 __ CheckEnumCache(null_value, &call_runtime); | 1017 __ CheckEnumCache(null_value, &call_runtime); |
| 1019 | 1018 |
| 1020 // The enum cache is valid. Load the map of the object being | 1019 // The enum cache is valid. Load the map of the object being |
| 1021 // iterated over and use the cache for the iteration. | 1020 // iterated over and use the cache for the iteration. |
| 1022 Label use_cache; | 1021 Label use_cache; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 Label non_proxy; | 1064 Label non_proxy; |
| 1066 __ bind(&fixed_array); | 1065 __ bind(&fixed_array); |
| 1067 | 1066 |
| 1068 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1067 // No need for a write barrier, we are storing a Smi in the feedback vector. |
| 1069 __ EmitLoadTypeFeedbackVector(rbx); | 1068 __ EmitLoadTypeFeedbackVector(rbx); |
| 1070 int vector_index = SmiFromSlot(slot)->value(); | 1069 int vector_index = SmiFromSlot(slot)->value(); |
| 1071 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)), | 1070 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)), |
| 1072 TypeFeedbackVector::MegamorphicSentinel(isolate())); | 1071 TypeFeedbackVector::MegamorphicSentinel(isolate())); |
| 1073 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check | 1072 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check |
| 1074 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object | 1073 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object |
| 1075 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 1074 STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
| 1076 __ CmpObjectType(rcx, LAST_JS_PROXY_TYPE, rcx); | 1075 __ CmpObjectType(rcx, JS_PROXY_TYPE, rcx); |
| 1077 __ j(above, &non_proxy); | 1076 __ j(above, &non_proxy); |
| 1078 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy | 1077 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy |
| 1079 __ bind(&non_proxy); | 1078 __ bind(&non_proxy); |
| 1080 __ Push(rbx); // Smi | 1079 __ Push(rbx); // Smi |
| 1081 __ Push(rax); // Array | 1080 __ Push(rax); // Array |
| 1082 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); | 1081 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); |
| 1083 __ Push(rax); // Fixed array length (as smi). | 1082 __ Push(rax); // Fixed array length (as smi). |
| 1084 __ Push(Smi::FromInt(0)); // Initial index. | 1083 __ Push(Smi::FromInt(0)); // Initial index. |
| 1085 | 1084 |
| 1086 // Generate code for doing the condition check. | 1085 // Generate code for doing the condition check. |
| (...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3125 | 3124 |
| 3126 VisitForAccumulatorValue(args->at(0)); | 3125 VisitForAccumulatorValue(args->at(0)); |
| 3127 | 3126 |
| 3128 Label materialize_true, materialize_false; | 3127 Label materialize_true, materialize_false; |
| 3129 Label* if_true = NULL; | 3128 Label* if_true = NULL; |
| 3130 Label* if_false = NULL; | 3129 Label* if_false = NULL; |
| 3131 Label* fall_through = NULL; | 3130 Label* fall_through = NULL; |
| 3132 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, | 3131 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
| 3133 &if_false, &fall_through); | 3132 &if_false, &fall_through); |
| 3134 | 3133 |
| 3134 |
| 3135 __ JumpIfSmi(rax, if_false); | 3135 __ JumpIfSmi(rax, if_false); |
| 3136 Register map = rbx; | 3136 __ CmpObjectType(rax, JS_PROXY_TYPE, rbx); |
| 3137 __ movp(map, FieldOperand(rax, HeapObject::kMapOffset)); | |
| 3138 __ CmpInstanceType(map, FIRST_JS_PROXY_TYPE); | |
| 3139 __ j(less, if_false); | |
| 3140 __ CmpInstanceType(map, LAST_JS_PROXY_TYPE); | |
| 3141 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3137 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 3142 Split(less_equal, if_true, if_false, fall_through); | 3138 Split(equal, if_true, if_false, fall_through); |
| 3143 | 3139 |
| 3144 context()->Plug(if_true, if_false); | 3140 context()->Plug(if_true, if_false); |
| 3145 } | 3141 } |
| 3146 | 3142 |
| 3147 | 3143 |
| 3148 void FullCodeGenerator::EmitObjectEquals(CallRuntime* expr) { | 3144 void FullCodeGenerator::EmitObjectEquals(CallRuntime* expr) { |
| 3149 ZoneList<Expression*>* args = expr->arguments(); | 3145 ZoneList<Expression*>* args = expr->arguments(); |
| 3150 DCHECK(args->length() == 2); | 3146 DCHECK(args->length() == 2); |
| 3151 | 3147 |
| 3152 // Load the two objects into registers and perform the comparison. | 3148 // Load the two objects into registers and perform the comparison. |
| (...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4848 Assembler::target_address_at(call_target_address, | 4844 Assembler::target_address_at(call_target_address, |
| 4849 unoptimized_code)); | 4845 unoptimized_code)); |
| 4850 return OSR_AFTER_STACK_CHECK; | 4846 return OSR_AFTER_STACK_CHECK; |
| 4851 } | 4847 } |
| 4852 | 4848 |
| 4853 | 4849 |
| 4854 } // namespace internal | 4850 } // namespace internal |
| 4855 } // namespace v8 | 4851 } // namespace v8 |
| 4856 | 4852 |
| 4857 #endif // V8_TARGET_ARCH_X64 | 4853 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |