| 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/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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // Always emit a 'return undefined' in case control fell off the end of | 336 // Always emit a 'return undefined' in case control fell off the end of |
| 337 // the body. | 337 // the body. |
| 338 { Comment cmnt(masm_, "[ return <undefined>;"); | 338 { Comment cmnt(masm_, "[ return <undefined>;"); |
| 339 __ mov(eax, isolate()->factory()->undefined_value()); | 339 __ mov(eax, isolate()->factory()->undefined_value()); |
| 340 EmitReturnSequence(); | 340 EmitReturnSequence(); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 | 344 |
| 345 void FullCodeGenerator::ClearAccumulator() { | 345 void FullCodeGenerator::ClearAccumulator() { |
| 346 __ Move(eax, Immediate(Smi::FromInt(0))); | 346 __ Move(eax, Immediate(Smi::kZero)); |
| 347 } | 347 } |
| 348 | 348 |
| 349 | 349 |
| 350 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { | 350 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { |
| 351 __ mov(ebx, Immediate(profiling_counter_)); | 351 __ mov(ebx, Immediate(profiling_counter_)); |
| 352 __ sub(FieldOperand(ebx, Cell::kValueOffset), | 352 __ sub(FieldOperand(ebx, Cell::kValueOffset), |
| 353 Immediate(Smi::FromInt(delta))); | 353 Immediate(Smi::FromInt(delta))); |
| 354 } | 354 } |
| 355 | 355 |
| 356 | 356 |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), | 979 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), |
| 980 isolate()->factory()->meta_map()); | 980 isolate()->factory()->meta_map()); |
| 981 __ j(not_equal, &fixed_array); | 981 __ j(not_equal, &fixed_array); |
| 982 | 982 |
| 983 | 983 |
| 984 // We got a map in register eax. Get the enumeration cache from it. | 984 // We got a map in register eax. Get the enumeration cache from it. |
| 985 Label no_descriptors; | 985 Label no_descriptors; |
| 986 __ bind(&use_cache); | 986 __ bind(&use_cache); |
| 987 | 987 |
| 988 __ EnumLength(edx, eax); | 988 __ EnumLength(edx, eax); |
| 989 __ cmp(edx, Immediate(Smi::FromInt(0))); | 989 __ cmp(edx, Immediate(Smi::kZero)); |
| 990 __ j(equal, &no_descriptors); | 990 __ j(equal, &no_descriptors); |
| 991 | 991 |
| 992 __ LoadInstanceDescriptors(eax, ecx); | 992 __ LoadInstanceDescriptors(eax, ecx); |
| 993 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumCacheOffset)); | 993 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumCacheOffset)); |
| 994 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 994 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
| 995 | 995 |
| 996 // Set up the four remaining stack slots. | 996 // Set up the four remaining stack slots. |
| 997 __ push(eax); // Map. | 997 __ push(eax); // Map. |
| 998 __ push(ecx); // Enumeration cache. | 998 __ push(ecx); // Enumeration cache. |
| 999 __ push(edx); // Number of valid entries for the map in the enum cache. | 999 __ push(edx); // Number of valid entries for the map in the enum cache. |
| 1000 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1000 __ push(Immediate(Smi::kZero)); // Initial index. |
| 1001 __ jmp(&loop); | 1001 __ jmp(&loop); |
| 1002 | 1002 |
| 1003 __ bind(&no_descriptors); | 1003 __ bind(&no_descriptors); |
| 1004 __ add(esp, Immediate(kPointerSize)); | 1004 __ add(esp, Immediate(kPointerSize)); |
| 1005 __ jmp(&exit); | 1005 __ jmp(&exit); |
| 1006 | 1006 |
| 1007 // We got a fixed array in register eax. Iterate through that. | 1007 // We got a fixed array in register eax. Iterate through that. |
| 1008 __ bind(&fixed_array); | 1008 __ bind(&fixed_array); |
| 1009 | 1009 |
| 1010 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check | 1010 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check |
| 1011 __ push(eax); // Array | 1011 __ push(eax); // Array |
| 1012 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); | 1012 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); |
| 1013 __ push(eax); // Fixed array length (as smi). | 1013 __ push(eax); // Fixed array length (as smi). |
| 1014 PrepareForBailoutForId(stmt->PrepareId(), BailoutState::NO_REGISTERS); | 1014 PrepareForBailoutForId(stmt->PrepareId(), BailoutState::NO_REGISTERS); |
| 1015 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1015 __ push(Immediate(Smi::kZero)); // Initial index. |
| 1016 | 1016 |
| 1017 // Generate code for doing the condition check. | 1017 // Generate code for doing the condition check. |
| 1018 __ bind(&loop); | 1018 __ bind(&loop); |
| 1019 SetExpressionAsStatementPosition(stmt->each()); | 1019 SetExpressionAsStatementPosition(stmt->each()); |
| 1020 | 1020 |
| 1021 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. | 1021 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. |
| 1022 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. | 1022 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. |
| 1023 __ j(above_equal, loop_statement.break_label()); | 1023 __ j(above_equal, loop_statement.break_label()); |
| 1024 | 1024 |
| 1025 // Get the current entry of the array into register eax. | 1025 // Get the current entry of the array into register eax. |
| (...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2964 LhsKind assign_type = Property::GetAssignType(prop); | 2964 LhsKind assign_type = Property::GetAssignType(prop); |
| 2965 | 2965 |
| 2966 // Evaluate expression and get value. | 2966 // Evaluate expression and get value. |
| 2967 if (assign_type == VARIABLE) { | 2967 if (assign_type == VARIABLE) { |
| 2968 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); | 2968 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); |
| 2969 AccumulatorValueContext context(this); | 2969 AccumulatorValueContext context(this); |
| 2970 EmitVariableLoad(expr->expression()->AsVariableProxy()); | 2970 EmitVariableLoad(expr->expression()->AsVariableProxy()); |
| 2971 } else { | 2971 } else { |
| 2972 // Reserve space for result of postfix operation. | 2972 // Reserve space for result of postfix operation. |
| 2973 if (expr->is_postfix() && !context()->IsEffect()) { | 2973 if (expr->is_postfix() && !context()->IsEffect()) { |
| 2974 PushOperand(Smi::FromInt(0)); | 2974 PushOperand(Smi::kZero); |
| 2975 } | 2975 } |
| 2976 switch (assign_type) { | 2976 switch (assign_type) { |
| 2977 case NAMED_PROPERTY: { | 2977 case NAMED_PROPERTY: { |
| 2978 // Put the object both on the stack and in the register. | 2978 // Put the object both on the stack and in the register. |
| 2979 VisitForStackValue(prop->obj()); | 2979 VisitForStackValue(prop->obj()); |
| 2980 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); | 2980 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 2981 EmitNamedPropertyLoad(prop); | 2981 EmitNamedPropertyLoad(prop); |
| 2982 break; | 2982 break; |
| 2983 } | 2983 } |
| 2984 | 2984 |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3562 isolate->builtins()->OnStackReplacement()->entry(), | 3562 isolate->builtins()->OnStackReplacement()->entry(), |
| 3563 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3563 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3564 return ON_STACK_REPLACEMENT; | 3564 return ON_STACK_REPLACEMENT; |
| 3565 } | 3565 } |
| 3566 | 3566 |
| 3567 | 3567 |
| 3568 } // namespace internal | 3568 } // namespace internal |
| 3569 } // namespace v8 | 3569 } // namespace v8 |
| 3570 | 3570 |
| 3571 #endif // V8_TARGET_ARCH_IA32 | 3571 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |