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/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), | 1003 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
1004 Heap::kMetaMapRootIndex); | 1004 Heap::kMetaMapRootIndex); |
1005 __ j(not_equal, &fixed_array); | 1005 __ j(not_equal, &fixed_array); |
1006 | 1006 |
1007 // We got a map in register rax. Get the enumeration cache from it. | 1007 // We got a map in register rax. Get the enumeration cache from it. |
1008 __ bind(&use_cache); | 1008 __ bind(&use_cache); |
1009 | 1009 |
1010 Label no_descriptors; | 1010 Label no_descriptors; |
1011 | 1011 |
1012 __ EnumLength(rdx, rax); | 1012 __ EnumLength(rdx, rax); |
1013 __ Cmp(rdx, Smi::kZero); | 1013 __ Cmp(rdx, Smi::FromInt(0)); |
1014 __ j(equal, &no_descriptors); | 1014 __ j(equal, &no_descriptors); |
1015 | 1015 |
1016 __ LoadInstanceDescriptors(rax, rcx); | 1016 __ LoadInstanceDescriptors(rax, rcx); |
1017 __ movp(rcx, FieldOperand(rcx, DescriptorArray::kEnumCacheOffset)); | 1017 __ movp(rcx, FieldOperand(rcx, DescriptorArray::kEnumCacheOffset)); |
1018 __ movp(rcx, FieldOperand(rcx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 1018 __ movp(rcx, FieldOperand(rcx, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
1019 | 1019 |
1020 // Set up the four remaining stack slots. | 1020 // Set up the four remaining stack slots. |
1021 __ Push(rax); // Map. | 1021 __ Push(rax); // Map. |
1022 __ Push(rcx); // Enumeration cache. | 1022 __ Push(rcx); // Enumeration cache. |
1023 __ Push(rdx); // Number of valid entries for the map in the enum cache. | 1023 __ Push(rdx); // Number of valid entries for the map in the enum cache. |
1024 __ Push(Smi::kZero); // Initial index. | 1024 __ Push(Smi::FromInt(0)); // Initial index. |
1025 __ jmp(&loop); | 1025 __ jmp(&loop); |
1026 | 1026 |
1027 __ bind(&no_descriptors); | 1027 __ bind(&no_descriptors); |
1028 __ addp(rsp, Immediate(kPointerSize)); | 1028 __ addp(rsp, Immediate(kPointerSize)); |
1029 __ jmp(&exit); | 1029 __ jmp(&exit); |
1030 | 1030 |
1031 // We got a fixed array in register rax. Iterate through that. | 1031 // We got a fixed array in register rax. Iterate through that. |
1032 __ bind(&fixed_array); | 1032 __ bind(&fixed_array); |
1033 | 1033 |
1034 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object | 1034 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object |
1035 __ Push(Smi::FromInt(1)); // Smi(1) indicates slow check | 1035 __ Push(Smi::FromInt(1)); // Smi(1) indicates slow check |
1036 __ Push(rax); // Array | 1036 __ Push(rax); // Array |
1037 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); | 1037 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); |
1038 __ Push(rax); // Fixed array length (as smi). | 1038 __ Push(rax); // Fixed array length (as smi). |
1039 PrepareForBailoutForId(stmt->PrepareId(), BailoutState::NO_REGISTERS); | 1039 PrepareForBailoutForId(stmt->PrepareId(), BailoutState::NO_REGISTERS); |
1040 __ Push(Smi::kZero); // Initial index. | 1040 __ Push(Smi::FromInt(0)); // Initial index. |
1041 | 1041 |
1042 // Generate code for doing the condition check. | 1042 // Generate code for doing the condition check. |
1043 __ bind(&loop); | 1043 __ bind(&loop); |
1044 SetExpressionAsStatementPosition(stmt->each()); | 1044 SetExpressionAsStatementPosition(stmt->each()); |
1045 | 1045 |
1046 __ movp(rax, Operand(rsp, 0 * kPointerSize)); // Get the current index. | 1046 __ movp(rax, Operand(rsp, 0 * kPointerSize)); // Get the current index. |
1047 __ cmpp(rax, Operand(rsp, 1 * kPointerSize)); // Compare to the array length. | 1047 __ cmpp(rax, Operand(rsp, 1 * kPointerSize)); // Compare to the array length. |
1048 __ j(above_equal, loop_statement.break_label()); | 1048 __ j(above_equal, loop_statement.break_label()); |
1049 | 1049 |
1050 // Get the current entry of the array into register rax. | 1050 // Get the current entry of the array into register rax. |
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2955 LhsKind assign_type = Property::GetAssignType(prop); | 2955 LhsKind assign_type = Property::GetAssignType(prop); |
2956 | 2956 |
2957 // Evaluate expression and get value. | 2957 // Evaluate expression and get value. |
2958 if (assign_type == VARIABLE) { | 2958 if (assign_type == VARIABLE) { |
2959 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); | 2959 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); |
2960 AccumulatorValueContext context(this); | 2960 AccumulatorValueContext context(this); |
2961 EmitVariableLoad(expr->expression()->AsVariableProxy()); | 2961 EmitVariableLoad(expr->expression()->AsVariableProxy()); |
2962 } else { | 2962 } else { |
2963 // Reserve space for result of postfix operation. | 2963 // Reserve space for result of postfix operation. |
2964 if (expr->is_postfix() && !context()->IsEffect()) { | 2964 if (expr->is_postfix() && !context()->IsEffect()) { |
2965 PushOperand(Smi::kZero); | 2965 PushOperand(Smi::FromInt(0)); |
2966 } | 2966 } |
2967 switch (assign_type) { | 2967 switch (assign_type) { |
2968 case NAMED_PROPERTY: { | 2968 case NAMED_PROPERTY: { |
2969 VisitForStackValue(prop->obj()); | 2969 VisitForStackValue(prop->obj()); |
2970 __ movp(LoadDescriptor::ReceiverRegister(), Operand(rsp, 0)); | 2970 __ movp(LoadDescriptor::ReceiverRegister(), Operand(rsp, 0)); |
2971 EmitNamedPropertyLoad(prop); | 2971 EmitNamedPropertyLoad(prop); |
2972 break; | 2972 break; |
2973 } | 2973 } |
2974 | 2974 |
2975 case NAMED_SUPER_PROPERTY: { | 2975 case NAMED_SUPER_PROPERTY: { |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3550 DCHECK_EQ( | 3550 DCHECK_EQ( |
3551 isolate->builtins()->OnStackReplacement()->entry(), | 3551 isolate->builtins()->OnStackReplacement()->entry(), |
3552 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3552 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3553 return ON_STACK_REPLACEMENT; | 3553 return ON_STACK_REPLACEMENT; |
3554 } | 3554 } |
3555 | 3555 |
3556 } // namespace internal | 3556 } // namespace internal |
3557 } // namespace v8 | 3557 } // namespace v8 |
3558 | 3558 |
3559 #endif // V8_TARGET_ARCH_X64 | 3559 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |