Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.cc

Issue 2381843002: Add Smi::Zero and replace all Smi::FromInt(0) calls (Closed)
Patch Set: Mark Smi::kZero as V8_EXPORT_PRIVATE Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_X87 5 #if V8_TARGET_ARCH_X87
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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // Always emit a 'return undefined' in case control fell off the end of 333 // Always emit a 'return undefined' in case control fell off the end of
334 // the body. 334 // the body.
335 { Comment cmnt(masm_, "[ return <undefined>;"); 335 { Comment cmnt(masm_, "[ return <undefined>;");
336 __ mov(eax, isolate()->factory()->undefined_value()); 336 __ mov(eax, isolate()->factory()->undefined_value());
337 EmitReturnSequence(); 337 EmitReturnSequence();
338 } 338 }
339 } 339 }
340 340
341 341
342 void FullCodeGenerator::ClearAccumulator() { 342 void FullCodeGenerator::ClearAccumulator() {
343 __ Move(eax, Immediate(Smi::FromInt(0))); 343 __ Move(eax, Immediate(Smi::kZero));
344 } 344 }
345 345
346 346
347 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { 347 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) {
348 __ mov(ebx, Immediate(profiling_counter_)); 348 __ mov(ebx, Immediate(profiling_counter_));
349 __ sub(FieldOperand(ebx, Cell::kValueOffset), 349 __ sub(FieldOperand(ebx, Cell::kValueOffset),
350 Immediate(Smi::FromInt(delta))); 350 Immediate(Smi::FromInt(delta)));
351 } 351 }
352 352
353 353
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), 971 __ cmp(FieldOperand(eax, HeapObject::kMapOffset),
972 isolate()->factory()->meta_map()); 972 isolate()->factory()->meta_map());
973 __ j(not_equal, &fixed_array); 973 __ j(not_equal, &fixed_array);
974 974
975 975
976 // We got a map in register eax. Get the enumeration cache from it. 976 // We got a map in register eax. Get the enumeration cache from it.
977 Label no_descriptors; 977 Label no_descriptors;
978 __ bind(&use_cache); 978 __ bind(&use_cache);
979 979
980 __ EnumLength(edx, eax); 980 __ EnumLength(edx, eax);
981 __ cmp(edx, Immediate(Smi::FromInt(0))); 981 __ cmp(edx, Immediate(Smi::kZero));
982 __ j(equal, &no_descriptors); 982 __ j(equal, &no_descriptors);
983 983
984 __ LoadInstanceDescriptors(eax, ecx); 984 __ LoadInstanceDescriptors(eax, ecx);
985 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumCacheOffset)); 985 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumCacheOffset));
986 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumCacheBridgeCacheOffset)); 986 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumCacheBridgeCacheOffset));
987 987
988 // Set up the four remaining stack slots. 988 // Set up the four remaining stack slots.
989 __ push(eax); // Map. 989 __ push(eax); // Map.
990 __ push(ecx); // Enumeration cache. 990 __ push(ecx); // Enumeration cache.
991 __ push(edx); // Number of valid entries for the map in the enum cache. 991 __ push(edx); // Number of valid entries for the map in the enum cache.
992 __ push(Immediate(Smi::FromInt(0))); // Initial index. 992 __ push(Immediate(Smi::kZero)); // Initial index.
993 __ jmp(&loop); 993 __ jmp(&loop);
994 994
995 __ bind(&no_descriptors); 995 __ bind(&no_descriptors);
996 __ add(esp, Immediate(kPointerSize)); 996 __ add(esp, Immediate(kPointerSize));
997 __ jmp(&exit); 997 __ jmp(&exit);
998 998
999 // We got a fixed array in register eax. Iterate through that. 999 // We got a fixed array in register eax. Iterate through that.
1000 __ bind(&fixed_array); 1000 __ bind(&fixed_array);
1001 1001
1002 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check 1002 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check
1003 __ push(eax); // Array 1003 __ push(eax); // Array
1004 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); 1004 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset));
1005 __ push(eax); // Fixed array length (as smi). 1005 __ push(eax); // Fixed array length (as smi).
1006 PrepareForBailoutForId(stmt->PrepareId(), BailoutState::NO_REGISTERS); 1006 PrepareForBailoutForId(stmt->PrepareId(), BailoutState::NO_REGISTERS);
1007 __ push(Immediate(Smi::FromInt(0))); // Initial index. 1007 __ push(Immediate(Smi::kZero)); // Initial index.
1008 1008
1009 // Generate code for doing the condition check. 1009 // Generate code for doing the condition check.
1010 __ bind(&loop); 1010 __ bind(&loop);
1011 SetExpressionAsStatementPosition(stmt->each()); 1011 SetExpressionAsStatementPosition(stmt->each());
1012 1012
1013 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. 1013 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index.
1014 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. 1014 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length.
1015 __ j(above_equal, loop_statement.break_label()); 1015 __ j(above_equal, loop_statement.break_label());
1016 1016
1017 // Get the current entry of the array into register eax. 1017 // Get the current entry of the array into register eax.
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 LhsKind assign_type = Property::GetAssignType(prop); 2956 LhsKind assign_type = Property::GetAssignType(prop);
2957 2957
2958 // Evaluate expression and get value. 2958 // Evaluate expression and get value.
2959 if (assign_type == VARIABLE) { 2959 if (assign_type == VARIABLE) {
2960 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); 2960 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL);
2961 AccumulatorValueContext context(this); 2961 AccumulatorValueContext context(this);
2962 EmitVariableLoad(expr->expression()->AsVariableProxy()); 2962 EmitVariableLoad(expr->expression()->AsVariableProxy());
2963 } else { 2963 } else {
2964 // Reserve space for result of postfix operation. 2964 // Reserve space for result of postfix operation.
2965 if (expr->is_postfix() && !context()->IsEffect()) { 2965 if (expr->is_postfix() && !context()->IsEffect()) {
2966 PushOperand(Smi::FromInt(0)); 2966 PushOperand(Smi::kZero);
2967 } 2967 }
2968 switch (assign_type) { 2968 switch (assign_type) {
2969 case NAMED_PROPERTY: { 2969 case NAMED_PROPERTY: {
2970 // Put the object both on the stack and in the register. 2970 // Put the object both on the stack and in the register.
2971 VisitForStackValue(prop->obj()); 2971 VisitForStackValue(prop->obj());
2972 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); 2972 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0));
2973 EmitNamedPropertyLoad(prop); 2973 EmitNamedPropertyLoad(prop);
2974 break; 2974 break;
2975 } 2975 }
2976 2976
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
3554 isolate->builtins()->OnStackReplacement()->entry(), 3554 isolate->builtins()->OnStackReplacement()->entry(),
3555 Assembler::target_address_at(call_target_address, unoptimized_code)); 3555 Assembler::target_address_at(call_target_address, unoptimized_code));
3556 return ON_STACK_REPLACEMENT; 3556 return ON_STACK_REPLACEMENT;
3557 } 3557 }
3558 3558
3559 3559
3560 } // namespace internal 3560 } // namespace internal
3561 } // namespace v8 3561 } // namespace v8
3562 3562
3563 #endif // V8_TARGET_ARCH_X87 3563 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698