| 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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 __ j(above_equal, &done_convert, Label::kNear); | 987 __ j(above_equal, &done_convert, Label::kNear); |
| 988 __ bind(&convert); | 988 __ bind(&convert); |
| 989 ToObjectStub stub(isolate()); | 989 ToObjectStub stub(isolate()); |
| 990 __ CallStub(&stub); | 990 __ CallStub(&stub); |
| 991 __ bind(&done_convert); | 991 __ bind(&done_convert); |
| 992 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); | 992 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); |
| 993 __ Push(rax); | 993 __ Push(rax); |
| 994 | 994 |
| 995 // Check for proxies. | 995 // Check for proxies. |
| 996 Label call_runtime; | 996 Label call_runtime; |
| 997 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 997 __ CmpObjectType(rax, JS_PROXY_TYPE, rcx); |
| 998 __ CmpObjectType(rax, LAST_JS_PROXY_TYPE, rcx); | 998 __ j(equal, &call_runtime); |
| 999 __ j(below_equal, &call_runtime); | |
| 1000 | 999 |
| 1001 // Check cache validity in generated code. This is a fast case for | 1000 // Check cache validity in generated code. This is a fast case for |
| 1002 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 1001 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
| 1003 // guarantee cache validity, call the runtime system to check cache | 1002 // guarantee cache validity, call the runtime system to check cache |
| 1004 // validity or get the property names in a fixed array. | 1003 // validity or get the property names in a fixed array. |
| 1005 __ CheckEnumCache(null_value, &call_runtime); | 1004 __ CheckEnumCache(null_value, &call_runtime); |
| 1006 | 1005 |
| 1007 // The enum cache is valid. Load the map of the object being | 1006 // The enum cache is valid. Load the map of the object being |
| 1008 // iterated over and use the cache for the iteration. | 1007 // iterated over and use the cache for the iteration. |
| 1009 Label use_cache; | 1008 Label use_cache; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 Label non_proxy; | 1051 Label non_proxy; |
| 1053 __ bind(&fixed_array); | 1052 __ bind(&fixed_array); |
| 1054 | 1053 |
| 1055 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1054 // No need for a write barrier, we are storing a Smi in the feedback vector. |
| 1056 __ EmitLoadTypeFeedbackVector(rbx); | 1055 __ EmitLoadTypeFeedbackVector(rbx); |
| 1057 int vector_index = SmiFromSlot(slot)->value(); | 1056 int vector_index = SmiFromSlot(slot)->value(); |
| 1058 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)), | 1057 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)), |
| 1059 TypeFeedbackVector::MegamorphicSentinel(isolate())); | 1058 TypeFeedbackVector::MegamorphicSentinel(isolate())); |
| 1060 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check | 1059 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check |
| 1061 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object | 1060 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object |
| 1062 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 1061 STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
| 1063 __ CmpObjectType(rcx, LAST_JS_PROXY_TYPE, rcx); | 1062 __ CmpObjectType(rcx, JS_PROXY_TYPE, rcx); |
| 1064 __ j(above, &non_proxy); | 1063 __ j(above, &non_proxy); |
| 1065 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy | 1064 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy |
| 1066 __ bind(&non_proxy); | 1065 __ bind(&non_proxy); |
| 1067 __ Push(rbx); // Smi | 1066 __ Push(rbx); // Smi |
| 1068 __ Push(rax); // Array | 1067 __ Push(rax); // Array |
| 1069 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); | 1068 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); |
| 1070 __ Push(rax); // Fixed array length (as smi). | 1069 __ Push(rax); // Fixed array length (as smi). |
| 1071 __ Push(Smi::FromInt(0)); // Initial index. | 1070 __ Push(Smi::FromInt(0)); // Initial index. |
| 1072 | 1071 |
| 1073 // Generate code for doing the condition check. | 1072 // Generate code for doing the condition check. |
| (...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3112 | 3111 |
| 3113 VisitForAccumulatorValue(args->at(0)); | 3112 VisitForAccumulatorValue(args->at(0)); |
| 3114 | 3113 |
| 3115 Label materialize_true, materialize_false; | 3114 Label materialize_true, materialize_false; |
| 3116 Label* if_true = NULL; | 3115 Label* if_true = NULL; |
| 3117 Label* if_false = NULL; | 3116 Label* if_false = NULL; |
| 3118 Label* fall_through = NULL; | 3117 Label* fall_through = NULL; |
| 3119 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, | 3118 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
| 3120 &if_false, &fall_through); | 3119 &if_false, &fall_through); |
| 3121 | 3120 |
| 3121 |
| 3122 __ JumpIfSmi(rax, if_false); | 3122 __ JumpIfSmi(rax, if_false); |
| 3123 Register map = rbx; | 3123 __ CmpObjectType(rax, JS_PROXY_TYPE, rbx); |
| 3124 __ movp(map, FieldOperand(rax, HeapObject::kMapOffset)); | |
| 3125 __ CmpInstanceType(map, FIRST_JS_PROXY_TYPE); | |
| 3126 __ j(less, if_false); | |
| 3127 __ CmpInstanceType(map, LAST_JS_PROXY_TYPE); | |
| 3128 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3124 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 3129 Split(less_equal, if_true, if_false, fall_through); | 3125 Split(equal, if_true, if_false, fall_through); |
| 3130 | 3126 |
| 3131 context()->Plug(if_true, if_false); | 3127 context()->Plug(if_true, if_false); |
| 3132 } | 3128 } |
| 3133 | 3129 |
| 3134 | 3130 |
| 3135 void FullCodeGenerator::EmitObjectEquals(CallRuntime* expr) { | 3131 void FullCodeGenerator::EmitObjectEquals(CallRuntime* expr) { |
| 3136 ZoneList<Expression*>* args = expr->arguments(); | 3132 ZoneList<Expression*>* args = expr->arguments(); |
| 3137 DCHECK(args->length() == 2); | 3133 DCHECK(args->length() == 2); |
| 3138 | 3134 |
| 3139 // Load the two objects into registers and perform the comparison. | 3135 // Load the two objects into registers and perform the comparison. |
| (...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4835 Assembler::target_address_at(call_target_address, | 4831 Assembler::target_address_at(call_target_address, |
| 4836 unoptimized_code)); | 4832 unoptimized_code)); |
| 4837 return OSR_AFTER_STACK_CHECK; | 4833 return OSR_AFTER_STACK_CHECK; |
| 4838 } | 4834 } |
| 4839 | 4835 |
| 4840 | 4836 |
| 4841 } // namespace internal | 4837 } // namespace internal |
| 4842 } // namespace v8 | 4838 } // namespace v8 |
| 4843 | 4839 |
| 4844 #endif // V8_TARGET_ARCH_X64 | 4840 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |